# DSolve doesn't find formal solution

I have another question regarding DSolve, I hope it's permitted to ask it.

I have to find a solution to the following problem with a differential equation:

DSolve[{x''[t] == (x'[t]^2 - 4 x[t]^4)/x[t], x[0] == 1, x[1] == 1.2}, x[t], {t, 0, 1}]


but mathematica just echoes my code and doesn't compute.

Writing the following code

s = NDSolveValue[{x''[t] == (x'[t]^2 - 4 x[t]^4)/x[t], x[0] == 1,
x[1] == 1.2}, {x}, {t, -5, 8}];
Plot[Evaluate@Through[s[t]], {t, -5, 8}]


I get the plot of the solution, but what I really need is the formal solution of the problem with the differential equation and the border conditions.

How should it be done?

• Do you know there is a symbolic solution? Commented Dec 20, 2016 at 16:39
• I think yes, because it's a differential equation rising from the geodesic equations of a riemannian metric Commented Dec 20, 2016 at 16:58
• the first one, sorry I'll edit it. Commented Dec 20, 2016 at 19:46
• yes it seems so Commented Dec 20, 2016 at 19:55
• When I run your NDSolve code, I obtain numerous error messages and a curve for which x[0] == 0.5. Commented Dec 20, 2016 at 19:59

## 2 Answers

With little help MMA can find general and particular solution

ode = x''[t] - (x'[t]^2 - 4*x[t]^4)/x[t]


A new variable x[t]=1/v[t]:

xx[t_] := v[t]^(-1);
ode2 = FullSimplify[(ode /. x -> xx)*v[t]^3] // Expand
sol = DSolve[ode2 == 0, v[t], t]


$\left\{\left\{v(t)\to \frac{1}{2} e^{-e^{c_1} t-2 c_1-e^{c_1} c_2} \left(e^{2 e^{c_1} \left(c_2+t\right)}+4 e^{2 c_1}\right)\right\},\left\{v(t)\to \frac{1}{2} \left(e^{-e^{c_1} t-2 c_1-e^{c_1} c_2}+4 e^{e^{c_1} t+e^{c_1} c_2}\right)\right\}\right\}$

Back substituting:

sol2 = x[t] -> 1/v[t] /. sol


$\left\{x(t)\to \frac{2 e^{e^{c_1} t+2 c_1+e^{c_1} c_2}}{e^{2 e^{c_1} \left(c_2+t\right)}+4 e^{2 c_1}},x(t)\to \frac{2}{e^{-e^{c_1} t-2 c_1-e^{c_1} c_2}+4 e^{e^{c_1} t+e^{c_1} c_2}}\right\}$

Check the results, can be verified: First and second solution :

 (ode /. sol2[[1]] /. D[sol2[[1]], t] /. D[sol2[[1]], t, t]) ==
0 // FullSimplify
(*True*)
(ode /. sol2[[2]] /. D[sol2[[2]], t] /. D[sol2[[2]], t, t]) ==
0 // FullSimplify
(*True*)


Now You must find the constants c1 and c2,numerically only. Let's take the first solution of the equation sol2 and find constans:

 sol3 = FindRoot[{(x[t] /. sol2[[1]] /. t -> 0 /. C[1] -> c1 /.
C[2] -> c2) ==
1, (x[t] /. sol2[[1]] /. t -> 1 /. C[1] -> c1 /. C[2] -> c2) ==
6/5}, {{c1, 0.1 - I}, {c2, 0.5 - I}}]

(*{c1 -> 0.979599 - 0.797296 I, c2 -> 0.138683 + 0.212765 I} *)

sol4 = sol2[[1]] /. C[1] -> c1 /. C[2] -> c2 /. sol3


$x(t)\to \frac{2 e^{(1.86076\, -1.90557 i) t+(2.62269\, -1.46296 i)}}{e^{(3.72152\, -3.81115 i) (t+(0.138683\, +0.212765 i))}+(-0.675155-28.3665 i)}$

Checks boundary conditions:

 x[t] /. sol4 /. t -> 0
(* 1. - 5.55112*10^-17 I *)
x[t] /. sol4 /. t -> 1
(* 1.2 - 5.55112*10^-17 I*)


.

 s = NDSolveValue[{x''[t] == (x'[t]^2 - 4 x[t]^4)/x[t], x[0] == 1,
x[1] == 1.2}, {x}, {t, -5, 8}];


In this case NDSolveValue spit out Power::infy and fails.

 Plot[{Re@Evaluate[x[t] /. sol4], Evaluate@Through[s[t]]}, {t, -5, 8},
PlotRange -> All,
PlotLegends -> {"Solution with FindRoot", "NDSolve"}]


• The plot does not have x[0] == 1. Commented Dec 20, 2016 at 20:02
• @ bbgodfrey .Yep you are right. Commented Dec 20, 2016 at 20:08
• It's very probably the system {(x[t] /. sol2[[1]] /. t -> 0 /. C[1] -> c1 /. C[2] -> c2) == 1, (x[t] /. sol2[[1]] /. t -> 1 /. C[1] -> c1 /. C[2] -> c2) == 6/5} has complex solutions only. Commented Dec 20, 2016 at 20:36
• @user64494 .Thanks for info. Commented Dec 20, 2016 at 20:51

It is likely that there is no solution to the ODE system given in the question due to inconsistent boundary conditions. Certainly, Mariusz Iwaniuk, the OP, and I have tried without success to obtain a solution, both symbolically and numerically. On the other hand, with consistent boundary conditions both symbolic and numerical solutions can be obtained readily. For instance, with x[1] == 2/5, the numerical solution is

s = NDSolveValue[{x''[t] == (x'[t]^2 - 4 x[t]^4)/x[t], x[0] == 1, x[1] == 2/5},
x, {t, 1}];
Plot[s[t], {t, 0, 1}, PlotRange -> {0, Automatic}]


and the corresponding symbolic solution,

ss = (x[t] /. First@DSolve[{x''[t] == (x'[t]^2 - 4 x[t]^4)/x[t]}, x[t], t,
Assumptions -> x > 0] // Simplify) /. {C[1] -> c1, C[2] -> c2}
(* (2 c1 E^(Sqrt[c1] (c2 + t)))/(4 c1 + E^(2 Sqrt[c1] (c2 + t))) *)


Boundary conditions are imposed by

fr = {ss /. t -> 0, ss /. t -> 1};
con = FindRoot[Thread[fr == {1, 2/5}], {{c1, 8}, {c2, 1}}]
(* {c1 -> 6.30464, c2 -> 0.36378} *)


The plot of ss/.con is identical to that above.

Addendum: Upper bound on x1

The upper bound on x[1] can be found as follows.

NMaximize[{fr[[2]], fr[[1]] == 1, 0 <= c1}, {c1, c2}, WorkingPrecision -> 30]
(* {0.401412731593713172432788279860,
{c1 -> 6.80483818872865062735255300019, c2 -> 0.341320047083856817600759895202}} *)


Thus, the upper bound on x[1] is about 0.4014127, and both the ss and con computations fail (or give complex-number solutions, which is equally unsatisfactory) for x[1] == 0.4014128.

• Exactly saying, you demonstrate there is no real-valued solution of the ODE under consideration. Commented Dec 21, 2016 at 8:40
• @user64494 The upper bound on x[1] is about 0.4014127, as shown in the addendum to my answer. Commented Dec 21, 2016 at 15:43