Maple 2020 Questions and Posts

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

HOW I CAN FIND A , B DIRECTLY?

NOT BY WRITING RELATION 5?

A.mw



Maple Worksheet - Error

Failed to load the worksheet /maplenet/convert/A.mw .
 

Download A.mw

 

 

In Latex 897 correct Latex is generated for the following code. In 905, wrong Latex is generated. This is different from the other cases I posted about (links below) and new issue.

In 897, the Latex generated for this example compiles with no error

restart;
sol:=(Vector(2, [x__1(t),x__2(t)])) = (Vector(2, [2^(3/4)*3^(1/4)*(exp(2^(3/4)*3^(1/4)*t)*_C1-exp(-2^(3/4)*3^(1/4)*t)*_C2-sin(2^(3/4)*3^(1/4)*t)*_C3+cos(2^(3/4)*3^(1/4)*t)*_C4),2*6^(1/2)*(exp(2^(3/4)*3^(1/4)*t)*_C1+exp(-2^(3/4)*3^(1/4)*t)*_C2-sin(2^(3/4)*3^(1/4)*t)*_C4-cos(2^(3/4)*3^(1/4)*t)*_C3)]));
Latex(sol)

Now compiling the Latex gives

\documentclass[11pt]{article}
\usepackage{amsmath}
\usepackage{maplestd2e}  

\begin{document}
\[
\left[\begin{array}{c}x_{1} \! \left(t \right) \\x_{2} \! \left(t \right) \end{array}\right]
 = 
\left[\begin{array}{c}2^{\frac{3}{4}} 3^{\frac{1}{4}} \left({\mathrm e}^{2^{\frac{3}{4}} 3^{\frac{1}{4}} t} \mathit{\_C1} -{\mathrm e}^{-2^{\frac{3}{4}} 3^{\frac{1}{4}} t} \mathit{\_C2} -\sin \! \left(2^{\frac{3}{4}} 3^{\frac{1}{4}} t \right) \mathit{\_C3} +\cos \! \left(2^{\frac{3}{4}} 3^{\frac{1}{4}} t \right) \mathit{\_C4} \right) \\2 \sqrt{6}\, \left({\mathrm e}^{2^{\frac{3}{4}} 3^{\frac{1}{4}} t} \mathit{\_C1} +{\mathrm e}^{-2^{\frac{3}{4}} 3^{\frac{1}{4}} t} \mathit{\_C2} -\sin \! \left(2^{\frac{3}{4}} 3^{\frac{1}{4}} t \right) \mathit{\_C4} -\cos \! \left(2^{\frac{3}{4}} 3^{\frac{1}{4}} t \right) \mathit{\_C3} \right) \end{array}\right]
\]
\end{document}

In 905

The Latex(sol) gives

\documentclass[11pt]{article}
\usepackage{amsmath}
\usepackage{maplestd2e}  

\begin{document}
\[
\left[\begin{array}{c}x_{1} \! \left(t \right) 
\\
 x_{2} \! \left(t \right) \end{array}\right]
 = 
\left[\begin{array}{c}2^{\frac{3}{4}} 3^{\frac{1}{4}} 
\\
\left({\mathrm e}^{2^{\frac{3}{4}} 3^{\frac{1}{4}} t} \textit{\_C1} -{\mathrm e}^{-2^{\frac{3}{4}} 3^{\frac{1}{4}} t} \textit{\_C2} -
\\
\sin \! \left(2^{\frac{3}{4}} 3^{\frac{1}{4}} t \right) \textit{\_C3} +\cos \! \left(2^{\frac{3}{4}} 3^{\frac{1}{4}} t \right) \textit{\_C4} \right) 
\\
 2 \sqrt{6}\, 
\\
\left({\mathrm e}^{2^{\frac{3}{4}} 3^{\frac{1}{4}} t} \textit{\_C1} +{\mathrm e}^{-2^{\frac{3}{4}} 3^{\frac{1}{4}} t} \textit{\_C2} -
\\
\sin \! \left(2^{\frac{3}{4}} 3^{\frac{1}{4}} t \right) \textit{\_C4} -\cos \! \left(2^{\frac{3}{4}} 3^{\frac{1}{4}} t \right) \textit{\_C3} \right) \end{array}\right]
\]
\end{document}

