Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

I just spend 2 hrs trying to make this work in headless worksheet, but it does not work. I have A worksheet, which calls B worksheet. The call all go through OK and I set it all correctly. Set up the section in worksheet B and document property, etc.. as described in help.

So the call works OK and arguments are passed correctly from A to B.

The problem is that in worksheet B, I wanted to generate a plot in order to save it to postscript file.  This did not work. Nothing gets exported, even  though the plot is actually generated correctly in B.  How do I know this? Becaue B returns the plot back to A, and I can see the plot was correctly generated.  The file .ps never gets created. I look at the folder these worksheets are in, and there is no .ps file created.

But it was not saved to .ps file.  The same code works ok in standard worksheet and plot is saved correctly to .ps file using same code.

I also could not export the plot to JPEG file from worksheet B.  Only thing that worked is exporting some text to .TXT file from B.  

Any one knows of limitation to calling one worksheet from another?  It seems somethings work in headless worksheet and some things do not. Which does not make it useful.

You might ask, why Am I doing this? Because I wanted to call that B worksheet later on (if it worked) from a script to do the plot exporting, as the quality is better when in a "worksheet" vs. command line).

But since this does not even work when calling the worksheet from another worksheet, then there is no point of trying it from the command line.

Attached A and B. To try it, please save both worksheets in same folder and simply open and run it. It will call  

This is the first time I used documentTools package. I did not even know one can call one worksheet from another before.

I suspect it had to do with print(); call becoming inactive in headless worksheet, which causes nothing to be send to the postscript file. But I am not sure. Without print(); one can't export the plot.

I do not understand why is it so hard in Maple to export a plot to a PDF. Why is there not a simple export command to export a plot to PDF like with all the other software out there in the world?  This is the year 2021, not 1980. How many decades does Maplesoft needs to implement export to PDF?

This is on windows 10. Maple 2021.1

This is


p:=DocumentTools[RunWorksheet]( "" , [the_function=sin(x),the_variable=x]  ):
print("Back from calling worksheet B. Here is the result");


"Back from calling worksheet B. Here is the result"



This is







return p;




Hello, ive got another question. Im in the last chapter of this book, and i hope i can finish the book this month. So i can start with part 2 of the series of applied math for higher job education. The first book is basically the freshmans year worth of math, and im completing it within 2 months. So im happy with that. :) 

Okey here is the question: 
Draw half a circle x^2+y^2=4, with y >= (bigger or equal to) 0. 

So how do i make half a circle instead of the whole circle? 

The rest of the text says:
Which body is created if the area bordered by the x-axis and this half circle is revolved around the x-axis?
Calculate the volume of this body. 


The Function

smartplot(x^2+y^2 = 4)





eq1 := xdot = (xk - xk1)/dt;
eq2 := xdot2 = (xk - 2*xk1 + xk2)/dt^2;
eq3 := c*xdot + k*xk + m*xdot2 = F;
sol := solve({eq1, eq2, eq3}, xk);

What am I missing here? Ty 

How to change the distance (spacing) between 2D Input cells and 2D Output cells so that this procedure can be inserted into a style sheet and thus applied to multiple documents?



