Maple 2017 Questions and Posts

These are Posts and Questions associated with the product, Maple 2017

I have this equation but maple solve root is 2

Root is 4 x1 =1, x2= 8.95006470,

x3 =0 .6939575785

x4 = -0.6440222825


Hello, for an assignment I was given the task of iteratively calculating the water depth of a flow using Newton's method. For this I tried to create a procedure wich uses a number of input values. The code is listed below;


Newton := proc (n, y0, Q, b, m, k, S0) local A, P, Sf, y, F, dAdy, dPdy, Fdiff, i; global ylist; y[0] := y0; for i from 0 to n do A[i] := (b+m*y[i])*y[i]; P[i] := b+2*y[i]*sqrt(1+m^2); Sf[i] := Q*abs(Q)*P[i]^(4/3)/(k^2*A[i]^(10/3)); F[i] := S0/Sf[i]-1; dAdy[i] := b+2*m*y[1]; dPdy[i] := 2*sqrt(1+m^2); Fdiff := (2/3)*(F[i]-1)(5*dAdy[i]/A[i]-2*dPdy[i]/P[i]); y[i] := procname(evalf(y[i]-F[i](y[i])/Fdiff[i](y[i]))) end do; ylist := [seq(y[i], i = 0 .. n)]; return ylist end proc;

Newton(10, 1, 5, 12, 1, 30, 0.1e-4);
Error, (in Newton) invalid input: Newton uses a 2nd argument, y0, which is missing


As you can see, I get an error referring to the second argument y0, which is the starting value of the calculation. The error says the argument is missing, however it is right there in the brackets of the Newton procedure (along with the values of all other parameters). I have tried explicitly stating that y0:=1, and changing the name of the parameter, however that didn't help.

Am I missing something really simple, or is there something wrong with my code?

Thanks in advance.

I find the 2D math input in Maple to somewhat cumbersome for various expressions.
Specifically, I have a function f(z) = z^2, with w = f(I x + y) where I is the imaginary number.

I typed the line in 2D math

plots[implicitplot]({Im(w) = 2, Re(w) = 2}, x = -5 .. 5, y = -5 .. 5, colour = {"Blue", "Red"})
Error, (in plot/color) invalid color specification: {"Blue", "Red"}

For some reason this does not work in 2D math, but in Maple-input it works as expected.

I recall from past use of Maple, that there were other problems as well with the 2D math input.
I know you need to be particular with the use of space. 

Are there other common pitfalls or "bugs" related to use of 2D math input ?


I am revising the unstable period orbits of the Logistic map, y[n]=4*y[n-1]*(1-y[n]), in Maple.  Although I have implemented the equation and use a loop for the iterations, I wonder whether there is a faster and concise way to code the equation in Maple. 

Here it is what I did:

y[0] := (-sqrt(5)+5)*(1/8);

for n to 10 do y[n] := 4*y[n-1]*(1-y[n-1]) end do;
soly := [seq(simplify(expand(y[n]), radical), n = 0 .. 10)];
dat := [seq([n, Re(evalf(soly[n]))], n = 1 .. 10)]; plot(dat, labels = ["k", "x(k)"], style = pointline,title="Period 2");

Since only few iterations are needed, the solution is symbolic (and then convert to float).  

Many thanks.





I wonder how I could use Maple commands to do the following:

An irrational number, ir, (a huge symbolic expression as a result of iterating a discrete map) is converted to single precision (Real16) and then to hexadecimal as a string. Example: using matlab it will be something like single(ir)=0.25(float representation) =3e800000 (hexadecimal representation).

I am not sure if single precision is available in Maple 2017 but I guess Real32, Real64 and Real128 are.

Once the hexadecimal representation is acquired I need to convert it back to Real16, Real 32 and etc.

Your help is much appreciated.

Many thanks


Trying to simulate tossing 10 coins. What  am i doing rong? Thanks




a := Vector[row](1 .. 10)

Vector[row](%id = 18446745395177063238)



for k to 10 do r := rand(1 .. 2); if r < .5 then a[k] := "H" else a[k] := "T"; print(a[k]) end if end do

proc () (proc () option builtin = RandNumberInterface; end proc)(6, 2, 1)+1 end proc


Error, cannot determine if this expression is true or false: r < .5



Vector[row](%id = 18446745395177063238)







If I add "restart" to a program, then interface(imaginaryunit=j) don't work. Why? 

interface(imaginaryunit = j);
The output is j^2  but the output should be -1. 


I am new to Maple and have some problems with fonts in Maple's forms. How can I increase the size of the monospaced font? (see the screenshot).


I want to plot the approximation of a surface by polynomials. The surface is given by (x,y,f(x,y)) where f(x,y) is given by the following expression

proc (x) options operator, arrow; (sum(i*cos((i+1)*(-2+4*x[1])+i), i = 1 .. 5))*(sum(i*cos((i+1)*(-2+4*x[2])+i), i = 1 .. 5)) end proc

