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

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

Maple 2024

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.

 > interface(version);

 > Physics:-Version();

Using solve

 > restart;

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

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

 > odetest(mysol,ode);

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

 > restart;

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

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

 > odetest(mysol,ode);

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.

 > interface(version);

 > Physics:-Version()

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);

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);

 >

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.

﻿