MaplePrimes Questions

How do I genereate random negative numbers?


when i put a minus sign in the rand-function i get an error.


I need to for example generate a random number between -r and r, where r is the input



Is there a difference between scoping rules for regular procedures and for arrow operators?

      Inspired by the theme
Examples in the Mathematica did Alexander Bannikov.
It is equidistant radius 0.1 to the surface

   (x1 ^ 2 + x2 ^ 2-0.4) ^ 2 + (x3 + sin (x1 * x2 + x3)) ^ 4-0.1 = 0;

and an example of parameterization the same surface

As I have understood from the words of Alexander Bannikov, parameterization was performed using the functions: RegionFunction, ContourPlot3D, ClippingPlanes.

It turns out that Maple functions inferior?

Hi everybody, 

I am working with Maple 2015.2 ; system = OS X El Capitan
I would like to compare the outputs of two files by using  the Worksheet:-Comparator command file contains this single instruction
> a:=1; contains this single instruction
> a := 2;

Both us are located on my desktop, which is also my current directory in the worksheet from which I am going to run the comparison.

MyDir := cat(currentdir(), "/Desktop/");
OriginalFile := cat(MyDir, ""):
ModifiedFile := cat(MyDir, ""):

# to verify that all is going well I use these two commands 
# Worksheet:-DisplayFile(OriginalFile):
# Worksheet:-DisplayFile(ModifiedFile):

Running the  command  Worksheet:-Comparator(OriginalFile, ModifiedFile) returns me error messages :
The first one is  (after having selected  "compare" and next "run" in the Comparator Maplet) 

and the second one (after having cliked ont the "OK" button" on this alert window)

Note that the same thing happens if I use Worksheet:-Comparator() and select the two files with the browsers
Could you please help me to understand what happens ?

Thanks in advance


How do I solve the problem that attached? Please give me the correction. thank you

Hello! Hope everything fine with you. I am try to solve the three-point differential by numerical method in attached file but failed. Please see the attachement and solve my problem. I am very thankful your kind effort. Please take care.

With my best regards and sincerely.

Muhammad Usman

School of Mathematical Sciences 
Peking University, Beijing, China

What code to use in a maplet that would open the open file window? 

ie when I push a button the open file window opens allowing the user to choose a file.





G := 6.6743*10^(-8); 1; c := 2.99792458*10^10; 1; pi := 3.143; 1; rho := 5.3808*10^14









diff(P(r), r) = -G*(rho*c^2+P(r))*((4*pi*r^3*(1/3))*rho+4*Pi*r^3*P(r)/c^2)/(c^2*(r^2-2*G*r*(4*pi*r^3*(1/3))*rho/c^2)), diff(v(r), r) = 1.485232054*10^(-28)*((4*pi*r^3*(1/3))*rho+4.450600224*10^(-21)*Pi*r^3*P(r))/(r^2-1.485232054*10^(-28)*r*(4*pi*r^3*(1/3))*rho)

diff(P(r), r) = -0.7426160269e-28*(0.4836021866e36+P(r))*(0.2254913920e16*r^3+0.4450600224e-20*Pi*r^3*P(r))/(r^2-0.3349070432e-12*r^4), diff(v(r), r) = 0.1485232054e-27*(0.2254913920e16*r^3+0.4450600224e-20*Pi*r^3*P(r))/(r^2-0.3349070432e-12*r^4)


condition; -1; P(0) = 0, v(1014030) = -.4283

P(0) = 0, v(1014030) = -.4283





I found the solution of P(r) at P(0)=0, but could obtain the result of v(r) at v(1014030)=-0.4283, v(r) may have a graph such that i can goes from -0.4283 to 0.

I've posted  a code for a procedure, but it seems it does not execute with other versions of Maple the way it does with my version (5.4). Here is the link. I am curious to identify within the procedure code the cause of this divergence. Note: in 5.4 the code is preceded with readlib(eliminate).

I Have a problem with opening a document

When i open the document it shows a blanc document and this message 

no matter wich i choose, maple just shows a plain document.


Is there any solution to this problem?



Hi guys, i'm working on a problem using the runge kutta method (4). The problem is, when I run this program, with the given starting values, it perfectly calculates every value of x[w-i] except x[0] and i have no idea why. Can anyone help? Thanks!


In maple you can use the interactive menu and choose what axes you want to look at the plot, ie. I choose Z axes and see the plot from above, can i do this by using syntax as a plot option?



restart; with(plots); with(Student[Precalculus]); with(LinearAlgebra)

S1 := x^2+y^2 = 4;

x^2+y^2 = 4


z = 2-x


F := Vector(3, {(1) = cos(z), (2) = x^2, (3) = 2*y}, attributes = [vectorfield, coords = cartesian[x, y, z]])


F := VectorCalculus:-Curl(F)

F := Vector(3, {(1) = 2, (2) = -sin(z), (3) = 2*x}, attributes = [vectorfield, coords = cartesian[x, y, z]])


g := [diff(rhs(S2), x), diff(rhs(S2), y)]

[-1, 0]


intergrand := -F[1]*g[1]-F[2]*g[2]+F[3]




Integrasjons område er projeksjonen på z=0 planet, her sirkel med radius=2

Intersection := lhs(S1) = rhs(S2);

x^2+y^2 = 2-x


{x = x, y = (-x^2-x+2)^(1/2)}, {x = x, y = -(-x^2-x+2)^(1/2)}


X := solve(rhs(Y[1, 2]))

-2, 1


plot3d([lhs(S1), rhs(S2)], x = X[1] .. X[2], y = rhs(Y[2, 2]) .. rhs(Y[1, 2]), color = [red, green]);


plot3d([lhs(S1), rhs(S2)], x = X[1] .. X[2], y = rhs(Y[2, 2]) .. rhs(Y[1, 2]), color = [red, green])





I have a vector x of this type:

x :=Vector[column]([A__11*u__1+A__12*u__2+...+A__1m*u__m,




If I define u:=Vector[column]([u__1,u__2,...,u__m]), then it is clear that the equation has the form x=A*u.

I want to extract the matrix A, for the given vectors x and u.

IMPORTANT: I know I could create a loop (i=1 to m) and set u__i=1 and all other u__j=0 (for all j not equal i) and then reconstruct each column by this method, but it seems to be a overkill for such an easy problem.

I would be glad, if someone could show me a method how one can achive this in maple.

I am trying to reproduce some systems for multibody systems by using maple.

I want to define a rotation matrix

Rot__alpha:=Matrix([[ cos(alpha) , -sin(alpha) , 0 ], [ sin(alpha) , cos(alpha) , 0 ], [ 0 , 0 , 1 ]]);

Now I want to differentiate this matrix with respect to time t. I have tried the following but it does not work:

map(implicitdiff, Rot__alpha,alpha);

I actually want something like this:

d/dt (Rot(alpha))=Matrix([[ -sin(alpha)*a , -cos(alpha)*a , 0 ], [ cos(alpha)*a , -sin(alpha)*a , 0 ], [ 0 , 0 , 0 ]]);

where a is d(alpha)/dt. So alpha is not an explicit function of t.

It would be great if someone could provide me a method for performing these kind of calculations. 

In C++, we use continue statement to continue with the loop. What is maple's equivalent statement of continue as used in C++?


2 3 4 5 6 7 8 Last Page 4 of 1394