Original Problem

Here's the original ODE and initial conditions

> ODE := (1+epsilon*h(t))^2 * diff( h(t), t$2 ) + 1 = 0;

[Maple Math]

> IC := h(0) = 0, D(h)(0)=1;

[Maple Math]

>

Obtain O( [Maple Math] ) expansion for solution to the IVP.

> Hexp := h0(t) + h1(t)*epsilon + h2(t)*epsilon^2 + O(epsilon^3);

[Maple Math]

> ODEexp := series( lhs(eval( ODE, h(t)=Hexp )), epsilon, 3 );

[Maple Math]

>

Here is one way to extract the coefficients of [Maple Math] from the above ODE.

> ODE0 := op(1, ODEexp ) = 0;

> ODE1 := coeff( ODEexp, epsilon ) = 0;

> ODE2 := coeff( ODEexp, epsilon^2 ) = 0;

[Maple Math]

[Maple Math]

[Maple Math]

>

Here are the corresponding initial conditions.

> IC0 := h0(0)=0, D(h0)(0)=1;

> IC1 := h1(0)=0, D(h1)(0)=0;

> IC2 := h2(0)=0, D(h2)(0)=0;

[Maple Math]

[Maple Math]

[Maple Math]

>

These problems are all linear ODEs with constant coefficients, so the solutions are not difficult to find (by hand - or by Maple).

> H0 := dsolve( {ODE0,IC0}, h0(t) );

> H1 := dsolve( {eval(ODE1,H0),IC1}, h1(t) );

> H2 := dsolve( {eval(ODE2,{H0,H1}),IC2}, h2(t) );

[Maple Math]

[Maple Math]

[Maple Math]

Putting these back into the expansion for the solution, we find

> Hexp2 := eval( Hexp, {H0,H1,H2} );

[Maple Math]

>