Maple 2020 Questions and Posts

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

 

restart;
expr:=a^2*(2*a^2*p^3-a^2*((p^2+1)^2*(a^2-1))^(1/2)-((p^2+1)^2*(a^2-1))^(1/2)*p^2+2*p*a^2-2*p^3+((p^2+1)^2*(a^2-1))^(1/2)-2*p)/((p^2+1)^2*(a^2-1))^(1/2)/(p^3-((p^2+1)^2*(a^2-1))^(1/2)+p)/(a^2-p^2-1);
int(expr,p)

Gives

why does Maple give division by zero?

Here is the result from integration package on Mathematica

ClearAll[a, p];
expr = a^2*(2*a^2*p^3 - 
       a^2*((p^2 + 1)^2*(a^2 - 1))^(1/2) - ((p^2 + 1)^2*(a^2 - 1))^(1/
           2)*p^2 + 2*p*a^2 - 2*p^3 + ((p^2 + 1)^2*(a^2 - 1))^(1/2) - 
       2*p)/((p^2 + 1)^2*(a^2 - 1))^(1/
        2)/(p^3 - ((p^2 + 1)^2*(a^2 - 1))^(1/2) + p)/(a^2 - p^2 - 1)
<< Rubi`
Int[expr, p]

Which it can integrate. Result is a little long. (removed since looks too long)

But my question really is not why Maple could not integrate it, but why the division by zero? 

Maple 2020.1

(Context: As part of a EU consumer watchdog report I've been asked to re-validate a number of publically stated APR rates for various consumer loan. )

(Apologize if this should have been posted to some bug-tracker but I was unable to find such a forum.)

System: MacOS 10.14.6, Maple 2020.1

Summary: Some simple exponential summations entered in 2D Input seems to crash the kernel and it is dependent on the numerical value of the exponent. The same expressions entered in 1D plaintext Maple Notation works fine. The numerically/expression evaluations are also significantly slower in 2D Input in a Document (x10) as compared to 1D Maple Notation in a Worksheet.

The attached worksheet is a "killer" worksheet and will on OSX 10.14.6 + Maple 2020.1 kill the kernel connection (crash the kernel).

kernel-crash.mw

Example:

A trivial example, entering 2D Math (assume PV & C are positive real numbers), say

will cause a lost connection to the kernel after 40-50s entering the epression and the UI being busy (unclear what it is doing since no real calculation is performed) which I assume is a sign that the kernel crashed. It seems to dependent on the exponent in the divisor. So for example the following variation will not crash the kernel

Doing the exact same calculation with a worksheet in old plain maple notation both varianta are both significantly faster in the numerical operation (solving for 'r') and assigning 'eq2' and never crashes (regardless of numerical value of exponent).

The workaround is of course obvious but it would be nice if this bug could be adressed.

It seems that whenever I try to give the 2D-UI a chance (since it is actally easier to visually view complex expressions)  something always comes back and bites me...

Update: The crash is only repeatable with the "sum()" command and not the "add()" command.

 

 

 

This is a programming question.

The goal is to solve an equation such as eq:=x^2+2*x-1=0; and obtain the solution as list with x= on each solution, like this

                       sol := [x = sqrt(2) - 1, x = -1 - sqrt(2)]

The command  to start with is sol:=solve(eq,x) which gives 

                       sol := sqrt(2) - 1, -1 - sqrt(2)

But to have x= show up, the command is modifed to be sol:=solve(eq,{x}) by adding {} around the variable to solve for, and now Maple gives 

                       sol := {x = sqrt(2) - 1}, {x = -1 - sqrt(2)}

Which is not yet the goal.. Changing the command to sol:=[solve(eq,{x})]  gives 

                       sol := [{x = sqrt(2) - 1}, {x = -1 - sqrt(2)}]

Which is still not the goal. Changing the command to sol:=solve(eq,[x])  gets closer to the goal.  it gives

                      sol := [[x = sqrt(2) - 1], [x = -1 - sqrt(2)]]

To remove the extra pair [ ] the list is Flattened like this

eq:=x^2+2*x-1=0;
sol:=solve(eq,[x]);
sol:=ListTools:-Flatten(sol)

Which gives me what I want, which is one list (not list of lists), and with x= in there

                             sol := [x = sqrt(2) - 1, x = -1 - sqrt(2)]

Is there a better way to obtain the above form of result than what I have above?

 

I need to check if expression is "special" kind of polynomial. Where powers are allowed to be non-integers and can be fractions. This is not polynomial in the mathematical sense ofcourse so can not use type(expr,polynom) on it, and did not see a way to tell type(expr,polynom) to accept non-integer exponents.

For an example, given p(x):=x^2+x^(1/3)+3+sqrt(x)+x^Pi+1/x*sin(x): it will return false, due to sin(x) term there. Without this term, it will return true, since all other terms have the form x^anything.

Currently, this is what I do

expr:=x^2+x^(1/3)+3+sqrt(x)+x^Pi+1/x*sin(x):

if type(expr,polynom(anything,x)) then
   print("Yes, normal polynomial");
else
   what_is_left:=remove(Z->type(Z,{`^`('identical'(x),algebraic),'identical'(x)}),expr);
   if has(what_is_left,x) then
      print("Not special polynomial");
   else
      print("Yes, special polynomial");
   fi;
fi;

While with

expr:=x^2+x^(1/3)+3+sqrt(x)+x^Pi+1/x:

It will print "Yes, special polynomial"

Is the above a good way to do this, or do you suggest a better way? It seems to work on the few tests  I did on it so far.

It is always "polynomial" in one symbol, such as x. So if it contains any function of x, other than  x^exponent, where exponent can only be numeric, or other symbol, it will fail the test. So this below will pass the a above test as well

expr:=x^2+x^(1/3)+3+sqrt(x)+x^a+1/x:

 

I was just praising Maple for not rewriting/simplifying  expressions automatically without the explicit user asking for it, when I found the following strange result

expr:=arccos(a-p) does not cause any change in the input. Good.

But when I change the letter ordering to expr:=arccos(p-a) now Maple changed it to Pi - arccos(a - p)

I have no idea why. Is there an option to tell Maple not to do that, even if it is mathematically correct? 

restart;
expr:=arccos(a-p);

restart;
expr:=arccos(p-a);

It seems to use lexicographical ordering to re-write things. Is it possible to turn that off?  Notice that I did not ask for simplification or anything. 

Maple 2020.1, Physics 724

I was checking my solution against Maple. Maple gives solution with integral and RootOf. I am not able to simplify it to better compare.

restart;
ode:=y(x)=ln(cos(diff(y(x),x)))+diff(y(x),x)*tan(diff(y(x),x));
sol:=dsolve(ode);

It is the second solution above I want to simplify/evaluate. So I tried

restart;
ode:=y(x)=ln(cos(diff(y(x),x)))+diff(y(x),x)*tan(diff(y(x),x));
sol:=dsolve(ode);
sol:=[sol][2];
DEtools:-remove_RootOf(sol)

But this did nothing. Then I tried adding useint in the dsolve command

restart;
ode:=y(x)=ln(cos(diff(y(x),x)))+diff(y(x),x)*tan(diff(y(x),x));
sol:=dsolve(ode,useint);

But this also kept the integral there. Then I tried eval

restart;
ode:=y(x)=ln(cos(diff(y(x),x)))+diff(y(x),x)*tan(diff(y(x),x));
sol:=[dsolve(ode,'explicit')];
eval(sol[2])

The solution I obtained is 

y(x) = -ln(_C1^2 - 2*_C1*x + x^2 + 1)/2 + ((-2*x + 2*_C1)*arctan(-x + _C1))/2

Which does verify to zero OK using odetest.

Any suggestions/tricks to use to get an more explicit solution from Maple I am overlooking?

Maple 2020.1 , Physics 724

I can post/attach my full solution if needed. 

 

 

Hello,

I have a particular problem that I haven't managed to find the solution to by googling.

9/10 times that I open Maple 2020 I can't seem to open any of my saved documents. it opens the start tab, and I'm still able to open a new document or worksheet, but then when I try to change to text instead of math, it won't let me. I can type, but I can't press backspace or enter.

I have tried restarting and shutting down my computer, but every time I have to just force quit Maple because it won't respond half of the time and it won't quit normally.

I'm running the latest version of Maple and using macOS Catalina version 10.15.5.

I have no problems assigning simple plots to variables and then displaying all in a single plot using the display command.

However, I am now trying to do the same using implicitplot without success.

This is my code;

restart;
f := 3*(x^2 + y^2)^2 = 100*x*y;

with(plots, implicitplot);
p1 := implicitplot(f, x = -4 .. 4, y = -4 .. 4, rangeasview = true):

p2 := pointplot([[1, Pi/2], [-1, -Pi/2]], color = red):

display({p1,p2})

What I get is a small implicit plot and the code for the pointplot back at me.

Is there any way to make this work?

Thank you for your help.

Jose

 

I solved this ODE and got a solution and wanted to compre it with Maple. This is initial value first oder ODE. So it should have no constants in it. But Maple's solution contains something I never seen before _B1~

I wonder what it means? And odetest did not verify Maple's solution. 

restart;
ode:=diff(y(x),x)-y(x)/x+csc(y(x)/x)=0;
sol:=dsolve([ode,y(1)=0]);
simplify(odetest(sol,ode));

odetest does not gives zero.

This is my solution

mysol:=y(x)=x*arccos(ln(x)+1);
odetest(mysol,ode)

   0

Any idea what _B1~ means? The ~ looks like it is an assumed variable? may be leaked from inside Maple.

Maple 2020.1 on windows 10

 

I use odeadvisor a lot to tell me the type of the ode. It is one of the best tools in Maple.

But sometimes it overlooks some types of ODE's, if the ODE is written in different way. This does not happen alot. Here is an example

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


And advisor says it is rational, which is correct. 

But it does not also say it is exact. By rewriting as follows, it now see it is exact as well as rational:

ode2:=(denom(rhs(ode)))*diff(y(x),x)-(numer(rhs(ode)))=0;
DEtools:-odeadvisor(ode2);

And now it says [_exact, _rational]. It is the same ODE, just written different.

This is not a complaint about the advisor, I know it is not easy to figure the type of the ODE under different trasformations, but may be something to look into to improve it to be able to detect more types.

Maple 2020.1 

One thing I always liked about Maple, is that it does not do automatic simplifications or automatic re-write of expressions without the user explicitly asking for it like some other CAS systems do, which I think this is the right way.

So I was surprised when I set up a rational expression of a numerator and denominator, then when I asked for its denom and numer, I found Maple did automatic rewrite (even though on the screen the expression remained as it was originally). This caused a bug in my program (since it assumed as long as no simplifcation is made on the expression, numer and denom will remain as it was orginally placed). Here is an example

restart;
num:=-(1-x/exp(y));
den:=(exp(y)+x);
expr:=num/den;

So now, one would expect, by looking at the screen, when asking for numer(expr) to obtain back -(1-x/exp(y))  but this is not what happens

numer(expr)

And 

denom(expr)

So Maple's internal representation of numer and denom, is not what "appears" on the screen for the user. Maple automatically replaced -1+x/exp(y) by (-exp(y)+x)/exp(y) and then moved denominator of this, which is exp(y), down to the denominator of the orginal expression.

I was surprised by this, since as I said, my experence with Maple is that it keeps expressions as entered and will change them only when the user asks for a change.

How common is such behavior in Maple? and why did Maple do this under the cover manipulation in this case? It is probably documented somewhere if I search hard enough.

 

 

I was trying to compare my solution with Maple on this ode, when I noticed Maple gives solution with no y(x)= in it. 

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

When there is more than one solution, Maple write y(x) on each. For an example

dsolve(diff(y(x),x)^2=x)

How to explain this output?

Maple 2020.1

I think I've seen such a problem before but thought it was fixed.

Here is an example, where depending on what one calls the constant of integration, maple can or not, verify the solution of the ode.

This should not happen.

When calling the constant of integration C[1] or _C Maple does not verify the solution. Only when using _C1 it does.

This is a problem, since I do not use _C1 or _C2  in my solution (so not to conflict with Maple's), I use C[1] and C[2].

Is there a workaround for this? 

Example 1

ode:=diff(z(x),x)+z(x)*cos(x)=z(x)^n*sin(2*x);
mysol:=z(x) = 1/((_C1*exp(sin(x)*(n - 1))*n - _C1*exp(sin(x)*(n - 1)) + 2*sin(x)*n - 2*sin(x) + 2)/(n - 1))^(1/(n - 1));
odetest(mysol,ode);

    0

Now I just changed _C1 to C[1] 

restart;
ode:=diff(z(x),x)+z(x)*cos(x)=z(x)^n*sin(2*x);
mysol:=z(x) = 1/(( C[1]*exp(sin(x)*(n - 1))*n - C[1]*exp(sin(x)*(n - 1)) + 2*sin(x)*n - 2*sin(x) + 2)/(n - 1))^(1/(n - 1));
odetest(mysol,ode);

 

and I get 2 pages full of stuff thrown at the screen. Same when using C as constant of integration.

I could change my C[1] and C[2] to _C1 and _C2 each time just before calling odetest as workaround.

But would like to ask if this is supposed to happen and why it happens. I depend on odetest alot, as I use it to tell me if my solution is correct or not and I do not want false negatives.

I have found additional ones. May be these will help locate the problem

Example 2

restart;
ode:=diff(y(x),x) = (1+x+y(x))^(1/2);
mysol1:=y(x) = LambertW(-exp(-x/2 - 1 + C[1]/2))^2 + 2*LambertW(-exp(-x/2 - 1 + C[1]/2)) - x:
odetest(mysol1,ode);

gives

But when using _C1 instead of C[1], this is the answer

restart;
ode:=diff(y(x),x) = (1+x+y(x))^(1/2):
mysol2:=y(x) = LambertW(-exp(-x/2 - 1 + _C1/2))^2 + 2*LambertW(-exp(-x/2 - 1 + _C1/2)) - x:
odetest(mysol2,ode);

Example 3

restart;
ode:=diff(y(x),x) = f(x)*y(x)+g(x)*y(x)^k:
mysol1:=y(x) = (-exp(-(k - 1)*Int(f(x), x))*(int(g(x)*exp((k - 1)*Int(f(x), x)), x)*k - int(g(x)*exp((k - 1)*Int(f(x), x)), x) - C[1]))^(-1/(k - 1)):
odetest(mysol1,ode);

   #long output is given

Changing C[1] to _C1 gives 0 right away

restart;
ode:=diff(y(x),x) = f(x)*y(x)+g(x)*y(x)^k:
mysol2:=y(x) = (-exp(-(k - 1)*Int(f(x), x))*(int(g(x)*exp((k - 1)*Int(f(x), x)), x)*k - int(g(x)*exp((k - 1)*Int(f(x), x)), x) - _C1))^(-1/(k - 1)):
odetest(mysol2,ode);

     0

 

Example 4

restart;
ode:=3*y(x)*diff(y(x),x)+5*cot(x)*cot(y(x))*cos(y(x))^2 = 0:
mysol1:=y(x) = RootOf(10*ln(sin(x))*cos(_Z)^2 - 3*cos(_Z)*sin(_Z) + 30*C[1]*cos(_Z)^2 + 3*_Z):
odetest(mysol1,ode);

Gives pages long output. Changing C[1] to _C1 gives zero

restart;
ode:=3*y(x)*diff(y(x),x)+5*cot(x)*cot(y(x))*cos(y(x))^2 = 0:
mysol2:=y(x) = RootOf(10*ln(sin(x))*cos(_Z)^2 - 3*cos(_Z)*sin(_Z) + 30*_C1*cos(_Z)^2 + 3*_Z):
odetest(mysol2,ode);

    0

 

Example 5

restart;
ode:=x*(x-a*y(x))*diff(y(x),x) = y(x)*(y(x)-a*x);
mysol1:=y(x) = exp((-a + 1)*RootOf(x*exp(ln(x)*a + _Z*a + C[1]*a + C[1]) + exp(ln(x)*a + _Z*a + C[1]*a - _Z + C[1])*x - 1) - ln(x)*a - C[1]*(a + 1)):
odetest(mysol1,ode);

gives

Changing C[1] to _C1 gives zero

restart;
ode:=x*(x-a*y(x))*diff(y(x),x) = y(x)*(y(x)-a*x);
mysol2:=y(x) = exp((-a + 1)*RootOf(x*exp(ln(x)*a + _Z*a + _C1*a + _C1) + exp(ln(x)*a + _Z*a + _C1*a - _Z + _C1)*x - 1) - ln(x)*a - _C1*(a + 1)):
odetest(mysol2,ode);

              0

 

Example 6

restart;
ode:=x*diff(y(x),x)^2-a*y(x)*diff(y(x),x)+b = 0:
mysol1:=y(x) = x*RootOf(2*x*_Z^2*a - 2*C[1]*_Z^((2*a - 1)/(a - 1))*a - x*_Z^2 + C[1]*_Z^((2*a - 1)/(a - 1)) - b)/a + b/(RootOf(2*x*_Z^2*a - 2*C[1]*_Z^((2*a - 1)/(a - 1))*a - x*_Z^2 + C[1]*_Z^((2*a - 1)/(a - 1)) - b)*a):
odetest(mysol1,ode);

gives many pages of output. Changing C[1] to _C1 gives zero

restart;
ode:=x*diff(y(x),x)^2-a*y(x)*diff(y(x),x)+b = 0:
mysol2:=y(x) = x*RootOf(2*x*_Z^2*a - 2*_C1*_Z^((2*a - 1)/(a - 1))*a - x*_Z^2 + _C1*_Z^((2*a - 1)/(a - 1)) - b)/a + b/(RootOf(2*x*_Z^2*a - 2*_C1*_Z^((2*a - 1)/(a - 1))*a - x*_Z^2 + _C1*_Z^((2*a - 1)/(a - 1)) - b)*a):
odetest(mysol2,ode);

             0

and more. I think the above should hopefully help locate the issue.

Maple 2020.1 with Physics 708

 

The general solution of x2y'' + 3xy' + λy = 0 is (from Example 4 here)

Why does dsolve(x^2*diff(y(x), x, x) + 3*x*diff(y(x), x) + lambda*y(x) = 0) give only the third case instead of the whole solution?

I see this error once in a while

Error, (in SolveTools:-CancelInverses) assertion failed, simplify should not leak _Z variables out from RootOfs 

When I run a long script. Unfortunately, I have not been able to make a small example to reproduce it. So it is random. I've seen it about 5-6 times in the last 2-3 weeks, over 100 runs during this time.

Just wanted to see if anyone saw this before. The strange thing it is random. I can re-run the same script, or restart it from the point where it failed,  with no changes anywhere, and this error do not show up again for days, and suddenly it shows up again.

Must be related how to Maple internal cache memory happened to be arranged at that time. I noticed that a number of things in Maple seem to happen at random times, such as a random hang of the server at different times and places. I could never understand why this happens in Maple.

If there is only one thing Maplesoft could do for the next version, it will be to improve the robustness of its software.

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