with both variables varying in the interval [0,1]. Then, by using the Bernstein polynomials of two variables (see, for instance, this paper for details, the graph of the resulting (plot3d) surface (x,y,p(x,y))  it is not even like to the original surfaces.

Please, see this PDF of what I have done:  plots.pdf

Some idea or suggestion?


Dear all,

Following the comments I am editing this post:

I have a function F of variables (r1,r2,theta1,theta2,r,theta,a). r1, r2,theta1,theta2 are function of r,  theta and a. I want to take derivative of F with respect to a. r and theta are independent of a . I expressed everything in terms of 'a' as a function of 'a' at first. Then I use diff(F, a). I see there is an error in the final expression G .There is a restriction that theta1 should lie between -Pi to Pi and theta2 between 0 to 2*Pi. I speculate this is the source of error. Work sheet is attached. Reason: value of G: integration in 0 to pi/4 gives some  value but for 0 to pi it evaluates to zero and so is the case with 0 to 2*Pi. As "G "physically represents energy it must be a positive value.


theta1 := unapply(arctan(r*sin(theta)/(r*cos(theta)-a)), a);

proc (a) options operator, arrow; arctan(r*sin(theta)/(r*cos(theta)-a)) end proc



## theta1 -->[-Pi,Pi] and theta2-->[0,2*Pi]


theta2 := unapply(arctan(r*sin(theta)/(r*cos(theta)+a)), a);

proc (a) options operator, arrow; arctan(r*sin(theta)/(r*cos(theta)+a)) end proc




proc (a) options operator, arrow; ((r*cos(theta)-a)^2+r^2*sin(theta)^2)^(1/2) end proc


proc (a) options operator, arrow; ((r*cos(theta)+a)^2+r^2*sin(theta)^2)^(1/2) end proc







plot(arctan(tan(x)), x = (1/2)*Pi .. Pi)


## I have to use a constraint that

assume(theta1(a) < Pi, theta1(a) > -Pi, theta2(a) > 0, theta2(a) < 2*Pi, a>0,r>0)











## get u_r and u_theta as u[1] and u[2]

u[1] := u1*cos(theta)+u2*sin(theta);



u[2] := -sin(theta)*u1+cos(theta)*u2;



Diff_ur := simplify(diff(u[1], a));





Diff_ut := simplify(diff(u[2], a));




# find the limiting case

Att := limit(Diff_ut*r*sin(2*theta), r = infinity);



Arr := limit(Diff_ur*r*(1-cos(2*theta)), r = infinity);



G := (1/8)*(int(Arr+Att, theta = 0 .. Pi/2))*sigma*4;










Hello everyone!

I am trying to calculate the Killing vectors for the metric below. For such, I used the packages DifferentialGeometry and Physics. However, I found different results these packages. Could someone explain why?

Thanks in advance!


Dear Users,

I have difficulty in finding numerical integration of a function f(r,t) which is a function of position r and time t. Function f(r,t) consists 100 terms (for example : BesselJ(0, 151.5793716314014*r)+BesselJ(0, 151.5793716314014*r)*r^2+......100 terms). For a particular time t=t1, f(r,t1) is calculated and then integrated as follows:

I am using evalf(Int(f(r,t1),r=0..1)

Maple takes a lot of time  to evaluate it as it is integrating it in one shot!  Is there a way to

a) pick the terms individually and integrate it

b) then sum these individual terms up together

c) How reliable is evalf(int(f(r,t1),r=0..1)) is? Is evalf (Int()..)  the best way to evaluate integration?


Hey there,


I'm trying to build a procedure that can function as an adapted form of Prim's algorithm. The idea is that on a graph with just vertices, the procedure has a starting point, and from there will find out which vertex is the cheapest to connect to (currently expressed purely by the lowest distance). Once this is found, the connected vertex is removed from a list that has vertices that aren't connected yet, and added to a list of vertices that are in the minimal spanning tree.

My problem is that I get an error returned that says "invalid Boolean expression", and I'm not sure how to solve it. Can anybody here point me in the right direction?

The procedure is defined as follows:

Primmetje := proc (aantal, posities, begin)
local knopenover, knopeninmst, huidig, V, kaart, e, a;
knopenover := [seq(i, i = 1 .. aantal)];
knopeninmst := {};
huidig := [0, 0];
if begin <> {} then
  V := [begin];
knopeninmst := knopeninmst union {V}
end if;
remove(V, knopenover);
kaart := Graph(aantal);
SetVertexPositions(kaart, posities);
while nops(knopeninmst) < aantal
do for e in knopeninmst
   do for a in knopenover
     do if huidig = [0, 0] or Distance(posities[e], posities[a]) < Distance(posities[huidig[1]], posities[huidig[2]]) then
   huidig := [e, a];
knopeninmst := knopeninmst union {a};
remove(a, knopenover);
AddEdge(kaart, huidig)
end if
end do
end do
end do
end proc

When I try to execute it with some parameters the return is this:

vp := [2.5, 21], [6, 13.5], [8, 10], [11, 24.5], [14.3, 19.4], [16.8, 26], [22, 21.5], [22, 17], [22.2, 12.5], [26.8, 23], [28, 20.5], [30, 25.5], [32, 21], [29.5, 16];
Primmetje(14, vp, 1);
Error, (in Primmetje) invalid boolean expression: [[6, 13.5]]

I think it has something to do with the double brackes, but I'm not sure how to solve it.

How to change the numbers shown in the diagram shapes from y=0.5- to rigth form








For an Array A, say, and some positive integer n, say, Maple interpretes A^n as raising each entry separately to the same power n. Without the Physics package loaded, A^n can also be written as A . A . ... . A (n times). But with the Physics package loaded, this equality is broken (at least in Maple 2017): If A is a 2D square Array, A . A all of a sudden is no longer equal to A^2, but rather to convert(A,Matrix)^2, i.e., to the square of the Array considered as a Matrix. The presence of the dot operator seems to make the Physics enviroment convert A to a Matrix. This seems to me to be a bug.

5 6 7 8 9 10 11 Last Page 7 of 37