Which when compiled using texlive lualatex gives error. There is a missing \right. 

>lualatex foo5.tex
This is LuaHBTeX, Version 1.12.0 (TeX Live 2020)
 restricted system commands enabled.
(./foo5.tex
LaTeX2e <2020-10-01> patch level 2
.....
..Defaults to "dvips" Driver
(/usr/local/texlive/2020/texmf-dist/tex/latex/graphics/epsfig.sty (/usr/local/texlive/2020/texmf-dist/tex/latex/graphics/graphicx.sty (/usr/local/texlive/2020/texmf-dist/tex/latex/graphics/keyval.sty) (/usr/local/texlive/2020/texmf-dist/tex/latex/graphics/graphics.sty (/usr/local/texlive/2020/texmf-dist/tex/latex/graphics/trig.sty) (/usr/local/texlive/2020/texmf-dist/tex/latex/graphics-cfg/graphics.cfg) (/usr/local/texlive/2020/texmf-dist/tex/latex/graphics-def/dvips.def))))
Defining Automatic Style Generation Macros
Defining Maple Spreadsheet Environments
Maple Spreadsheet and Table Support
) (/usr/local/texlive/2020/texmf-dist/tex/latex/l3backend/l3backend-luatex.def) (./foo5.aux) (/usr/local/texlive/2020/texmf-dist/tex/latex/base/ts1cmr.fd)
! Missing \right. inserted.
<inserted text>
\right .
l.14 \\

?


 

Maple 2020.2, Physics 905

Fyi, the issues I know about in Latex()  as of now are these 4

https://www.mapleprimes.com/questions/231398-Regression-In-Latex-Between-897-And?sq=231398

https://www.mapleprimes.com/questions/231397-Latex-Latex-Generates-Command-Not-In

https://www.mapleprimes.com/questions/231273-Why-Latex-Fail-To-Convert-Solution

https://www.mapleprimes.com/questions/231262-Latex-Generates-Wrong-Latex-For-This-Example

 

FYI,

I was testing Physics 905 to see if this bug reported in https://www.mapleprimes.com/questions/231262-Latex-Generates-Wrong-Latex-For-This-Example

But I found that now Maple generates a new command called \munderset  while in 897 it used to be  \Mapleunderset

So the problem was not fixed. In addition now it uses a command called \munderset which is not in any of Maple style files and not a standard Latex macro name. 

Replacing \munderset back to \Mapleunderset now the same error that was generated in the above linked to question, using the same exact code shown there.

So I think this new command should remain \Mapleunderset unless there is a new Maple syle file used which is not part of Maple 2020.2? 

To reproduce this, please run the same code posted in the above link. No need to duplicate it here again, and you will see this problem.

Maple 2020.2, Physics 905

 

 

I think Maple is wrong here. But may be someone could show me how it is correct?

Maple says this ode (below) is of type d'Alembert. But I am not able to show this. It is impossible for me to put this ode in _dAlembert. form. So I gave up.

https://www.maplesoft.com/support/help/Maple/view.aspx?path=odeadvisor/dAlembert

The challenge then is to put the following first order ODE in the above form to show it is dAlembert.

I could not do it. I worked on this by hand and not possible to get the ODE in the above form. Could someone show this?

restart;
ode:=3*x^2*y(x)^3+y(x)^4+(3*x^3*y(x)^2+4*x*y(x)^3+y(x)^4)*diff(y(x),x) = 0;
DEtools:-odeadvisor(ode);

The first thing I do when I want to show this, is to solve for y(x) from the ode. Since I can't use solve on an ode, I start by replacing all the diff(y(x),x) with say p. Then now solve for y(x). If it is dAlembert, then it should give expression that be put in the form    y(x)=x*f(p) + g(p). Notice that the functions f(p) and g(p) are functions of p only and not of x. This is important.  And f(p) is multiplied by linear term and not x^(3/2) or x^(1/2), etc... The term multiplying f(p) has to be linear in x.

ode:=subs(diff(y(x),x)=p,ode):
sol:=[PDEtools:-Solve(ode,y(x))];

