Maple 2021 Questions and Posts

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

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 A.mw and run it. It will call B.mw  

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 A.mw
 

restart;

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

"C:\tmp\TEST_MAPLE"

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

 


 

This is B.mw
 


 

Inputs

 

the_function:=0;

the_variable:=0;


p:=plot(the_function,the_variable=-2*Pi..2*Pi):
full_file_name:=cat("C:\\tmp\\TEST_MAPLE\\tmp.ps");
plotsetup(ps,plotoutput=full_file_name):
print(p);
plotsetup(default):

return p;


 

Download B.mw

Download A.mw

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.

restart;
sol:=exp(-3^(1/2)*(cos(x)-1)/sin(x)):
plot(sol,x=0..2*Pi);

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

plot(sol,x=0..2*Pi,view=[default,-1..20]);

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?

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

restart;
p:=plot(sin(x),x=0..3,axesfont=[12,12]);
full_file_name:=cat("C:\\TMP\\tmp.ps");
plotsetup(ps,plotoutput=full_file_name);
print(p);   
plotsetup(default):

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\\tmp.ps");
> 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?

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.

Thanks

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.

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.

Recently I saw a heated discussion on this post:https://www.mapleprimes.com/questions/233026-Write-Output-Of-For-Loop-To-txt-File

In Carl Love  's answer, I felt the power of adjacency matrix of graph. I carefully read maple's function to generate non IsomorphicGraphs:  NonIsomorphicGraphs. There was one passage that I thought was really interesting.

selectform = graph, adjacency, or bits
This specifies the form used for a graph when it is being passed to the select procedure. The forms are identical to those for outputform, but note that adjacency and bits are the most efficient forms, while graph is only reasonable for a relatively small number of comparison operations (1000 or less), as it needs to form a Graph for every comparison. Note also that when selectform=adjacency the same read-only Matrix is internally used to pass the data for every call to reduce overhead. This is not possible with a Graph structure.

I never quite understood what the advantage of this bits was. At least according to the help documentation, we have  to do many works to do to convert this into a adjacency matrix of graph.

[NonIsomorphicGraphs(8, output = graphs, restrictto = regular[2])]

bit := Vector[row](Bits:-Split(210256131, bits = (8*(8 - 1))/2));
M := Matrix(8, 8, shape = symmetric, datatype = integer[1]);
M[1, 2 .. 8] := bit[1 .. 7];

M[2, 3 .. 8] := bit[8 .. 13];

M[3, 4 .. 8] := bit[14 .. 18];
M[4, 5 .. 8] := bit[19 .. 22];

M[5, 6 .. 8] := bit[23 .. 25];

M[6, 7 .. 8] := bit[26 .. 27];
M[7, 8 .. 8] := bit[28 .. 28];
M;

From adjacency matrix of graph,  we can diractly get a lot of information about the graph, like edges, and the number of closed walks of a particular length, but from bits , what imformation of graph we can get?

If we have to convert it to an adjacency matrix fist, maybe it's a little bit more complicated from above long codes. At least there isn't a more efficient way to convert?

Hi,

I am generating several random weighted graphs using the following code:

with(GraphTheory):
with(RandomGraphs):
G:=RandomGraph(10,20,connected):
G1:=AssignEdgeWeights(G,5..25):
DrawGraph(G1,showlabels=true,stylesheet=[edgecolor=blue,weightfont = [times,bold,11]])

By default weight labels appear to be positioned at the midpoint of each edge. Is there a way to change that positioning?

Thanks!

Hey everyone ! 

I want to get the analytical function from a piecewise differential equation defined on 6 intervals but Maple returns me a numerical result... I think it hides a Runge Kutta method.. However, it returned me an analytical function for a similar piecewise differential equation defined on 3 intervals.

Do you know how I could get the analytical function defined on the 6 intervals ?

Thank you very much for your time ! 

Alex

eq := diff(Uy(x), x, x)-piecewise(x < d1, 12*F*x/(E*b*h^3), d1 < x and x < d2, 12*((F+F1)*x-F1*d1)/(E*b*h^3), d2 < x and x < d3, 12*((F+F1+F2)*x-F1*d1-F2*d2)/(E*b*h^3), d3 < x and x < d4, 12*((F5+F4-F)*x+F*L-F5*d5-F4*d4)/(E*b*h^3), d4 < x and x < d5, 12*((F5-F)*x+F*L-F5*d5)/(E*b*h^3), 12*F*(L-x)/(E*b*h^3))

