# Thread: Using Power Series to solve Non-Homog. DE

1. ## Using Power Series to solve Non-Homog. DE

The equation is y''-4xy'-4y= e^x, assuming that y=(sigma from 0 to infinity) c_nx^n, a=0

So I did the substitution and found the recurrence term to be
c_n+2 = [(8nc_n)/(n+2)(n+1)]

I just have to find the first six terms of the solution but how do I get the first two terms? (since when n=0 I get c_2)

2. The first two are arbitrary and are due to the initial conditions so if y(0)=0 and y'(0)=1 then c0=0 and c1=1. Here's some Mathematica code to check the first 25 terms of the power series with those initial conditions against a numerically computed solution. It's a little messy. See if you can interpret it if you want. Note how I set c0 to 0 and c1 to 1 then created a table using your recurrence relation to compute the next 25 terms then used NDSolve to solve it numerically then superimposed the two plots. The agreement is not as good as I would expect.

Code:
Subscript[c, 0] = 0;
Subscript[c, 1] = 1;
myclist = Table[Subscript[c, n + 2] =
(8*n*Subscript[c, n])/((n + 2)*
(n + 1)), {n, 0, 25}]
myf[x_] := Sum[Subscript[c, n]*x^n,
{n, 0, 25}];
p1 = Plot[myf[x], {x, 0, 1}]
mysol = NDSolve[{Derivative[2][y][x] -
4*x*Derivative[1][y][x] -
4*y[x] == Exp[x], y[0] == 0,
Derivative[1][y][0] == 1}, y,
{x, 0, 1}];
p2 = Plot[Evaluate[y[x] /. mysol],
{x, 0, 1}, PlotStyle -> Red]
Show[{p1, p2}]