Example 5.3.7

Solve[1-x^3==0,x]
NSolve[1-x^3==0,x]

Here, the red dot is the dot we are expanding the series solution about, and the blue dots are the complex poles of p and q. The radius of convergence is the length of the blue line.

dot1[x_,y_,k_]:=Graphics[{Hue[k],Disk[{x,y},0.05]}]
di[x1_,y1_,x2_,y2_]:=Graphics[{Hue[0.6],Line[{{x1,y1},{x2,y2}}]}]

Show[dot1[0,0,0.0],dot1[1/2,(Sqrt[3])/2,0.7],dot1[1/2,-(Sqrt[3])/2,0.7],di[0,0,1/2,Sqrt[3]/2],PlotRange->{{-2,2},{-2,2}},AspectRatio->1,Axes->True,AxesLabel->{"Re","Im"},ImageSize->{400,Automatic}]

Show[dot1[2,0,0.0],dot1[1/2,(Sqrt[3])/2,0.7],dot1[1/2,-(Sqrt[3])/2,0.7],di[2,0,1/2,Sqrt[3]/2],PlotRange->{{-2.2,2.2},{-2.2,2.2}},AspectRatio->1,Axes->True,AxesLabel->{"Re","Im"},ImageSize->{400,Automatic}]

Example 5.3.11

Here are the truncated series manipulations. We have to ensure we go out far enough to get correct terms in the coefficients we use--the last term will always be missing something.

k=12;
 (∑_(n=0)^k)(n+2)(n+1)a[n+2](x^n)+((∑_(n=0)^k)((((-1))^n)/((2n+1)!))(x^(2n+1)))((∑_(n=0)^k)a[n](x^n));
Expand[%];
Collect[%,x];
Series[%,{x,0,9}]

k=4;
 (∑_(n=0)^k)(n+2)(n+1)a[n+2](x^n)+((∑_(n=0)^k)((((-1))^n)/((2n+1)!))(x^(2n+1)))((∑_(n=0)^k)a[n](x^n));
Expand[%];
Collect[%,x];
Series[%,{x,0,9}]

Notice the (x^5)term in the above is missing something that we had when we went out to 12 terms. This is not surprising, since we have truncated some of the series at (x^4).

Here is Mathematica's solution

Clear[y]
L[y_]:=D[y,{x,2}]+Sin[x]y
L[y[x]]
DSolve[L[y[x]]==0,y[x],x]

Opps, it can't do it. Looks like our series solution is a pretty awesome technique!

Example 5.3.11 Revisited: Mathematica to do it all for you.

Check out the other Mathematica file for today if you want a more detailed eplanation of the following procedure. You should be able to parse what is happening at each step. This gets the entire solution by evaluating one Mathematica cell, which is great if you know what is going on, not so great if you don't understand the manipulations Mathematica is doing for you and don't feel confident that you could do them by hand. Change k and get more terms in the solution.

Clear[a,x,y,i]
k=13;
y = (∑_(n=0)^k)a[n](x^n);
ddy = D[D[y,x],x];
ss = Normal[Series[Sin[x],{x,0,k}]];

eq1 = ddy + ss y;
eq1 = Expand[eq1];
eq1 = Collect[eq1,x];
Do[ sol = Solve[Coefficient[eq1,x,i-2]==0,a[i]];
a[i] = a[i] /. First[sol], {i,2,k}]

Collect[y,{a[0],a[1]}]

Let's check if this is correct:

Clear[y]
L[y_]:=D[y,{x,2}]+Sin[x]y

L[1-((x^3)/6)+((x^5)/120)+((x^6)/180)-((x^7)/5040)-((13 (x^8))/20160)-((x^9)/13440)+((x^10)/30240)+((569 (x^11))/39916800)-((37 (x^12))/79833600)-((7457 (x^13))/6227020800)]

Series[%,{x,0,10}]

L[x-((x^4)/12)+((x^6)/180)+((x^7)/504)-((x^8)/6720)-((7 (x^9))/25920)-((x^10)/50400)+((107 (x^11))/6652800)+((31 (x^12))/6842880)-((41 (x^13))/94348800)]

Series[%,{x,0,10}]

Both of our series solutions satisfy the differential equation.