MaplePrimes Questions

Pls see below worksheet. I want to compute the maximum number that appears in the Collatz series when starting with several starting numbers.

I calculate the maximum number appearing when starting with a specific number in procedure collatz. Then I want to calculate the maximum number appearing when calling different starting numbers in procedure collatz_max by calling collatz several times - collatz_max does not yet contain the handing of the results from collatz as the below error appears. If I only call collatz in collatz_max it return the right value, but in the loop or if I assign collatz to a variable within procedure collatz_max, calling collatz returns () as a result.

What do I do wrong?

Thanks for helping,



Is it possible to write 

x^4 - 3*x^2 + 3

as a polynomial in 


? This is a math question first of all. If it is possible, how do we do it in Maple.

For context, I am investigating a particular line of inquiry into answering this question about computation of Taylor polynomial.

again, I wish Maple help can be better. A simple example of how to use listplot on matrix is all what is needed.

I have a matrix, 3 rows and 5 columns. I need to use listplot to generate 3 listplots on same graph. I can do this one row at a time. But when calling listplot(m) where m is the matrix, it gives error

Error, (in plots:-pointplot) incorrect number of coordinates in points data

Clicking on the above link, as usual sends me to page that says There is no help page available for this error

Help says

The listplot command also accepts a list or Matrix containing points data. great. But how?? I click on the link next to the above line, it sends me to page about pointplot. There is says that pointplot also accepts a matrix of size n by 2. Does this mean listplot matrix must also be two columns? It does not say this on the listplot help page.

For a workaround, I now generate plot of each row on its own, then use display to put them all on same graph. But the problem with this is that all have same color. I was hoping that if Maple did it all at once, it will automatically pick different color for each line as is the case with Mathematica (example below)

Is there a better way to do this? For reference, I'd like to generate similar plot like this

You see, the colors are automatically selected. With manual plotting of each row myself, I have to select the color myself and to make sure they are different and so on. It will be better if the system did all of this.

Please see attached worksheet



Matrix(3, 5, {(1, 1) = 1, (1, 2) = 2, (1, 3) = 5, (1, 4) = 6, (1, 5) = 9, (2, 1) = 3, (2, 2) = 4, (2, 3) = 5, (2, 4) = 13, (2, 5) = 14, (3, 1) = 1, (3, 2) = 3, (3, 3) = 4, (3, 4) = 10, (3, 5) = 11})

plots:-listplot(m); #why this fail?

Error, (in plots:-pointplot) incorrect number of coordinates in points data


#for a workaround, I can do this. But now all lines have same color which is not good.



What is the correct way to use listplot with matrix?

I have created some plots of inverse primes  like this example1.pdf .

The filled color-shape in the middle is what I want do do with all areas in this picture or in other pictures.

In other words the goal is to fill the differnt areas in the print with different colors.

So I need to find the points of the Polygons, as I have done by hand with that yellow Polygon.

A procdure that is ready will give give the crosspoints of the lines.

These are the line-coordinates (the 1st number ist the number of iterations)

2*L[1]=number of lines in L

L:=[14, [[1, 1], [1, 26]], [[1, 26], [26, 26]], [[26, 26], [26, 37]], [[26, 37], [37, 37]], [[37, 37], [37, 39]], [[37, 39], [39, 39]], [[39, 39], [39, 20]], [[39, 20], [20, 20]], [[20, 20], [20, 23]], [[20, 23], [23, 23]], [[23, 23], [23, 30]], [[23, 30], [30, 30]], [[30, 30], [30, 70]], [[30, 70], [70, 70]], [[70, 70], [70, 45]], [[70, 45], [45, 45]], [[45, 45], [45, 34]], [[45, 34], [34, 34]], [[34, 34], [34, 32]], [[34, 32], [32, 32]], [[32, 32], [32, 51]], [[32, 51], [51, 51]], [[51, 51], [51, 48]], [[51, 48], [48, 48]], [[48, 48], [48, 41]], [[48, 41], [41, 41]], [[41, 41], [41, 1]], [[41, 1], [1, 1]]]

These are the crosspoints:

cp := [[23, 26], [30, 37], [32, 37], [26, 30], [48, 45], [39, 34], [41, 34], [45, 41]]

To plot the pdf I used this code:

poly2 := [[32, 32], [34, 32], [34, 34], [39, 34], [39, 39], [37, 39], [37, 37], [32, 37]]

poly 2 is just an axample, how it looks like when its ready.

display(seq(line(op(L[i])), i = 2 .. 2*L[1] + 1), polygonplot([poly2], color = "Resene GoldenTainoi", axes = none, style = polygon), color = blue, thickness = 0.8);

So I hope, you can help me :)

This is a beautyfull way to paint a prime  by just printing the remainders of the recursive dividing of the inverse prime in lines.

Thanks a lot,


int(sin(x)/x*exp(-2*I*pi*f*x), x = -infinity .. infinity) gives the incorrect answer pi. The correct answer is pi for abs(f)