Would you tel me why this code doesn't work : the  lenghts of BC and BD are not constant. Thank you very much.
AB := 39;
BC := 140;
BD := 140;
Vdot := proc(U, V) local i; add(U[i]*V[i], i = 1 .. 2); end proc;
dist := proc(M, N) sqrt(Vdot(expand(M - N), expand(M - N))); end proc;
Fig := proc(alpha)
local cir, R, BC, BD, AC, AD, lAC, A, lBC, lAB, lBD, beta, B, C, Cc, Dd, D, Aa, Bb, F1, F2, d, k, h, i, Pb, Ph, pb1, ph1, Qb, Qh, qh1, qb1, p1, P1, p2, P2, p3, P3, p4, P4, q1, Q1, q2, Q2, q3, Q3, q4, Q4, cy1, cy2, cy3, cy4, tA, tB, tC, tD;
A := [0, 0]; R := 39; d := 83; BC := 140; BD := 140;
B := [R*cos(alpha), R*sin(alpha)];
k := BC/R; h := 1/2*sqrt(2);
Ph := [h*(R + BC), h*(R + BC)];
Pb := [h*(-R + BC), h*(-R + BC)];
Qh := [-h*(R + BC), h*(R + BC)];
Qb := [-h*(-R + BC), h*(-R + BC)];
P1 := [Ph[1] - 1/2*d*h, Ph[2] + 1/2*d*h];
P2 := [Ph[1] + 1/2*d*h, Ph[2] - 1/2*d*h];
P3 := [Pb[1] - 1/2*d*h, Pb[2] + 1/2*d*h];
P4 := [Pb[1] + 1/2*d*h, Pb[2] - 1/2*d*h];
Q1 := [Qh[1] + 1/2*d*h, Qh[2] + 1/2*d*h];
Q2 := [Qh[1] - 1/2*d*h, Qh[2] - 1/2*d*h];
Q3 := [Qb[1] + 1/2*d*h, Qb[2] + 1/2*d*h];
Q4 := [Qb[1] - 1/2*d*h, Qb[2] - 1/2*d*h];
cir := circle(A, R, color = black, linestyle = longdash);
F1 := plot(x, x = -R .. R + BC, color = black, linestyle = longdash);
F2 := plot(-x, x = -R - BC .. R, color = black, linestyle = longdash);
AC := R*(cos(alpha) + sqrt(k^2 - sin(alpha)^2));
C := [h . AC, h . AC];
AD := R*(cos(Pi - alpha) + sqrt(k^2 - sin(Pi - alpha)^2));
D := [-h*AD, h*AD]; lBC := plot([B, C], color = red, thickness = 4);
lAB := plot([A, B], color = red, thickness = 4); print(evalf(dist(B, C)), evalf(dist(B, D)));
lBD := plot([B, D], color = red, thickness = 4);
pb1 := pointplot(Pb, symbol = solidcircle, symbolsize = 5, color = black);
ph1 := pointplot(Ph, symbol = solidcircle, symbolsize = 5, color = black);
qb1 := pointplot(Qb, symbol = solidcircle, symbolsize = 5, color = black);
qh1 := pointplot(Qh, symbol = solidcircle, symbolsize = 5, color = black);
p1 := pointplot(P1, symbol = solidcircle, symbolsize = 10, color = black);
p2 := pointplot(P2, symbol = solidcircle, symbolsize = 10, color = black);
p3 := pointplot(P3, symbol = solidcircle, symbolsize = 10, color = black);
p4 := pointplot(P4, symbol = solidcircle, symbolsize = 10, color = black);
q1 := pointplot(Q1, symbol = solidcircle, symbolsize = 10, color = black);
q2 := pointplot(Q2, symbol = solidcircle, symbolsize = 10, color = black);
q3 := pointplot(Q3, symbol = solidcircle, symbolsize = 10, color = black);
q4 := pointplot(Q4, symbol = solidcircle, symbolsize = 10, color = black);
Aa := pointplot(A, symbol = solidcircle, symbolsize = 12, color = blue);
Bb := pointplot(B, symbol = solidcircle, symbolsize = 12, color = blue);
Cc := pointplot(C, symbol = solidcircle, symbolsize = 12, color = blue);
Dd := pointplot(D, symbol = solidcircle, symbolsize = 12, color = blue);
cy1 := plot([P1, P3], color = black, thickness = 8); cy2 := plot([P2, P4], color = black, thickness = 8);
cy3 := plot([Q1, Q3], color = black, thickness = 8); cy4 := plot([Q2, Q4], color = black, thickness = 8);
tA := textplot([0, 0, "A"], 'align' = {'above', 'right'});
tB := textplot([B[1], B[2], "B"], 'align' = {'above', 'right'});
tC := textplot([C[1], C[2], "C"], 'align' = {'above', 'right'});
tD := textplot([D[1], D[2], "D"], 'align' = {'above', 'right'});
display([cir, F1, F2, pb1, ph1, qb1, qh1, p1, p2, p3, p4, q1, q2, q3, q4, Aa, Bb, Cc, Dd, lAB, lBC, lBD, cy1, cy2, cy3, cy4, tA, tB, tC, tD], scaling = constrained); end proc;
display([seq(Fig((2*alpha*Pi)/50), alpha = 0 .. 50)], insequence = true, axes = none);

I'm trying to solve nonlinear system of equations via homotopy perturbation method. Please help with ideas to develop the code.




de1 := (1 - p)*(diff(x(t), t $ 1) - r*x) + p*(diff(x(t), t $ 1) - r*(1 - (x + y)/K) + al*x*v);

de2 := (1 - p)*(diff(y(t), t $ 1) + m*y+u*y) + p*(diff(y(t), t $ 1) - al*x*v + m*y+u*y);

