nm

10436 Reputation

19 Badges

12 years, 194 days

MaplePrimes Activity


These are questions asked by nm

Maple's Student:-ODEs:-ODESteps solves an ode by doing change of variable on the independent variable, but the resulting ode is wrong and final answer is wrong.

Here is one such example

restart;
ode:=diff(diff(y(x),x),x)*sin(x)^2 = 2*y(x);
Student:-ODEs:-ODESteps(ode):

But this result is wrong. First of all, we can not have both x and t  in the same ode. This is what dchange gives

ode:=diff(y(x),x$2)*sin(x)^2-2*y(x)=0;
tr:={PDEtools:-Solve(t=ln(x),x)};
simplify(PDEtools:-dchange(tr,ode,[t]))

It looks like Student:-ODEs:-ODESteps is trying to solve  sin(x)^2*y'' + 2 y=0 as EULER type ode.

But Euler type ode will look like  x^2*y'' +2 y=0  

It seems to have confused sin(x)^2 with x^2. This change of variable it used only works for EULER type ode with polynomial coefficient, not trig coefficients.

Maple 2024.2 on Windows 10

These two issues probably came up before, but I can't find where and when searching Maple primes.

So I thought to summarize the issues I see with odetest in one post, in the hope to get clarification on current status on these from the powers who know.

The first issue

The order in which odetest returns the answer. When odetest is called to check the ode and IC, as in 

the_status := odetest(sol,[ode,IC])

One would expect the_status to be a list, where the first entry tells if sol verifies the ode, and the second entry tells if sol verifies IC.

i.e. the order is the same as in the input. right? Since ode is first and IC is second in the input list.

But Maple sometimes mixes the order. See example 1 below. This makes it impossible to determine if the solution verifies the ode or IC,  when one of the entries in the_status is zero and the other is not, since order can be reversed sometimes.

Second issue:

When the solution is implicit, Maple gives invalid odetest result on the IC, unless one rewrites the solution using (lhs-rhs)(sol)=0.

i.e. move everything to the left side of the equation with RHS zero. This happens sometimes and when the solution is implicit.

I have thought this was fixed in current Maple, but it is not.  I remember this came up before, but can't find when and where.

Example 2 below shows an example.

Will these two issues hopefully be fixed in Maple 2025? Sometimes one forgets to rewrite the solution using (lhs-rhs)(sol)=0 and this results in false negative. 

Please see worksheet below. ps. I hope forum manager does not delete this question.

interface(version);