Looking at second and third solutions. None of them is dAlembert.  This can be shown by either simplyfing it with assumptions, where not possible to obtain the needed form, or by simply replacing p back with diff(y(x),x) and asking advisor for the type of the resulting ode

DEtools:-odeadvisor( subs(p=diff(y(x),x),sol[2]));
DEtools:-odeadvisor(subs(p=diff(y(x),x),sol[3]));

So none is d'Alembert.

Question is: Could someone may be proof that this ode is d'Alembert? By putting it in the form   y(x)=x*f(p)+g(p)? Or is advisor is wrong here?

ps. I tried infolevel[DEtools:-odeadvisor]:=4 to try to trace it, but it does not work.

pps. I worked this out by hand, and I get 

                y(x)= x^(3/2)*f(p)  where f(p) = sqrt(-12 p^2)+sqrt(12*p)

And this is not d'Alembert.

 

I was just using odeadvisor to check type of some ode's, when I noticed it gives 

             Error, (in ODEtools/radnormal) numeric exception: division by zero

on ode's of form y(x)=x*diff(y(x),x)^n+x^2

for different n:

restart;
for n from -5 to 5 do
    if n<>0 then
       try
          ode:=y(x)=x*diff(y(x),x)^(n)+x^2;
          DEtools:-odeadvisor(ode);
          print("n=",n,"OK, no error");
       catch:
          print("n=",n,StringTools:-FormatMessage( lastexception[2..-1] ));
       end try;
    fi;
od;

Is this known issue and is expected?

Maple 2020.2 on windows 10


 

I am getting this error. Is this expected or known issue?  

restart;
sol:=-csgn(1, 1/(_C1*a - _C1*x - 1))*_C1*a^4/((k + 1)*(_C1*a - _C1*x - 1)^2) + 4*csgn(1, 1/(_C1*a - _C1*x - 1))*_C1*a^3*x/((k + 1)*(_C1*a - _C1*x - 1)^2) - 6*csgn(1, 1/(_C1*a - _C1*x - 1))*_C1*a^2*x^2/((k + 1)*(_C1*a - _C1*x - 1)^2) + 4*csgn(1, 1/(_C1*a - _C1*x - 1))*_C1*a*x^3/((k + 1)*(_C1*a - _C1*x - 1)^2) - csgn(1, 1/(_C1*a - _C1*x - 1))*_C1*x^4/((k + 1)*(_C1*a - _C1*x - 1)^2) + a^2/((k + 1)*(_C1*a - _C1*x - 1)^2) - 2*a*x/((k + 1)*(_C1*a - _C1*x - 1)^2) + x^2/((k + 1)*(_C1*a - _C1*x - 1)^2) + csgn(1, 1/(_C1*a - _C1*x - 1))*a^3/((k + 1)*(_C1*a - _C1*x - 1)^2) - 3*csgn(1, 1/(_C1*a - _C1*x - 1))*a^2*x/((k + 1)*(_C1*a - _C1*x - 1)^2) + 3*csgn(1, 1/(_C1*a - _C1*x - 1))*a*x^2/((k + 1)*(_C1*a - _C1*x - 1)^2) - csgn(1, 1/(_C1*a - _C1*x - 1))*x^3/((k + 1)*(_C1*a - _C1*x - 1)^2) - csgn(1/(_C1*a - _C1*x - 1))*a^2/((k + 1)*(_C1*a - _C1*x - 1)^2) + 2*csgn(1/(_C1*a - _C1*x - 1))*a*x/((k + 1)*(_C1*a - _C1*x - 1)^2) - csgn(1/(_C1*a - _C1*x - 1))*x^2/((k + 1)*(_C1*a - _C1*x - 1)^2);

solve( simplify(sol)=0,x,allsolutions = true) assuming real; #also x::real, same error

Maple 2020.2 on winsows 10. Physics 897

 

 

The following command returned 1026 instead of 1000 samples. Any ideas why?

R1 := Sample(Normal(0, 1), 1000);
length(R1);
 

Thanks

Should dsolve has missed this solution? I used singsol=all option:

restart;
ode:=y(x)^2+(x^2+x*y(x))*diff(y(x),x) = 0;
dsolve(ode,y(x),singsol=all)

But y(x)=0 is singular solution. It can not be obtained from the above general solutions for any constant of integration value.

