nm

11353 Reputation

20 Badges

13 years, 8 days

MaplePrimes Activity


These are questions asked by nm

For some reason, I get dozens of ode's that fail to odetest when using method='laplace' with dsolve.

Yet, all the solutions are correct. These are from textbooks.

I tried giving odetest assumptions but nothing worked so far. So I am thinking of just ignoring result of odetest when laplace method is used and to assume it is correct each time. Otherwise, I will get false negative all the time on these.

Thought to ask if someone knows why this happens and if there is some universal trick to use when calling odetest on such solutions.

Here is worksheet with few examples where odetest do not verify the solutions (even though they are "correct", when solving these ode's by hand). 

May be if odetest was told that the solution was generated using method='laplace' it will help it, but there is no such option (as in the case with 'series' option). 

Btw, if method='laplace' is not used on these examples, then odetest have no problem verifying the solutions and gives zero on all of them.

interface(version);

`Standard Worksheet Interface, Maple 2025.0, Linux, March 24 2025 Build ID 1909157`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1873 and is the same as the version installed in this computer, created 2025, May 18, 21:44 hours Pacific Time.`

SupportTools:-Version();

`The Customer Support Updates version in the MapleCloud is 21 and is the same as the version installed in this computer, created May 28, 2025, 23:36 hours Eastern Time.`

restart;

ode:=diff(x(t),t$2)+4*diff(x(t),t)+13*x(t) = f(t):
ic:=x(0) = 0, D(x)(0) = 0:
sol:=dsolve([ode,ic],x(t),method='laplace');
odetest(sol,[ode,ic]);

x(t) = (1/3)*(int(f(_U1)*exp(-2*t+2*_U1)*sin(3*t-3*_U1), _U1 = 0 .. t))

[-(1/6)*(-(26*I)*(Int(f(_U1)*sinh(-(3*I)*t+(3*I)*_U1)*exp(2*_U1+(3*I)*t), _U1 = 0 .. t))-(13*I)*exp((6*I)*t)*(Int(exp((2-3*I)*_U1)*f(_U1), _U1 = 0 .. t))+(13*I)*(Int(exp((2-3*I)*_U1)*f(_U1)*exp((6*I)*_U1), _U1 = 0 .. t)))*exp((-2-3*I)*t), 0, 0]

ode:=diff(diff(x(t),t),t)+4*x(t) = Dirac(t)+Dirac(t-Pi):
ic:=x(0) = 0, D(x)(0) = 0:
sol:=dsolve([ode,ic],x(t),method='laplace');

odetest(sol,[ode,ic]);

x(t) = (1/2)*sin(2*t)*(1+Heaviside(t-Pi))

[-Dirac(t), 0, -1]

ode:=diff(diff(x(t),t),t)+4*x(t) = Dirac(t):
ic:=x(0) = 0, D(x)(0) = 0:
sol:=dsolve([ode,ic],x(t),method='laplace'):
odetest(sol,[ode,ic]);

[-Dirac(t), 0, -1]

ode:=diff(diff(x(t),t),t)+4*diff(x(t),t)+8*x(t) = f(t):
ic:=x(0) = 0, D(x)(0) = 0:
sol:=dsolve([ode,ic],x(t),method='laplace'):
odetest(sol,[ode,ic]);

[-2*(-(2*I)*(Int(f(_U1)*sinh((2*I)*_U1-(2*I)*t)*exp(2*_U1+(2*I)*t), _U1 = 0 .. t))+2*(Int(f(_U1)*cosh((2*I)*_U1-(2*I)*t)*exp(2*_U1+(2*I)*t), _U1 = 0 .. t))+I*(Int(exp((2-2*I)*_U1)*exp((4*I)*_U1)*f(_U1), _U1 = 0 .. t))-I*exp((4*I)*t)*(Int(exp((2-2*I)*_U1)*f(_U1), _U1 = 0 .. t))-(Int(exp((2-2*I)*_U1)*exp((4*I)*_U1)*f(_U1), _U1 = 0 .. t))-exp((4*I)*t)*(Int(exp((2-2*I)*_U1)*f(_U1), _U1 = 0 .. t)))*exp((-2-2*I)*t), 0, 0]

 


 

Download how_to_odetest_laplace_solution_may_29_2025.mw

 

I've been debugging this for 20 hrs and finally able to make an example.

I noticed that solve() suddenly no longer works and times out.

First time calling solve() works. Second time it I see message

               Warning, solve may be ignoring assumptions on the input variables.

And it hangs.  Same exact code.   It has to do with calling odetest before and using Physics:-Setup('assumingusesAssume' = false):

i.e. this works
  
     odetest(...) assuming integer
     solve(....) #no hang
     odetest(....) assuming positive

     odetest(...)  assuming integer
     solve(....)  #no hang


But this does not work

     odetest(...) assuming integer
     solve(....) #no hang
     Physics:-Setup('assumingusesAssume' = false):
     odetest(....) assuming positive
     Physics:-Setup('assumingusesAssume' = true):

     odetest(...) assuming integer
     solve(...)   #HANGS
     

Here is worksheet showing the problem. If I remove first call to odetest, solve do not hang.

Also removing Physics:-Setup('assumingusesAssume' = false):, solve also works OK. (ie. does not hang)

So it has to do with some internal caching which causes solve to stop working.

Can others reproduce this and can cause it and how to fix it so solve do not hang second time?

The input used below is not important. It is just what I found to cause this. One would expect solve() to work same way for same input all the time.

Also, same problem happens when using PDEtools:-Solve instead of solve. It hangs second time.

interface(version);

`Standard Worksheet Interface, Maple 2025.0, Linux, March 24 2025 Build ID 1909157`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1873 and is the same as the version installed in this computer, created 2025, May 18, 21:44 hours Pacific Time.`

SupportTools:-Version();

`The Customer Support Updates version in the MapleCloud is 20 and is the same as the version installed in this computer, created May 23, 2025, 23:34 hours Eastern Time.`

restart

DEFINE input

 

ode:=y(x)*sqrt(1 + diff(y(x), x)^2) - a*y(x)*diff(y(x), x) - a*x = 0:
sol:=-_C4^2 + (-y(x)*sqrt(_C4^2/y(x)^2) + a*x)^2/a^2 + y(x)^2 = 0:
ode_to_test:=y(x)*(1+diff(y(x),x)^2)^(1/2)-a*y(x)*diff(y(x),x)-a*x = 0:

FIRST TIME solve works

 

    try
        timelimit(30,(odetest(sol,ode,y(x)) assuming integer));
    catch:
        NULL;
    end try:

    try
        timelimit(30,[solve(ode_to_test,diff(y(x),x))]);
        print("SOLVE worked");              
    catch:
        print("WHY TIMED OUT??");              
    end try:

    Physics:-Setup('assumingusesAssume' = false):
    try
        timelimit(30, (odetest(sol,ode,y(x)) assuming positive) );
    catch:
        NULL;
    end try:
    Physics:-Setup('assumingusesAssume' = true):

"SOLVE worked"

 

 

RUN SAME CODE AS ABOVE again, now it does not work

 

    try
        timelimit(30,(odetest(sol,ode,y(x)) assuming integer));
    catch:
        NULL;
    end try:

    try
        timelimit(30,[solve(ode_to_test,diff(y(x),x))]);
        print("SOLVE worked");              
    catch:
        print("WHY TIMED OUT??");              
    end try:

    Physics:-Setup('assumingusesAssume' = false):
    try
        timelimit(30, (odetest(sol,ode,y(x)) assuming positive) );
    catch:
        NULL;
    end try:
    Physics:-Setup('assumingusesAssume' = true):

Warning, solve may be ignoring assumptions on the input variables.

"WHY TIMED OUT??"

 

 

 

 

Download why_solve_stops_working_maple_2025_may_28_2025.mw

This worksheet below shows that by removing Physics:-Setup('assumingusesAssume' = false): now solve works OK second time. (I turn on/off Physics:-Setup('assumingusesAssume' since I found sometimes it can help with odetest to turn it off in some other cases. But now I am scared of touching this setting as it seems to have side effects internally)

interface(version);

`Standard Worksheet Interface, Maple 2025.0, Linux, March 24 2025 Build ID 1909157`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1873 and is the same as the version installed in this computer, created 2025, May 18, 21:44 hours Pacific Time.`

SupportTools:-Version();

`The Customer Support Updates version in the MapleCloud is 20 and is the same as the version installed in this computer, created May 23, 2025, 23:34 hours Eastern Time.`

restart

DEFINE input

 

ode:=y(x)*sqrt(1 + diff(y(x), x)^2) - a*y(x)*diff(y(x), x) - a*x = 0:
sol:=-_C4^2 + (-y(x)*sqrt(_C4^2/y(x)^2) + a*x)^2/a^2 + y(x)^2 = 0:
ode_to_test:=y(x)*(1+diff(y(x),x)^2)^(1/2)-a*y(x)*diff(y(x),x)-a*x = 0:

FIRST TIME solve works

 

    try
        timelimit(30,(odetest(sol,ode,y(x)) assuming integer));
    catch:
        NULL;
    end try:

    try
        timelimit(30,[solve(ode_to_test,diff(y(x),x))]);
        print("SOLVE worked");              
    catch:
        print("WHY TIMED OUT??");              
    end try:

    try
        timelimit(30, (odetest(sol,ode,y(x)) assuming positive) );
    catch:
        NULL;
    end try:

"SOLVE worked"

 

 

RUN SAME CODE AS ABOVE again, now it does not work

 

    try
        timelimit(30,(odetest(sol,ode,y(x)) assuming integer));
    catch:
        NULL;
    end try:

    try
        timelimit(30,[solve(ode_to_test,diff(y(x),x))]);
        print("SOLVE worked");              
    catch:
        print("WHY TIMED OUT??");              
    end try:

    try
        timelimit(30, (odetest(sol,ode,y(x)) assuming positive) );
    catch:
        NULL;
    end try:

"SOLVE worked"

 

 

 

 

Download why_solve_stops_working_maple_2025_may_28_2025_V2.mw

Should maple have given solution to x as zero in the following?

solve(x^n=0,x)

What if n is zero? what if n is negative?  

Another program I tried this on gives

Maple 2025

Should solution to a first order ode with IC not have any constant of integration in it? This is what the teacher said at school.

But Maple in this example returns a solution to first order Riccati ode with c1 still in the solution even though it is given IC.

How is this possible? This is problem from Differential equations and their applications, 3rd ed., M. Braun, Section 1.10. Page 80, problem #5

If dsolve was not able to resolve c1 from IC for some reason, should it not have returned any solution in this case? 

btw, I could not verify the solution on the ode itself using odetest, but may be assumptions are needed. Will try and see...

restart;

interface(version);

`Standard Worksheet Interface, Maple 2025.0, Linux, March 24 2025 Build ID 1909157`

SupportTools:-Version();

`The Customer Support Updates version in the MapleCloud is 19 and is the same as the version installed in this computer, created May 21, 2025, 13:44 hours Eastern Time.`

Physics:-Version();

 

`The "Physics Updates" version in the MapleCloud is 1873 and is the same as the version installed in this computer, created 2025, May 18, 21:44 hours Pacific Time.`

restart;

libname;

"/home/me/maple/toolbox/2025/Physics Updates/lib", "/home/me/maple/toolbox/2025/Maple Customer Support Updates/lib", "/home/me/maple2025/lib"

ode:=diff(y(x),x)=1+y(x)+y(x)^2*cos(x);
IC:=y(0)=0;
maple_sol:=dsolve([ode,IC]);

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

y(0) = 0

y(x) = -(1/2)*csgn(sin((1/2)*x))*(MathieuS(-1, -2, arccos(cos((1/2)*x)))*csgn(sin((1/2)*x))*c__1+4*MathieuS(-1, -2, arccos(cos((1/2)*x)))*cos(x)*c__1-MathieuSPrime(-1, -2, arccos(cos((1/2)*x)))*csgn(sin((1/2)*x))*c__1-c__1*MathieuS(-1, -2, arccos(cos((1/2)*x)))+c__1*MathieuSPrime(-1, -2, arccos(cos((1/2)*x)))-MathieuCPrime(-1, -2, arccos(cos((1/2)*x)))*csgn(sin((1/2)*x))+MathieuC(-1, -2, arccos(cos((1/2)*x)))*csgn(sin((1/2)*x))+4*MathieuC(-1, -2, arccos(cos((1/2)*x)))*cos(x)+MathieuCPrime(-1, -2, arccos(cos((1/2)*x)))-MathieuC(-1, -2, arccos(cos((1/2)*x))))/((c__1*MathieuS(-1, -2, arccos(cos((1/2)*x)))-c__1*MathieuSPrime(-1, -2, arccos(cos((1/2)*x)))-MathieuCPrime(-1, -2, arccos(cos((1/2)*x)))+MathieuC(-1, -2, arccos(cos((1/2)*x))))*cos(x))

lprint(maple_sol);

y(x) = -1/2*csgn(sin(1/2*x))/(c__1*MathieuS(-1,-2,arccos(cos(1/2*x)))-c__1*
MathieuSPrime(-1,-2,arccos(cos(1/2*x)))-MathieuCPrime(-1,-2,arccos(cos(1/2*x)))
+MathieuC(-1,-2,arccos(cos(1/2*x))))*(MathieuS(-1,-2,arccos(cos(1/2*x)))*csgn(
sin(1/2*x))*c__1+4*MathieuS(-1,-2,arccos(cos(1/2*x)))*cos(x)*c__1-MathieuSPrime
(-1,-2,arccos(cos(1/2*x)))*csgn(sin(1/2*x))*c__1-c__1*MathieuS(-1,-2,arccos(cos
(1/2*x)))+c__1*MathieuSPrime(-1,-2,arccos(cos(1/2*x)))-MathieuCPrime(-1,-2,
arccos(cos(1/2*x)))*csgn(sin(1/2*x))+MathieuC(-1,-2,arccos(cos(1/2*x)))*csgn(
sin(1/2*x))+4*MathieuC(-1,-2,arccos(cos(1/2*x)))*cos(x)+MathieuCPrime(-1,-2,
arccos(cos(1/2*x)))-MathieuC(-1,-2,arccos(cos(1/2*x))))/cos(x)

 

 

Download why_c_in_solution_may_23_2025.mw

Update

Looked up the textbook, it says solution exist and unique over 0<=x<=1/3, using these now Maple verifies the ode itself, but does not verify the IC (because c__1 is there). Here is updated worksheet. The bottom line, I think the solution is wrong as it should not have any constant of integration in it. Textbook also does say what the solution should be.

restart;

interface(version);

`Standard Worksheet Interface, Maple 2025.0, Linux, March 24 2025 Build ID 1909157`

SupportTools:-Version();

`The Customer Support Updates version in the MapleCloud is 20. The version installed in this computer is 19 created May 21, 2025, 13:44 hours Eastern Time, found in the directory /home/me/maple/toolbox/2025/Maple Customer Support Updates/lib/Maple`

Physics:-Version();

 

`The "Physics Updates" version in the MapleCloud is 1873 and is the same as the version installed in this computer, created 2025, May 18, 21:44 hours Pacific Time.`

restart;

libname;

"/home/me/maple/toolbox/2025/Physics Updates/lib", "/home/me/maple/toolbox/2025/Maple Customer Support Updates/lib", "/home/me/maple2025/lib"

ode:=diff(y(x),x)=1+y(x)+y(x)^2*cos(x);
IC:=y(0)=0;
maple_sol:=dsolve([ode,IC]):
simplify(maple_sol) assuming x>=0 and x<=1/3;

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

y(0) = 0

y(x) = (2*c__1*MathieuS(-1, -2, (1/2)*x)+2*MathieuC(-1, -2, (1/2)*x))/(c__1*MathieuSPrime(-1, -2, (1/2)*x)-c__1*MathieuS(-1, -2, (1/2)*x)+MathieuCPrime(-1, -2, (1/2)*x)-MathieuC(-1, -2, (1/2)*x))

odetest(%,[ode,IC]);

[0, -2/(c__1-1)]

 

 

Download why_c_in_solution_may_23_2025_v2.mw

Same exact code. When adding Physics:-Setup(assumingusesAssume = true):  before, now pdsolve do not give solution.

Removing Physics:-Setup(assumingusesAssume = true): now it works.

Why? Should not solution be returned in both cases?

interface(version);

`Standard Worksheet Interface, Maple 2025.0, Linux, March 24 2025 Build ID 1909157`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1872 and is the same as the version installed in this computer, created 2025, May 17, 22:58 hours Pacific Time.`

SupportTools:-Version();

`The Customer Support Updates version in the MapleCloud is 17 and is the same as the version installed in this computer, created May 5, 2025, 12:37 hours Eastern Time.`

restart;

Example 1. Adding Physics:-Setup(assumingusesAssume = true): makes pdsolve fail

 

Physics:-Setup(assumingusesAssume = true):

pde := diff(u(r, t), t) = k*diff(u(r, t), r$2):
ic  := u(r,0)=r*f(r):
bc  := u(0,t)=0,u(a,t)=a*phi(t):
sol:= pdsolve({pde, ic, bc}, u(r, t));

 

 

Example 2. Same code but removing Physics:-Setup(assumingusesAssume = true): makes it work

 

restart;

pde := diff(u(r, t), t) = k*diff(u(r, t), r$2):
ic  := u(r,0)=r*f(r):
bc  := u(0,t)=0,u(a,t)=a*phi(t):
sol:= pdsolve({pde, ic, bc}, u(r, t));

u(r, t) = Sum(2*sin(n*Pi*r/a)*exp(-k*Pi^2*n^2*t/a^2)*(Int(r*(-phi(0)+f(r))*sin(n*Pi*r/a), r = 0 .. a))/a, n = 1 .. infinity)+Int(Sum(2*sin(n*Pi*r/a)*exp(-k*Pi^2*n^2*(t-tau)/a^2)*(diff(phi(tau), tau))*a*(-1)^n/(n*Pi), n = 1 .. infinity), tau = 0 .. t)+r*phi(t)

 


 

Download pdsolve_fail_when_adding_assuming.mw

1 2 3 4 5 6 7 Last Page 2 of 199