de3 := (1 - p)*(diff(v(t), t $ 1) + eta*v) + p*(diff(v(t), t $ 1) - B*y + eta*v);

ibvc := x(0) = 0.005, y(0) = 0.0007;

v(0) = 2;

r:=0.005; al:=0.002; m:=0.0001; K:=0.0138; B:=0.2; eta:=0.006; u:=0.0001;

n := 4;

X := unapply(add(g[k](t)*p^k, k = 0 .. n), x);

Y := unapply(add(h[k](t)*p^k, k = 0 .. n), x);

V := unapply(add(i[k](t)*p^k, k = 0 .. n), x);

DE1 := series(eval(de1, x = X), p = 0, n + 1);

DE2 := series(eval(de2, y = Y), p = 0, n + 1);

DE3 := series(eval(de3, v = V), p = 0, n + 1);

C1 := map(coeffs, eval([ibvc], x = X), p);

C2 := map(coeffs, eval([ibvc], y = Y), p);

C3 := map(coeffs, eval([ibvc], v = V), p);

for k from 0 to n do

    IBVC1 := select(has, C1, g[k]);

    IBVC2 := select(has, C2, h[k]);

    IBVC3 := select(has, C3, i[k]);

    s1 := dsolve({coeff(DE1, p, k), op(IBVC1)});

    s2 := dsolve({coeff(DE2, p, k), op(IBVC2)});

    s3 := dsolve({coeff(DE3, p, k), op(IBVC3)});

    h[k] := unapply(rhs(s1), t);

h[k] := unapply(rhs(s2), t);

i[k] := unapply(rhs(s3), t);

end do;

'X(t)' = X(t) + O(p^(n + 1));

'Y(t)' = Y(t) + O(p^(n + 1));

'V(t)' = V(t) + O(p^(n + 1));


How to make changes in the code?


in my program, I need to generate plot of solution. I only know where the initial condition x value is. So I give to plot the x range as some value around that initial condition location. But this is not perfect, since the command line script will fail if Y value happend to be too large somewhere in this range due to singularity. (This fails only in the command line print driver, not in the worksheet GUI).

I can ofcource limit the y range also, using view=[....] but I do not know how to pick best Y range  automatically in the program to show what is interesting in the plot without doing lots of analysis on the expression.

There is something called smartview which is supposed to be active by default. But it does not seem to be working too well.

Here is an example. This function blows up at value near x=Pi  due to singularity. and I want the plot to automatically limit the Y range without having to specify manually the y view.


So clearly "smartview" did not do it or I am not using it correctly. But it is supposed to be "active"? 

Compare the same thing with Mathematica Plot where this  is handled automatically by Plot

sol = Exp[-3^(1/2)*(Cos[x] - 1)/Sin[x]];
Plot[sol, {x, 0, 2*Pi}]

Again, I know I can do the following in Maple


The problem is that I am doing this in a program, which only gets an expression as function of x to plot, around some x location. So hard to decide what the right Y range is. It will best if Plot can determine the best view automatically.

How to use smartview to handle this? Or are there other alternative plot options for such cases?

Is there a build-in package for Maple where I can do binomial test ? single tail and two tailed? If n and p are known?

The command line print driver is still broken in Maple.  Same code works OK in the worksheet, but gives error in command line.


No problem in the worksheet.  When putting the above code in file t.mpl and running it from DOS command line, it gives this error

>"C:\Program Files\Maple 2021\bin.X86_64_WINDOWS\cmaple.exe"  t.mpl

    |\^/|     Maple 2021 (X86 64 WINDOWS)
._|\|   |/|_. Copyright (c) Maplesoft, a division of Waterloo Maple Inc. 2021
 \  MAPLE  /  All rights reserved. Maple is a trademark of
 <____ ____>  Waterloo Maple Inc.
      |       Type ? for help.
> p:=plot(sin(x),x=0..3,axesfont=[12,12]):
> full_file_name:=cat("C:\\TMP\\");
> plotsetup(ps,plotoutput=full_file_name);
> print(p);

Error, invalid FONT specification

> plotsetup(default):
> quit

The fix is to remove axesfont=[12,12] from the plot command.

Is this known bug in Maple 2021.1 on windows 10?

