Question: PDEtools:-Solve vs. solve. RootOf form difference.

I was trying to find out why my solution was not validating for this ode. It turned out because I was using solve instead of PDEtools:-Solve. It took me sometime to find this.

This made huge difference on odetest to verify the solution.

This is very simple ode. We just need to integrate once. But first we have to solve for y'(x). 

And here comes the difference. When I used solve to solve for y'(x), odetest did not verify the solution.

When using PDEtools:-Solve, it did.

The difference is how each returned the solution for y'(x). Both have RootOf but written differently and this made the difference.

1) Why solutions are written differently? 

2) Is this to be expected? I have thought Solve uses same engine as solve below the cover.

3) is it possible to make solve give the same form as Solve or change to that form?

I am now changing more of my code to use PDEtools:-Solve because of this.

27860

interface(version);

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

Physics:-Version();

`The "Physics Updates" version in the MapleCloud is 1757. The version installed in this computer is 1756 created 2024, June 5, 19:39 hours Pacific Time, found in the directory C:\Users\Owner\maple\toolbox\2024\Physics Updates\lib\`

Using solve

 

restart;

27860

ode:=x-ln(diff(y(x),x))-sin(diff(y(x),x))=0;
RHS:=solve(ode,diff(y(x),x));

x-ln(diff(y(x), x))-sin(diff(y(x), x)) = 0

RootOf(_Z-exp(-sin(_Z)+x))

mysol:= y(x) = Int(RHS,x)+c__1;

y(x) = Int(RootOf(_Z-exp(-sin(_Z)+x)), x)+c__1

odetest(mysol,ode);

-ln(RootOf(_Z-exp(-sin(_Z)+x)))+x-sin(RootOf(_Z-exp(-sin(_Z)+x)))

using PDEtools:-Solve (now it verifies) with no extra effort

 

restart;

27860

ode:=x-ln(diff(y(x),x))-sin(diff(y(x),x))=0;
RHS:=PDEtools:-Solve(ode,diff(y(x),x)):
RHS:=rhs(%);

x-ln(diff(y(x), x))-sin(diff(y(x), x)) = 0

RootOf(-x+ln(_Z)+sin(_Z))

mysol:= y(x) = Int(RHS,x)+c__1;

y(x) = Int(RootOf(-x+ln(_Z)+sin(_Z)), x)+c__1

odetest(mysol,ode);

0

 

 

Download PDEtools_Solve_vs_solve_june_8_2024.mw

 

Update

Here is a counter example. Where now it is the other way around.

Using solve makes odetest happy, but when using PDEtools:-Solve odetest does not verify the solution.  Same exact ODE.   


 

28652

interface(version);

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

Physics:-Version()

`The "Physics Updates" version in the MapleCloud is 1757 and is the same as the version installed in this computer, created 2024, June 6, 14:53 hours Pacific Time.`

Example, using solve works

 

ode:=exp(diff(y(x), x) - y(x)) - diff(y(x), x)^2 + 1 = 0;
RHS:=solve(ode,diff(y(x),x));
RHS:=eval(RHS,y(x)=y);
mysol:=Intat(eval(1/RHS,y=_a),_a=y(x))=x+c__1;
odetest(mysol,ode);

exp(diff(y(x), x)-y(x))-(diff(y(x), x))^2+1 = 0

Warning, solutions may have been lost

RootOf(-exp(_Z-y(x))+_Z^2-1)

RootOf(-exp(_Z-y)+_Z^2-1)

Intat(1/RootOf(-exp(_Z-_a)+_Z^2-1), _a = y(x)) = x+c__1

0

Example, using PDEtools:-Solve fails

 

ode:=exp(diff(y(x), x) - y(x)) - diff(y(x), x)^2 + 1 = 0;
RHS:=rhs(PDEtools:-Solve(ode,diff(y(x),x)));
RHS:=eval(RHS,y(x)=y);
mysol:=Intat(eval(1/RHS,y=_a),_a=y(x))=x+c__1;
odetest(mysol,ode);

exp(diff(y(x), x)-y(x))-(diff(y(x), x))^2+1 = 0

RootOf(_Z^2*exp(y(x))-exp(_Z)-exp(y(x)))

RootOf(_Z^2*exp(y)-exp(_Z)-exp(y))

Intat(1/RootOf(_Z^2*exp(_a)-exp(_Z)-exp(_a)), _a = y(x)) = x+c__1

exp(RootOf(_Z^2*exp(y(x))-exp(_Z)-exp(y(x)))-y(x))-RootOf(_Z^2*exp(y(x))-exp(_Z)-exp(y(x)))^2+1

 


 

Download PDEtools_Solve_vs_solve_june_9_2024.mw

So now I have no idea which to use. Sometimes solve works and sometimes Solve works. I  guess I have to now solve the ode both ways each time and see which works.

 

Please Wait...