Application Center - Maplesoft

App Preview:

The Spring Pendulum

You can switch back to the summary page by clicking here.

Learn about Maple
Download Application


 

Image 

The Spring Pendulum  

Prof. C. Madigan
Nova Scotia Agricultural College
Truro, N.S.    B2N 5E3
cmadigan@nsac.ca 

 

The problem being considered is a  pendulum attached to a spring.  (Damping is ignored but can easily be included.) 

Image 

Initialization 

restart; -1; with(plots); -1; with(DEtools); -1 

Theory 

Part 1.     A  pendulum of mass m having a variable length 

The problem will be broken up into two parts.   

We begin by modelling a pendulum of mass m having a variable length 

 

                                            Image 

Taking the origin at the point of suspension we have the following: 

Typesetting:-mrow(Typesetting:-mo(Image   

               Pendulum's position is OP = [ Lsin(θ), -Lcos(θ) ] 

                                  velocity = OP' = [Lcos(θ)θ'+  L'sin(θ), Lsin(θ)θ'-L'cos(θ) ] 

                            acceleration = OP'' = [Typesetting:-mrow(Typesetting:-mi(Typesetting:-mrow(Typesetting:-mo( Typesetting:-mrow(Typesetting:-mo(                                                                                                                                    

                                   Also  F = [ -Tsin(θ), Tcos(θ)-mg ] 

Setting F=ma and equating  we obtain 

                 

-Tsin(theta) = m[`+`(Lcos(theta)*(diff(theta(x), x, x))-(Lsin(theta))(diff(theta(x), x))^2+(diff(L(x), x))*cos(theta)*(diff(theta(x), x))+(diff(L(x), x, x))*sin(theta), (diff(L(x), x))*cos(theta)*(dif... 

               (1) 

       Typesetting:-mrow(Typesetting:-mi(Typesetting:-mrow(Typesetting:-mi(                  (2)  

Elliminating T from these equations and simplifying we obtain the following result 

                               Typesetting:-mrow(Typesetting:-mi(                                                                                        (3) 

One can add a damping term if one wishes.  Since the variation in L will be oscillatory we assume that 

                             Typesetting:-mrow(Typesetting:-mi(     Where      

Typesetting:-mrow(Typesetting:-msub(Typesetting:-mi( 

Also the natural frequency is ω = Typesetting:-mrow(Typesetting:-msqrt(Typesetting:-mrow(Typesetting:-mi(the phase angle δ controls where in the swing the maximum length occurs. 

Example 1. 

 

 

L := proc (t) options operator, arrow; 2+.75*sin(sqrt(9.81/1.98)*t-1/16*Pi) end proc 

proc (t) options operator, arrow; 2+.75*sin(sqrt(9.81/1.98)*t-1/16*Pi) end proc (2.1.1.1)
 

deq := L(t)*(diff(theta(t), t, t))+2*(diff(L(t), t))*(diff(theta(t), t))+9.81*sin(theta(t)) = 0 

(2-.75*cos(2.225880827*t+7/16*Pi))*(diff(diff(theta(t), t), t))+3.338821240*sin(2.225880827*t+7/16*Pi)*(diff(theta(t), t))+9.81*sin(theta(t)) = 0
(2-.75*cos(2.225880827*t+7/16*Pi))*(diff(diff(theta(t), t), t))+3.338821240*sin(2.225880827*t+7/16*Pi)*(diff(theta(t), t))+9.81*sin(theta(t)) = 0
(2.1.1.2)
 

slnn := dsolve({(D(theta))(0) = 1, theta(0) = 1/6*Pi, deq}, theta(t), numeric) 

proc (x_rkf45) local res, data, vars, solnproc, outpoint, ndsol, i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; _EnvDSNumericSaveDigits := Digits; Digits := 14; if _EnvInF... (2.1.1.3)
 

odeplot(slnn, [t, theta(t)], t = 0 .. 40, numpoints = 2000) 

Plot
 

odeplot(slnn, [theta(t), (D(theta))(t)], t = 0 .. 40, numpoints = 2000, title = `Phase Plane`) 

Plot
 

Part 2.    The spring pendulum 

 

 

We now consider the Spring Pendulum  In this case the mass m is at one end of a spring and the other is attached to a fixed point of suspension.  The spring remains straight, and the tension in it obeys Hooke's law; the spring constant is k.  The unstretched spring has a length  Typesetting:-mrow(Typesetting:-msub(Typesetting:-mi(and its length at time t is L(t).    

 

                                        Image 

Again resolving the forces perendicular to and parallel to the pendulum we obtain the following system of equations 

 

                       Typesetting:-mrow(Typesetting:-mi(                                    (1) 

                       Typesetting:-mrow(Typesetting:-mi(               (2)                    

For the second equation you need to determine the acceleration along the spring.  ( Recall: accel vector dot unit position vector)  

 

Example 1   Set  k/m = 4, Typesetting:-mrow(Typesetting:-msub(Typesetting:-mi( have as initial values L(0) = 3 ,D(L)(0) = 1,  θ(0) = 0.1 and D(θ)(0) = 0.1 

 

restart; -1; with(plots); -1; with(DEtools); -1 

 

deq1 := L(t)*(diff(theta(t), t, t))+2*(diff(L(t), t))*(diff(theta(t), t))+9.81*sin(theta(t)) = 0 

L(t)*(diff(diff(theta(t), t), t))+2*(diff(L(t), t))*(diff(theta(t), t))+9.81*sin(theta(t)) = 0 (2.2.1.1)
 

deq2 := (diff(L(t), t, t))-L(t)*(diff(theta(t), t))^2+`*`(4, L(t)-2)-9.81*cos(theta(t)) = 0 

(diff(diff(L(t), t), t))-L(t)*(diff(theta(t), t))^2+4*L(t)-8-9.81*cos(theta(t)) = 0 (2.2.1.2)
 

slnn := dsolve({deq1, deq2, (D(theta))(0) = -.1, theta(0) = -.1, (D(L))(0) = 1, L(0) = 3}, {theta(t), L(t)}, numeric) 

proc (x_rkf45) local res, data, vars, solnproc, outpoint, ndsol, i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; _EnvDSNumericSaveDigits := Digits; Digits := 14; if _EnvInF... (2.2.1.3)
 

slnn(2) 

[t = 2., L(t) = 5.05163704114921952, diff(L(t), t) = -2.78656047049556266, theta(t) = 0.517986178353492742e-1, diff(theta(t), t) = .138481580132514104]
[t = 2., L(t) = 5.05163704114921952, diff(L(t), t) = -2.78656047049556266, theta(t) = 0.517986178353492742e-1, diff(theta(t), t) = .138481580132514104]
(2.2.1.4)
 

slnn(1)[2] 

L(t) = 5.49769151854668880 (2.2.1.5)
 

 

odeplot(slnn, [theta(t), (D(theta))(t)], t = 0 .. 80, numpoints = 2000) 

Plot
 

odeplot(slnn, [L(t), (D(L))(t)], t = 0 .. 60, numpoints = 2000) 

Plot
 

 

Typesetting:-mrow(Typesetting:-mo(
Typesetting:-mrow(Typesetting:-mo(
Typesetting:-mrow(Typesetting:-mo(
Typesetting:-mrow(Typesetting:-mo(
Typesetting:-mrow(Typesetting:-mo(
Typesetting:-mrow(Typesetting:-mo(
Typesetting:-mrow(Typesetting:-mo(
Typesetting:-mrow(Typesetting:-mo(
Typesetting:-mrow(Typesetting:-mo(
 

 

A2 := display([plla || (0 .. 600)], insequence = true); -1 

A3 := display([plbob || (0 .. 600)], insequence = true); -1 

A4 := display([plcv || (0 .. 600)], insequence = true); -1 

display([A2, A3, A4]) 

Plot
 

 

Procedure to draw the spring pendulum having the following as inputs 

 

                    the spring-mass ratio  (k/m)        R 

                    unstretched spring length             L1 

                    Initial length of the spring     L(0)  =  L 

                    Initial velocity for the spring  D(L)(0) = dL 

                    Initial angle of the pendulum    θ(0)  = a 

                    Initial velocity of the pendulum  D(θ)(0) = b  

                    number of frames to use in the animation   n 

 

NOTE Since the procedure, as written, uses several of the same labels as used above it is best to restart before executing the procedure. 

 

Enjoy playing with the spring pendulum!!! 

 

restart; -1; with(plots); -1; with(DEtools); -1 

 

Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mrow(Typesetting:-mi(
 

 

drwpend(4, 2, 2.5, -1, .3, .1, 500) 

Plot
 

 

procedure to draw the phase planes. 

 

The first procedure draws the phase planes for both the pendulum aand the spring.  The second one does an animation of these drawings and takes some time to do the plots. 

 

 

restart; -1; with(plots); -1; with(DEtools); -1 

 

Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mrow(Typesetting:-mi(
 

 

drwphse(4, 2, 2.5, -1, .3, .1, 500) 

Plot
 

 

Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mrow(Typesetting:-mi(
 

 

drwphseanim(4, 2, 2.5, -1, .3, .1, 500) 

Plot
 

 

Legal Notice: The copyright for this application is owned by the author(s). Neither Maplesoft nor the author are responsible for any errors contained within and are not liable for any damages resulting from the use of this material. This application is intended for non-commercial, non-profit use only. Contact the author for permission if you wish to use this application in for-profit activities.
 

Image