Another approach to finding an InitialSeeding for Troesch's equation
is the Principle of Least Action, by considering the equation to be an
equation of motion.
A Lagrangian can be constructed with its equation of motion being
Troesch's equation.
In[1]:= Needs["VariationalMethods`"]
In[2]:= EulerEquations[1/2 x'[t]^2 + Cosh[5 x[t]], x[t], t]
Out[2]= 5 Sinh[5 x[t]] - (x^\[Prime]\[Prime])[t] == 0
The solution to the boundary value equation of motion can be constructed
by minimizing the Action, which is the integral of the Lagrangian
over the time period. The Lagrangian is the kinetic energy minus
the potential energy. The two terms can be discretized, using a finite
difference approximation for the time derivative.
Discretized variables with bounds:
In[3]:= vwb = Table[{x[t], -1, 2}, {t, 0, 1, 1/20}];
Discretized approximation to integral of kinetic energy
In[4]:= sumKE = 1/20*1/
2 Sum[((x[t + 1/40] - x[t - 1/40])/(1/20))^2, {t, 1/40, 39/40, 1/20}] //
Expand;
Discretized approximation to the integral of the potential energy
In[5]:= sumPE = - (1/21) Sum[Cosh[5 x[t]], {t, 0, 1, 1/20}];
Minimize the discretized approximation to the Action
In[6]:= AbsoluteTiming[nmsln = NMinimize[{sumKE - sumPE, x[0] == 0, x[1] == 1}, vwb];]
Out[6]= {0.123725, Null}
Construct an interpolation function from the solution
In[7]:= int = Interpolation[Table[{t, x[t]}, {t, 0, 1, 1/20}] /. nmsln[[2]]];
Find the derivative at t = 0
In[8]:= int'[0]
Out[8]= 0.0523738
Use the derivative as an Initial Seeding
In[9]:= AbsoluteTiming[
nsln = NDSolve[{5 Sinh[5 x[t]] - (x^\[Prime]\[Prime])[t] == 0, x[0] == 0,
x[1] == 1}, x, t, InitialSeeding -> {x'[0] == 0.0523}]];
Plot the result
