V 13.1 introduced the option IncludeSingularSolutions
When trying it, so far I have found over 250 ode's which hangs when using this option. First and second order. At the bottom I've put a link to plain .m file that contains list of ode's that hang and also link to a more complete notebook that shows more examples.
I do not mean DSolve
just takes longer time now to finish, but I mean really hangs. I've waited for more than one hr on some and DSolve
was still running.
Without this option, DSolve
would otherwise finish almost instantly.
My question is: Is there an option to set a timelimit on finding the Singular solution, so that if it can't find it within this time, to simply ignore this option? Similar to
"IntegrateOptions" /. SystemOptions[]
Where one can set a timelimit on some options so not to cause the whole command to hang or take more time than wanted.
And why it seem to always hang when the solution of the ode has ProductLog
in it. But I have found cases where it also hang when the solution has no ProductLog
but these are much less common.
This is unfortunate, since now it means one has to try this option not knowing in advanced if the long time being taken and the reason for the timeout and failure of DSolve
is because it could not find the singular solution and not because it could not find the general solution (which it can find). This option should be able to quickly decide if there is singular solution or not and not hang trying to find it.
Here is an example
ode=y'[x]==(1+x+y[x])^(1/2);
sol=AbsoluteTiming[TimeConstrained[DSolve[ode,y[x],x,IncludeSingularSolutions->False],60]];
Print["time used ",sol[[1]],"\nsolution =",sol[[2]]];
sol=AbsoluteTiming[TimeConstrained[DSolve[ode,y[x],x,IncludeSingularSolutions->True],60]];
Print["time used ",sol[[1]],"\nsolution =",sol[[2]]];
Here is another
ode=-(a*(-y[x]+x*y'[x])^r)+y''[x]==0;
sol=AbsoluteTiming[TimeConstrained[DSolve[ode,y[x],x,IncludeSingularSolutions->False],60]];
Print["time used ",sol[[1]],"\nsolution =",sol[[2]]];
sol=AbsoluteTiming[TimeConstrained[DSolve[ode,y[x],x,IncludeSingularSolutions->True],60]];
Print["time used ",sol[[1]],"\nsolution =",sol[[2]]];
Here is another
ode = (y[x] + 3*x - 1)^2*y'[x] - (2*y[x] - 1)*(4*y[x] + 6*x - 3) ==
0;
sol = AbsoluteTiming[
TimeConstrained[
DSolve[ode, y[x], x, IncludeSingularSolutions -> False], 60]];
Print["time used ", sol[[1]], "\nsolution =", sol[[2]]];
sol = AbsoluteTiming[
TimeConstrained[
DSolve[ode, y[x], x, IncludeSingularSolutions -> True], 60]];
Print["time used ", sol[[1]], "\nsolution =", sol[[2]]];
Links
m file that contains list of odes
DSolve[y'[x] == Sqrt[1 + x + y[x]], y, x]
produces a wrong solution{{y -> Function[{x}, -x + 2 ProductLog[-E^(-(3/2) - x/2 - C[1]/2)] + ProductLog[-E^(-(3/2) - x/2 - C[1]/2)]^2]}}
in view ofy'[x] == Sqrt[1 + x + y[x]] /. %;% /. {C[1] -> 1, x -> 1}
which results in{False}
. $\endgroup$ProductLog[z]
byProductLog[k, z]
in the solution toy'[x] == Sqrt[1 + x + y[x]]
, as hinted at by the warning fromSolve
, one finds domains over which the altered solution is valid fork
a nonzero integer. Fork == 0
, the solution seems to satisfy the ode only atx - C[1] - 1 == 0
(in the complex plane), which is not much of a solution. $\endgroup$