I am trying to evaluate the following ODE numerically:
NDSolve[(2 + Sqrt[2] +s^2 -(-2 + Sqrt[2]) s^4 + s^6) /(1 + s^2)^2 yy[s] -(1 - s^2)^2 yy''[s] == 0 &&
yy[-1] == 0 && yy'[-1] == 1, yy[s], {s, -1, 1}]
and I surprisingly get the following error:
Power::infy: "Infinite expression 1/0.^2 encountered."
Infinity::indet: "Indeterminate expression 0.\ ComplexInfinity encountered."
NDSolve::ndnum: "Encountered non-numerical value for a derivative at s == -1.`."
One can verify directly that no infinities should appear at s=-1
:
D[(2 + Sqrt[2] + s^2 - (-2 + Sqrt[2]) s^4 + s^6)/(1 + s^2)^2, s] /. s -> -1
gives: 3 + 1/4 (-8 + 4 (-2 + Sqrt[2]))
But apparently, the ODE solver automatically divides by the factor in front of the yy''[s]
term before computation. in this case we indeed find a singular
D[-(2 + Sqrt[2] + s^2 - (-2 + Sqrt[2]) s^4 + s^6)/((1 + s^2)^2 (1 - s^2)^2), s] /. s -> -1
Clearly, if one does not divide by the factor of the kinetic term, the ODE is well defined on the whole interval including the boundaries. Why does the solver divide? What can I do to prevent this? Or maybe there is some workaround?
yy''[s]
ats == -1
, since the coefficient vanishes. (At a naive level, it cannot then approximate the next value ofyy'[s]
fors
a little greater than-1
, etc.) What is being detected is thats == -1
is a singular point, and there are infinitely many solutions to this IVP (one for each value ofyy''[-1]
you care to assign). $\endgroup$eps=10^-14
as a summand to the factor in front ofyy''[s]
. Are these any good? $\endgroup$y[1]
$\endgroup$y[s]
,y'[s]
ats == 0
or some other point? Or is knowing thaty
approaches infinity ats == 1
enough? $\endgroup$