`Standard Worksheet Interface, Maple 2024.2, Windows 10, October 29 2024 Build ID 1872373`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1838 and is the same as the version installed in this computer, created 2024, December 2, 10:11 hours Pacific Time.`

libname;

"C:\Users\Owner\maple\toolbox\2024\Physics Updates\lib", "C:\Program Files\Maple 2024\lib"

restart;

 

Example 1: order of status from odetest is not same as order of input

 

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

x = 1/(3*exp((1/2)*y(x)^2)-y(x)^2-2)

#we see that odetest verifies the ode
odetest(sol,ode)

0

#but when adding IC, 0 is now in second entry, instead of first

odetest(sol,[ode,IC])

[(y(x)^4-y(x)^2*y(-1/(y(x)^2-3*exp((1/2)*y(x)^2)+2))*(D(y))(-1/(y(x)^2-3*exp((1/2)*y(x)^2)+2))+y(-1/(y(x)^2-3*exp((1/2)*y(x)^2)+2))^3*(D(y))(-1/(y(x)^2-3*exp((1/2)*y(x)^2)+2))-6*y(x)^2*exp((1/2)*y(x)^2)+3*exp((1/2)*y(x)^2)*y(-1/(y(x)^2-3*exp((1/2)*y(x)^2)+2))*(D(y))(-1/(y(x)^2-3*exp((1/2)*y(x)^2)+2))+4*y(x)^2-2*y(-1/(y(x)^2-3*exp((1/2)*y(x)^2)+2))*(D(y))(-1/(y(x)^2-3*exp((1/2)*y(x)^2)+2))+9*exp(y(x)^2)-12*exp((1/2)*y(x)^2)+4)/(y(x)^2-3*exp((1/2)*y(x)^2)+2)^2, 0]

#SHOULD NOT zero above be in first slot in the list instead of second slot??

 

 

Example 2. We must write the solution using (lhs-rhs)(sol)=0

 

restart;

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

x = 1/(3*exp((1/2)*y(x)^2)-y(x)^2-2)

odetest((lhs-rhs)(sol)=0,[ode,IC])

[0, 0]

#we see that now it verified both IC and sol

 

 

 

 

Download issues_with_odetest_dec_16_2024.mw

What is the correct syntax to do this change of variable from the text book:

The problem is that using PDEtools:-dchange, it wants the transformation to have form { old = new}, i.e. x=...  so I can not write  z=g(x) in the transformation. 

For example

ode:= diff(y(x),x$2)+diff(y(x),x)+y(x)=sin(x);
PDEtools:-dchange({z= g(x)},ode,known={x},unknown={z});

Error, (in dchange/info) missing a list with the new variables
And if I first solve for x so that I can write the transformation with x on left side, it still does not work

ode:= diff(y(x),x$2)+diff(y(x),x)+y(x)=sin(x);
PDEtools:-dchange({x=RootOf(g(_Z) - z)},ode,known={x},unknown={z});

Where RootOf(g(_Z) - z) was result of solve(z=g(x),x);

I am sure this can be done in Maple, I just do not know the right syntax to use with dchange.

Maple 2024.2

Is there a trick to make Maple give same result below when using eval and limit?  

Attached worksheet. This comes in context of solving ode  using Laplace. Initial conditions are at zero. And need to solve for the constant of integration. 

It works when using eval, since Dirac(t) becomes Dirac(0), but when using Limit, Dirac(t) becomes zero and the _C1 is lost. I was wondering if limit should also return Dirac(0) like eval?

interface(version);

`Standard Worksheet Interface, Maple 2024.2, Windows 10, October 29 2024 Build ID 1872373`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1838 and is the same as the version installed in this computer, created 2024, December 2, 10:11 hours Pacific Time.`

restart;

e:=1/2*t+_C1*Dirac(t);

(1/2)*t+_C1*Dirac(t)

eval(e,t=0)

_C1*Dirac(0)

limit(e,t=0)

0

 

 

Download dirac_limit_dec_13_2024.mw

In Latest Maple 2024.2, I found that when doing z:=%  where % is result on integration, causes internal error 

          Error, unexpected result from Typesetting

But when the interface is set to standard, no such error.

This not only happen in worksheet, but also when code is run in command line!

Worksheet below.

interface(version);

`Standard Worksheet Interface, Maple 2024.2, Windows 10, October 29 2024 Build ID 1872373`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1837 and is the same as the version installed in this computer, created 2024, December 2, 10:11 hours Pacific Time.`

Example using extended

 

restart;

interface(typesetting=extended):

int(exp(-int(b(t),t))*t^4*csc(t)^2,t);

int(exp(-(int(b(t), t)))*t^4*csc(t)^2, t)

z:=%;

Error, (in Risch:-Norman) too many levels of recursion

` `

Error, unexpected result from Typesetting

 

Example using standard

 

restart;

interface(typesetting=standard):

int(exp(-int(b(t),t))*t^4*csc(t)^2,t);

int(exp(-(int(b(t), t)))*t^4*csc(t)^2, t)

z:=%;

int(exp(-(int(b(t), t)))*t^4*csc(t)^2, t)

 

 

Example using direct assignment also

 

restart;

interface(typesetting=extended):

z:=int(exp(-int(b(t),t))*t^4*csc(t)^2,t);

Error, (in Risch:-Norman) too many levels of recursion

` `

Error, unexpected result from Typesetting

Download extended_interface_causes_internal_bug_dec_13_2024.mw

ps. also reported to Maple support

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