MapleDESer.mws

A Series Solution

To a First Order DE

We are looking at series solutions to the first order differential equation

dy/dx+y = sin(x) .

The initial condition is y(0) = 0 .

>    ode:=diff(y(x),x)+y(x)=sin(x);

ode := diff(y(x),x)+y(x) = sin(x)

>    dsolve({ode,y(0)=0},y(x),type=series);

y(x) = series(1/2*x^2-1/6*x^3+O(x^6),x,6)

>    Order:=10;

Order := 10

>    dsolve({ode,y(0)=0},y(x),type=series);

y(x) = series(1/2*x^2-1/6*x^3+1/720*x^6-1/5040*x^7+O(x^10),x,10)

>    Order:=12;

Order := 12

>    dsolve({ode,y(0)=0},y(x),type=series);

y(x) = series(1/2*x^2-1/6*x^3+1/720*x^6-1/5040*x^7+1/3628800*x^10-1/39916800*x^11+O(x^12),x,12)

>    rhs(%);

series(1/2*x^2-1/6*x^3+1/720*x^6-1/5040*x^7+1/3628800*x^10-1/39916800*x^11+O(x^12),x,12)

>    poly:=convert(%,polynom);

poly := 1/2*x^2-1/6*x^3+1/720*x^6-1/5040*x^7+1/3628800*x^10-1/39916800*x^11

>    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);

[Maple Plot]

>    Order:=16;

>    dsolve({ode,y(0)=0},y(x),type=series);

Order := 16

y(x) = series(1/2*x^2-1/6*x^3+1/720*x^6-1/5040*x^7+1/3628800*x^10-1/39916800*x^11+1/87178291200*x^14-1/1307674368000*x^15+O(x^16),x,16)

>    rhs(%);

series(1/2*x^2-1/6*x^3+1/720*x^6-1/5040*x^7+1/3628800*x^10-1/39916800*x^11+1/87178291200*x^14-1/1307674368000*x^15+O(x^16),x,16)

>    poly:=convert(%,polynom);

poly := 1/2*x^2-1/6*x^3+1/720*x^6-1/5040*x^7+1/3628800*x^10-1/39916800*x^11+1/87178291200*x^14-1/1307674368000*x^15

>    SeriesSoln:=plot(poly,x=0..9*Pi/4,color=blue):

>    display(SeriesSoln,AnalSoln);

[Maple Plot]

>    Order:=20;

>    dsolve({ode,y(0)=0},y(x),type=series);

Order := 20

y(x) = series(1/2*x^2-1/6*x^3+1/720*x^6-1/5040*x^7+1/3628800*x^10-1/39916800*x^11+1/87178291200*x^14-1/1307674368000*x^15+1/6402373705728000*x^18-1/121645100408832000*x^19+O(x^20),x,20)
y(x) = series(1/2*x^2-1/6*x^3+1/720*x^6-1/5040*x^7+1/3628800*x^10-1/39916800*x^11+1/87178291200*x^14-1/1307674368000*x^15+1/6402373705728000*x^18-1/121645100408832000*x^19+O(x^20),x,20)

>    rhs(%);

series(1/2*x^2-1/6*x^3+1/720*x^6-1/5040*x^7+1/3628800*x^10-1/39916800*x^11+1/87178291200*x^14-1/1307674368000*x^15+1/6402373705728000*x^18-1/121645100408832000*x^19+O(x^20),x,20)
series(1/2*x^2-1/6*x^3+1/720*x^6-1/5040*x^7+1/3628800*x^10-1/39916800*x^11+1/87178291200*x^14-1/1307674368000*x^15+1/6402373705728000*x^18-1/121645100408832000*x^19+O(x^20),x,20)

>    poly:=convert(%,polynom);

poly := 1/2*x^2-1/6*x^3+1/720*x^6-1/5040*x^7+1/3628800*x^10-1/39916800*x^11+1/87178291200*x^14-1/1307674368000*x^15+1/6402373705728000*x^18-1/121645100408832000*x^19
poly := 1/2*x^2-1/6*x^3+1/720*x^6-1/5040*x^7+1/3628800*x^10-1/39916800*x^11+1/87178291200*x^14-1/1307674368000*x^15+1/6402373705728000*x^18-1/121645100408832000*x^19

>    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);

[Maple Plot]

>