I have an action $S$,
$$S = \int dx \frac{1}{z^d} \sqrt{1 + \frac{z'(x)^2}{f(z)}}$$
where the Lagrangian $L$ is,
$$L = \frac{1}{z^d} \sqrt{1 + \frac{z'(x)^2}{f(z)}}$$
I want to plot $z(x)$ and solve the value of $S$, however, I encountered some error. The equations of motion (EOM) are nonlinear and I know they can be solved using some numerical approximation techniques, actually, this post is related to (275496) where @AlexTrounev used the wavelet approach. The Lagrangian there is much more complicated than what is here, however, I found that they produced similar errors using NDSolve.
Actually, the Lagrangian here has a conserved quantity which allowed me to simplify $S$ by hand and solve it with the help of Mathematica. The reason I'm posting this is that I'm hoping that NDSolve can fully solve the EOM without resorting to conservation quantities since the Lagrangian is much simpler but that didn't work. I want to know if it is an NDSolve issue where it cannot find the correct technique (thus needing the wavelet approach) or an equation issue.
I want to emphasize that I really want to know what part of the equation is causing the issue (which was not cleared in the other post) so that I can understand it better.
The plot of $z(x)$ should have the form shown in a sample below (disregarding the scale/values on the axes),
Needs["VariationalMethods`"]
f = 1 - (z[x]/zh)^(d + 1);
L = Sqrt[1 + (z'[x]^2/f)]/z[x]^d;
eqeuler = EulerEquations[L, z[x], x];
wp = 20;
equations = SetPrecision[{eqeuler /. {d -> 3, zh -> 10}, z[10^-5] == 10^-5, z'[10] == 0}, wp];
eq = equations[[1]];
bc1 = equations[[2]];
bc2 = equations[[3]];
sols = NDSolve[{eq, bc1, bc2}, z, {x, 10^-5, 10}, Method -> "StiffnessSwitching", WorkingPrecision -> wp]
Power::infy: Infinite expression 1/0^3 encountered.
Power::infy: Infinite expression 1/0^4 encountered.
Infinity::indet: Indeterminate expression 0 ComplexInfinity encountered.
Power::infy: Infinite expression 1/0^3 encountered.
General::stop: Further output of Power::infy will be suppressed during this calculation.
Infinity::indet: Indeterminate expression 0 ComplexInfinity encountered.
Infinity::indet: Indeterminate expression 0 ComplexInfinity ComplexInfinity encountered.
General::stop: Further output of Infinity::indet will be suppressed during this calculation.
NDSolve::ndnum: Encountered non-numerical value for a derivative at x == 1.`20.*^-5.
Plot[Evaluate[z[x] /. sols], {x, 10^-5, 10}, AspectRatio -> 3/4, Frame -> True, FrameLabel -> {"x", "z"}, PlotStyle -> {Blue, 24}, LabelStyle -> {Black, 20}, PlotRange -> Full, ImageSize -> Large, AspectRatio -> 3/4]
Update
I have tried the shooting method as advised in the posts (237117) (72725), however, I still encounter problems like step size is effectively zero; singularity or stiff system suspected. I'm not sure if shooting method is the best way.


z'[10] == 0toz'[10^-5] == 0so that now both initial conditions are at same point, then this error goes away. (but you still getNDSolve::ndsz: At x == 0.000014311849291849864, step size is effectively zero; singularity or stiff system suspected.this tells me the problem is because you have initial conditions at different points? – Nasser Nov 11 '22 at 17:20NDSolvecannot solve it as is, and maybe some sort of boundary value problem techniques are required? – mathemania Nov 11 '22 at 18:07y[ti] == y0in that post withz'[x0] == zp0in here whereFindRoot[zpf[zp0] == 0, {zp0, 10^5, 10^15}, MaxIterations -> 1000]but it gave me some errors aboutInterpolationFunctionandFindRoot. Actually, I'm not sure if the range{zp0, 10^5, 10^15}is a good guess since the only thing I know is that at the initial pointz[x]shoots up quickly as seen in the image I posted. – mathemania Nov 12 '22 at 08:14NDSolveand improper execution of shooting method (or other variants). The post here is the simpler version of the post where the wavelet method was used. – mathemania Nov 13 '22 at 05:59