MapleDEseries3.mws

The Oscillating Pendulum

Linear and Non-Linear Models

Truncated series solutions to the non-linear model are graphed in blue (SeriesSoln).  The analytical solution to the linear model is graphed in red (AnalSoln).  Note the different initial condition in this example.

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

ode := diff(y(x),`$`(x,2))+sin(y(x)) = 0

>    Order:=12;

Order := 12

>    dsolve({ode,y(0)=Pi/3,D(y)(0)=0},y(x),type=series);

y(x) = series(1/3*Pi+(-1/4*3^(1/2))*x^2+1/96*3^(1/2)*x^4+1/720*3^(1/2)*x^6+(-7/46080*3^(1/2))*x^8+(-7/1036800*3^(1/2))*x^10+O(x^12),x,12)

>    rhs(%);

series(1/3*Pi+(-1/4*3^(1/2))*x^2+1/96*3^(1/2)*x^4+1/720*3^(1/2)*x^6+(-7/46080*3^(1/2))*x^8+(-7/1036800*3^(1/2))*x^10+O(x^12),x,12)

>    poly:=convert(%,polynom);

poly := 1/3*Pi-1/4*3^(1/2)*x^2+1/96*3^(1/2)*x^4+1/720*x^6*3^(1/2)-7/46080*3^(1/2)*x^8-7/1036800*x^10*3^(1/2)

>    with(plots):AnalSoln:=plot((Pi/3)*cos(x),x=0..Pi,color=red):

Warning, the name changecoords has been redefined

>    SeriesSoln:=plot(poly,x=0..Pi,y=-1.5..1.2,color=blue):

>    display(SeriesSoln,AnalSoln);

[Maple Plot]

>    Order:=16;

Order := 16

>    dsolve({ode,y(0)=Pi/3,D(y)(0)=0},y(x),type=series);

y(x) = series(1/3*Pi+(-1/4*3^(1/2))*x^2+1/96*3^(1/2)*x^4+1/720*3^(1/2)*x^6+(-7/46080*3^(1/2))*x^8+(-7/1036800*3^(1/2))*x^10+37/17107200*3^(1/2)*x^12+(-841/24908083200*3^(1/2))*x^14+O(x^16),x,16)

>    rhs(%);

series(1/3*Pi+(-1/4*3^(1/2))*x^2+1/96*3^(1/2)*x^4+1/720*3^(1/2)*x^6+(-7/46080*3^(1/2))*x^8+(-7/1036800*3^(1/2))*x^10+37/17107200*3^(1/2)*x^12+(-841/24908083200*3^(1/2))*x^14+O(x^16),x,16)

>    poly:=convert(%,polynom);

poly := 1/3*Pi-1/4*3^(1/2)*x^2+1/96*3^(1/2)*x^4+1/720*x^6*3^(1/2)-7/46080*3^(1/2)*x^8-7/1036800*x^10*3^(1/2)+37/17107200*x^12*3^(1/2)-841/24908083200*x^14*3^(1/2)

>    with(plots):AnalSoln:=plot((Pi/3)*cos(x),x=0..Pi,color=red):

>    SeriesSoln:=plot(poly,x=0..Pi,y=-1.5..1.2,color=blue):

>    display(SeriesSoln,AnalSoln);

[Maple Plot]

>    Order:=20;

Order := 20

>    dsolve({ode,y(0)=Pi/3,D(y)(0)=0},y(x),type=series);