odetest(y(x)=0,ode)

                 0

if I change the type of ode, Maple now gives y(x)=0 but the general solution is too complicated (which is OK) but the point is that it does now find y(x)=0.

dsolve(ode,y(x),[dAlembert]);


           y(x)=0,  etc.....

my question is: Why singsol=all did not also give y(x)=0 in this example?  Is there something I am misundertanding here?

Maple 2020.2

I've been struggling to implement a more complicated version of the example from Acer here:
    https://www.mapleprimes.com/questions/231110-Typesetting-In-Plots-

The basic idea is that Maple allows XML for typesetting (and maybe MathML? I don't use the MLs, so I can't speak to limitations or differences).

It's somewhat straightforward, but extremely tedious. The statement that this is " undocumented, but not overly difficult " may be true, but it's time-consuming to learn bits and pieces of any additional language just to typeset something that resembles extremely common typesetting language, and frankly feels like a waste of time. In a world where we have LaTeX, I don't see why Maple can't use LaTeX language for typesetting in plots. Python, MatLAB have this feature, and a homebrew version of this for Mathematica came up during my searching, but nothing useful for Maple. The Physics package  has some function to take the Maple and produce LaTeX code (untested by me so far), but not being able the other direction to typeset axes, titles, and textplots with LaTeX notation is shocking to me.

When one attempts the tag formating from html/XML like here:
  https://www.maplesoft.com/support/help/Maple/view.aspx?path=MathML
or formatting, errors come up. Basic things like having control over a given character's size seem impossible without the tag formatting, and I tried for some time to get all sorts of variations of #mstyle to work using the syntax method of the linked question. The converters that I've found that go from LaTeX to MathML use this tag formatting.

Here are some examples that I made up to demonstrate acer's method and one particular area where the MathML spectactularly fails compared to LaTeX, and included to (current as of this moment) links that give element names for XML and symbol names for html/xml:
https://developer.mozilla.org/en-US/docs/Web/MathML/Element
https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references

MapleXMLExamples.mw

The contents are failing to be inserted, but the file downloads correctly from the preview for me.

I just had enough with odetest hanging (even when using with timelimit). I wait hours and hours each time (even though I have 30 second timelimit, which Maple ignores) and I do not think Maplesoft is going to fix this in my lifetime.  

So I am attempting to make my own very simple and basic odetest.

I give it an ode and explicit solution in for form sol:= y(x)=... and the function uses algsubs(sol,ode) and checks it is gets zero or not (it will also do simplify if needed)

But there is a BIG problem.   Even though algsubs(z=0,z/z);  gives back 1 as expected,  but

restart;
ode:=diff(y(x), x)/y(x);
sol:=y(x)=0;

algsubs(sol,ode);   #this gives ZERO. It should be 1

If we do algsubs on each term one by one

algsubs(sol,numer(ode));
algsubs(sol,denom(ode));

            0
            0

So why did algsubs give zero in the first case, since  the result of the algsubs should be 0/0 which algsubs knows in the limit it is 1?   How did it come up with zero?

Clearly my simple method of replacing odetest with algsubs is not working. I need a more robust way to handle this.

subs does not work. Since subs does not know how substitute y(x)=f(x) into derivatives involved in an ODE.

My question is: Is there a way to teach algsubs to give 1 for the above example? or better function to use?

I tried applyrule instead of algsubs, but that does not work.

applyrule(sol, ode)

Error, (in rec) numeric exception: division by zero
 

Is there a better method to use? I am trying to do simple version of odetest that does not hang. Even if not perfect. Will only use it for explicit solutions, not implicit since implicit is much harder.

Here is a more full example

ode:=diff(y(x),x)^2+2*x*diff(y(x),x)/y(x)-1 = 0;
sol:=y(x)=0;
odetest(sol,ode)

                            0

But when I use my simple method

ode:=diff(y(x),x)^2+2*x*diff(y(x),x)/y(x)-1 = 0;
sol:=y(x)=0;
algsubs(sol,ode);

                          -1 = 0

The reason it failed, because algsubs replaced the second term by 0 instead of 1. The second term in the ode is diff(y(x),x)/y(x)

