# Solving a second order non-linear D.E using series

I have been trying to solve the following second order non-linear differential equation.

$$\frac{\sin ^2(q(z)) \left(3 \left(z^2 q'(z)^2+1\right) \cos (q(z))+z \sin (q(z)) \left(-z q''(z)+4 z^2 q'(z)^3+3 q'(z)\right)\right)}{z^5 \left(z^2 q'(z)^2+1\right)^{3/2}}=0$$

For which I know that the solution is $ArcCos[m z]$ as can be seen below

In:= (
Sin[q[z]]^2 (3 Cos[q[z]] (1 + z^2 Derivative[q][z]^2) +
z Sin[q[z]] (3 Derivative[q][z] +
4 z^2 Derivative[q][z]^3 - z (q^\[Prime]\[Prime])[z])))/(
z^5 (1 + z^2 Derivative[q][z]^2)^(3/2)) /.
q -> (ArcCos[m #] &) // Factor

Out= 0


There is a symmetry under $z \rightarrow - z$ and so $ArcCos[- m z]$ also solves it.

In:=
Sin[q[z]]^2 (3 z Sin[q[z]] Derivative[q][z] +
4 z^3 Sin[q[z]] Derivative[q][z]^3 +
3 Cos[q[z]] (1 + z^2 Derivative[q][z]^2) -
z^2 Sin[q[z]] (q^\[Prime]\[Prime])[z]) /.
q -> (ArcCos[- m #] &) // Factor

Out= 0


I found a very interesting answer given by @Nasser in this thread second order non-linear D.E

however when I try to solve using the above I cannot get precisely the solution, but only approximately. See below

findSeriesSolution[t_, nTerms_] :=
Module[{pt = 0, u, ode, s0, s1, ic, eq, sol, roots},
ic = {u -> \[Pi]/2 , u' -> m};
ode = Sin[
u[t]]^2 (3 t Sin[u[t]] Derivative[u][t] +
4 t^3 Sin[u[t]] Derivative[u][t]^3 +
3 Cos[u[t]] (1 + t^2 Derivative[u][t]^2) -
t^2 Sin[u[t]] (u^\[Prime]\[Prime])[t]);
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[]]
seriesSol = findSeriesSolution[x, 5]


And the above gives me While the expansion of $ArcCos[-m z]$

In:= ArcCos[- m z] // Series[#, {z, 0, 9}] & It is not quite clear what I am doing wrong. Any help would be much appreciated.

Edit: As I am still strugling to understand what's going on here is how I can obtain the first few terms of the $ArcCos$ expansion explicitly using the above.

findSeriesSolution[t_, nTerms_] :=
Module[{pt = 0, u, ode, s0, s1, ic, eq, sol, roots},
ic = {u -> \[Pi]/2, u' -> 1, u'' -> 0, u''' -> 1,
u'''' -> 0, u'''''' -> 0, u''''''' -> 0};
ode = Sin[u[t]]^2 (3 t Sin[u[t]] Derivative[u][t] +
4 t^3 Sin[u[t]] Derivative[u][t]^3 +
3 Cos[u[t]] (1 + t^2 Derivative[u][t]^2) -
t^2 Sin[u[t]] u''[t]);
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[]]
seriesSol = findSeriesSolution[ x, 5] /. x -> m x


It just seems that as I go higher, I need to determine more derivatives, in a way that I don't understand

• Try:findSeriesSolution[t_, nTerms_] := Module[{pt = 0}, {ic = {u -> \[Pi]/2, u' -> m}}; ode = Sin[ u[t]]^2 (3 Cos[u[t]] (1 + t^2 u'[t]^2) + t Sin[u[t]] (3 u'[t] + 4 t^2 u'[t]^3 - t u''[t])); 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[]]; seriesSol = findSeriesSolution[z, 5] – Mariusz Iwaniuk Mar 15 '18 at 16:07
• Thanks for taking the time to answer, however in your code as in the first bit of mine there are unevaluated derivatives. – DiSp0sablE_H3r0 Mar 15 '18 at 16:11

Sorry for short answer, but have to run to class which starts in few minutes.

But there does not seem to be series expansion around zero for your ode. Using 11.3, it can find series solution around t=1. May be this can get you started

ode= Sin[u[t]]^2 (3 t Sin[u[t]] u'[t]+4 t^3 Sin[u[t]] u'[t]^3+
3 Cos[u[t]] (1+t^2 u[t]^2)-t^2 Sin[u[t]] u''[t])

AsymptoticDSolveValue[ode==0,u[t],{t,0,5}]
(* does not evaluate*)


but

AsymptoticDSolveValue[ode==0,u[t],{t,1,5}] Version 11.3

• Thanks for getting in the trouble, but that's a bit strange, as the other piece of code does give a result back without any errors. Enjoy your class – DiSp0sablE_H3r0 Mar 15 '18 at 17:50
• I solved it using the previous method you had posted. The solution comes out to be what it should, and I used the same structure to calculate some more D.E's that I wanted. Thanks again!!! – DiSp0sablE_H3r0 Mar 15 '18 at 22:34

After working out some things this is how one obtains the precise solution to the above problem using the method proposed by @Nasser here .

It seems that the procedure works fine as soon as one pushes a bit the calculation and deduces which terms remain undetermined and why. And also in the original post, I made some stupid things in the initial conditions. The code below is how it should be done.

findSeriesSolution[t_, nTerms_] :=
Module[{pt =
0}, {ic = {u -> \[Pi]/2, u' -> - m, u'' -> 0,
u''' -> - m^3}};
ode = Sin[u[t]]^2 (3 Cos[u[t]] (1 + t^2 u'[t]^2) +
t Sin[u[t]] (3 u'[t] + 4 t^2 u'[t]^3 - t u''[t]));
s0 = Series[ode, {t, pt, nTerms}]; s0 = s0 /. ic;
roots = Solve@LogicalExpand[s0 == 0];
s1 = Series[u[t], {t, pt, nTerms}];
sol = Normal[s1] /. ic /. roots[]];
seriesSol = findSeriesSolution[z, 11]
(seriesSol =
findSeriesSolution[z, 11] - ArcCos[m z] //
Series[#, {z, 0, 11}] & // Normal) // Factor


The results are; the first is the solution and the second is the result obtained when I subtract the known solution.

\[Pi]/2 - m z - (m^3 z^3)/6 - (3 m^5 z^5)/40 - (5 m^7 z^7)/112 - (
35 m^9 z^9)/1152 - (63 m^11 z^11)/2816

0