About two weeks ago I've posted the following question on MathOverflow:
Solving a boundary value problem numerically, with high precision.
That is, the ODE is \begin{equation} y''=y^2-t \tag{1} \end{equation} and we're looking for the two slopes $\alpha_1,\alpha_2$ such that the solutions $y_i$ with the initial conditions \begin{align} y_i(0)&=0 \\y_i'(0)&=\alpha_i \quad i=1,2 \end{align} are asymptotic to $\sqrt{t}$ as $t \to +\infty$.
I've been trying to attack it myself for quite some time, and here's what I came up with:
Using the quadratic Taylor approximation based at a point $t_i$ we get \begin{align} y(t_{i+1}) & \approx y(t_i)+y'(t_i)(t_{i+1}-t_i)+\frac{y''(t_i)}{2}(t_{i+1}-t_i)^2\\ &=y(t_i)+y'(t_i)(t_{i+1}-t_i)+\frac{y^2(t_i)-t_i}{2}(t_{i+1}-t_i)^2 \end{align} where I have used the ODE $(1)$ to reduce the final coefficient. Similarly one gets an approximation for the slope: \begin{align} y'(t_{i+1})& \approx y'(t_i)+y''(t_i)(t_{i+1}-t_i)\\ &=y'(t_i)+\left(y^2(t_i)-t_i \right)(t_{i+1}-t_i) \end{align}
In Mathematica, I've implemented this "time step" as follows (The Clip
command is used to avoid overflow)
QuadraticTaylor[{y_, p_, t_, dt_}] := {Clip[y + p dt + 1/2 (y^2 - t) dt^2, {-4, 4}],
p + (y^2 - t) dt, t + dt, dt};
Then after trying out different slopes I using the method in the interval $[0,10]$ with $N=10^5$ subintervals and $\alpha=0.92437$ results in a blowup. That is, the code
With[{Parabola = ContourPlot[x == y^2, {x, 0, 10}, {y, -5, 5},ContourStyle->Black]},
Manipulate[T = NestList[QuadraticTaylor, {0, \[Alpha], 0, 10/N}, N];
Show[Parabola,
ListPlot[Map[{#[[3]], #[[1]]} &, T]]], {{\[Alpha], 0.92437`}, -10,
10}, {{dt, 0.1}, 0, 1}, {{N, 10000}, 1, 1000000, 1}]]
produced the following plot
while using $\alpha=0.92436$ resulted in an undershoot.
Thus, I thought that one of the critical slopes lies in the interval $[0.92436,0.92437]$. However, using a higher degree Taylor approximation (which I could only do with fewer subintervals, since the evaluations are computationally more expensive), it looks like the interval is actually $$[0.92437548,0.92437549] .$$
Here I'm at a point in which I'm not sure what is the optimal tradeoff between the degree of the Taylor approximation, and the number of subintervals $N$. Moreover, these calculations take a pretty long time (over a minute) for $N>10^6$.
I'd love to hear your thoughts on my attempt, also, if you know a better way to do this please let me know! I'd like to get at least 16 decimal digits on both of the $\alpha$s (my attempt only discusses the positive $\alpha$). Thank you!
P.S. I've also tried using NDSolve to do this, but I'm not sure on how to tweak the settings to best fit my problem. Using default settings seems to get the 7th digit wrong.