A Series Solution
To a First Order DE
We are looking at series solutions to the first order differential equation
.
The initial condition is
.
| > | ode:=diff(y(x),x)+y(x)=sin(x); |
| > | dsolve({ode,y(0)=0},y(x),type=series); |
| > | Order:=10; |
| > | dsolve({ode,y(0)=0},y(x),type=series); |
| > | Order:=12; |
| > | dsolve({ode,y(0)=0},y(x),type=series); |
| > | rhs(%); |
| > | poly:=convert(%,polynom); |
| > | with(plots):AnalSoln:=plot((1/2)*(exp(-x)+sin(x)-cos(x)),x=0..9*Pi/4,color=red): |
Warning, the name changecoords has been redefined
| > | SeriesSoln:=plot(poly,x=0..9*Pi/4,color=blue): |
| > | display(SeriesSoln,AnalSoln); |
| > | Order:=16; |
| > | dsolve({ode,y(0)=0},y(x),type=series); |
| > | rhs(%); |
| > | poly:=convert(%,polynom); |
| > | SeriesSoln:=plot(poly,x=0..9*Pi/4,color=blue): |
| > | display(SeriesSoln,AnalSoln); |
| > | Order:=20; |
| > | dsolve({ode,y(0)=0},y(x),type=series); |
| > | rhs(%); |
| > | poly:=convert(%,polynom); |
| > | AnalSoln:=plot((1/2)*(exp(-x)+sin(x)-cos(x)),x=0..11*Pi/4,color=red): |
| > | SeriesSoln:=plot(poly,x=0..11*Pi/4,color=blue): |
| > | display(SeriesSoln,AnalSoln); |
| > |