UNIVERSITY OF THE W I T W AT E R S R A N D, J O H A N N E S B U R G
School of Computer Science and Applied Mathematics
APPM2023
Mechanics II
2024
Assignment-04
Supplemental
Issued: 23 August 2024 Total: 0
Due: 17:00, 22 October 2024
Instructions
• Read all the instructions and questions carefully.
• Typeset the solution document as a PDF file using the WitsHomework.cls LATEX document
template. Use the empty.tex LATEX document to start typesetting the solution.
• Use plain written English where necessary.
• Include only high quality PDF plots in the submission. Add your Student Number as a clear
and legible watermark in the background to each plot.
• Students may use the supplementary resources posted on the course Moodle page to
complete this assignment.
• Students are encouraged to work in groups. However, this is to be individual work and each
student must submit their own report.
APPM2023 Assignment-04 - 2024 1 of 3
Introduction
Consider the double link pendulum in Figure 1 and answer the questions that follow. Students
should refer to the Mathematica documentation for information on the following functions to
help with this assignment: D, NDSolveValue, Manipulate and Line. Students should also refer to
the Mathematica code from previous assignments to help with this assignment.
θ1 r⃗1
ŷ
m1
θ2 r⃗2
x̂
m2
Figure 1: The multi-link pendulum comprises a collection of masses mi and massless, rigid rods
of length ri . Here we show an example of a 2-link pendulum, fixed at an anchor point. The relative
position of mi +1 with respect to mi is given by the vector r⃗i +1 . The weight of each mass acts in the
− ŷ direction.
APPM2023 Assignment-04 - 2024 2 of 3
Question 1 — The Double Pendulum (10 Points)
Answer the following questions.
[1.1] Construct the Lagrangian L for the 2-link pendulum as the sum of lagrangians L1 and L2
for masses m1 and m2, respectively. (2 points)
[1.2] Determine the Euler-Lagrange equations for the mass m2 and m2 , in terms of the angular
discplacements θ1 and θ2 . (2 points)
[1.3] Suppose r1 = r2 = 1 and m1 = m2 = 1. Further, suppse that at t = 0 that the pendulum is
dropped from rest at θ1 (0) = θ2 (0) = π3 . Use the Mathematica function NDSolve to numerically
solve for the θ1 (t ) and θ2 (t ) between t = 0 and t = 5. (2 points)
[1.4] Plot θ1 (t ) and θ2 (t ) versus time between t = 0 and t = 5. (2 points)
[1.5] Construct a graphical simulation of the motion of the 2-link pendulum as represented in
Figure 1 between t = 0 and t = 5. Use the following Mathematica code to help construct this
simulation (2 points)
m1pos [ t_ ] := (* Add your code for position of m1 here *)
m2pos [ t_ ] := (* Add your code for position fo m2 here *)
rod1pos [ t_ ] := (* Add your code for rod 1 here *)
rod2pos [ t_ ] := (* Add your code for rod 2 here *)
anchor := Graphics [{ White , Disk [{0 , 0} , 0.05]}];
ball1 [ t_ ] := Graphics [{ Red , Disk [ m1pos [ t ] , 0.05]}];
ball2 [ t_ ] := Graphics [{ Red , Disk [ m2pos [ t ] , 0.05]}];
rod1 [ t_ ] := Graphics [{ Red , Thick , Line [ rod1pos [ t ]]}];
rod2 [ t_ ] := Graphics [{ Red , Thick , Line [ rod2pos [ t ]]}];
Animate [
Show [
rod1 [ t ] ,
rod2 [ t ] ,
ball1 [ t ] ,
ball2 [ t ] ,
anchor ] ,
{t , 0 , 5} ,
];
APPM2023 Assignment-04 - 2024 3 of 3