diff(diff(Uy(x), x), x)-piecewise(x < d1, 12*F*x/(E*b*h^3), d1 < x and x < d2, 12*((F+F1)*x-F1*d1)/(E*b*h^3), d2 < x and x < d3, 12*((F+F1+F2)*x-F1*d1-F2*d2)/(E*b*h^3), d3 < x and x < d4, 12*((F5+F4-F)*x+F*L-F5*d5-F4*d4)/(E*b*h^3), d4 < x and x < d5, 12*((F5-F)*x+F*L-F5*d5)/(E*b*h^3), 12*F*(L-x)/(E*b*h^3))

(1)

dsolve({eq, Uy(0) = 0, Uy(L) = 0}, Uy(x))

assign(dsolve({eq, Uy(0) = 0, Uy(L) = 0}, Uy(x)))

Uy_sol := unapply(Uy(x), x)

proc (x) options operator, arrow; Uy(x) end proc

(2)

E := 210*10^9; L := 4; d1 := (1/6)*L; d2 := 2*L*(1/6); d3 := 3*L*(1/6); d4 := 4*L*(1/6); d5 := 5*L*(1/6); b := 0.1e-1; h := 0.5e-2

210000000000

 

4

 

2/3

 

4/3

 

2

 

8/3

 

10/3

 

0.1e-1

 

0.5e-2

(3)

eq

diff(diff(Uy(x), x), x)-piecewise(x < 2/3, 0.4571428572e-1*F*x, 2/3 < x and x < 4/3, 0.4571428572e-1*(F+F1)*x-0.3047619048e-1*F1, 4/3 < x and x < 2, 0.4571428572e-1*(F+F1+F2)*x-0.3047619048e-1*F1-0.6095238096e-1*F2, 2 < x and x < 8/3, 0.4571428572e-1*(F5+F4-F)*x+.1828571429*F-.1523809524*F5-.1219047619*F4, 8/3 < x and x < 10/3, 0.4571428572e-1*(F5-F)*x+.1828571429*F-.1523809524*F5, 0.4571428572e-1*F*(4-x))

(4)

dsolve({eq, Uy(0) = 0, Uy(L) = 0}, Uy(x))

Uy(x) = -(1/4)*(Int(Int(piecewise(_z1 < 2/3, (1142857143/25000000000)*F*_z1, _z1 < 4/3, (1142857143/25000000000)*F*_z1-(380952381/12500000000)*F1+(1142857143/25000000000)*F1*_z1, _z1 < 2, (1142857143/25000000000)*F*_z1-(380952381/6250000000)*F2-(380952381/12500000000)*F1+(1142857143/25000000000)*F1*_z1+(1142857143/25000000000)*_z1*F2, _z1 < 8/3, -(1142857143/25000000000)*F*_z1-(1219047619/10000000000)*F4-(380952381/2500000000)*F5+(1828571429/10000000000)*F+(1142857143/25000000000)*F4*_z1+(1142857143/25000000000)*_z1*F5, _z1 < 10/3, -(1142857143/25000000000)*F*_z1-(380952381/2500000000)*F5+(1828571429/10000000000)*F+(1142857143/25000000000)*_z1*F5, 10/3 <= _z1, -(1142857143/25000000000)*F*_z1+(1142857143/6250000000)*F), _z1 = 0 .. _z1), _z1 = 0 .. 4))*x+Int(Int(piecewise(_z1 < 2/3, (1142857143/25000000000)*F*_z1, _z1 < 4/3, (1142857143/25000000000)*F*_z1-(380952381/12500000000)*F1+(1142857143/25000000000)*F1*_z1, _z1 < 2, (1142857143/25000000000)*F*_z1-(380952381/6250000000)*F2-(380952381/12500000000)*F1+(1142857143/25000000000)*F1*_z1+(1142857143/25000000000)*_z1*F2, _z1 < 8/3, -(1142857143/25000000000)*F*_z1-(1219047619/10000000000)*F4-(380952381/2500000000)*F5+(1828571429/10000000000)*F+(1142857143/25000000000)*F4*_z1+(1142857143/25000000000)*_z1*F5, _z1 < 10/3, -(1142857143/25000000000)*F*_z1-(380952381/2500000000)*F5+(1828571429/10000000000)*F+(1142857143/25000000000)*_z1*F5, 10/3 <= _z1, -(1142857143/25000000000)*F*_z1+(1142857143/6250000000)*F), _z1 = 0 .. _z1), _z1 = 0 .. x)

(5)

Uy(x)[0]

Uy(x)[0]

(6)

assign(dsolve({eq, Uy(0) = 0, Uy(L) = 0}, Uy(x)))