Which is 0/0 but this is 1 in the limit. But algsubs used 0 instead for some reason.

So I need a little bit smarter way to replace my solution into the ode than just using algsubs. May need to use some of the tricks I've seen used here before using freez/thaw/frontend, etc.. which I still do not understand.

Any recommendation?  This is meant to work for any single ode and any explicit solution of the form y(x)=....

This algsubs method works actually pretty well on many ode's. I've tested it on 2,000 ode's. It just fails so far on subtle ones like the above. Here is just random example where it works

restart;
ode:=diff(y(x),x)^2 = (-x+1)/x;
sol:=y(x)=_C1+arcsin(2*x-1)/2+sqrt(x-x^2);

evalb(simplify(algsubs(sol,ode)))

                     true

So I just need a way to handle the cases where it gives 0/0 I think. I have 20 ODE's which now fail out of about 2,000 using this basic method compared to using odetest.

 

Thank you

I was trying to simplify long expression of the form    f(x)=g(x), where f(x) should simplify to be the same as g(x) and get 0=0. But Maple simplify just return the input back.

Then I wrote simplify(f(x)-g(x)) and now Maple returned 0 back.

What is the difference between simplify (f(x)=g(x)) and simplify(f(x)-g(x))? And why the second worked but not the first?

restart;
f:=(9*(x^(-2/3*a))^2*exp(6/a*(x^(-2/3*a))^(1/2))^2*_C0^2-6*(x^(-2/3*a))^(3/2)*exp(
6/a*(x^(-2/3*a))^(1/2))^2*_C0^2*a+x^(-2/3*a)*exp(6/a*(x^(-2/3*a))^(1/2))^2*_C0^
2*a^2+18*(x^(-2/3*a))^2*exp(6/a*(x^(-2/3*a))^(1/2))*_C0-2*x^(-2/3*a)*exp(6/a*(x
^(-2/3*a))^(1/2))*_C0*a^2+6*(x^(-2/3*a))^(3/2)*a+x^(-2/3*a)*a^2+9*(x^(-2/3*a))^
2)/(3*_C0*exp(6/a*(x^(-2/3*a))^(1/2))*(x^(-2/3*a))^(1/2)-exp(6/a*(x^(-2/3*a))^(
1/2))*_C0*a+3*(x^(-2/3*a))^(1/2)+a)^2:

g:=x^(-2/3*a):

And now

simplify(f=g);

But

simplify(f-g);

                                                           0

And

simplify(f-g=0);

                 0 = 0 

Why Maple behaves like this? I did not know it makes difference if one writes f=g vs. f-g in terms of simplification. 

I copied the code to Mathematica to see how it behaves, and Mathematica Simplify worked on both f=g and also on f-g as one would have expected:

 

Maple 2020.2 on windows

 

With this application, the differential equation of forced systems is studied directly. It comes with embedded components and also with native Maple code. Soon I will develop this same application with MapleSim. Only for engineering students.

Damped_Forced_Movement.mw

Lenin AC

Ambassador of Maple

For the last hr, I've been trying to find out why Maple solve was hanging inside one module in my .mla when called.

I would try the same code in new worksheet, no hang. I had timelimit on it. Same exact code as in the module.

I go back to the other worksheet, do restart, call the module (after loading the library by setting libname) which calls solve(), and it hangs. Each time.

I tried may be 10 times. No difference between the code in the mla and the other worksheet where I had copy of the solve command. All other settings are the same. 

ONLY after I closed Maple, and restarted Maple, and opened the worksheet where the call used to hang, and called the module again, now it did not hang and solve completed.

This is not the first time I've seen such a strange thing. Sometimes Maple will hang for hrs (I start  a test, go to sleep,. wake up hrs later, and see maple hanged for hrs from the time stamp).

Closes Maple, start the test from where it was hanging, and now no hang. It runs OK from then on.

This tells me that doing just restart from the worksheet do not clean everything. (I use the command restart, not by pressing the restart button in the menu, not sure if these are different, they should be the same  I would think).

I've seen this problem before. sometimes the test just hangs. No matter how many time I do restart from the worksheet, it just hangs. When I restart Maple, it works from same place it was hanging.

My question is, what could possibly make Maple not hang when starting fresh. vs. using the restart command?  I am using the same worksheet, and I have "create new engine for each document" selected in options.

