I am new to solving numerically ODES and thus it is difficult for me to judge the reliability/trustworthiness of the results that I have produced for the following problem:

I am dealing with a 2nd order ODE (I can add a non-linear term to it, too) on the interval $[0,1]$ with regular singularity at $0$ and $1$. I converted the ODE into a 1st order one and interpreted it as a IVP by setting an initial condition at $x=1$ motivated by symmetry arguments and let ODE45 integrate from $x=1$ to $x=0$. In this way I can produce solutions which is nice.

But here comes the problem: I have to use these solutions later on, e.g., I can also compute the $L^2$-norm of the solutions on the interval $[0,1]$ with respect to some measure and what I get as a result seems to depend sensitively on

(1.) the cut-off at $x=0$ (I let ODE45 run until "eps", the machine precision but I could also take smaller and bigger values)

(2.) the smallness of AbsTol and RelTol (both around eps)

(3.) the tspan size, i.e., the number of slices into which I cut the interval, like $10^6$.

Depending on how I vary the values in (1.)-(3.) I get results which differ from one another and not to a small extent. I believe that the code is correctly implemented, rather I guess the problem comes from the regular singularity which leads me to the question how trustworthy ODE45 is for such a problem. Does anybody have experiences with such a problem and can recommend what I could do to get more reliable results? Thanks!


The equation reads $2x~(1-x)~f''(x)+(3-4x)~f'(x)+a~f(x)+b~f^n(x)=0;~~ a,b\in\mathbb{R}, n\in\mathbb{N}.$

"not to a small extent" means a change in the result for the normalization from e.g $10^{-2}$ to $10^{20}$ if I solve until $x=eps*100$ vs. $x=eps$.

  • 1
    $\begingroup$ The solution should certainly depend on those factors. Since "not to a small extent" is a very vague phrase, you'll need to give more detail. It may also help to give the equation you're solving. $\endgroup$ – David Ketcheson Nov 1 '15 at 4:31
  • 1
    $\begingroup$ I don't know if ODE45 is intended to work for problems with singularities. You might look at the discussion near the beginning of Section 7 of this paper, and the references given there. $\endgroup$ – David Ketcheson Nov 2 '15 at 6:20
  • $\begingroup$ Thank you very much @DavidKetcheson. I also thought about trying asc.tuwien.ac.at/~ewa/PDF_Files/sbvp_doc.pdf. Have you come across that? $\endgroup$ – Hamurabi Nov 2 '15 at 11:09
  • 1
    $\begingroup$ It seems like sbvp is exactly what you need. $\endgroup$ – David Ketcheson Nov 3 '15 at 6:44
  • $\begingroup$ Alright. I will try to implement this one. Im curious how the results might differ and will post that here then. $\endgroup$ – Hamurabi Nov 3 '15 at 15:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.