Uy(x)[0]

(-(1/4)*(Int(Int(piecewise(_z1 < 2/3, (1142857143/25000000000)*F*_z1, _z1 < 4/3, (1142857143/25000000000)*F*_z1-(380952381/12500000000)*F1+(1142857143/25000000000)*F1*_z1, _z1 < 2, (1142857143/25000000000)*F*_z1-(380952381/6250000000)*F2-(380952381/12500000000)*F1+(1142857143/25000000000)*F1*_z1+(1142857143/25000000000)*_z1*F2, _z1 < 8/3, -(1142857143/25000000000)*F*_z1-(1219047619/10000000000)*F4-(380952381/2500000000)*F5+(1828571429/10000000000)*F+(1142857143/25000000000)*F4*_z1+(1142857143/25000000000)*_z1*F5, _z1 < 10/3, -(1142857143/25000000000)*F*_z1-(380952381/2500000000)*F5+(1828571429/10000000000)*F+(1142857143/25000000000)*_z1*F5, 10/3 <= _z1, -(1142857143/25000000000)*F*_z1+(1142857143/6250000000)*F), _z1 = 0 .. _z1), _z1 = 0 .. 4))*x+Int(Int(piecewise(_z1 < 2/3, (1142857143/25000000000)*F*_z1, _z1 < 4/3, (1142857143/25000000000)*F*_z1-(380952381/12500000000)*F1+(1142857143/25000000000)*F1*_z1, _z1 < 2, (1142857143/25000000000)*F*_z1-(380952381/6250000000)*F2-(380952381/12500000000)*F1+(1142857143/25000000000)*F1*_z1+(1142857143/25000000000)*_z1*F2, _z1 < 8/3, -(1142857143/25000000000)*F*_z1-(1219047619/10000000000)*F4-(380952381/2500000000)*F5+(1828571429/10000000000)*F+(1142857143/25000000000)*F4*_z1+(1142857143/25000000000)*_z1*F5, _z1 < 10/3, -(1142857143/25000000000)*F*_z1-(380952381/2500000000)*F5+(1828571429/10000000000)*F+(1142857143/25000000000)*_z1*F5, 10/3 <= _z1, -(1142857143/25000000000)*F*_z1+(1142857143/6250000000)*F), _z1 = 0 .. _z1), _z1 = 0 .. x))[0]

(7)

Uy(x < d1)

Uy(x < 2/3)

(8)

Uy(x)[x < d1]

(-(1/4)*(Int(Int(piecewise(_z1 < 2/3, (1142857143/25000000000)*F*_z1, _z1 < 4/3, (1142857143/25000000000)*F*_z1-(380952381/12500000000)*F1+(1142857143/25000000000)*F1*_z1, _z1 < 2, (1142857143/25000000000)*F*_z1-(380952381/6250000000)*F2-(380952381/12500000000)*F1+(1142857143/25000000000)*F1*_z1+(1142857143/25000000000)*_z1*F2, _z1 < 8/3, -(1142857143/25000000000)*F*_z1-(1219047619/10000000000)*F4-(380952381/2500000000)*F5+(1828571429/10000000000)*F+(1142857143/25000000000)*F4*_z1+(1142857143/25000000000)*_z1*F5, _z1 < 10/3, -(1142857143/25000000000)*F*_z1-(380952381/2500000000)*F5+(1828571429/10000000000)*F+(1142857143/25000000000)*_z1*F5, 10/3 <= _z1, -(1142857143/25000000000)*F*_z1+(1142857143/6250000000)*F), _z1 = 0 .. _z1), _z1 = 0 .. 4))*x+Int(Int(piecewise(_z1 < 2/3, (1142857143/25000000000)*F*_z1, _z1 < 4/3, (1142857143/25000000000)*F*_z1-(380952381/12500000000)*F1+(1142857143/25000000000)*F1*_z1, _z1 < 2, (1142857143/25000000000)*F*_z1-(380952381/6250000000)*F2-(380952381/12500000000)*F1+(1142857143/25000000000)*F1*_z1+(1142857143/25000000000)*_z1*F2, _z1 < 8/3, -(1142857143/25000000000)*F*_z1-(1219047619/10000000000)*F4-(380952381/2500000000)*F5+(1828571429/10000000000)*F+(1142857143/25000000000)*F4*_z1+(1142857143/25000000000)*_z1*F5, _z1 < 10/3, -(1142857143/25000000000)*F*_z1-(380952381/2500000000)*F5+(1828571429/10000000000)*F+(1142857143/25000000000)*_z1*F5, 10/3 <= _z1, -(1142857143/25000000000)*F*_z1+(1142857143/6250000000)*F), _z1 = 0 .. _z1), _z1 = 0 .. x))[x < 2/3]