Dear Maple community, 

I'm trying to solve a complex expression by taking its first-order derivative and finding the optimal solution. As a result, I'm getting a rootOf expression, which is further not solved by using explicit or allvalues APIs provided in the maple. Can you guys help me where I'm going wrong?

I'm attaching my code file as well for


U[d] := Zeta[n]*(2^(2/3)*(theta[n]*lambda*A*beta[n])^(2/3)/(4*beta[n])-delta[n]*`λA`+U[n]+alpha[n])+Zeta[g]*(U[g]-delta[g](1-lambda)*A+tau*A+R+(-2*A*theta[g]*(lambda-1)*beta[g])^(2/3)/(4*beta[g]))+tau*A-A



FOC := diff(U[d], A)








xyz := solve(FOC = 0, A, explicit)









I am not able to even trap this Maple exception.

Any suggestions what to do? It is not a problem if it can't solve it, but I need to at least be able to  trap the exception in order to go to the next one, else the whole program now stops when it hits this.

I used try..catch but this exception just ignores this and escapes to top level. This is not the first time I've seen Maple exception escape the try/catch. I do not understand why some do that and some not. I

Is this another bug?


`Standard Worksheet Interface, Maple 2022.1, Windows 10, May 26 2022 Build ID 1619613`


eq:=1 = -X*(-1/4*(-40*(X + x0)^(5/3) - 20/3*(X + x0)^(2/3)*Y - 20/3*(X + x0)^(2/3)*y0 - 32*A*(X + x0)^(1/3))/((X + x0)^(5/3)*(Y + y0)) + 5/12*(-15*(X + x0)^(8/3) - 4*(X + x0)^(5/3)*Y - 4*(X + x0)^(5/3)*y0 - 24*A*(X + x0)^(4/3) + 12*A^2)/((X + x0)^(8/3)*(Y + y0)))/(Y*(1/(Y + y0) + 1/4*(-15*(X + x0)^(8/3) - 4*(X + x0)^(5/3)*Y - 4*(X + x0)^(5/3)*y0 - 24*A*(X + x0)^(4/3) + 12*A^2)/((X + x0)^(5/3)*(Y + y0)^2)));

1 = -X*(-(1/4)*(-40*(X+x0)^(5/3)-(20/3)*(X+x0)^(2/3)*Y-(20/3)*(X+x0)^(2/3)*y0-32*A*(X+x0)^(1/3))/((X+x0)^(5/3)*(Y+y0))+(5/12)*(-15*(X+x0)^(8/3)-4*(X+x0)^(5/3)*Y-4*(X+x0)^(5/3)*y0-24*A*(X+x0)^(4/3)+12*A^2)/((X+x0)^(8/3)*(Y+y0)))/(Y*(1/(Y+y0)+(1/4)*(-15*(X+x0)^(8/3)-4*(X+x0)^(5/3)*Y-4*(X+x0)^(5/3)*y0-24*A*(X+x0)^(4/3)+12*A^2)/((X+x0)^(5/3)*(Y+y0)^2)))

   print("trapped the error");
end try;

Error, (in anonymous procedure called from type/realcons) too many levels of recursion



Hi, I'm working on some chemistry and i'd like for the unit to me mol/l not mol/m^3. How do i fix this? I googled it and it seems like the unit is the universal standard for concentration but i wasn't taught this in school as we were told to use mol/l. 

I've tried googling and following the guides on the site but i honestly cant figure out what im doing wrong.

Picture for reference 


I don't understand. With 2 degrees of liberty and a factor of 5% (1-95%), the table Khi-2 indicates 5,99.

It is impossible for me to obtain this value with Mapple. 2 following tests :

Y := ChiSquareRandomVariable(2);
                            Y := _R0

PDF(Y, 0.05);
CDF(Y, 0.05);


PDF(Y, 0.95);
CDF(Y, 0.95);


The same problème with the instruction RandomVariable(ChiSquare(v)).

Thank you to help me.

Kinds regards

The netlist in the attached Maple file will not solve. 
It will solve if I remove

.CONS Vx=v[D]-v[S]

from the netlist.

Syrup returns a 2 element list of [eqs, vars] that can be easily solved using the solve command as shown in the attached file

It will be great if  DEtools:-convertAlg  which is designed to find coefficients of a linear ode, not to expand the coefficients it finds.

This caused my patterns to fail, as after putting the coefficients in a certain form, and then calling DEtools:-convertAlg later on somewhere else in the program, the patterns no longer worked due to this unexpected expansion.

It will be better if DEtools:-convertAlg returns the coefficients it find as is and not expand them. I could not find an option to use for this. Here is an example.

ode:=b*(x+x^2)*diff(y(x),x$2)+x*(2*a - 1)*diff(y(x),x)+c*y(x)=0;

After the call the coefficients become


You might ask that one can easily "fix" this afterwords. Sure. I can use collect on x. But the point is that in general, it might not be clear what to collect on or what the changes that were made are.

