Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

condi := [p1 + p2 + p3 = 1];
simplify(s, condi);
                  condi := [p1 + p2 + p3 = 1]

 /      c (-1 + p1 + p2)        c (-1 + p1 + p2)         
{ a = - ----------------, b = - ----------------,           c = c, 
 \             p1                               p2                

      c (p1 + p2) (-1 + p1 + p2)           c (p2 - 1)          c (p1 - 1)
  d = --------------------------,             e = ----------, f = ----------
                p1 p2                                       p1                 p2    

  \ 
   }
  / 


assigne(%);
c := 10;
a := factor(simplify(a, condi));
b := factor(simplify(b, condi));
d := factor(simplify(d, condi));
e := factor(simplify(e, condi));
f := factor(simplify(f, condi));
                            c := 10

                             a := a

                             b := b

                             d := d

                             e := e

                             f := f

NULL;
Why "factor" does not play its role ?   Thank you.

I'd like to be able to define functions with units and then use them.

In the example below, things don't work with Maple input. I've shown one example, with the function f2.

It seems to work better with 2D input, but it seems that it is not possible to make plots.

In the example below, I define f4 as a function of two variables that returns a function of one variable.

I'd like to call the outer function, obtain a function as a result (r1 below) and then plot the latter.

restart

with(Units:-Simple)

NULL

f1 := proc (x) options operator, arrow; x*Unit('m') end proc

proc (x) options operator, arrow; Units:-Simple:-`*`(x, Unit('m')) end proc

(1)

f1(2)

2*Units:-Unit(m)

(2)

f2:=x->xUnit(m)

Units:-Unit(m)

(3)

f2(2)

f2(2)

(4)

f3 := proc (x, y) options operator, arrow; x*Unit('m')*y*Unit('m') end proc

proc (x, y) options operator, arrow; Units:-Simple:-`*`(Units:-Simple:-`*`(Units:-Simple:-`*`(x, Unit('m')), y), Unit('m')) end proc

(5)

f3(2, 3)

6*Units:-Unit(m^2)

(6)

f4 := proc (x, y) options operator, arrow; proc (z) options operator, arrow; x*Unit('m')*y*Unit('m')*z*Unit('m') end proc end proc

proc (x, y) options operator, arrow; proc (z) options operator, arrow; Units:-Simple:-`*`(Units:-Simple:-`*`(Units:-Simple:-`*`(Units:-Simple:-`*`(Units:-Simple:-`*`(x, Unit('m')), y), Unit('m')), z), Unit('m')) end proc end proc

(7)

r1 := f4(2, 3)

proc (z) options operator, arrow; Units:-Simple:-`*`(Units:-Simple:-`*`(Units:-Simple:-`*`(Units:-Simple:-`*`(Units:-Simple:-`*`(2, Unit('m')), 3), Unit('m')), z), Unit('m')) end proc

(8)

r1(4)

24*Units:-Unit(m^3)

(9)

plot(r1)

 

NULL

The contents above aren't showing the error that Maple gives when I try to plot.

Here is a screenshot

Download FunctionUnits.mw

I have a variable with the unit Volt.

I'd like to print something like "The voltage is %f" where the floating point is the value of the variable with the unit.

I've tried the options below so far.

How would one accomplish this?

with(Units:-Simple)

NULL

x := 5*Unit('V')

5*Units:-Unit(V)

(1)

printf(x)

Error, (in fprintf) format string expected

 

printf("%f", x)

Error, (in fprintf) number expected for floating point format

 

printf("%d", x)

Error, (in fprintf) integer expected for integer format

 

printf("%a", x)

5*Units:-Unit(V)

 

printf("%A", x)

5*Units:-Unit(V)

 

printf("%q", x)

5*Units:-Unit(V)

 

printf("%v", x)

5*Units:-Unit(V)

 

printf("%P", x)

                               5 Units:-Unit(V)

 

print(x)

5*Units:-Unit(V)

(2)

print(The*voltage*is, x)

The*voltage*is, 5*Units:-Unit(V)

(3)

print(The*voltage*is*x)

