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 (LinearSoln). The non-linear model with damping is investigated at the bottom of the worksheet.
> | ode:=diff(y(x),x,x)+sin(y(x))=0; |
> | Order:=12; |
> | dsolve({ode,y(0)=Pi/6,D(y)(0)=0},y(x),type=series); |
> | rhs(%); |
> | poly:=convert(%,polynom); |
> | with(plots):LinearSoln:=plot((Pi/6)*cos(x),x=0..Pi,color=red): |
> | SeriesSoln:=plot(poly,x=0..Pi,color=blue): |
> | display(SeriesSoln,LinearSoln); |
> | Order:=16; |
> | dsolve({ode,y(0)=Pi/6,D(y)(0)=0},y(x),type=series); |
> | rhs(%); |
> | poly:=convert(%,polynom); |
> | with(plots):LinearSoln:=plot((Pi/6)*cos(x),x=0..Pi,color=red): |
> | SeriesSoln:=plot(poly,x=0..Pi,color=blue): |
> | display(SeriesSoln,LinearSoln); |
> | Order:=20; |
> | dsolve({ode,y(0)=Pi/6,D(y)(0)=0},y(x),type=series); |
> | rhs(%); |
> | poly:=convert(%,polynom); |
> | poly1:=convert(%,polynom); |
> | with(plots):LinearSoln:=plot((Pi/6)*cos(x),x=0..9*Pi/8,color=red): |
> | SeriesSoln:=plot(poly,x=0..9*Pi/8,color=blue): |
> | display(SeriesSoln,LinearSoln); |
> | Order:=24; |
> | dsolve({ode,y(0)=Pi/6,D(y)(0)=0},y(x),type=series); |
> | rhs(%); |
> | poly:=convert(%,polynom); |
> | with(plots):LinearSoln:=plot((Pi/6)*cos(x),x=0..9*Pi/8,color=red): |
> | SeriesSoln:=plot(poly,x=0..9*Pi/8,color=blue): |
> | display(SeriesSoln,LinearSoln); |
> | Order:=32; |
> | dsolve({ode,y(0)=Pi/6,D(y)(0)=0},y(x),type=series); |
> | rhs(%); |
> | poly:=convert(%,polynom); |
> | with(plots):LinearSoln:=plot((Pi/6)*cos(x),x=0..9*Pi/8,color=red): |
> | SeriesSoln:=plot(poly,x=0..9*Pi/8,color=blue): |
> | display(SeriesSoln,LinearSoln); |
The non-linear ODE's below, ode2 (graphed in green) and ode3 (graphed in black), include damping.
> | ode2:=diff(y(x),x,x)+0.02*diff(y(x),x)+sin(y(x))=0; |
> | Order:=20; |
> | dsolve({ode2,y(0)=Pi/6,D(y)(0)=0},y(x),type=series); |
> | rhs(%); |
> | poly2:=convert(%,polynom); |
> | with(plots):LinearSoln:=plot((Pi/6)*cos(x),x=0..9*Pi/8,y=-0.6..0.6,color=red): |
> | SeriesSoln1:=plot(poly1,x=0..9*Pi/8,y=-0.6..0.6,color=blue): |
> | SeriesSoln2:=plot(poly2,x=0..9*Pi/8,y=-0.6..0.6,color=green): |
> | display(SeriesSoln1,SeriesSoln2,LinearSoln); |
> | with(plots):LinearSoln:=plot((Pi/6)*cos(x),x=0..2*Pi,color=red): |
> | SeriesSoln1:=plot(poly1,x=0..2*Pi,color=blue): |
> | SeriesSoln2:=plot(poly2,x=0..2*Pi,color=green): |
> | display(SeriesSoln1,SeriesSoln2,LinearSoln); |
> | ode3:=diff(y(x),x,x)+0.05*diff(y(x),x)+sin(y(x))=0; |
> | Order:=20; |
> | dsolve({ode3,y(0)=Pi/6,D(y)(0)=0},y(x),type=series); |
> | rhs(%); |
> | poly3:=convert(%,polynom); |
> | with(plots):LinearSoln:=plot((Pi/6)*cos(x),x=0..9*Pi/8,y=-0.6..0.6,color=red): |
> | SeriesSoln1:=plot(poly1,x=0..9*Pi/8,y=-0.6..0.6,color=blue): |
> | SeriesSoln2:=plot(poly2,x=0..9*Pi/8,y=-0.6..0.6,color=green): |
> | SeriesSoln3:=plot(poly3,x=0..9*Pi/8,y=-0.6..0.6,color=black): |
> | display(SeriesSoln1,SeriesSoln2,SeriesSoln3,LinearSoln); |
> |