MapleDEseries2.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).

>    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/6,D(y)(0)=0},y(x),type=series);

y(x) = series(1/6*Pi-1/4*x^2+1/96*3^(1/2)*x^4+(-1/21504*3^(1/2))*x^8+1/161280*x^10+O(x^12),x,12)

>    rhs(%);

series(1/6*Pi-1/4*x^2+1/96*3^(1/2)*x^4+(-1/21504*3^(1/2))*x^8+1/161280*x^10+O(x^12),x,12)

>    poly:=convert(%,polynom);

poly := 1/6*Pi-1/4*x^2+1/96*3^(1/2)*x^4-1/21504*3^(1/2)*x^8+1/161280*x^10

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

>    SeriesSoln:=plot(poly,x=0..Pi,color=blue):

>    display(SeriesSoln,AnalSoln);

[Maple Plot]

>    Order:=16;

Order := 16

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

y(x) = series(1/6*Pi-1/4*x^2+1/96*3^(1/2)*x^4+(-1/21504*3^(1/2))*x^8+1/161280*x^10-1/23482368*x^14+O(x^16),x,16)

>    rhs(%);

series(1/6*Pi-1/4*x^2+1/96*3^(1/2)*x^4+(-1/21504*3^(1/2))*x^8+1/161280*x^10-1/23482368*x^14+O(x^16),x,16)

>    poly:=convert(%,polynom);

poly := 1/6*Pi-1/4*x^2+1/96*3^(1/2)*x^4-1/21504*3^(1/2)*x^8+1/161280*x^10-1/23482368*x^14

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

>    SeriesSoln:=plot(poly,x=0..Pi,color=blue):

>    display(SeriesSoln,AnalSoln);

[Maple Plot]

>    Order:=20;

Order := 20

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

y(x) = series(1/6*Pi-1/4*x^2+1/96*3^(1/2)*x^4+(-1/21504*3^(1/2))*x^8+1/161280*x^10-1/23482368*x^14+19/9017229312*3^(1/2)*x^16+O(x^20),x,20)

>    rhs(%);

series(1/6*Pi-1/4*x^2+1/96*3^(1/2)*x^4+(-1/21504*3^(1/2))*x^8+1/161280*x^10-1/23482368*x^14+19/9017229312*3^(1/2)*x^16+O(x^20),x,20)

>    poly:=convert(%,polynom);

poly := 1/6*Pi-1/4*x^2+1/96*3^(1/2)*x^4-1/21504*3^(1/2)*x^8+1/161280*x^10-1/23482368*x^14+19/9017229312*3^(1/2)*x^16

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

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

>    display(SeriesSoln,AnalSoln);

[Maple Plot]

>    Order:=24;

Order := 24

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

y(x) = series(1/6*Pi-1/4*x^2+1/96*3^(1/2)*x^4+(-1/21504*3^(1/2))*x^8+1/161280*x^10-1/23482368*x^14+19/9017229312*3^(1/2)*x^16+(-83/5139820707840*3^(1/2))*x^20+197/79153238900736*x^22+O(x^24),x,24)

>    rhs(%);

series(1/6*Pi-1/4*x^2+1/96*3^(1/2)*x^4+(-1/21504*3^(1/2))*x^8+1/161280*x^10-1/23482368*x^14+19/9017229312*3^(1/2)*x^16+(-83/5139820707840*3^(1/2))*x^20+197/79153238900736*x^22+O(x^24),x,24)

>    poly:=convert(%,polynom);

poly := 1/6*Pi-1/4*x^2+1/96*3^(1/2)*x^4-1/21504*3^(1/2)*x^8+1/161280*x^10-1/23482368*x^14+19/9017229312*3^(1/2)*x^16-83/5139820707840*x^20*3^(1/2)+197/79153238900736*x^22
poly := 1/6*Pi-1/4*x^2+1/96*3^(1/2)*x^4-1/21504*3^(1/2)*x^8+1/161280*x^10-1/23482368*x^14+19/9017229312*3^(1/2)*x^16-83/5139820707840*x^20*3^(1/2)+197/79153238900736*x^22

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

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

>    display(SeriesSoln,AnalSoln);

[Maple Plot]

>    Order:=32;

Order := 32

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

y(x) = series(1/6*Pi-1/4*x^2+1/96*3^(1/2)*x^4+(-1/21504*3^(1/2))*x^8+1/161280*x^10-1/23482368*x^14+19/9017229312*3^(1/2)*x^16+(-83/5139820707840*3^(1/2))*x^20+197/79153238900736*x^22-151/74835789506150...
y(x) = series(1/6*Pi-1/4*x^2+1/96*3^(1/2)*x^4+(-1/21504*3^(1/2))*x^8+1/161280*x^10-1/23482368*x^14+19/9017229312*3^(1/2)*x^16+(-83/5139820707840*3^(1/2))*x^20+197/79153238900736*x^22-151/74835789506150...

>    rhs(%);

series(1/6*Pi-1/4*x^2+1/96*3^(1/2)*x^4+(-1/21504*3^(1/2))*x^8+1/161280*x^10-1/23482368*x^14+19/9017229312*3^(1/2)*x^16+(-83/5139820707840*3^(1/2))*x^20+197/79153238900736*x^22-151/7483578950615040*x^26...
series(1/6*Pi-1/4*x^2+1/96*3^(1/2)*x^4+(-1/21504*3^(1/2))*x^8+1/161280*x^10-1/23482368*x^14+19/9017229312*3^(1/2)*x^16+(-83/5139820707840*3^(1/2))*x^20+197/79153238900736*x^22-151/7483578950615040*x^26...

>    poly:=convert(%,polynom);

poly := 1/6*Pi-1/4*x^2+1/96*3^(1/2)*x^4-1/21504*3^(1/2)*x^8+1/161280*x^10-1/23482368*x^14+19/9017229312*3^(1/2)*x^16-83/5139820707840*x^20*3^(1/2)+197/79153238900736*x^22-151/7483578950615040*x^26+1198...
poly := 1/6*Pi-1/4*x^2+1/96*3^(1/2)*x^4-1/21504*3^(1/2)*x^8+1/161280*x^10-1/23482368*x^14+19/9017229312*3^(1/2)*x^16-83/5139820707840*x^20*3^(1/2)+197/79153238900736*x^22-151/7483578950615040*x^26+1198...

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

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

>    display(SeriesSoln,AnalSoln);

[Maple Plot]

>