The hang used to happen in solve, in here

#this is inside a function inside a module inside .mla library
#

eq:=x = 1/2/(p^2+2)^(1/8)*2^(1/2)*((1+(-4*p^2+1)^(1/2))/(1/(4*p^2-1)*p^2)^(1/2)/(-4
*p^2+1)^(1/2))^(3/4)/(((-4*p^2+1)^(1/2)+3)/(p^2+2)^(1/2))^(1/4)*_C1*p^(1/4);

        try               
            sol_p:=timelimit(20,[:-solve(x=rhs(eq),p)]);
        catch:
           return [];
        end try;
#hangs here. Never completes. Only when starting Maple the hang is gone. 

#trace below
......
Main: polynomial system split into 1 parts under preprocessing
Main: using RegularChains based methods
SolverVariableOrder: using the variable order  _S000008 > _S000011 > _S000009 > _S000006 > _S000005
TriangularDecomposition: using deterministic algorithm for decomposition
<<<< HANGS HERE EACH TIME >>>>

Again, only when I restarted Maple, did the hang go away. it is one equation solving for one variable.

So now, I get into the habit of closing all of Maple and starting it again when I get a hang. I do not trust restart command any more to clear everything.

Any idea why this happens? Memory not cleared somewhere? Cache problem? Does the frontend itself stores something that could cause this? does restart use new mserver.exe each time or same mserver.exe process as last time?

if restart does not actually terminate the mserver.exe that the worksheet was talking to, but only sends request to mserver.exe to clear its own memory, this could explain things.

It is possible that mserver.exe which is attached to that worksheet does not fully clear all its own memory and something remain there which affects why it hangs in same place each time, even though restart was issued each time, and only when restarting Maple itself will clear this and the hangs goes away.

 

 

I am using Maple's CodeTools[Usage] to check memory measurement for a few lines of code i have.

One line is calling a custom function and the usage reports ~16 GB usage, the other line is a Groebner Basis computation and reports ~200 MB of memory usage. The usage is reported via 'bytesused' flag in the CodeTools[Usage] input.

However, GNU time command returns 6 GB total for the whole code iteration. Why is there such a discrepancy? Does maple's bytesused mean something different than GNU time's max resident set size?

When asking dsolve to use specific ode type to solve an ode, in particular, dAlembert type, which typically generate complicated solutions, sometimes dsolve solution shows up using parameter T.

But odetest gets confused by this expression it seems. I am not able to figure if I am doing something wrong in using odetest, or may be odetest does not know how to handle such form of a solution.

Here is an example. This ode

is of these types:

restart;
ode:=diff(y(x), x) = (y(x)^3 + 2*x*y(x)^2 + x^2*y(x) + x^3)/(x*(y(x) + x)^2);
DEtools:-odeadvisor(ode);

By default, dsolve was smart to use homogeneous type to solve the ODE, as this gives the simplest solution. 

One can force dsolve to use the other types. When using dAlembert, odetest gives an error trying to verify any one of the solutions returned from dsolve due to the way the solution is returned. Here is the result

restart;
ode:=diff(y(x), x) = (y(x)^3 + 2*x*y(x)^2 + x^2*y(x) + x^3)/(x*(y(x) + x)^2);
sol:=[dsolve(ode,y(x),[homogeneous])];

No problem here for odetest. it can verify any of the above 3 solutions with no error generated.

odetest(sol[1],ode)

          0

Lets compare using dAlembert type

restart;
ode:=diff(y(x), x) = (y(x)^3 + 2*x*y(x)^2 + x^2*y(x) + x^3)/(x*(y(x) + x)^2);
sol:=[dsolve(ode,y(x),[dAlembert])]: #solution too complicated to show here
odetest(sol[1],ode)

 

It looks like odetest does not know how to handle the form of the solution as returned by dsolve for this case. The problem is that each solution is actually made up of two parts, not just y(x) as normally is the case. One part defines something called X(T_) and the next part which is the solution y(x) uses this X(T) in it. 

Did I do something wrong, or is there a way around this, or is this by design?

Maple 2020.2

First 20 21 22 23 24 25 26 Last Page 22 of 55