Question: two solutions, exactly the same, one hangs and the other does not

I gave up trying to figure out why Maple sometimes generates solutions from my code that look different, running the same exact code. I know Maple is not deterministic and this can happen sometimes for reasons I will never know.

The following two solutions are the same, it just sometimes Maple shuffles terms a little around. For example SQRT(6) comes out SQRT(2)*SQRT(3).  I have no idea why this happens. It could be how memory inside Maple happened to be at the time and what happened before.

But my question is the following. Here is one ode, and two solutions that are exactly the same. I called one good_sol and one bad_sol.

If I do simplify(bad_sol - good_sol) I get  0 = 0 but here is the problem. When calling odetest on the good_sol, Maple returns 0 instantly,  But on the bad_sol it just hangs.

Even though the two solution are exactly the same. i.e. Mathematically the same.  

I'd like to know why does this happen? And if there is a permanent fix I could always use.

The following worksheet shows this problem.

After much trial and error, I found that if I do radnormal(bad_sol) then now odetest returns zero right away and the hang is gone!

I am just trying to understand why. And why odetest then itself does not use radnormal if this makes it work better?

Do I need to call randormal on every solution before calling odetest then? Will calling randormal on the final solution have any bad side effects on other computation after that?  It should not I would think.

This is all done in code without looking at the screen and having to decide. So I would need a solution that will work for all cases. But for now, I will change my code and add randormal to all solutions and see what happens.

Using 2024.1 on windows.   May be Maple behaves different on macOS, I do not know.

interface(version);

`Standard Worksheet Interface, Maple 2024.1, Windows 10, June 25 2024 Build ID 1835466`

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1767 and is the same as the version installed in this computer, created 2024, June 28, 12:19 hours Pacific Time.`

restart;

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

4*x*(diff(y(x), x))^2-3*y(x)*(diff(y(x), x))+3 = 0

bad_sol:=ln(x) - c__1 - 1/2*ln((y(x)^2 - 6*x)/x) - 3*ln((sqrt(3)*y(x) + sqrt((3*y(x)^2 - 16*x)/x)*sqrt(x))/sqrt(x)) + 1/2*arctanh(1/2*(-16*sqrt(x) + 3*y(x)*sqrt(2)*sqrt(3))*sqrt(2)/(sqrt((3*y(x)^2 - 16*x)/x)*sqrt(x))) + 1/2*arctanh(1/2*(16*sqrt(x) + 3*y(x)*sqrt(2)*sqrt(3))*sqrt(2)/(sqrt((3*y(x)^2 - 16*x)/x)*sqrt(x))) = 0;

ln(x)-c__1-(1/2)*ln((y(x)^2-6*x)/x)-3*ln((3^(1/2)*y(x)+((3*y(x)^2-16*x)/x)^(1/2)*x^(1/2))/x^(1/2))+(1/2)*arctanh((1/2)*(-16*x^(1/2)+3*y(x)*2^(1/2)*3^(1/2))*2^(1/2)/(((3*y(x)^2-16*x)/x)^(1/2)*x^(1/2)))+(1/2)*arctanh((1/2)*(16*x^(1/2)+3*y(x)*2^(1/2)*3^(1/2))*2^(1/2)/(((3*y(x)^2-16*x)/x)^(1/2)*x^(1/2))) = 0

good_sol:=ln(x) - c__1 - 1/2*ln((y(x)^2 - 6*x)/x) - 3*ln((sqrt(3)*y(x) + sqrt(x)*sqrt((3*y(x)^2 - 16*x)/x))/sqrt(x)) + 1/12*sqrt(3)*sqrt(6)*sqrt(2)*arctanh(1/2*(-16*sqrt(x) + 3*y(x)*sqrt(6))*sqrt(2)/(sqrt(x)*sqrt((3*y(x)^2 - 16*x)/x))) + 1/12*sqrt(3)*arctanh(1/2*(16*sqrt(x) + 3*y(x)*sqrt(6))*sqrt(2)/(sqrt(x)*sqrt((3*y(x)^2 - 16*x)/x)))*sqrt(6)*sqrt(2) = 0;
 

ln(x)-c__1-(1/2)*ln((y(x)^2-6*x)/x)-3*ln((3^(1/2)*y(x)+((3*y(x)^2-16*x)/x)^(1/2)*x^(1/2))/x^(1/2))+(1/12)*3^(1/2)*6^(1/2)*2^(1/2)*arctanh((1/2)*(-16*x^(1/2)+3*y(x)*6^(1/2))*2^(1/2)/(((3*y(x)^2-16*x)/x)^(1/2)*x^(1/2)))+(1/12)*3^(1/2)*arctanh((1/2)*(16*x^(1/2)+3*y(x)*6^(1/2))*2^(1/2)/(((3*y(x)^2-16*x)/x)^(1/2)*x^(1/2)))*6^(1/2)*2^(1/2) = 0

simplify(bad_sol-good_sol)

0 = 0

odetest(good_sol,ode); #instant answer

0

odetest(bad_sol,ode); #hangs

Warning,  computation interrupted

 

radnormal(bad_sol)

ln(x)-c__1-(1/2)*ln((y(x)^2-6*x)/x)-3*ln((y(x)*x^(1/2)*3^(1/2)+x*(-(-3*y(x)^2+16*x)/x)^(1/2))/x)+(1/2)*arctanh((-(-3*y(x)^2+16*x)/x)^(1/2)*(3*y(x)*x^(1/2)*3^(1/2)-8*2^(1/2)*x)/(3*y(x)^2-16*x))+(1/2)*arctanh((-(-3*y(x)^2+16*x)/x)^(1/2)*(3*y(x)*x^(1/2)*3^(1/2)+8*2^(1/2)*x)/(3*y(x)^2-16*x)) = 0

odetest(%,ode); #instant answer

0

 


 

Download why_same_sol_hangs_july_7_2024.mw

 

Please Wait...