I just had enough with odetest hanging (even when using with timelimit). I wait hours and hours each time (even though I have 30 second timelimit, which Maple ignores) and I do not think Maplesoft is going to fix this in my lifetime.

So I am attempting to make my own very simple and basic odetest.

I give it an ode and **explicit** solution in for form **sol:= y(x)=...** and the function uses **algsubs(sol,ode)** and checks it is gets zero or not (it will also do simplify if needed)

But there is a BIG problem. Even though **algsubs(z=0,z/z);** gives back 1 as expected, but

restart;
ode:=diff(y(x), x)/y(x);
sol:=y(x)=0;
algsubs(sol,ode); #this gives ZERO. It should be 1

If we do algsubs on each term one by one

algsubs(sol,numer(ode));
algsubs(sol,denom(ode));
0
0

So why did algsubs give zero in the first case, since the result of the algsubs should be **0/0** which algsubs knows in the limit it is 1? How did it come up with zero?

Clearly my simple method of replacing odetest with algsubs is not working. I need a more robust way to handle this.

subs does not work. Since subs does not know how substitute **y(x)=f(x)** into derivatives involved in an ODE.

My question is: Is there a way to teach algsubs to give 1 for the above example? or better function to use?

I tried **applyrule** instead of algsubs, but that does not work.

applyrule(sol, ode)

Error, (in rec) numeric exception: division by zero

Is there a better method to use? I am trying to do simple version of odetest that does not hang. Even if not perfect. Will only use it for explicit solutions, not implicit since implicit is much harder.

Here is a more full example

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

** 0**

But when I use my simple method

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

**-1 = 0**

The reason it failed, because algsubs replaced the second term by 0 instead of 1. The second term in the ode is **diff(y(x),x)/y(x)**

Which is 0/0 but this is 1 in the limit. But algsubs used 0 instead for some reason.

So I need a little bit smarter way to replace my solution into the ode than just using algsubs. May need to use some of the tricks I've seen used here before using freez/thaw/frontend, etc.. which I still do not understand.

Any recommendation? This is meant to work for any single ode and any explicit solution of the form y(x)=....

This algsubs method works actually pretty well on many ode's. I've tested it on 2,000 ode's. It just fails so far on subtle ones like the above. Here is just random example where it works

restart;
ode:=diff(y(x),x)^2 = (-x+1)/x;
sol:=y(x)=_C1+arcsin(2*x-1)/2+sqrt(x-x^2);
evalb(simplify(algsubs(sol,ode)))

**true**

So I just need a way to handle the cases where it gives 0/0 I think. I have 20 ODE's which now fail out of about 2,000 using this basic method compared to using odetest.

Thank you