Maple 2020 Questions and Posts

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

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.

Update March 7, 2024.

FYI, examples giving this error using Maple 2024 using different functions


 

interface(version);

`Standard Worksheet Interface, Maple 2024.0, Windows 10, March 01 2024 Build ID 1794891`

restart;

kernelopts('assertlevel'=2):

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

exp(x)*sin(y(x))-3*x^2+(exp(x)*cos(y(x))+(1/3)/y(x)^(2/3))*(diff(y(x), x)) = 0

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

ode:=diff(y(x),x)*y(x)/(1+1/2*sqrt(1+diff(y(x),x)^2))=-x;
dsolve([ode,y(0)=3],y(x))

(diff(y(x), x))*y(x)/(1+(1/2)*(1+(diff(y(x), x))^2)^(1/2)) = -x

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

 


 

Download leak_Z_maple_2024.mw

 

I have reported this to Mapesoft.

 

I have a string which includes characters from the extended ASCII character set. I simply want to print the string. Nothing fancy. Hence my question is: how does one print characters from the extended ASCII character set so that they show up as the characters and not a bunch of empty boxes?  (A technique for UTF-8  character printing would be a bonus.)   

<Edit> For example, in integers, my string could be:

s := [56, 72, 157, 38];

Hence there printing of s as a string should be a 4 character / bytes entity: 

printf("%s", convert(s, bytes));

 I want to find all real roots of   equation x^2 + floor(x) - 10=0

restart: 
solve(x^2+floor(x)-10,x) assuming x::real 

maple tells me:

  RootOf(_Z^2 + floor(_Z) - 10)

allvalues(%) 

RootOf(_Z^2 + floor(_Z) - 10, 2.828427125 + 0.*I)

even though  usRealDomain.

use RealDomain in  solve(x^2+floor(x)-10,x) end use

We get nothing!

So I trun to use fsolve.

plot(x^2+floor(x)-10,x=-5..5)

                                  

s:=fsolve(x^2+floor(x)-10,{x});
fsolve(x^2+floor(x)-10,x,avoid={s})

                     s := {x = 2.828427125}

                          -3.741657387

 

I try to use mathematica, it is good:

Solve[x^2 + Floor[x] - 10 == 0, x, Reals]

Could Maple  do that?

 

 

 

 

 

 

Hi,

   My question should have a straight forward answer but after considerable searching I am unable to find one that is satisfactory. I am new to Maple.

I am writing an exam question, and I would like to change the parameter values to create different versions of the same question. I begin by defining the parameters and defining the supply schedule:

n:= 10: alpha:= -60: beta:= 20:

Qs:= alpha + beta*P;

The question with text and inserted math appears as follows (after each math expression I use CTRL = to generate an inline expression):

There are n = 10 identical firms. Supply is given by Qs = 20 P - 60. When P := 4 = 4 then quantity supplied is equal to Qs = 20. Calculate the ...

What I want instead is the following:

There are 10 identical firms. Supply is given by Qs = 20 P - 60. When P = 4 then quantity supplied is equal to 20.  Calculate the ...

I want the values highlighted in blue to update if I change the values for n, alpha and beta, and then click the !!! button in the Maple menu. I am okay with moving the "P = 4" out of the question and defining it as a parameter along with n, alpha and beta. However, when I do this Qs evaluates as a value rather than the Qs = 20P - 60 expression.

Thank you very much.

 

 

I discovered the LinearAlgebra package can use CUDA, 

CUDA, the Compute Unified Device Architecture, is an extension of C created by nVidia that allows the programmer to take advantage of the massive parallel computing power of an nVidia graphics card to do general purpose computation.

I also discovered that my new GTX 1660 Ti graphics card has 1,536 CUDA Cores, and the Maple CUDA package allows Maple to use the GPU hardward to accelerate certain LinearAlgebra routines.

The Maple command calling sequence is

CUDA[command]( arguments )

command( arguements )

But that is all I know.

Do any of you know just how much Maple can do with this sort of thing?  I've only had my individual license a couple of weeks so I don't have any perspective on what this means for Maple.

Can a lot of Maple make use of this sort of thing, or just a little bit?

Are there any other facilities in Maple that can make effective use of CUDA or any multi-processing like fully engaging all the coomputers CPUs?

I am interested regardless where the capabilities are implemented since enhancement can come from Maple, extensions, the Windows OS, the CPUs, or grahics card.... or any combination of these.

I rescently downloaded and installed my new Maple 2020 on my Windows 10 64x computer.

I noticed this in the install log:

   Log started 06/13/2020 at 03:25:42
   Preferred installation mode : win32
   Trying to init installer in mode win32
   Mode win32 successfully initialized
   Preparing Check for Update Tool
   Checking for Maple 2020 Updates

My question is this:  I know that under windows 10,  32 bit progams will generally install on even if a computer is 64x.

So should have Maple installed under mode win32?  Is there a 64 bit mode that will take better advanage of the system?

For that matter, is there any configuring that can install it or configure it to take better advanatage of the multi-threaded hardward capabilities?

Thanks, JS

( edited after the fact

BTW I tried to give your comment, kernelopts(wordsize) as the best answer, but it wouldn't let me because it is a comment.  So I gave your previous answer the credit.

kernelopts(wordsize) really hits it on the head for me.)

I'd like to solve the equation b^4+12*b^2+22*b^2-20*b+1=0

M:=b^4+12*b^2+22*b^2-20*b+1;
s:=solve(M,{b}):
s1:=allvalues(s[1])[]:# first solution

I find   first solution has  common subexpressions 5435 + 3*sqrt(515793), so I want to repalce by t. but unfortunately failed.

eq:=5435 + 3*sqrt(515793)=t:
applyrule(eq,s1);
# failed

why? in  following simple instance, it is OK!

eq:=5435 + 3*sqrt(515793)=t:
applyrule(eq,sqrt(5435 + 3*sqrt(515793)));

 

 

 

 

 

I try an import of csv external data file but i have "inconsistency".

With the smaller file import is OK,

With the second, bigger, the import is not "consistency" and i can not after perform statisyical analysis, possible on the smaller.

Attached zipped the 2 files (smaller test1_plantdata, bigger sub1_plantdata)

The structure of the csv file is exactly the same.

follow Maple code (changing directory and file name):

-------------------------------------------

restart;

with(Statistics);

interface(displayprecision = 4);

plantdata := Import("D:/Dati/Prove/Maple/test1_plantdata.csv");

---------------------------

I don't understand where is the "error"...

Thanks, regards.

 

Whenever I call solve, I now make sure to convert the solution to a set first to get rid of duplicate solutions which could be generated.

Is there a way to tell solve to return unique solution only by default?

restart:
expr:=-1/2*ln(u)-1/4*ln(u^2+2)-ln(x)-C[1]:
sol:=solve(expr = 0,u):
nops([sol])

   8

But there are actually only 4. The other 4 are duplicated

nops(convert([sol],set))

 4

This does not happen all the time,but I noticed it few times now. Is this to be expected?

Maple 2020.1

 

 I try to solve the general solutions of  sin(x^2)=1/2. And then I would  like to check the solution,but failed. How to do?

s:=solve(sin(x^2)=1/2,allsolutions);
about(_Z1);  #Originally _Z1, renamed _Z1~: is assumed to be: integer
about(_B1);  #Originally _B1, renamed _B1~: is assumed to be: OrProp(0,1)
test:=simplify(subs(x=s[1],sin(x^2)))

it sholud be 1/2. Thanks!

First 43 44 45 46 47 48 49 Last Page 45 of 55