# Numerically solve 2nd order differential equations:

I'm trying to solve these two coupled 2nd order differential equations, but I'm getting nowhere. Mathematica can't seem to solve these no matter what I do. The equations are:

$m(v)=\frac{1}{2}&space;(\tanh(3v)+1)&space;\\&space;\frac{r(x)^4}{r_{*}^{2}}=&space;r(x)^2&space;+&space;2r'(x)v'(x)-(r(x)^2-m(v))v'(x)^2&space;\\&space;r(x)^2&space;-&space;r(x)^2v'(x)^2&space;-&space;r(x)v''(x)&space;+&space;2&space;r'(x)v'(x)=0$

The $$r_{*}$$ is the value of the $$r$$ at midpoint and I have the mentioned boundary value conditions:

$r(0)=r(l)=\infty&space;,\;\;\;&space;v(0)=v(l)=t$

and also I have the following symmetry along the $$x$$ axis where at the midpoint I have $$r'(x)=v(x)=0$$. I tried to solve these equations with NDsolve for the following boundary conditions but I had no luck:

m = 1/2 (Tanh[v[x]/(1/3)] + 1);
NDSolve[{r[x]^4/1.1^2 - r[x]^2 -
2 r'[x] v'[x] + (r[x]^2 - m) v'[x]^2 == 0,
r[x]^2 - r[x]^2 v'[x]^2 - r[x] v''[x] + 2 r'[x] v'[x] == 0,
r[1] == 100000, v[1] == 4, v[2] == 4}, {r, v}, {x, 1, 2},
MaxSteps -> Infinity]


I have set $$t=0$$ and used 10000 instead of $$\infty$$. but unfortunately, I get the following error mesages:

Power::infy: Infinite expression 1/0. encountered.
Infinity::indet: Indeterminate expression 0. ComplexInfinity encountered.
General::stop: Further output of Power::infy will be suppressed during this calculation.
NDSolve::ndnum: Encountered non-numerical value for a derivative at x == 1.


I would very much appreciate any help

• You are giving initial conditions in different points, also different from the starting value of x. Jun 27, 2021 at 10:09

This can be solved with the ShootingMethod To give you an idea of how this works, one needs to find the boundary condition that satisfies v[4]==1. So, this is an illustration of guessing:

rv = ParametricNDSolveValue[{r[x]^4/(11/10)^2 - r[x]^2 -
2 r'[x] v'[x] + (r[x]^2 - m) v'[x]^2 == 0,
r[x]^2 - r[x]^2 v'[x]^2 - r[x] v''[x] + 2 r'[x] v'[x] == 0,
r[1] == 1, v[1] == 4, v'[1] == guess}, {r, v}, {x, 1, 5}, guess,
MaxSteps -> Infinity]

Needs["DifferentialEquationsInterpolatingFunctionAnatomy"];

Manipulate[
DynamicModule[{traj, t0, t1},
traj = rv[guess];
{{t0, t1}} = First[InterpolatingFunctionDomain /@ traj];
ParametricPlot[
Through[traj[t]], {t, t0, t1}, AspectRatio -> 1
]
],
{{guess, 1}, -10, 10}
]
`

So, you want to get close (there may be multiple solutions as illustrated in the link) and then use the Shooting method as described there.