# Solving a second order non-linear differential equation

I am trying to solve the following equation

DSolve[{u''[t] + 4 u[t] + 0.1 u[t]^3 u'[t] ^2 == 0, u[0] == 1,
u'[0] == 1}, u, t]


Unfortunately Mathematica is unable to do so. Is there a way to obtain the much needed solution ?

• Hi ! Please, post code, not images. – Sektor Jan 18 '15 at 21:50
• Do you really need an exact solution ? Would a numerical one do the job ? – Sektor Jan 18 '15 at 22:27
• The numerical solution is immediately done with NDSolve. For a symbolic solution try to DSolve the ODE without initial conditions. You will find the Inverse function of Integrals containing the error function Erf. – Dr. Wolfgang Hintze Jan 18 '15 at 23:38
• @Dr.WolfgangHintze For a symbolic solution try to DSolve the ODE without initial conditions. You will find the Inverse function of Integrals containing the error function Erf On which version M gave solution to this? Using version 10.02, it does not. It returns unevaluated. screen shot: !Mathematica graphics – Nasser Jan 19 '15 at 4:38
• @Nasser Mathematica 8.0.4 produces a response not dissimilar to Maple's. Version 9.0.1 did not produce any result and actually crashed with 0.1 not substituted for 1/10. – Oleksandr R. Jan 19 '15 at 5:28

You can use series solution to find analytical solution, but this will be valid only near the point of expansion (it is Taylor series). This finds such solution and compares it to NDSolve solution. The more terms you use, the more accurate the approximation will be.

seriesSol = findSeriesSolution[t, 20];
numericSol = u[t] /. First@NDSolve[{u''[t] + 4 u[t] + 1/10 u[t]^3 u'[t]^2 == 0,
u[0] == 1, u'[0] == 1}, u[t], {t, 0, 1.5}];


Now compare

Grid[{{Plot[seriesSol, {t, 0, 1}, PlotRange -> {{0, 1}, {0, 2}},
PlotLabel -> "Series solution"],
Plot[numericSol, {t, 0, 1}, PlotRange -> {{0, 1}, {0, 2}},
PlotLabel -> "Numerical solution"]}}]


You can see the series solution is accurate, but near t=0, up to about t=0.6 or so.

The series solution is

seriesSol = findSeriesSolution[t, 6];
1 + t - (41 t^2)/20 - (29 t^3)/50 + (1607 t^4)/2000 - (12569 t^5)/50000 -
(277427 t^6)/600000 + (8878343 t^7)/10500000 + (445409479 t^8)/840000000


The function is

findSeriesSolution[t_, nTerms_] := Module[{pt = 0, u, ode, s0, s1, ic, eq, sol},
ic = {u[0] -> 1, u'[0] -> 1};
ode = u''[t] + 4 u[t] + 1/10 u[t]^3 u'[t]^2;
s0 = Series[ode, {t, pt, nTerms}];
s0 = s0 /. ic;
roots = Solve@LogicalExpand[s0 == 0];
s1 = Series[u[t], {t, pt, nTerms + 2}];
sol = Normal[s1] /. ic /. roots[[1]]
]


I tried your problem in Maple, it was able to find analytical solution without using Series method, but the analytical solution can't really be used, as it comes in terms of unevaluated integrals and I was not able to get Maple to evaluate them in any way. I could not remove all of its RootOf, which means these can't be evaluated, so basically it also could not find analytical solution. For your interest, here is Maple results:

eq:= diff(u(t),t$2) + 4*u(t) + 1/10* u(t)^3*diff(u(t),t)^2= 0; sol:=dsolve({eq,u(0)=1,D(u)(0)=1},u(t));  • Very late comment but here is also something that may be used. Mathematica may be used to arrive at the series solution proposed by the Differential transformation method (but I am guessing you already knew that! :)) Differential transformation method: Mukherjee 2011 and Hassan 2008. – dearN Nov 12 '16 at 15:21 The general symbolic solution of the ODE (allowing for two arbitrary facors a and b in the ODE) in MMA is $Version
(* Out[284]= "8.0 for Microsoft Windows (64-bit) (October 7, 2011)" *)

DSolve[{u''[t] + a u[t] + b u[t]^3 u'[t]^2 == 0}, u[t], t]


$\left\{\left\{u[t]\to \text{InverseFunction}\left[\int_1^{\text{$\#$1}} -\frac{\sqrt{2}}{\sqrt{2 e^{-\frac{1}{2} b K[1]^4} C[1]-\frac{a e^{-\frac{1}{2} b K[1]^4} \sqrt{2 \pi } \text{Erfi}\left[\frac{\sqrt{b} K[1]^2}{\sqrt{2}}\right]}{\sqrt{b}}}} \, dK[1]\&\right][t+C[2]]\right\},\left\{u[t]\to \text{InverseFunction}\left[\int_1^{\text{$\#$1}} \frac{\sqrt{2}}{\sqrt{2 e^{-\frac{1}{2} b K[2]^4} C[1]-\frac{a e^{-\frac{1}{2} b K[2]^4} \sqrt{2 \pi } \text{Erfi}\left[\frac{\sqrt{b} K[2]^2}{\sqrt{2}}\right]}{\sqrt{b}}}} \, dK[2]\&\right][t+C[2]]\right\}\right\}$

This looks similar to Nasser's Maple expression.

Inverting gives t as a function of u:

$t+C[2] ==\pm \int_1^{u[t]} \frac{\sqrt{2}}{\sqrt{2 e^{-\frac{1}{2} b z^4} C[1]-\frac{a e^{-\frac{1}{2} b z^4} \sqrt{2 \pi } \text{Erfi}\left[\frac{\sqrt{b} z^2}{\sqrt{2}}\right]}{\sqrt{b}}}} \, dz$

There are two constants C[1] and C[2] as required for the general solution.

Let us check the Special case b = 0.

In the limit b->0 the integral becomes

$\text{Limit}\left[\frac{\sqrt{2}}{\sqrt{2 e^{-\frac{1}{2} b z^4} C[1]-\frac{a e^{-\frac{1}{2} b z^4} \sqrt{2 \pi } \text{Erfi}\left[\frac{\sqrt{b} z^2}{\sqrt{2}}\right]}{\sqrt{b}}}},b\to 0\right]$

(* Out[311]= 1/Sqrt[-a u^2 + C[1]] *)


Inserting and resolving for u gives

Simplify[Solve[ArcTan[(Sqrt[a] u)/Sqrt[-a u^2 + C[1]]]/Sqrt[a] == t + C[2],
u], {\[Pi]/2/Sqrt[a] > t + C[2] > 0, C[1] == 1}]

(* Out[335]= {{u -> -(Sin[Sqrt[a] (t + C[2])]/Sqrt[a])}, {u -> Sin[Sqrt[a] (t + C[2])]/
Sqrt[a]}} *)


which is the expected harmonic solution.

Hence we can safely state that MMA (Version 8) can solve this ODE in symbolic form.

P.S. Even if there is no need, you are of course free to make a series expansion into powers of b of the exaxt solution. But, as is well known, you must carefully treat "secular" terms which give rise to spurious divergences.