5*The*voltage*is*Units:-Unit(V)

(4)

NULL

Download PrintUnits.mw

Performing

II := int( Dirac(x^2+y^2-1), x = -infinity..infinity )

gives 

II = 1/sqrt(abs(y^2 - 1))

with no restriction on y. It seems that the answer (at least to the question I thought I was asking) is actually 

II = 1/sqrt(1-y^2) for y\in[-1,1], 0 else

Am I misunderstaning the meaning of Dirac and its integral?

Hi all,

How Can I sort a list of polynomials with parametric coefficients based on the following criteria?
1. Fewer different parameters in the coefficients.
2. If the number of parameters is the same, the lower power of the parameters.
3. If the previous criteria are the same, sentences with parametric coefficients appear later.

Otherwise, the list is in order. For example, I want to obtain the sorted list 

[(a+2)*x[1]+3*x[2]-x[3]+(a-2)*x[4],2*x[1]+2*x[2]-b*x[3]+(c+1)*x[4], (a-1)*x[1]+x[2]+(a+1)*x[3]+(C^2-1)*x[4], (a+b)*x[1]+(c-3)*x[2]+(-b-1)*x[3]+2*x[4]] from the following list:

[(a-1)*x[1]+x[2]+(a+1)*x[3]+(C^2-1)*x[4], 2*x[1]+2*x[2]-b*x[3]+(c+1)*x[4], (a+2)*x[1]+3*x[2]-x[3]+(a-2)*x[4], (a+b)*x[1]+(c-3)*x[2]+(-b-1)*x[3]+2*x[4]]. 

Could you please guide me?

Thanks.

Good day. 

I recently constructed a Maple model using an LPSolve routine to solve for a classic factory (Operations Research) assignment problem. Basically, this involves 4 factories that, in any combination, can supply goods and fulfil demand to 10 customers. If any given factory is activated, the model determines what factory should supply what customer so that the weighted-distance is minimized.

However, in addtion to this - I would like to know the quantity of items that each factory supplies to each of their respective customers and I would like to verify that the quantity demanded by each customer is fulfilled. 

I was hoping that somebody could guide me on how to do this. Any suggestions would be most welcomed.

The model is attached.

Thanks for reading!

MaplePrimes_Jan_27.mw

I am trying to draw the streamline for my coupled system but do not get the outcome. Could anyone please help in this regard?

Detail: My system contains x and y;  Regrading x=0, if I do not assign it to zero, do not get the results. Otherwise, there is no need to put x=0 because I am interested in plotting stream plots between y and x (y on the vertical axis and x on the horizontal axis). Besides this, I solved this system analytically, then considered the stream function, did some steps, and plotted the streamline. It is different from the stream function, which has been obtained directly by using the numeric method. I have assigned the values to the parameters that I used during the analytical plot. I put x=0 and did not get the answer. Besides,  I am uploading the graph as a reference, which I have obtained by considering the stream function. This plot is similar to my flow direction, and I expect the same results from the numeric method.

streamline_Help.mw

dr := draw([Tr(t3), AP(cbl), BP(cbl), CP(cbl)]),
textplot([coordinates(A)[], "A"], [coordinates(B)[], "B"], [coordinates(C)[], "C"], align = {above, right});
Error, (in plots:-textplot) unexpected options: [[0, 0, "B"], [13, 0, "C"]]
Why the coordinates are unrecognized ? Thank you.

Hi! I'm trying to find out if i can construct a sequence fn that generates all the (positive) rational numbers as n goes to infinity.

This is, the sequence shows to be an injective homomorphism fn: N -> Q+ . This sequence was constructed by cantor in his proof of rationals being countably infinite, and can really be helpful in evaluating expressions using rational numbers, but i do not knoww if it is implemented in maple, or how to construct it myself. 

Any help would be very appreciated. 

The equal sign ":=" in my document sign has changed to a "d".  The equal sign "=" has not changed.  Is there a setting I need to change?

Thank you in advance.

Hello