y(x) = series(1/3*Pi+(-1/4*3^(1/2))*x^2+1/96*3^(1/2)*x^4+1/720*3^(1/2)*x^6+(-7/46080*3^(1/2))*x^8+(-7/1036800*3^(1/2))*x^10+37/17107200*3^(1/2)*x^12+(-841/24908083200*3^(1/2))*x^14+(-184463/68319313920...
y(x) = series(1/3*Pi+(-1/4*3^(1/2))*x^2+1/96*3^(1/2)*x^4+1/720*3^(1/2)*x^6+(-7/46080*3^(1/2))*x^8+(-7/1036800*3^(1/2))*x^10+37/17107200*3^(1/2)*x^12+(-841/24908083200*3^(1/2))*x^14+(-184463/68319313920...

>    rhs(%);

series(1/3*Pi+(-1/4*3^(1/2))*x^2+1/96*3^(1/2)*x^4+1/720*3^(1/2)*x^6+(-7/46080*3^(1/2))*x^8+(-7/1036800*3^(1/2))*x^10+37/17107200*3^(1/2)*x^12+(-841/24908083200*3^(1/2))*x^14+(-184463/6831931392000*3^(1...
series(1/3*Pi+(-1/4*3^(1/2))*x^2+1/96*3^(1/2)*x^4+1/720*3^(1/2)*x^6+(-7/46080*3^(1/2))*x^8+(-7/1036800*3^(1/2))*x^10+37/17107200*3^(1/2)*x^12+(-841/24908083200*3^(1/2))*x^14+(-184463/6831931392000*3^(1...

>    poly:=convert(%,polynom);

poly := 1/3*Pi-1/4*3^(1/2)*x^2+1/96*3^(1/2)*x^4+1/720*x^6*3^(1/2)-7/46080*3^(1/2)*x^8-7/1036800*x^10*3^(1/2)+37/17107200*x^12*3^(1/2)-841/24908083200*x^14*3^(1/2)-184463/6831931392000*3^(1/2)*x^16+2632...
poly := 1/3*Pi-1/4*3^(1/2)*x^2+1/96*3^(1/2)*x^4+1/720*x^6*3^(1/2)-7/46080*3^(1/2)*x^8-7/1036800*x^10*3^(1/2)+37/17107200*x^12*3^(1/2)-841/24908083200*x^14*3^(1/2)-184463/6831931392000*3^(1/2)*x^16+2632...

>    with(plots):AnalSoln:=plot((Pi/3)*cos(x),x=0..9*Pi/8,color=red):

>    SeriesSoln:=plot(poly,x=0..9*Pi/8,y=-1.5..1.2,color=blue):

>    display(SeriesSoln,AnalSoln);

[Maple Plot]

>    Order:=24;

Order := 24

>    dsolve({ode,y(0)=Pi/3,D(y)(0)=0},y(x),type=series);

y(x) = series(1/3*Pi+(-1/4*3^(1/2))*x^2+1/96*3^(1/2)*x^4+1/720*3^(1/2)*x^6+(-7/46080*3^(1/2))*x^8+(-7/1036800*3^(1/2))*x^10+37/17107200*3^(1/2)*x^12+(-841/24908083200*3^(1/2))*x^14+(-184463/68319313920...
y(x) = series(1/3*Pi+(-1/4*3^(1/2))*x^2+1/96*3^(1/2)*x^4+1/720*3^(1/2)*x^6+(-7/46080*3^(1/2))*x^8+(-7/1036800*3^(1/2))*x^10+37/17107200*3^(1/2)*x^12+(-841/24908083200*3^(1/2))*x^14+(-184463/68319313920...

>    rhs(%);

series(1/3*Pi+(-1/4*3^(1/2))*x^2+1/96*3^(1/2)*x^4+1/720*3^(1/2)*x^6+(-7/46080*3^(1/2))*x^8+(-7/1036800*3^(1/2))*x^10+37/17107200*3^(1/2)*x^12+(-841/24908083200*3^(1/2))*x^14+(-184463/6831931392000*3^(1...
series(1/3*Pi+(-1/4*3^(1/2))*x^2+1/96*3^(1/2)*x^4+1/720*3^(1/2)*x^6+(-7/46080*3^(1/2))*x^8+(-7/1036800*3^(1/2))*x^10+37/17107200*3^(1/2)*x^12+(-841/24908083200*3^(1/2))*x^14+(-184463/6831931392000*3^(1...

>    poly:=convert(%,polynom);

poly := 1/3*Pi-1/4*3^(1/2)*x^2+1/96*3^(1/2)*x^4+1/720*x^6*3^(1/2)-7/46080*3^(1/2)*x^8-7/1036800*x^10*3^(1/2)+37/17107200*x^12*3^(1/2)-841/24908083200*x^14*3^(1/2)-184463/6831931392000*3^(1/2)*x^16+2632...
poly := 1/3*Pi-1/4*3^(1/2)*x^2+1/96*3^(1/2)*x^4+1/720*x^6*3^(1/2)-7/46080*3^(1/2)*x^8-7/1036800*x^10*3^(1/2)+37/17107200*x^12*3^(1/2)-841/24908083200*x^14*3^(1/2)-184463/6831931392000*3^(1/2)*x^16+2632...

>    with(plots):AnalSoln:=plot((Pi/3)*cos(x),x=0..9*Pi/8,color=red):

>    SeriesSoln:=plot(poly,x=0..9*Pi/8,y=-1.5..1.2,color=blue):

>    display(SeriesSoln,AnalSoln);

[Maple Plot]

>    Order:=32;

Order := 32

>    dsolve({ode,y(0)=Pi/3,D(y)(0)=0},y(x),type=series);

y(x) = series(1/3*Pi+(-1/4*3^(1/2))*x^2+1/96*3^(1/2)*x^4+1/720*3^(1/2)*x^6+(-7/46080*3^(1/2))*x^8+(-7/1036800*3^(1/2))*x^10+37/17107200*3^(1/2)*x^12+(-841/24908083200*3^(1/2))*x^14+(-184463/68319313920...
y(x) = series(1/3*Pi+(-1/4*3^(1/2))*x^2+1/96*3^(1/2)*x^4+1/720*3^(1/2)*x^6+(-7/46080*3^(1/2))*x^8+(-7/1036800*3^(1/2))*x^10+37/17107200*3^(1/2)*x^12+(-841/24908083200*3^(1/2))*x^14+(-184463/68319313920...
y(x) = series(1/3*Pi+(-1/4*3^(1/2))*x^2+1/96*3^(1/2)*x^4+1/720*3^(1/2)*x^6+(-7/46080*3^(1/2))*x^8+(-7/1036800*3^(1/2))*x^10+37/17107200*3^(1/2)*x^12+(-841/24908083200*3^(1/2))*x^14+(-184463/68319313920...

>    rhs(%);

series(1/3*Pi+(-1/4*3^(1/2))*x^2+1/96*3^(1/2)*x^4+1/720*3^(1/2)*x^6+(-7/46080*3^(1/2))*x^8+(-7/1036800*3^(1/2))*x^10+37/17107200*3^(1/2)*x^12+(-841/24908083200*3^(1/2))*x^14+(-184463/6831931392000*3^(1...
series(1/3*Pi+(-1/4*3^(1/2))*x^2+1/96*3^(1/2)*x^4+1/720*3^(1/2)*x^6+(-7/46080*3^(1/2))*x^8+(-7/1036800*3^(1/2))*x^10+37/17107200*3^(1/2)*x^12+(-841/24908083200*3^(1/2))*x^14+(-184463/6831931392000*3^(1...
series(1/3*Pi+(-1/4*3^(1/2))*x^2+1/96*3^(1/2)*x^4+1/720*3^(1/2)*x^6+(-7/46080*3^(1/2))*x^8+(-7/1036800*3^(1/2))*x^10+37/17107200*3^(1/2)*x^12+(-841/24908083200*3^(1/2))*x^14+(-184463/6831931392000*3^(1...

>    poly:=convert(%,polynom);

poly := 1/3*Pi-1/4*3^(1/2)*x^2+1/96*3^(1/2)*x^4+1/720*x^6*3^(1/2)-7/46080*3^(1/2)*x^8-7/1036800*x^10*3^(1/2)+37/17107200*x^12*3^(1/2)-841/24908083200*x^14*3^(1/2)-184463/6831931392000*3^(1/2)*x^16+2632...
poly := 1/3*Pi-1/4*3^(1/2)*x^2+1/96*3^(1/2)*x^4+1/720*x^6*3^(1/2)-7/46080*3^(1/2)*x^8-7/1036800*x^10*3^(1/2)+37/17107200*x^12*3^(1/2)-841/24908083200*x^14*3^(1/2)-184463/6831931392000*3^(1/2)*x^16+2632...
poly := 1/3*Pi-1/4*3^(1/2)*x^2+1/96*3^(1/2)*x^4+1/720*x^6*3^(1/2)-7/46080*3^(1/2)*x^8-7/1036800*x^10*3^(1/2)+37/17107200*x^12*3^(1/2)-841/24908083200*x^14*3^(1/2)-184463/6831931392000*3^(1/2)*x^16+2632...
poly := 1/3*Pi-1/4*3^(1/2)*x^2+1/96*3^(1/2)*x^4+1/720*x^6*3^(1/2)-7/46080*3^(1/2)*x^8-7/1036800*x^10*3^(1/2)+37/17107200*x^12*3^(1/2)-841/24908083200*x^14*3^(1/2)-184463/6831931392000*3^(1/2)*x^16+2632...

>    with(plots):AnalSoln:=plot((Pi/3)*cos(x),x=0..9*Pi/8,color=red):

>    SeriesSoln:=plot(poly,x=0..9*Pi/8,y=-1.5..1.2,color=blue):

>    display(SeriesSoln,AnalSoln);

[Maple Plot]

>