Series Solution Example Number 4
With initial conditions
Truncated series solutions are graphed in blue (Order = 8), red (Order = 12), green (Order = 16), and black (Order = 32) .
| > | ode:=diff(y(x),x,x)-4*x*diff(y(x),x)+x*y(x)=-sin(x)-4*x*cos(x)+x*sin(x); | 
| > | Order:=8; | 
| > | dsolve({ode,y(0)=1,D(y)(0)=1},y(x),type=series); | 
| > | rhs(%); | 
| > | poly1:=convert(%,polynom); | 
| > | with(plots): | 
| > | SeriesSoln1:=plot(poly1,x=0..7,color=blue): | 
| > | display(SeriesSoln1); | 
| > | Order:=12; | 
| > | dsolve({ode,y(0)=1,D(y)(0)=1},y(x),type=series); | 
| > | rhs(%); | 
| > | poly2:=convert(%,polynom); | 
| > | SeriesSoln2:=plot(poly2,x=0..7,color=red): | 
| > | display(SeriesSoln1,SeriesSoln2); | 
| > | Order:=16; | 
| > | dsolve({ode,y(0)=1,D(y)(0)=1},y(x),type=series); | 
| > | rhs(%); | 
| > | poly3:=convert(%,polynom); | 
| > | SeriesSoln3:=plot(poly3,x=0..7,color=green): | 
| > | display(SeriesSoln1,SeriesSoln2,SeriesSoln3); | 
| > | soln1:=plot(poly1,x=0..4,y=-100..2,color=blue): | 
| > | soln2:=plot(poly2,x=0..4,y=-100..2,color=red): | 
| > | soln3:=plot(poly3,x=0..4,y=-100..2,color=green): | 
| > | display(soln1,soln2,soln3); | 
| > | Order:=32; | 
| > | dsolve({ode,y(0)=1,D(y)(0)=1},y(x),type=series); | 
| > | rhs(%); | 
| > | poly4:=convert(%,polynom); | 
| > | with(plots): | 
| > | SeriesSoln4:=plot(poly4,x=0..7,color=black): | 
| > | display(SeriesSoln4); | 
| > | soln4:=plot(poly4,x=0..4,y=-100..2,color=black): | 
| > | display(soln1,soln2,soln3,soln4); | 
| > | soln1:=plot(poly1,x=0..2,y=-1..2,color=blue): | 
| > | soln2:=plot(poly2,x=0..2,y=-1..2,color=red): | 
| > | soln3:=plot(poly3,x=0..2,y=-1..2,color=green): | 
| > | display(soln1,soln2,soln3); | 
Changing an initial condition in finding soln5 (orange) produces what?
| > | Order:=16; | 
| > | dsolve({ode,y(0)=0,D(y)(0)=1},y(x),type=series); | 
| > | rhs(%); | 
| > | poly5:=convert(%,polynom); | 
| > | soln1:=plot(poly1,x=0..3.14,y=-1..2,color=blue): | 
| > | soln2:=plot(poly2,x=0..3.14,y=-1..2,color=red): | 
| > | soln3:=plot(poly3,x=0..3.14,y=-1..2,color=green): | 
| > | soln5:=plot(poly5,x=0..3.14,y=-1..2,color=orange): | 
| > | display(soln1,soln2,soln3,soln5); | 
We can see below that maybe the computer does not yet know everything (and it took a long time on this one).
| > | dsolve({ode,y(0)=0,D(y)(0)=1},y(x)); | 
| > | 
| > |