I need to share some results with a colleague who is not a user of Maple, and a way to do this is by using the Tabulate (plain command and not from DocumentTools) function to format them. In the worksheet, the output looks good, but when I try to print it or save it as a PDF, only a few lines are printed. It appears that Maple is not able to break the tables into multiple pages for printing.

The output is a table with 77 rows and 30 columns.   

I welcome alternative solutions to the problem of displaying the results. 

Many thanks

I am trying to find the value of y4 at t=infinity and t=-infinity when lambda1>lambda2 or lambda1<lambda2. But every time I got the same answer. For example, if we do it by hand then the terms which are responsible for making the indeterminate form can be extracted and canceled (see Fig.). 

But in limit.mw y4 is too lengthy-expression and very difficult to do it manually.

Hi,

 I'm looking for a simpler code to generate random proportional tables, like k*x type? Thanks for your suggestions.

TabPropQ.mw

Hey!

I am working on a 2-dimensional real curve gamma, that is being deformed by a real 2x2 matrix A and translated by some shift vector s. Both the matrix A and the vector s depend on two real parameters alpha and beta, which vary between 0 and 1. My goal is to create an animated plot that shows the curve depending on the parameters alpha and beta (ideally with some sort of slider, so I can play with different values of alpha and beta). I am having a hard time animating this, also because I am unsure if this is actually possible in Maple. The code I am working with is so far:

with(plots);
with(LinearAlgebra);
f := x -> exp(2*I*Pi*x);
CDFT := Matrix(3, 3, [[1, 1, 1], [1, f(1/3), f(2/3)], [1, f(2/3), f(1/3)]]);

al := 10/100;
be := 10/100;
lam1 := f(al);
lam2 := f(be);
lam3 := f(-al - be);
coef := (1/3*HermitianTranspose(CDFT)) . (Vector[column](3, [lam3, lam2, lam1]));
a := coef[1];
b := coef[2];
c := coef[3];

gam := t -> MatrixVectorMultiply(Matrix(2, 2, [[Re(a^2 + b*c), -Im(a^2 - b*c)], [Im(a^2 + b*c), Re(a^2 - b*c)]]), Vector[column](2, [cos(2*t) - 2*cos(t), sin(2*t) + 2*sin(t)])) + 3*Vector[column](2, [Re(b*c), Im(b*c)]);
P1 := plot([cos(2*t) - 2*cos(t), sin(2*t) + 2*sin(t), t = 0 .. 2*Pi], color = [blue]);
P2 := plot([gam(t)[1], gam(t)[2], t = 0 .. 2*Pi], color = [purple]);
plots:-display([P1, P2]);

Note that you can basically ignore everything up to the definition of the curve gam (short for gamma), apart from the definition of the parameters al and be (alpha and beta). The plot P1 corresponds to the "unperturbed curve", i.e. when we multiply the curve by the identity, which happens for alpha=beta=0. The plot P2 is now the deformed curve. The output is then:

My goal is now to animate this plot such that I can play with different values of alpha and beta, without having to manually insert them. How do I do this?

Here is an example where evalf[n] doesn't operate on the argument of the undefined function f.

x := rand(0. .. 1.)()
                          0.2342493224
y := x+f(x):
evalf[4](y)
                    0.2342 + f(0.2342493224)

# but, as soon as f is a known function:
evalf[4](cos(x))
                             0.9727


Here is a way to force evalf[4](f(x)) to return f(0.2342)?

I found only two ways to do this:
First: declare interface(displayprecision=4) 

interface(displayprecision=4):
y;
                 0.2342 + f(0.2342)

Or: do this (which is relatively cumbersome)

Evalf := proc(expr, n)
  local i := [indets(evalf[n](expr), numeric)[]]:
  eval(expr, i =~ evalf[4](i))
end proc:

Evalf(y, 4)
                 0.2342 + f(0.2342)

Thanks in advance.

PS:  I do not like setting displayprecision to some value because its effect is remnant: if you execute again the same worksheet (begining with a restart), the value of displayprecision is not reset to 10 but keeps the value you gave it previously, somewhere in the worksheet.

First 15 16 17 18 19 20 21 Last Page 17 of 2097