(9)

NULL

Download cas_5v_F_inconnues.mw

Hi,

I try to display a different steps of an mathematical developpement with ShowSteps command, but But the command gives nothing in the new version Maple 2021?

Thanks for your Help

QShowSteps.mw

I do not know why int() on this integrand fails always first time, and works second time it is called. seems like something is not loaded correctly first time?

integrand:=(((-3*x^2-18*x-27)*exp(2)^2+(30*x^3+330*x^2+1170*x+1350)*exp(2)-75*x^4-1200*x^3-7050*x^2-18000*x-16875)*ln(x)+(12*x^2+54*x+81)*exp(2)^2+(-120*x^3-1106*x^2-3510*x-4050)*exp(2)+225*x^4+3560*x^3+20990*x^2+54000*x+50625)/((3*x^4+18*x^3+27*x^2)*exp(2)^2+(-30*x^5-330*x^4-1170*x^3-1350*x^2)*exp(2)+75*x^6+1200*x^5+7050*x^4+18000*x^3+16875*x^2):

print("First time");
int(integrand,x);

print("second time");
int(integrand,x);

Worksheet attached.

Update

Here is a movie. it is few minutes long. This happens by random and not each time. This movie shows the command starting from "restart" are repated 4 times. First two times, no error. Then the error shows up.  So it is random. Maybe it depends if Maple is busy with other things or not. I have each worksheet set to use its own server though. So I have no idea why this happens sometimes and not other times.

 

 

 

issue_int_nov_11_2021.mw

I think there is a problem here

restart;
the_integrand:=(((-2*x^2+2)*exp(exp(exp(3)))^2+(4*x^3-4*x)*exp(exp(exp(3)))-2*x^4-6*x^2+8)*exp(ln(x)-x^2)*ln(exp(exp(exp(3)))^2-2*x*exp(exp(exp(3)))+x^2+4)+((2*x^2-2)*exp(2)*exp(exp(exp(3)))^2+((-4*x^3+4*x)*exp(2)-2*x)*exp(exp(exp(3)))+(2*x^4+6*x^2-8)*exp(2)+2*x^2)*exp(ln(x)-x^2))/(exp(exp(exp(3)))^2-2*x*exp(exp(exp(3)))+x^2+4);

int(the_integrand,x,method=_RETURNVERBOSE)

#try MeijerG
int(the_integrand,x,method=MeijerG);

gives

I do not know if this known or not.

Maple 2021.1 on windows

This is Maple 2021.1 on windows.

===================
restart;
expr:=x^(6+1/3);
res:=series(expr,x=0,6);
==============

gives
        O(x^(19/3))

But type of the above is not series:

===========
type(res,'series');
        false
===========

Yet convert(res,polynom) works

================
convert(res,polynom)
          0
================

Which is correct conversion. But help says that

"convert/polynom
convert a series to polynomial form"

Notice, it says "series" there.

So the input must be type series. But Maple says
O(x^(19/3)) is not type series. I think this is wrong. The
type returned should be series. Now the type returned is 'function'
from the series command.

What Am I overlooking here?

fyi;

Maple 2021.1 on windows 10.

Screen in worksheet displays this (correct)

But latex generated when compiled using lualatex from TEXLIVE 2021 shows this

code 

sol:=(Vector(2, [x(t),y(t)])) = (Vector(2, [8*c[1]*exp((1/2+1/2*89^(1/2))*t)/(-3+89^(1/2))-8*c[2]*exp((1/2-1/2*89^(1/2))*t)/(3+89^(1/2))+2/11*t^2-3/11*exp(t)-2/121*t+23/1331,c[1]*exp((1/2+1/2*89^(1/2))*t)+c[2]*exp((1/2-1/2*89^(1/2))*t)-1/11*t^2-15/22*exp(t)+12/121*t-17/1331])):

sol:=simplify(sol);

latex(sol)

`Standard Worksheet Interface, Maple 2021.1, Windows 10, May 19 2021 Build ID 1539851`

`The "Physics Updates" version in the MapleCloud is 1105 and is the same as the version installed in this computer, created 2021, November 8, 23:55 hours Pacific Time.`

zip file attached include the latex file and worksheet used.

issue_latex_nov_6_2021.zip

First 21 22 23 24 25 26 27 Last Page 23 of 36