In principle, it is better to keep the coefficients in same form as they were in the ode so that the ode do not change form.

Maple 2022.1 on windows.

For example my friend emailed me.
His email address is, the email content is HELLO.
How does Maple print HELLO to the screen so I can see it?
Thanks for your help!


eq1 := (2*(r^2+a^2*cos(theta)^2))*(M*r-(1/2)*a^2-(1/2)*r^2)*(diff(f(r, theta), r, theta))+(2*(a^2*(M-r)*cos(theta)^2-M*r^2+a^2*r))*(diff(f(r, theta), theta))

2*(r^2+a^2*cos(theta)^2)*(M*r-(1/2)*a^2-(1/2)*r^2)*(diff(diff(f(r, theta), r), theta))+2*(a^2*(M-r)*cos(theta)^2-M*r^2+a^2*r)*(diff(f(r, theta), theta))


eq2 := sin(theta)*(r^2+a^2*cos(theta)^2)*(diff(f(r, theta), theta, theta))-cos(theta)*(diff(f(r, theta), theta))*(a^2*cos(theta)^2-2*a^2-r^2)

sin(theta)*(r^2+a^2*cos(theta)^2)*(diff(diff(f(r, theta), theta), theta))-cos(theta)*(diff(f(r, theta), theta))*(a^2*cos(theta)^2-2*a^2-r^2)


eq3 := -2*(r^2+a^2*cos(theta)^2)^2*(M*r-(1/2)*a^2-(1/2)*r^2)*sin(theta)*(diff(g(r, theta), r, r))+sin(theta)*(r^2+a^2*cos(theta)^2)^2*(diff(g(r, theta), theta, theta))+(4*(-(1/4)*cos(theta)^4*a^4+a^2*r*(M-(1/2)*r)*cos(theta)^2-M*a^2*r-(1/4)*r^4))*cos(theta)*(diff(g(r, theta), theta))-2*M*sin(theta)*(diff(g(r, theta), r))*(a^2+r^2)*(cos(theta)*a-r)*(cos(theta)*a+r)

-2*(r^2+a^2*cos(theta)^2)^2*(M*r-(1/2)*a^2-(1/2)*r^2)*sin(theta)*(diff(diff(g(r, theta), r), r))+sin(theta)*(r^2+a^2*cos(theta)^2)^2*(diff(diff(g(r, theta), theta), theta))+4*(-(1/4)*cos(theta)^4*a^4+a^2*r*(M-(1/2)*r)*cos(theta)^2-M*a^2*r-(1/4)*r^4)*cos(theta)*(diff(g(r, theta), theta))-2*M*sin(theta)*(diff(g(r, theta), r))*(a^2+r^2)*(cos(theta)*a-r)*(cos(theta)*a+r)


pdsolve([eq1, eq2, eq3])

[{f(r, theta) = _F1(r)+(Int((r^2+a^2*cos(theta)^2)/((cos(theta)+1)^(1/2)*(cos(theta)-1)^(1/2)), theta))*_C1/(2*M*r-a^2-r^2)}, [diff(diff(g(r, theta), r), r) = (sin(theta)*(sin(theta)^2*a^2-a^2-r^2)^2*(diff(diff(g(r, theta), theta), theta))-4*cos(theta)*((1/4)*a^4*sin(theta)^4+(-(1/2)*a^2+r*(M-(1/2)*r))*a^2*sin(theta)^2+(1/4)*(a^2+r^2)^2)*(diff(g(r, theta), theta))+2*M*sin(theta)*(diff(g(r, theta), r))*(a^2+r^2)*(sin(theta)^2*a^2-a^2+r^2))/(sin(theta)*(sin(theta)^2*a^2-a^2-r^2)^2*(2*M*r-a^2-r^2))]]






A := Omega; assume(Omega > 0); B = Omega

B = Omega





In a physics problem, I came across the following triple integral:

exp := -sin(alpha)*i*r*(-sin(alpha)*cos(phi)*cos(theta)+sin(theta)*cos(alpha))/(4*sqrt(-2*sin(theta)*sin(alpha)*cos(phi)*p*r-2*cos(alpha)*cos(theta)*p*r+p^2+r^2)*Pi(-2*sin(theta)*sin(alpha)*cos(phi)*p*r-2*cos(alpha)*cos(theta)*p*r+p^2+r^2)*(-2+sqrt(2))*Pi)

`assuming`([int(int(int(exp*p^2*sin(alpha), p = 0 .. 1), alpha = 0 .. (1/4)*Pi), phi = 0 .. 2*Pi)], [alpha > 0, alpha < (1/4)*Pi, r > 0, r < 1, phi > 0, phi < 2*Pi, theta > 0, theta < (1/4)*Pi])


I tried to perform each integration separately, but got no result. Is there any transformation or procedure, that I am not aware of, to accomplish this task?


First 176 177 178 179 180 181 182 Last Page 178 of 2329