ans:=6 *a[0]+2 *k^2 *b[1]*x^2 *y+k^2 *b[1] *y *lambda+6* k^2 *b[2]* x^3 *y-c *b[1] *x* y-2* c* b[2] *x^2 *y-c *b[2] *y *lambda+(6 *b[2]^2 *x^4 *lambda)/(lambda^2 *sigma+mu^2)+(6 *b[2]^2 *x^2 *lambda^2)/(lambda^2 *sigma+mu^2)+(6 *b[1]^2 *lambda* x^2)/(lambda^2 *sigma+mu^2)-12 *a[0] *b[2] *x *y-12* (a[1] . x)* b[2] *x* y-12* (a[2] . (x^2)) *b[2] *x* y+(6 *b[1]^2 *lambda^2)/(lambda^2 *sigma+mu^2)+k^2 *(a[1] . (-2 *x* (mu* y-x^2-lambda)-mu *x* y))+2 *k^2* (a[2] . ((mu* y-x^2-lambda)^2+x* (-2 *x (mu* y-x^2-lambda)-mu *x* y)))+c (a[1] . (mu *y-x^2-lambda))+2 *c (a[2] . (x *(mu *y-x^2-lambda)))+5* k^2 *b[2] *x *y *lambda-(c *b[2] *lambda^2 *mu)/(lambda^2 *sigma+mu^2)+(12 *b[1] *lambda *b[2] *x^3)/(lambda^2 *sigma+mu^2)+(12 *b[1] *lambda^2 *b[2] *x)/(lambda^2 *sigma+mu^2)-(12 *b[1]^2 *lambda *mu* y)/(lambda^2 *sigma+mu^2)+(k^2 *b[1] *lambda^2 *mu)/(lambda^2* sigma+mu^2)-12 *a[0] *b[1] *y-12* (a[1] . x) *b[1] *y-12* (a[2] . (x^2)) b[1] *y-6 *a[0]^2-12 *a[0] *(a[1] . x)-12 *a[0]* (a[2] . (x^2))-6* (a[1] . x)^2-12* (a[1] . x) *(a[2] . (x^2))-6* (a[2] . (x^2))^2-(2 *k^(2)* b[1] *lambda* mu^2 *y)/(lambda^2 *sigma+mu^2)+(k^2 *b[1] *lambda *mu *x^2)/(lambda^2 *sigma+mu^2)+(6* k^2 *b[2] *lambda *mu *x^3)/(lambda^2 *sigma+mu^2)+(6* k^2 *b[2] *lambda^2 *mu *x)/(lambda^2 *sigma+mu^2)+(2* c *b[2] *lambda *mu^2* y)/(lambda^2 *sigma+mu^2)-(c *b[2] *lambda* mu* x^2)/(lambda^2 *sigma+mu^2)-(12 *b[2]^2 *x^2 *lambda* mu* y)/(lambda^2 *sigma+mu^2)-(12* k^2 *b[2] *lambda* mu^2 *x *y)/(lambda^2 *sigma+mu^2)-(24 *b[1] *lambda *b[2] *x *mu* y)/(lambda^2 *sigma+mu^2)+6* (a[1] . x)+6* (a[2] . (x^2))+6 *b[2] *x *y+6 *b[1] *y;

P1 := coeff(coeff(ans, x, 4), y, 0);

Error, unable to compute coeff

Sometime, answer is coming sometine not.

2. Also, if one wants to substitute the value of x^2=t^2+5, in x^3 then why it is giving the ans.

Thank you very much!

I create and use the variable e (for elementary charge) often in my work.  I recently upgraded from version 2019 to version 2021 .  My workbooks now show the following warning when I run anything using my e vaiable.

Warning, if e is meant to be the exponential e, use command/symbol completion or palettes to enter this special symbol, or use the exp function

Is there a way to turn off this warning?  It is very annoying and a bit embarassing when I demo anything.


Hi Maple Users,

Microsoft is enticing me to upgrade to Windows 11 from 10 for free. I am a bit hesitant because I don't know if Maple 2021 will continue working as well as in Windows 10. Does anyone have any thoughts or wisdom to share.

Thank you.

So this is my integral and I need to determine the recursion formula (using maple's integration by parts) and then calculate In: 
∫ 1/(x^2+1)^n 𝑑𝑥

Thanks in advance!

i have this differential equation of order 4 that i have problem with solving it,

when ever i try solving it using maple the answer comes like this [  ] with nothing inside.

the differntial equation is: u'''' - sin x u'' + uu' - u=-1-sinx.

and the inital values are: u(0)=2, u'(0)=0,u''(0)=-1,u'''(0)=0.

if you got the answer can you send the code in maple so i can try it and see where i did wrong.

1 2 3 4 5 6 7 Last Page 2 of 1861