# Nonlinear first order equation with DSolve

I am trying to solve a geodesic equation on Mathematica and would like to get a precise result, using DSolve would be a good start for me. My problem is the following: I have a squared expression for my DE and manage to get a solution with NDSolve for my equation using the Method -> {"EquationSimplification" -> "Residual"} option but cannot find anything similar using DSolve. Is there a way to ask Mathematica to find an analytical solution for this? I think the problem comes from the fact that two solutions are possible with this equation: the one with r[x] increasing or the one with r[x] decreasing and then increasing again, I have solved this with the "r'[0] == -10" term with NDSolve.

Here is the code:

eqr = 0 == -(r'[x])^2 + En^2 - L^2*(1 - 2 mass/r[x])/r[x]^2
Rxn = NDSolve[{eqr, r[0] == 10000, r'[0] == -10, r'[0] == -10} /. {En -> 10, L -> 100,
mass -> 1}, r, {x, 0, 10000},
Method -> {"EquationSimplification" -> "Residual"}][[1, 1, 2]]
Rxa = DSolve[{eqr, r[0] == 10000} /. {En -> 10, L -> 100, mass -> 1}, r,
x]


The DSolve returns the error "DSolve::bvimp: General solution contains implicit solutions. In the boundary value problem, these solutions will be ignored, so some of the solutions will be lost"

• lots of errors running your code. what is eqr[x] = 0 ==.... supposed to be? Did you mean to define a function here? any way, V 12.1 gives errors running your NDSolve. Did not try the rest. Please make sure your code at least runs before posting it. Commented Apr 29, 2020 at 18:38
• Sorry about that, changed a bit my code for the post and didn't checked it twice, I edited the original code on the post.
– user72371
Commented Apr 29, 2020 at 22:30
• Your code still does not run. Please check the code you just updated in your notebook, and make sure you are using clean kernel to see the error. Commented Apr 29, 2020 at 22:37
• Forget the R0... It compiles now on V12!
– user72371
Commented Apr 29, 2020 at 22:41
• What is the surface where this curves are geodesics? Why are your equations of the first order, while geodesics are second order differential equations? I'm sure your question can be answered in a more satisfactory manner than that one below. Commented Apr 30, 2020 at 12:03

There is no explicit analytical solution only an implicit which can't be solved analytically for $$r(x)$$.

Clear["Global*"];
ode = -(r'[x])^2 + En^2 - L^2*(1 - 2 mass/r[x])/r[x]^2 == 0


First@DSolve[ode /. {En -> 10, L -> 100, mass -> 1}, r[x], x]


And Mathematica can't solve this for $$r(x)$$. Giving one BC shows this

 DSolve[{ode, r[0] == 10000}, r[x], x]
(* {} *)


DSolve::bvimp: General solution contains implicit solutions. In the boundary value problem, these solutions will be ignored, so some of the solutions will be lost.

Maple also gives an implicit solution, which is simpler, still the integral it gives can't be solved analytically

restart;
ode:= En^2- L^2*(1- (2*mass)/r(x))/r(x)^2 - diff(r(x),x)^2=0;
En:=10; L:=100; mass:=1;
ic:=r(0)=10000,D[1](r)(0)=-10;
sol:=dsolve([ode,ic],r(x));
DEtools:-remove_RootOf(sol)


$$-x+\int_{{\it \_b}}^{r \left( x \right) }\!-{\frac {{{\it \_a}}^{2}}{ 10}{\frac {1}{\sqrt {{\it \_a}\, \left( {{\it \_a}}^{3}-100\,{\it \_a} +200 \right) }}}}\,{\rm d}{\it \_a}+{\it \_C1}=0$$

Notice the upper limit is the solution. So it is implicit.

  Integrate[ - a^2/(10 Sqrt[a (a^3 - 100 a + 200)]), a] // InputForm


This is helpless to try to continue along this route.

Tried

AsymptoticDSolveValue[{ode /. {En -> 10, L -> 100, mass -> 1},
r[0] == 10000, r'[0] == -10}, r[x], {x, 0, 4}]
`

But it could not solve it even using Asymptotic methods.

I would suggest to stick to numerical solver for such complicated nonlinear ODE's. May be someone else have other ideas.

• Thank you for the answer!
– user72371
Commented Apr 29, 2020 at 23:29