Skip to content

Pendulums

CalcpadCE handles pendulum dynamics end-to-end on a single worksheet: nonlinear ODEs are integrated numerically, while inline SVG turns each time step into a frame of a physics animation.

All five sheets share the same recipe — derive the equations of motion, integrate with Runge-Kutta 4, then draw the bob, rod and trajectory inside the worksheet. The simple undamped and simple damped cases stay in one degree of freedom, so the integration result can be compared against analytical and small-angle approximations on the same plot — see the side-by-side comparison sheet for that. The elastic-damped variant adds a radial spring degree of freedom, and the double pendulum couples two angles into the chaotic regime.

Lengths, masses, damping factors and initial conditions are exposed at the top of each sheet, so every animation doubles as a parametric playground for stability and energy-loss studies.

Simple Undamped Pendulum 🎬

Single-degree-of-freedom undamped pendulum integrated with classical RK4 from a near-inverted initial angle. Each time step is rendered as an SVG frame so the swing builds up live, alongside an angle-versus-time plot.

Code:
#rad
'<table><tr><td>
'<h4>Input parameters</h4>
'Gravitational acceleration (m/s²) - 'g = 9.80665m/s^2
'Pendulum length -'l = 0.5m
'Pendulum mass -'m = 1kg
'Initial angle -'θ_0 = 179°|rad
'Maximum simulation time -'t_max = 11s
'<h4>Theoretical solution for large rotations</h4>
'</td><td>
#hide
Precision = 10^-5
PlotWidth = 300','PlotHeight = 150','PlotSVG = 1
w = 1.2*l', 'h_ = 2/3*w
W = 150', 'H = 130
k = W/w
L = l*k
R = L/10
x = -L*sin(θ_0)
y = L*cos(θ_0)
δ = 16
δ_x = 0.25*δ
δ_y = -2*δ
y_g = y - δ_y + R
#def svg$ = '<svg viewbox="'-60 - W/2' '-H-20' 'W + 120' '2*H + 40'" xmlns="http://www.w3.org/2000/svg" version="1.1" style="font-family: Georgia Pro; font-size:14px; width:'W'pt; height:'H + 50'pt; margin-left:20pt;">
#def thin_style$ = style="stroke:goldenrod; stroke-width:1; fill:none"
#def thick_style$ = style="stroke:steelblue; stroke-width:2; fill:none"
#def ball_style$ = style="stroke:steelblue; stroke-width:0.5;  fill:url(#ball)"
#def solid_style$ = style="stroke:black; stroke-width:1; fill:#eee"
#def load_style$ = style="stroke:steelblue; stroke-width:1; fill:steelblue;"
#include svg_drawing.cpd
#show
#val
svg$
'<defs><radialGradient id="ball" cx="35%" cy="35%"><stop offset="0%" stop-color="lightcyan"/><stop offset="100%" stop-color="lightblue"/></radialGradient><pattern id="concrete" x="4" y="4" width="8" height="8" patternUnits="userSpaceOnUse"><rect x="0" y="0" width="8" height="8" fill="#eae9e8" /><circle cx="1" cy="1" r="1.2" fill="#ccb" /><circle cx="5" cy="2" r="1.6" fill="#dadad0" /><circle cx="4" cy="6" r="0.8" fill="#aa9" /><circle cx="3" cy="4" r="0.4" fill="#884" /><circle cx="7" cy="5" r="1.2" fill="#cacaba" /><circle cx="5" cy="3" r="0.9" fill="#fffded" /></pattern></defs>
'<polygon points="0,0 '-δ','-δ' 'δ','-δ'" solid_style$/>
line$(0; 0; 0; l*k; thin_style$)
'<path d="M 0 '0.2*L' A '0.2*L' '0.2*L' 0 0 1 '0.2*x' '0.2*y'" thin_style$/>
texth$(δ*sign(θ_0);0.35*L;'θ_0*180/π'°)
line$(0; 0; x; y; thick_style$)
text$(x/2-δ_x*y/L; y/2+δ_x*x/L;450°-θ_0;'l'm)
circle$(0; 0; R/2; solid_style$)
circle$(0; 0; R/8; solid_style$)
circle$(x; y; R; ball_style$)
'<polygon points="'x','y_g + δ_y' 'x','y_g' 'x - δ_x','y_g + δ_y/3' 'x + δ_x','y_g + δ_y/3' 'x','y_g'" load_style$/>
texth$(x+3*δ_x; y_g-δ;g)
'</svg>
#equ
'</td></tr></table>
#noc
'Differential equation -'θ″ + g/l*sin(θ) = 0
#equ
'Incomplete elliptic integral of the first kind
F(φ; k) = $Integral{1/sqrt(1 - k^2*sin(θ)^2) @ θ = 0 : φ}
'Jacobi elliptic functions
'Modulus -'k = sin(θ_0/2)
am(u; k) = $Root{F(φ; k) = u @ φ = 0 : 3*π}
sn(u; k) = sin(am(u; k))','cn(u; k) = cos(am(u; k))
dn(u; k) = sqrt(1 - k*sn(u; k)^2)','cd(u; k) = cn(u; k)/dn(u; k)
'Period -'T_e = 4*sqrt(l/g)*F(π/2; k)
'Cyclic frequency -'f_e = 1/T_e|Hz
'Angular frequency -'ω_e = 2*π*rad*f_e|rad/s
'Equation of motion -'θ_e(t) = 2*asin(k*cd(sqrt(g/l)*t; k))
'Energy -'E_0 = m*l*g*(1 - cos(θ_0))|J
'<h4>Solution by Runge-Kutta RK4 method (explicit)</h4>
'For that purpose, the II order equation is reduced to the following system of I order equations
#noc
θ′ = ω'and'ω′ = (g/l)*sin(-θ)
#equ
'The solution will be performed iteratively
'Step size -'h = 0.02s
'Number of steps -'n = t_max/h
#hide
N = min(n; 80)
k_N = floor(n/N)
N = n\k_N
#show
'For each time step'n'the values for the next step will be obtained by using the following equstions
#noc
'<table class="eq" style="margin-left:24pt;">
'<tr><td>First step (k₁) -</td><td>'k_1,θ = ω_i', </td><td>' _
k_1,ω = (g/l)*sin(-θ_i)'</td></tr>
'<tr><td>Second step (k₂) -</td><td>'k_2,θ = ω_i + 0.5*h*k_1,ω', </td><td>'k_2,ω = (g/l)*sin(-(θ_i + 0.5*h*k_1,θ))'</td></tr>
'<tr><td>Third step (k₃) -</td><td>'k_3,θ = ω_i + 0.5*h*k_2,ω', </td><td>'k_3,ω = (g/l)*sin(-(θ_i + 0.5*h*k_2,θ))'</td></tr>
'<tr><td>Fourth step (k₄) -</td><td>'k_4,θ = ω_i + h*k_3,ω', </td><td>'k_4,ω = (g/l)*sin(-(θ_i + h*k_3,θ))'</td></tr>
'</table>
'Update values using weighted averages
'<p class="eq" style="border-left:solid 1pt black; margin-left:24pt; padding-left:3pt;"><var>θ</var><sub>n+1</sub> ='θ_i + (h/6)*(k_1,θ + 2*k_2,θ + 2*k_3,θ + k_4,θ)'<br/> <var>ω</var><sub>n+1</sub> = 'ω_i + (h/6)*(k_1,ω + 2*k_2,ω + 2*k_3,ω + k_4,ω)'</p>
#equ
'Allocate vectors
θ_RK4 = vector(n)'<br/>'ω_RK4 = vector(n)'<br/>'E_RK4 = vector(n)
'Set initial conditions
θ_RK4.1 = θ_0/1rad','ω_RK4.1 = 0/s
'Perform Runge-Kutta 4 steps
#for i = 1 : n - 1
    'RK4 factors
    k_1,θ = ω_RK4.i', ' _
    k_1,ω = (g/l)*sin(-θ_RK4.i)
    k_2,θ = ω_RK4.i + 0.5*h*k_1,ω
    k_2,ω = (g/l)*sin(-(θ_RK4.i + 0.5*h*k_1,θ))
    k_3,θ = ω_RK4.i + 0.5*h*k_2,ω
    k_3,ω = (g/l)*sin(-(θ_RK4.i + 0.5*h*k_2,θ))
    k_4,θ = ω_RK4.i + h*k_3,ω
    k_4,ω = (g/l)*sin(-(θ_RK4.i + h*k_3,θ))
    'Update values using weighted averages
    'Rotation -'θ_RK4.(i + 1) = θ_RK4.i + (h/6)*(k_1,θ + 2*k_2,θ + 2*k_3,θ + k_4,θ)
    'Angular velocity -'ω_RK4.(i + 1) = ω_RK4.i + (h/6)*(k_1,ω + 2*k_2,ω + 2*k_3,ω + k_4,ω)
    'Energy -'E_RK4.i = m*l^2*(1/2*ω_RK4.i^2 + (g/l)*(1 - cos(θ_RK4.i)))|J
    #hide
#loop
E_RK4.n = m*l^2*(1/2*ω_RK4.n^2 + (g/l)*(1 - cos(θ_RK4.n)))|J
t(i) = i*h - h
r2d = 180/π
#show
'. . .
'<style>.Series2{stroke:Lime!Important; stroke-dasharray: 30, 10;}</style>
'<h4>Plot results</h4>
'<table><tr><td>
'Rotation - <var>θ</var>(<var>t</var>), [°]<br/>
$Plot{t(i)|θ_e(t(i))*r2d & t(i)|θ_RK4.i*r2d @ i = 1 : min(1.5*N; n)}
'</td><td><br/><br/><br/>
'<b style="color:Red">━━━</b> Theoretical <br/>
'<b style="color:Lime">╸╸╸</b> Runge-Kutta 4
'</td></tr><tr><td>
'Absolute error Δθ(<var>t</var>), [°]<br/>
$Plot{t(i)|(θ_RK4.i - θ_e(t(i)))*r2d @ i = 1 : min(1.5*N; n)}
'</td><td><br/><br/><br/>
'<p><b style="color:Red">━━━</b> Runge-Kutta 4
'</td></tr><tr><td>
'Energy <var>E</var>(<var>t</var>), [J]<br/>
$Plot{t(i)|E_0 & t(i)|E_RK4.i & 0s|0.99999*E_0 @ i = 1 : min(1.5*N; n)}
'</td><td><br/><br/><br/>
'<b style="color:Red">━━━</b> Theoretical <br/>
'<b style="color:Lime">╸╸╸</b> Runge-Kutta 4
'</td></tr></table>
'<style>.fr{display:none;} .fr svg{margin-right:64pt; align:center;}</style>
'<h4>Animate results</h4>
#format 0.00
#hide
k = W/w
#val
#for i_N = 1 : N
    #hide
    i = i_N*k_N
    θ = θ_RK4.i
    x = -L*sin(θ)
    y = L*cos(θ)
    t = t(i)
    #show
    #val
    '<div class="fr" id="p1-fr-'i_N'">
    #equ
    #nosub
    'Simulation time -'t'<br/>
    $Plot{t(j)|θ_RK4.j*r2d & t(i)|θ_RK4.i*r2d & t_max|θ_0/1rad*r2d & t_max|-θ_0/1rad*r2d @ j = 1 : i}
    #val
    svg$
    '<polygon points="0,0 '-δ','-δ' 'δ','-δ'" solid_style$/>
    line$(0; 0; x; y; thick_style$)
    circle$(0; 0; R/2; solid_style$)
    circle$(0; 0; R/8; solid_style$)
    circle$(x; y; R; ball_style$)
    '</svg>
    '</div>
#loop
'<script>(function(){$("#p1-fr-1").show();var i=1;var fr=$("#p1-fr-1");setInterval(function(){fr.hide();if(++i>'N')i=1;fr=$("#p1-fr-"+i);fr.show();},'1000*h*k_N');})();</script>
#equ
Rendered Output:

Input parameters

Gravitational acceleration (m/s²) - g = 9.81 ms2

Pendulum length - l = 0.5 m

Pendulum mass - m = 1 kg

Initial angle - θ0 = 179° = 3.12 rad

Maximum simulation time - tmax = 11 s

Theoretical solution for large rotations
179°0.5mg

Differential equation - θ″ + gl · sin ( θ )  = 0

Incomplete elliptic integral of the first kind

F ( φ; k )  = φ1    1 − k2 · sin ( θ ) 2 dθ

Jacobi elliptic functions

Modulus - k = sin(θ02) = sin(3.12 rad2) = 1

am ( u; k )  = $Root{F  ( φ; k )  = u; φ ∈ [0; 3 · π]}

sn ( u; k )  = sin ( am  ( u; k )  )  , cn ( u; k )  = cos ( am  ( u; k )  ) 

dn ( u; k )  =     1 − k · sn  ( u; k ) 2 , cd ( u; k )  = cn  ( u; k ) dn  ( u; k ) 

Period - Te = 4 ·   lg · F(π2; k) = 4 ·   0.5 m9.81 m ∕ s2 · F(3.142; 1) = 5.53 s

Cyclic frequency - fe = 1Te = 15.53 s = 0.181 Hz

Angular frequency - ωe = 2 · π · rad · fe = 2 · 3.14 · rad · 0.181 Hz = 1.14 rad ∕ s

Equation of motion - θe ( t )  = 2 · asin(k · cd(  gl · t; k))

Energy - E0 = m · l · g ·  ( 1 − cos ( θ0 )  )  = 1 kg · 0.5 m · 9.81 m ∕ s2 ·  ( 1 − cos ( 3.12 rad )  )  = 9.81 J

Solution by Runge-Kutta RK4 method (explicit)

For that purpose, the II order equation is reduced to the following system of I order equations

θ′ = ω and ω′ = gl · sin ( -θ ) 

The solution will be performed iteratively

Step size - h = 0.02 s

Number of steps - n = tmaxh = 11 s0.02 s = 550

For each time step n = 550 the values for the next step will be obtained by using the following equstions

First step (k₁) - k1,θ = ωi , k1,ω = gl · sin ( -θi ) 
Second step (k₂) - k2,θ = ωi + 0.5 · h · k1,ω , k2,ω = gl · sin ( - ( θi + 0.5 · h · k1,θ )  ) 
Third step (k₃) - k3,θ = ωi + 0.5 · h · k2,ω , k3,ω = gl · sin ( - ( θi + 0.5 · h · k2,θ )  ) 
Fourth step (k₄) - k4,θ = ωi + h · k3,ω , k4,ω = gl · sin ( - ( θi + h · k3,θ )  ) 

Update values using weighted averages

θn+1 = θi + h6 ·  ( k1,θ + 2 · k2,θ + 2 · k3,θ + k4,θ ) 
ωn+1 = ωi + h6 ·  ( k1,ω + 2 · k2,ω + 2 · k3,ω + k4,ω ) 

Allocate vectors

θRK4 = vector ( n )  = vector ( 550 )  = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... 0]
ωRK4 = vector ( n )  = vector ( 550 )  = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... 0]
ERK4 = vector ( n )  = vector ( 550 )  = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... 0]

Set initial conditions

θRK4.1 = θ01 rad = 3.12 rad1 rad = 3.12 , ωRK4.1 = 0s = 0 s-1

Perform Runge-Kutta 4 steps

RK4 factors

k1,θ = ωRK4.1 = 0 s-1 , k1,ω = gl · sin ( -θRK4.1 )  = 9.81 m ∕ s20.5 m · sin ( -3.12 )  = -0.342 s-2

k2,θ = ωRK4.1 + 0.5 · h · k1,ω = 0 s-1 + 0.5 · 0.02 s ·  ( -0.342 s-2 )  = -0.00342 s-1

k2,ω = gl · sin ( - ( θRK4.1 + 0.5 · h · k1,θ )  )  = 9.81 m ∕ s20.5 m · sin ( - ( 3.12 + 0.5 · 0.02 s · 0 s-1 )  )  = -0.342 s-2

k3,θ = ωRK4.1 + 0.5 · h · k2,ω = 0 s-1 + 0.5 · 0.02 s ·  ( -0.342 s-2 )  = -0.00342 s-1

k3,ω = gl · sin ( - ( θRK4.1 + 0.5 · h · k2,θ )  )  = 9.81 m ∕ s20.5 m · sin ( - ( 3.12 + 0.5 · 0.02 s ·  ( -0.00342 s-1 )  )  )  = -0.343 s-2

k4,θ = ωRK4.1 + h · k3,ω = 0 s-1 + 0.02 s ·  ( -0.343 s-2 )  = -0.00686 s-1

k4,ω = gl · sin ( - ( θRK4.1 + h · k3,θ )  )  = 9.81 m ∕ s20.5 m · sin ( - ( 3.12 + 0.02 s ·  ( -0.00342 s-1 )  )  )  = -0.344 s-2

Update values using weighted averages

Rotation - θRK4.2 = θRK4.1 + h6 ·  ( k1,θ + 2 · k2,θ + 2 · k3,θ + k4,θ )  = 3.12 + 0.02 s6 ·  ( 0 s-1 + 2 ·  ( -0.00342 s-1 )  + 2 ·  ( -0.00342 s-1 )  +  ( -0.00686 s-1 )  )  = 3.12

Angular velocity - ωRK4.2 = ωRK4.1 + h6 ·  ( k1,ω + 2 · k2,ω + 2 · k3,ω + k4,ω )  = 0 s-1 + 0.02 s6 ·  ( -0.342 s-2 + 2 ·  ( -0.342 s-2 )  + 2 ·  ( -0.343 s-2 )  +  ( -0.344 s-2 )  )  = -0.00685 s-1

Energy - ERK4.1 = m · l2 · (12 · ωRK4.12 + gl ·  ( 1 − cos ( θRK4.1 )  ) ) = 1 kg ·  ( 0.5 m ) 2 · (12 · 0 s-12 + 9.81 m ∕ s20.5 m ·  ( 1 − cos ( 3.12 )  ) ) = 9.81 J

. . .

Plot results

Rotation - θ(t), [°]

-150 -100 -50 0 50 100 150 0 0.25 0.5 0.75 1 1.25 1.5 1.75 2 2.25 2.5 2.75 x y [0; -178.98] [2.71; 179]



━━━ Theoretical
╸╸╸ Runge-Kutta 4

Absolute error Δθ(t), [°]

-20 -10 0 10 20 0 0.25 0.5 0.75 1 1.25 1.5 1.75 2 2.25 2.5 2.75 x y [0; -19.31] [2.71; 27.61]



━━━ Runge-Kutta 4

Energy E(t), [J]

9.81 9.81 9.81 9.81 9.81 0 0.25 0.5 0.75 1 1.25 1.5 1.75 2 2.25 2.5 2.75 y [0; 9.81] [2.71; 9.81]



━━━ Theoretical
╸╸╸ Runge-Kutta 4
Animate results

Simulation time - t = 0.10 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 0.22 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 0.34 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 0.46 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 0.58 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 0.70 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 0.82 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 0.94 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 1.06 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 1.18 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 1.30 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 1.42 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 1.54 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 1.66 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 1.78 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 1.90 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 2.02 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 2.14 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 2.26 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 2.38 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 2.50 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 2.62 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 2.74 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 2.86 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 2.98 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 3.10 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 3.22 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 3.34 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 3.46 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 3.58 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 3.70 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 3.82 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 3.94 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 4.06 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 4.18 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 4.30 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 4.42 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 4.54 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 4.66 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 4.78 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 4.90 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 5.02 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 5.14 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 5.26 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 5.38 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 5.50 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 5.62 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 5.74 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 5.86 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 5.98 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 6.10 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 6.22 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 6.34 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 6.46 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 6.58 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 6.70 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 6.82 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 6.94 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 7.06 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 7.18 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 7.30 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 7.42 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 7.54 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 7.66 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 7.78 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 7.90 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 8.02 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 8.14 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 8.26 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 8.38 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 8.50 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 8.62 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 8.74 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 8.86 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 8.98 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 9.10 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 9.22 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 9.34 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 9.46 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 9.58 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 9.70 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 9.82 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 9.94 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 10.06 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 10.18 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 10.30 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 10.42 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 10.54 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 10.66 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 10.78 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simulation time - t = 10.90 s

-150 -100 -50 0 50 100 150 0 1 2 3 4 5 6 7 8 9 10 11 x y [0; -179] [11; 179]

Simple Damped Pendulum 🎬

Adds linear viscous damping \(b = β\, b_{cr}\) to the simple pendulum and integrates the resulting nonlinear ODE with RK4. The animation shows amplitude decay toward equilibrium for an arbitrary damping ratio.

Code:
#rad
'<table><tr><td>
'<h4>Input parameters</h4>
'Gravitational acceleration -'g = 9.80665m/s^2
'Pendulum length -'l = 1m
'Pendulum mass -'m = 1kg
'Initial angle -'θ_0 = -179°|rad
'Initial angular velocity -'ω_0 = 1.834rad/s
'Maximum simulation time -'t_max = 20s
'Damping factor (normaized) -'β = 0.005
'Critical damping -'b_cr = 2*m*sqrt(g/l)
'Damping -'b = β*b_cr
'</td><td>
#hide
Precision = 10^-5
PlotWidth = 300','PlotHeight = 150','PlotSVG = 1
w = 1.2*l', 'h_ = 2/3*w
W = 180', 'H = 150
k = W/w
L = l*k
R = L/10
x = L*sin(θ_0)
y = L*cos(θ_0)
δ = 16
δ_x = 0.25*δ
δ_y = -2*δ
y_g = y - δ_y + R
#def svg$ = '<svg viewbox="'-20-W/2' '-H-20' 'W+40' '2*H+40'" xmlns="http://www.w3.org/2000/svg" version="1.1" style="font-family: Georgia Pro; font-size:14px; width:'W+50'pt; height:'H+50'pt; margin-left:20pt;">
#def thin_style$ = style="stroke:goldenrod; stroke-width:1; fill:none"
#def thick_style$ = style="stroke:steelblue; stroke-width:2; fill:none"
#def ball_style$ = style="stroke:steelblue; stroke-width:0.5;  fill:url(#ball)"
#def solid_style$ = style="stroke:black; stroke-width:1; fill:#eee"
#def load_style$ = style="stroke:steelblue; stroke-width:1; fill:steelblue;"
#include svg_drawing.cpd
#show
#val
svg$
'<defs><radialGradient id="ball" cx="35%" cy="35%"><stop offset="0%" stop-color="lightcyan"/><stop offset="100%" stop-color="lightblue"/></radialGradient><pattern id="concrete" x="4" y="4" width="8" height="8" patternUnits="userSpaceOnUse"><rect x="0" y="0" width="8" height="8" fill="#eae9e8" /><circle cx="1" cy="1" r="1.2" fill="#ccb" /><circle cx="5" cy="2" r="1.6" fill="#dadad0" /><circle cx="4" cy="6" r="0.8" fill="#aa9" /><circle cx="3" cy="4" r="0.4" fill="#884" /><circle cx="7" cy="5" r="1.2" fill="#cacaba" /><circle cx="5" cy="3" r="0.9" fill="#fffded" /></pattern></defs>
'<polygon points="0,0 '-δ','-δ' 'δ','-δ'" solid_style$/>
line$(0; 0; 0; l*k; thin_style$)
'<path d="M 0 '0.2*L' A '0.2*L' '0.2*L' 0 0 'θ_0 < 0°' '0.2*x' '0.2*y'" thin_style$/>
texth$(-1.2*δ*sign(θ_0);0.25*L;'θ_0*180/π'°)
line$(0; 0; x; y; thick_style$)
text$(x/2-δ_x*y/L; y/2+δ_x*x/L;if(θ_0<0°;450°+θ_0;450°-θ_0);'l'm)
circle$(0; 0; R/2; solid_style$)
circle$(0; 0; R/8; solid_style$)
circle$(x; y; R; ball_style$)
'<polygon points="'x','y_g + δ_y' 'x','y_g' 'x - δ_x','y_g + δ_y/3' 'x + δ_x','y_g + δ_y/3' 'x','y_g'" load_style$/>
texth$(x+3*δ_x; y_g-δ;g)
'</svg>
#equ
'</td></tr></table>
'<h4>Solution by Runge-Kutta RK4 method (explicit)</h4>
#noc
'Differential equation -'θ″ + b/m*θ′ + g/l*sin(θ) = 0
#equ
'The II order equation is first reduced to the following system of I order equations
#noc
θ′ = ω'and'ω′ = (g/l)*sin(-θ) - b/m*ω
#equ
'The solution is performed iteratively
'Step size -'h = 0.02s
'Number of steps -'n = t_max/h
#hide
N = min(n; 120)
k_N = floor(n/N)
N = n\k_N
#show
'For each time step'n'the values for the next step will be obtained by using the following equstions
#noc
'<table class="eq" style="margin-left:24pt;">
'<tr><td>First step (k₁) -</td><td>'k_1,θ = ω_i', </td><td>' _
k_1,ω = (g/l)*sin(-θ_i) - b/m*k_1,θ'</td></tr>
'<tr><td>Second step (k₂) -</td><td>'k_2,θ = ω_i + 0.5*h*k_1,ω', </td><td>'k_2,ω = (g/l)*sin(-(θ_i + 0.5*h*k_1,θ)) - b/m*k_2,θ'</td></tr>
'<tr><td>Third step (k₃) -</td><td>'k_3,θ = ω_i + 0.5*h*k_2,ω', </td><td>'k_3,ω = (g/l)*sin(-(θ_i + 0.5*h*k_2,θ)) - b/m*k_3,θ'</td></tr>
'<tr><td>Fourth step (k₄) -</td><td>'k_4,θ = ω_i + h*k_3,ω', </td><td>'k_4,ω = (g/l)*sin(-(θ_i + h*k_3,θ)) - b/m*k_4,θ'</td></tr>
'</table>
'Update values using weighted averages
'<p class="eq" style="border-left:solid 1pt black; margin-left:24pt; padding-left:3pt;"><var>θ</var><sub>n+1</sub> ='θ_i + (h/6)*(k_1,θ + 2*k_2,θ + 2*k_3,θ + k_4,θ)'<br/> <var>ω</var><sub>n+1</sub> = 'ω_i + (h/6)*(k_1,ω + 2*k_2,ω + 2*k_3,ω + k_4,ω)'</p>
#equ
'Allocate vectors
θ = vector(n)'<br/>'ω = vector(n)
'Set initial conditions
θ.1 = θ_0/1rad','ω.1 = ω_0/1rad
'Perform Runge-Kutta 4 steps
#for i = 1 : n - 1
    'RK4 factors
    k_1,θ = ω.i', ' _
    k_1,ω = (g/l)*sin(-θ.i) - b/m*k_1,θ
    k_2,θ = ω.i + 0.5*h*k_1,ω
    k_2,ω = (g/l)*sin(-(θ.i + 0.5*h*k_1,θ)) - b/m*k_2,θ
    k_3,θ = ω.i + 0.5*h*k_2,ω
    k_3,ω = (g/l)*sin(-(θ.i + 0.5*h*k_2,θ)) - b/m*k_3,θ
    k_4,θ = ω.i + h*k_3,ω
    k_4,ω = (g/l)*sin(-(θ.i + h*k_3,θ)) - b/m*k_4,θ
    'Update values using weighted averages
    'Rotation -'θ.(i + 1) = θ.i + (h/6)*(k_1,θ + 2*k_2,θ + 2*k_3,θ + k_4,θ)
    'Angular velocity -'ω.(i + 1) = ω.i + (h/6)*(k_1,ω + 2*k_2,ω + 2*k_3,ω + k_4,ω)' < /p >
    #hide
#loop
t(i) = i*h - h
r2d = 180/π
#show
'Kinetic energy -'E_k(i) = m/2*l^2*ω.i^2|J
'Potential energy-'E_p(i) = m*l*g*(1 - cos(θ.i))|J
'...
'<h4>Plot results</h4>
'Rotation - <var>θ</var>(<var>t</var>), [°]
$Plot{t(i)|θ.i*r2d @ i = 1 : n}
'Energy - <var>E</var>(<var>t</var>), [J]
$Plot{t(i)|E_k(i) + E_p(i) & 0s|0J & 0s|0J & 0s|0J & t(i)|E_p(i) & t(i)|E_k(i) & 0s|0J @ i = 1 : n}
'<br/><b style="color:MediumVioletRed">━━</b> Potential - <var>E</var><sub>p</sub>,
'<b style="color:MediumSpringGreen">━━</b> Kinetic - <var>E</var><sub>k</sub>,
'<b style="color:Tomato">━━</b> Total - <var>E</var><sub>tot</sub>
'<style>.Series3, .Series4{stroke:none!Important; fill:none!Important;} .fr{display:none;} .fr svg{margin-right:64pt; align-center;}</style>
'<h4>Animate results</h4>
#format 0.00
#hide
k = W/w
#val
#for i_N = 1 : N
    #hide
    i = i_N*k_N
    θ_i = θ.i
    x = L*sin(θ_i)
    y = L*cos(θ_i)
    t = t(i)
    #show
    #val
    '<div class="fr" id="p2-fr-'i_N'">
    #equ
    #nosub
    'Simulation time -'t'<br/>
    $Plot{t(i)|θ.i*r2d & t(j)|θ.j*r2d & t_max|θ_0/1rad*r2d & t_max|-θ_0/1rad*r2d @ j = 1 : i}
    #val
    svg$
    '<polygon points="0,0 '-δ','-δ' 'δ','-δ'" solid_style$/>
    line$(0; 0; x; y; thick_style$)
    circle$(0; 0; R/2; solid_style$)
    circle$(0; 0; R/8; solid_style$)
    circle$(x; y; R; ball_style$)
    '</svg>
    '</div>
#loop
'<script>(function(){$("#p2-fr-1").show();var i=1;var fr=$("#p2-fr-1");setInterval(function(){fr.hide();if(++i>'N')i=1;fr=$("#p2-fr-"+i);fr.show();},'1000*h*k_N');})();</script>
#equ
Rendered Output:

Input parameters

Gravitational acceleration - g = 9.81 ms2

Pendulum length - l = 1 m

Pendulum mass - m = 1 kg

Initial angle - θ0 = -179° = -3.12 rad

Initial angular velocity - ω0 = 1.83 rads

Maximum simulation time - tmax = 20 s

Damping factor (normaized) - β = 0.005

Critical damping - bcr = 2 · m ·   gl = 2 · 1 kg ·   9.81 m ∕ s21 m = 6.26 kg ∕ s

Damping - b = β · bcr = 0.005 · 6.26 kg ∕ s = 0.0313 kg ∕ s

-179°1mg
Solution by Runge-Kutta RK4 method (explicit)

Differential equation - θ″ + bm · θ′ + gl · sin ( θ )  = 0

The II order equation is first reduced to the following system of I order equations

θ′ = ω and ω′ = gl · sin ( -θ )  − bm · ω

The solution is performed iteratively

Step size - h = 0.02 s

Number of steps - n = tmaxh = 20 s0.02 s = 1000

For each time step n = 1000 the values for the next step will be obtained by using the following equstions

First step (k₁) - k1,θ = ωi , k1,ω = gl · sin ( -θi )  − bm · k1,θ
Second step (k₂) - k2,θ = ωi + 0.5 · h · k1,ω , k2,ω = gl · sin ( - ( θi + 0.5 · h · k1,θ )  )  − bm · k2,θ
Third step (k₃) - k3,θ = ωi + 0.5 · h · k2,ω , k3,ω = gl · sin ( - ( θi + 0.5 · h · k2,θ )  )  − bm · k3,θ
Fourth step (k₄) - k4,θ = ωi + h · k3,ω , k4,ω = gl · sin ( - ( θi + h · k3,θ )  )  − bm · k4,θ

Update values using weighted averages

θn+1 = θi + h6 ·  ( k1,θ + 2 · k2,θ + 2 · k3,θ + k4,θ ) 
ωn+1 = ωi + h6 ·  ( k1,ω + 2 · k2,ω + 2 · k3,ω + k4,ω ) 

Allocate vectors

θ = vector ( n )  = vector ( 1000 )  = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... 0]
ω = vector ( n )  = vector ( 1000 )  = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... 0]

Set initial conditions

θ1 = θ01 rad = -3.12 rad1 rad = -3.12 , ω1 = ω01 rad = 1.83 rad ∕ s1 rad = 1.83 s-1

Perform Runge-Kutta 4 steps

RK4 factors

k1,θ = ω1 = 1.83 s-1 , k1,ω = gl · sin ( -θ1 )  − bm · k1,θ = 9.81 m ∕ s21 m · sin ( - ( -3.12 )  )  − 0.0313 kg ∕ s1 kg · 1.83 s-1 = 0.114 s-2

k2,θ = ω1 + 0.5 · h · k1,ω = 1.83 s-1 + 0.5 · 0.02 s · 0.114 s-2 = 1.84 s-1

k2,ω = gl · sin ( - ( θ1 + 0.5 · h · k1,θ )  )  − bm · k2,θ = 9.81 m ∕ s21 m · sin ( - ( -3.12 + 0.5 · 0.02 s · 1.83 s-1 )  )  − 0.0313 kg ∕ s1 kg · 1.84 s-1 = 0.293 s-2

k3,θ = ω1 + 0.5 · h · k2,ω = 1.83 s-1 + 0.5 · 0.02 s · 0.293 s-2 = 1.84 s-1

k3,ω = gl · sin ( - ( θ1 + 0.5 · h · k2,θ )  )  − bm · k3,θ = 9.81 m ∕ s21 m · sin ( - ( -3.12 + 0.5 · 0.02 s · 1.84 s-1 )  )  − 0.0313 kg ∕ s1 kg · 1.84 s-1 = 0.294 s-2

k4,θ = ω1 + h · k3,ω = 1.83 s-1 + 0.02 s · 0.294 s-2 = 1.84 s-1

k4,ω = gl · sin ( - ( θ1 + h · k3,θ )  )  − bm · k4,θ = 9.81 m ∕ s21 m · sin ( - ( -3.12 + 0.02 s · 1.84 s-1 )  )  − 0.0313 kg ∕ s1 kg · 1.84 s-1 = 0.474 s-2

Update values using weighted averages

Rotation - θ2 = θ1 + h6 ·  ( k1,θ + 2 · k2,θ + 2 · k3,θ + k4,θ )  = -3.12 + 0.02 s6 ·  ( 1.83 s-1 + 2 · 1.84 s-1 + 2 · 1.84 s-1 + 1.84 s-1 )  = -3.09

Angular velocity - ω2 = ω1 + h6 ·  ( k1,ω + 2 · k2,ω + 2 · k3,ω + k4,ω )  = 1.83 s-1 + 0.02 s6 ·  ( 0.114 s-2 + 2 · 0.293 s-2 + 2 · 0.294 s-2 + 0.474 s-2 )  = 1.84 s-1 < /p >

Kinetic energy - Ek ( i )  = m2 · l2 · ωi2

Potential energy- Ep ( i )  = m · l · g ·  ( 1 − cos ( θi )  ) 

...

Plot results

Rotation - θ(t), [°]

-200 0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179] [19.98; 877.39]

Energy - E(t), [J]

0 5 10 15 20 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [19.98; 21.29]
━━ Potential - Ep, ━━ Kinetic - Ek, ━━ Total - Etot
Animate results

Simulation time - t = 0.14 s

-150 -100 -50 0 50 100 150 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 179]

Simulation time - t = 0.30 s

-150 -100 -50 0 50 100 150 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 179]

Simulation time - t = 0.46 s

-150 -100 -50 0 50 100 150 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 179]

Simulation time - t = 0.62 s

-150 -100 -50 0 50 100 150 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 179]

Simulation time - t = 0.78 s

-150 -100 -50 0 50 100 150 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 179]

Simulation time - t = 0.94 s

-150 -100 -50 0 50 100 150 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 179]

Simulation time - t = 1.10 s

-150 -100 -50 0 50 100 150 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 179]

Simulation time - t = 1.26 s

-150 -100 -50 0 50 100 150 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 179]

Simulation time - t = 1.42 s

-150 -100 -50 0 50 100 150 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 179]

Simulation time - t = 1.58 s

-150 -100 -50 0 50 100 150 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 179]

Simulation time - t = 1.74 s

-150 -100 -50 0 50 100 150 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 179]

Simulation time - t = 1.90 s

-150 -100 -50 0 50 100 150 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 190.72]

Simulation time - t = 2.06 s

-150 -100 -50 0 50 100 150 200 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 205.41]

Simulation time - t = 2.22 s

-150 -100 -50 0 50 100 150 200 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 226.25]

Simulation time - t = 2.38 s

-100 0 100 200 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 257.32]

Simulation time - t = 2.54 s

-100 0 100 200 300 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 301.79]

Simulation time - t = 2.70 s

-100 0 100 200 300 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 357.34]

Simulation time - t = 2.86 s

-100 0 100 200 300 400 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 413.22]

Simulation time - t = 3.02 s

-100 0 100 200 300 400 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 458.19]

Simulation time - t = 3.18 s

-100 0 100 200 300 400 500 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 489.21]

Simulation time - t = 3.34 s

-100 0 100 200 300 400 500 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 509]

Simulation time - t = 3.50 s

-100 0 100 200 300 400 500 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 521.21]

Simulation time - t = 3.66 s

-100 0 100 200 300 400 500 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 528.67]

Simulation time - t = 3.82 s

-100 0 100 200 300 400 500 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 533.21]

Simulation time - t = 3.98 s

-100 0 100 200 300 400 500 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 535.99]

Simulation time - t = 4.14 s

-100 0 100 200 300 400 500 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 537.74]

Simulation time - t = 4.30 s

-100 0 100 200 300 400 500 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 538.91]

Simulation time - t = 4.46 s

-100 0 100 200 300 400 500 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 539.78]

Simulation time - t = 4.62 s

-100 0 100 200 300 400 500 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 540.6]

Simulation time - t = 4.78 s

-100 0 100 200 300 400 500 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 541.57]

Simulation time - t = 4.94 s

-100 0 100 200 300 400 500 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 542.94]

Simulation time - t = 5.10 s

-100 0 100 200 300 400 500 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 545.05]

Simulation time - t = 5.26 s

-100 0 100 200 300 400 500 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 548.43]

Simulation time - t = 5.42 s

-100 0 100 200 300 400 500 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 553.95]

Simulation time - t = 5.58 s

-100 0 100 200 300 400 500 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 562.96]

Simulation time - t = 5.74 s

-100 0 100 200 300 400 500 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 577.62]

Simulation time - t = 5.90 s

-100 0 100 200 300 400 500 600 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 601.02]

Simulation time - t = 6.06 s

-100 0 100 200 300 400 500 600 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 636.7]

Simulation time - t = 6.22 s

0 200 400 600 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 685.77]

Simulation time - t = 6.38 s

0 200 400 600 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 741.98]

Simulation time - t = 6.54 s

0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 793.02]

Simulation time - t = 6.70 s

0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 830.85]

Simulation time - t = 6.86 s

0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 855.31]

Simulation time - t = 7.02 s

0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 869.5]

Simulation time - t = 7.18 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 876.23]

Simulation time - t = 7.34 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 7.50 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 7.66 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 7.82 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 7.98 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 8.14 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 8.30 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 8.46 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 8.62 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 8.78 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 8.94 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 9.10 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.35]

Simulation time - t = 9.26 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 9.42 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 9.58 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.35]

Simulation time - t = 9.74 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.35]

Simulation time - t = 9.90 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.35]

Simulation time - t = 10.06 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.35]

Simulation time - t = 10.22 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 10.38 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 10.54 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.35]

Simulation time - t = 10.70 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 10.86 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.35]

Simulation time - t = 11.02 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 11.18 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 11.34 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 11.50 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 11.66 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 11.82 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 11.98 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 12.14 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 12.30 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 12.46 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 12.62 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.33]

Simulation time - t = 12.78 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 12.94 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.35]

Simulation time - t = 13.10 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 13.26 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 13.42 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.35]

Simulation time - t = 13.58 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 13.74 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 13.90 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 14.06 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 14.22 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 14.38 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.35]

Simulation time - t = 14.54 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 14.70 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 14.86 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 15.02 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 15.18 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 15.34 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 15.50 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 15.66 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 15.82 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.35]

Simulation time - t = 15.98 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 16.14 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 16.30 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 16.46 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 16.62 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 16.78 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 16.94 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 17.10 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 17.26 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 17.42 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 17.58 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 17.74 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 17.90 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 18.06 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 18.22 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 18.38 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.35]

Simulation time - t = 18.54 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 18.70 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.35]

Simulation time - t = 18.86 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.35]

Simulation time - t = 19.02 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 19.18 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.35]

Simulation time - t = 19.34 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 19.50 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.35]

Simulation time - t = 19.66 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Simulation time - t = 19.82 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.35]

Simulation time - t = 19.98 s

-200 0 200 400 600 800 0 2 4 6 8 10 12 14 16 18 20 x y [0; -179] [20; 877.39]

Elastic Damped Pendulum 🎬

Two-DOF elastic pendulum: the rigid rod is replaced by an axial spring of stiffness \(k_s\), giving coupled radial and angular equations of motion with independent damping factors. RK4 integration drives the SVG animation.

Code:
#rad
'<table><tr><td>
'<h4>Input parameters</h4>
'Gravitational acceleration -'g = 9.80665m/s^2
'Pendulum unstretched length -'l = 1m
'Pendulum mass -'m = 1kg
'Strut stiffness -'k_s = 40*(N/.m)
'Initial angle -'θ_0 = -179.9°|rad
'Initial angular velocity -'ω_0 = 0rad/s
'Initial length -'r_0 = 1.1*l
'Initial radial velocity -'v_0 = 0m/s
'Damping factor (normalized, radial) -'β_r = 0.05
'Damping factor (normalized, angular) -'β_θ = 0.01
'</td><td>
#hide
PlotWidth = 220','PlotHeight = 140','PlotSVG = 1
w = 1.2*l', 'h_ = 2/3*w
W = 150', 'H = 150
k = W/w
L = r_0*k
R = L/12
x = L*sin(θ_0)
y = L*cos(θ_0)
δ = 16
δ_x = 0.25*δ
δ_y = -2*δ
y_g = y - δ_y + R
#def svg$ = '<svg viewbox="'-100 - W/2' '-H' 'W + 200' '2*H  + 100'" xmlns="http://www.w3.org/2000/svg" version="1.1" style="font-family: Georgia Pro; font-size:14px; width:'W + 100'pt; height:'H + 100'pt;margin-left:-10pt;">
#def thin_style$ = style="stroke:goldenrod; stroke-width:1; fill:none;"
#def thick_style$ = style="stroke:steelblue; stroke-width:1.5; fill:none;"
#def ball_style$ = style="stroke:steelblue; stroke-width:0.5;  fill:url(#ball);"
#def bal0_style$ = style="stroke:steelblue; stroke-width:0.25;  fill:url(#ball); fill-opacity:0.5;"
#def solid_style$ = style="stroke:black; stroke-width:1; fill:#eee;"
#def load_style$ = style="stroke:steelblue; stroke-width:1; fill:steelblue;"
#include svg_drawing.cpd
#show
#val
'<br/><br/>
svg$
'<defs><radialGradient id="ball" cx="35%" cy="35%"><stop offset="0%" stop-color="lightcyan"/><stop offset="100%" stop-color="lightblue"/></radialGradient><pattern id="concrete" x="4" y="4" width="8" height="8" patternUnits="userSpaceOnUse"><rect x="0" y="0" width="8" height="8" fill="#eae9e8" /><circle cx="1" cy="1" r="1.2" fill="#ccb" /><circle cx="5" cy="2" r="1.6" fill="#dadad0" /><circle cx="4" cy="6" r="0.8" fill="#aa9" /><circle cx="3" cy="4" r="0.4" fill="#884" /><circle cx="7" cy="5" r="1.2" fill="#cacaba" /><circle cx="5" cy="3" r="0.9" fill="#fffded" /></pattern></defs>
'<polygon points="0,0 '-δ','-δ' 'δ','-δ'" solid_style$/>
line$(0; 0; 0; 0.4*L; thin_style$)
'<path d="M 0 '0.2*L' A '0.2*L' '0.2*L' 0 0 'θ_0 < 0°' '0.2*x' '0.2*y'" thin_style$/>
texth$(-1.5*δ*sign(θ_0);0.25*L;'θ_0*180/π'°)
line$(0; 0; x; y; thick_style$)
text$(x/2-δ_x*y/L; y/2+δ_x*x/L;450°+θ_0;'r_0' ('l') m)
circle$(0; 0; R/2; solid_style$)
circle$(0; 0; R/8; solid_style$)
circle$(l*k*sin(θ_0); l*k*cos(θ_0); R; bal0_style$)
circle$(x; y; R; ball_style$)
'<polygon points="'x','y_g + δ_y' 'x','y_g' 'x - δ_x','y_g + δ_y/3' 'x + δ_x','y_g + δ_y/3' 'x','y_g'" load_style$/>
texth$(x+3*δ_x; y_g-δ;g)
'</svg>
#equ
'</td></tr></table>
'Critical damping (radial) -'b_cr_r = 2*m*sqrt(k_s/m)
'Critical damping (angular) -'b_cr_θ = 2*m*l*sqrt(g/l)
'Radial damping -'b_r = β_r*b_cr_r
'Angular damping -'b_θ = β_θ*b_cr_θ
'Maximum simulation time -'t_max = 20s
'<h4>Solution by Runge-Kutta RK4 method (explicit)</h4>
'Differential equations
'<div style="border-left:solid 1pt black; margin-left:24pt; padding-left:3pt;">
#noc
m*r″ - m*r*θ′^2 + k_s*(r - l) + b_r*r′ - m*g*cos(θ) = 0
m*r*θ″ + 2*m*r′*θ′ + b_θ*θ′ + m*g*sin(θ) = 0
#equ
'</div>
'The II order system of 2 equations is first reduced to the following I order system of 4 equations
'<div style="border-left:solid 1pt black; margin-left:24pt; padding-left:3pt;">
#noc
r′ = v
v′ = r*ω^2 - k/m*(r - l) - b_r/m*v + g*cos(θ)
θ′ = ω
ω′ = -((2*m*v*ω + b_θ*ω + m*g*sin(θ))/(m*r))
#equ
'</div>
'The solution is performed iteratively
'Step size -'h = 0.01s
'Number of steps -'n = t_max/h
#hide
N = min(n; 120)
k_N = floor(n/N)
N = n\k_N
#show
'Allocate vectors
r = vector(n)
v = vector(n)
θ = vector(n)
ω = vector(n)
'Set initial conditions
r.1 = r_0','θ.1 = θ_0/1rad
v.1 = v_0','ω.1 = ω_0/1rad
'Define the system of ODEs
f_r(r; v; θ; ω) = v
f_v(r; v; θ; ω) = r*ω^2 + g*cos(θ) - k_s/m*(r - l) - b_r/m*v
f_θ(r; v; θ; ω) = ω
f_ω(r; v; θ; ω) = -((2*m*v*ω + b_θ*ω + m*g*sin(θ))/(m*r))
'Perform Runge-Kutta 4 steps
#for i = 1 : n - 1
    r_i = r.i', 'v_i = v.i
    θ_i = θ.i', 'ω_i = ω.i
    k_1r = h*v_i', 'k_1v = h*f_v(r_i; v_i; θ_i; ω_i)
    k_1θ = h*ω_i', 'k_1ω = h*f_ω(r_i; v_i; θ_i; ω_i)
    r_i = r.i + k_1r/2', 'v_i = v.i + k_1v/2
    θ_i = θ.i + k_1θ/2', 'ω_i = ω.i + k_1ω/2
    k_2r = h*v_i', 'k_2v = h*f_v(r_i; v_i; θ_i; ω_i)
    k_2θ = h*ω_i', 'k_2ω = h*f_ω(r_i; v_i; θ_i; ω_i)
    r_i = r.i + k_2r/2', 'v_i = v.i + k_2v/2
    θ_i = θ.i + k_2θ/2', 'ω_i = ω.i + k_2ω/2
    k_3r = h*v_i', 'k_3v = h*f_v(r_i; v_i; θ_i; ω_i)
    k_3θ = h*ω_i', 'k_3ω = h*f_ω(r_i; v_i; θ_i; ω_i)
    r_i = r.i + k_3r', 'v_i = v.i + k_3v
    θ_i = θ.i + k_3θ', 'ω_i = ω.i + k_3ω
    k_4r = h*v_i', 'k_4v = h*f_v(r_i; v_i; θ_i; ω_i)
    k_4θ = h*ω_i', 'k_4ω = h*f_ω(r_i; v_i; θ_i; ω_i)
    'Update values for the next step
    r.(i + 1) = r.i + (k_1r + 2*k_2r + 2*k_3r + k_4r)/6
    v.(i + 1) = v.i + (k_1v + 2*k_2v + 2*k_3v + k_4v)/6
    θ.(i + 1) = θ.i + (k_1θ + 2*k_2θ + 2*k_3θ + k_4θ)/6
    ω.(i + 1) = ω.i + (k_1ω + 2*k_2ω + 2*k_3ω + k_4ω)/6
    #hide
#loop
t(i) = i*h - h
r2d = 180/π
#show
'Kinetic energy -'E_k(i) = m/2*(v.i^2 + (r.i*ω.i)^2)|J
'Potential energy -'E_p(i) = k_s/2*(r.i - l)^2 - m*g*(r.i*cos(θ.i) - l)|J
'...
'<h4>Plot results</h4><table><tr><td>Angle - <var>θ</var>(<var>t</var>), [°]<br/>
$Plot{t(i)|θ.i*r2d @ i = 1 : n}
'</td><td>Length - <var>r</var>(<var>t</var>), [m]<br/>
$Plot{t(i)|r.i @ i = 1 : n}
'</td></tr><tr><td>Trajectory - <var>x</var>(<var>t</var>), <var>y</var>(<var>t</var>), [m]<br/>
$Plot{r.i*sin(θ.i)|-r.i*cos(θ.i) @ i = 1 : n}
'</td><td>Energy - <var>E</var>(<var>t</var>), [J]<br/>
$Plot{t(i)|E_p(i) + E_k(i) & 0s|0J & 0s|0J & 0s|0J & t(i)|E_p(i) & t(i)|E_k(i) @ i = 1 : n}
'<br/><b style="color:MediumVioletRed">━━</b> Potential - <var>E</var><sub>p</sub>,
'<b style="color:MediumSpringGreen">━━</b> Kinetic - <var>E</var><sub>k</sub>,
'<b style="color:Tomato">━━</b> Total - <var>E</var><sub>tot</sub>
'</td></tr></table>
'<style>.Series3, .Series4{stroke:none!Important; fill:none!Important;} .fr{display:none;} .fr svg{align:center;} .trace{stroke:red; stroke-width:1; fill:red;}</style>
'<h4>Animate results</h4>
#format 0.00
#hide
k = W/w
x = r*sin(θ)
y = r*cos(θ)
n_tr = 40
#for i_N = 1 : N
    #hide
    i = i_N*k_N
    xi = x.i*k
    yi = y.i*k
    t = t(i)
    i_0 = max((i_N - n_tr)*k_N; 2)
    n_0 = i - i_0
    Δr = abs(r_0 - l) + 0.2*l
    #show
    #val
    '<div class="fr" id="p4-fr-'i_N'">
    #equ
    #nosub
    'Simulation time -'t'<br/>
    '<table><tr><td>Angle - <var>θ</var>(<var>t</var>), [°]<br/>
    $Plot{t(i)|θ.i*r2d & t(j)|θ.j*r2d & t_max|θ_0/1rad*r2d & t_max|-θ_0/1rad*r2d @ j = 1 : i}
    '<br/>Length - <var>r</var>(<var>t</var>), [m]<br/>
    $Plot{t(i)|r.i & t(j)|r.j & t_max|l + Δr & t_max|l - Δr @ j = 1 : i}
    '</td><td>
    #val
    svg$
    #for j = 1 : n_0/2
        #hide
        j2 = i_0 + 2*j
        j1 = j2 - 2
        o = round(j/n_0*100)/100
        #show
        '<line x1="'x.j1*k'" y1="'y.j1*k'" x2="'x.j2*k'" y2="'y.j2*k'" class="trace" opacity="'o'"/>
    #loop
    '<polygon points="0,0 '-δ','-δ' 'δ','-δ'" solid_style$/>
    line$(0; 0; xi; yi; thick_style$)
    circle$(0; 0; R/2; solid_style$)
    circle$(0; 0; R/8; solid_style$)
    circle$(xi; yi; R; ball_style$)
    '</svg></td></tr></table></div>
#loop
'<script>(function(){$("#p4-fr-1").show();var i=1;var fr=$("#p4-fr-1");setInterval(function(){fr.hide();if(++i>'N')i=1;fr=$("#p4-fr-"+i);fr.show();},'1000*h*k_N');})();</script>
#equ
Rendered Output:

Input parameters

Gravitational acceleration - g = 9.81 ms2

Pendulum unstretched length - l = 1 m

Pendulum mass - m = 1 kg

Strut stiffness - ks = 40 Nm

Initial angle - θ0 = -179.9° = -3.14 rad

Initial angular velocity - ω0 = 0 rads

Initial length - r0 = 1.1 · l = 1.1 · 1 m = 1.1 m

Initial radial velocity - v0 = 0 ms

Damping factor (normalized, radial) - βr = 0.05

Damping factor (normalized, angular) - βθ = 0.01



-179.9°1.1 (1) mg

Critical damping (radial) - bcr_r = 2 · m ·   ksm = 2 · 1 kg ·   40 N ∕ m1 kg = 12.65 kg ∕ s

Critical damping (angular) - bcr_θ = 2 · m · l ·   gl = 2 · 1 kg · 1 m ·   9.81 m ∕ s21 m = 6.26 kg · m ∕ s

Radial damping - br = βr · bcr_r = 0.05 · 12.65 kg ∕ s = 0.632 kg ∕ s

Angular damping - bθ = βθ · bcr_θ = 0.01 · 6.26 kg · m ∕ s = 0.0626 kg · m ∕ s

Maximum simulation time - tmax = 20 s

Solution by Runge-Kutta RK4 method (explicit)

Differential equations

m · r″m · r · θ′2 + ks ·  ( rl )  + br · r′m · g · cos ( θ )  = 0

m · r · θ″ + 2 · m · r′ · θ′ + bθ · θ′ + m · g · sin ( θ )  = 0

The II order system of 2 equations is first reduced to the following I order system of 4 equations

r′ = v

v′ = r · ω2km ·  ( rl )  − brm · v + g · cos ( θ ) 

θ′ = ω

ω′ = - 2 · m · v · ω + bθ · ω + m · g · sin ( θ ) m · r

The solution is performed iteratively

Step size - h = 0.01 s

Number of steps - n = tmaxh = 20 s0.01 s = 2000

Allocate vectors

r = vector ( n )  = vector ( 2000 )  = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... 0]

v = vector ( n )  = vector ( 2000 )  = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... 0]

θ = vector ( n )  = vector ( 2000 )  = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... 0]

ω = vector ( n )  = vector ( 2000 )  = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... 0]

Set initial conditions

r1 = r0 = 1.1 m , θ1 = θ01 rad = -3.14 rad1 rad = -3.14

v1 = v0 = 0 m ∕ s , ω1 = ω01 rad = 0 rad ∕ s1 rad = 0 s-1

Define the system of ODEs

fr ( r; v; θ; ω )  = v

fv ( r; v; θ; ω )  = r · ω2 + g · cos ( θ )  − ksm ·  ( rl )  − brm · v

fθ ( r; v; θ; ω )  = ω

fω ( r; v; θ; ω )  = - 2 · m · v · ω + bθ · ω + m · g · sin ( θ ) m · r

Perform Runge-Kutta 4 steps

ri = r1 = 1.1 m , vi = v1 = 0 m ∕ s

θi = θ1 = -3.14 , ωi = ω1 = 0 s-1

k1r = h · vi = 0.01 s · 0 m ∕ s = 0 m , k1v = h · fv  ( ri; vi; θi; ωi )  = 0.01 s · fv  ( 1.1 m; 0 m ∕ s; -3.14; 0 s-1 )  = -0.138 m ∕ s

k = h · ωi = 0.01 s · 0 s-1 = 0 , k = h · fω  ( ri; vi; θi; ωi )  = 0.01 s · fω  ( 1.1 m; 0 m ∕ s; -3.14; 0 s-1 )  = 0.000156 s-1

ri = r1 + k1r2 = 1.1 m + 0 m2 = 1.1 m , vi = v1 + k1v2 = 0 m ∕ s + -0.138 m ∕ s2 = -0.069 m ∕ s

θi = θ1 + k2 = -3.14 + 02 = -3.14 , ωi = ω1 + k2 = 0 s-1 + 0.000156 s-12 = 7.78×10-5s-1

k2r = h · vi = 0.01 s ·  ( -0.069 m ∕ s )  = -0.00069 m , k2v = h · fv  ( ri; vi; θi; ωi )  = 0.01 s · fv  ( 1.1 m; -0.069 m ∕ s; -3.14; 7.78×10-5s-1 )  = -0.138 m ∕ s

k = h · ωi = 0.01 s · 7.78×10-5s-1 = 7.78×10-7 , k = h · fω  ( ri; vi; θi; ωi )  = 0.01 s · fω  ( 1.1 m; -0.069 m ∕ s; -3.14; 7.78×10-5s-1 )  = 0.000156 s-1

ri = r1 + k2r2 = 1.1 m + -0.00069 m2 = 1.1 m , vi = v1 + k2v2 = 0 m ∕ s + -0.138 m ∕ s2 = -0.0688 m ∕ s

θi = θ1 + k2 = -3.14 + 7.78×10-72 = -3.14 , ωi = ω1 + k2 = 0 s-1 + 0.000156 s-12 = 7.78×10-5s-1

k3r = h · vi = 0.01 s ·  ( -0.0688 m ∕ s )  = -0.000688 m , k3v = h · fv  ( ri; vi; θi; ωi )  = 0.01 s · fv  ( 1.1 m; -0.0688 m ∕ s; -3.14; 7.78×10-5s-1 )  = -0.137 m ∕ s

k = h · ωi = 0.01 s · 7.78×10-5s-1 = 7.78×10-7 , k = h · fω  ( ri; vi; θi; ωi )  = 0.01 s · fω  ( 1.1 m; -0.0688 m ∕ s; -3.14; 7.78×10-5s-1 )  = 0.000156 s-1

ri = r1 + k3r = 1.1 m +  ( -0.000688 m )  = 1.1 m , vi = v1 + k3v = 0 m ∕ s +  ( -0.137 m ∕ s )  = -0.137 m ∕ s

θi = θ1 + k = -3.14 + 7.78×10-7 = -3.14 , ωi = ω1 + k = 0 s-1 + 0.000156 s-1 = 0.000156 s-1

k4r = h · vi = 0.01 s ·  ( -0.137 m ∕ s )  = -0.00137 m , k4v = h · fv  ( ri; vi; θi; ωi )  = 0.01 s · fv  ( 1.1 m; -0.137 m ∕ s; -3.14; 0.000156 s-1 )  = -0.137 m ∕ s

k = h · ωi = 0.01 s · 0.000156 s-1 = 1.56×10-6 , k = h · fω  ( ri; vi; θi; ωi )  = 0.01 s · fω  ( 1.1 m; -0.137 m ∕ s; -3.14; 0.000156 s-1 )  = 0.000156 s-1

Update values for the next step

r2 = r1 + k1r + 2 · k2r + 2 · k3r + k4r6 = 1.1 m + 0 m + 2 ·  ( -0.00069 m )  + 2 ·  ( -0.000688 m )  +  ( -0.00137 m ) 6 = 1.1 m

v2 = v1 + k1v + 2 · k2v + 2 · k3v + k4v6 = 0 m ∕ s + -0.138 m ∕ s + 2 ·  ( -0.138 m ∕ s )  + 2 ·  ( -0.137 m ∕ s )  +  ( -0.137 m ∕ s ) 6 = -0.138 m ∕ s

θ2 = θ1 + k + 2 · k + 2 · k + k6 = -3.14 + 0 + 2 · 7.78×10-7 + 2 · 7.78×10-7 + 1.56×10-66 = -3.14

ω2 = ω1 + k + 2 · k + 2 · k + k6 = 0 s-1 + 0.000156 s-1 + 2 · 0.000156 s-1 + 2 · 0.000156 s-1 + 0.000156 s-16 = 0.000156 s-1

Kinetic energy - Ek ( i )  = m2 ·  ( vi2 +  ( ri · ωi ) 2 ) 

Potential energy - Ep ( i )  = ks2 ·  ( ril ) 2m · g ·  ( ri · cos ( θi )  − l ) 

...

Plot results
Angle - θ(t), [°]
-150 -100 -50 0 50 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [19.99; 132.96]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [19.99; 1.84]
Trajectory - x(t), y(t), [m]
-1.5 -1 -0.5 0 0.5 1 -1.25 -0.75 -0.25 0.25 0.75 1.25 x y [-1.35; -1.83] [1.3; 1.1]
Energy - E(t), [J]
0 2.5 5 7.5 10 12.5 15 17.5 20 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -0.798] [19.99; 20.79]
━━ Potential - Ep, ━━ Kinetic - Ek, ━━ Total - Etot
Animate results

Simulation time - t = 0.15 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0.7 0.8 0.9 1 1.1 1.2 1.3 0 2.5 5 7.5 10 12.5 15 17.5 20 y [0; 0.7] [20; 1.3]

Simulation time - t = 0.31 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0.7 0.8 0.9 1 1.1 1.2 1.3 0 2.5 5 7.5 10 12.5 15 17.5 20 y [0; 0.651] [20; 1.3]

Simulation time - t = 0.47 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0.5 0.6 0.7 0.8 0.9 1 1.1 1.2 1.3 0 2.5 5 7.5 10 12.5 15 17.5 20 y [0; 0.464] [20; 1.3]

Simulation time - t = 0.63 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0.5 0.6 0.7 0.8 0.9 1 1.1 1.2 1.3 0 2.5 5 7.5 10 12.5 15 17.5 20 y [0; 0.46] [20; 1.3]

Simulation time - t = 0.79 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0.5 0.6 0.7 0.8 0.9 1 1.1 1.2 1.3 0 2.5 5 7.5 10 12.5 15 17.5 20 y [0; 0.46] [20; 1.3]

Simulation time - t = 0.95 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0.5 0.6 0.7 0.8 0.9 1 1.1 1.2 1.3 0 2.5 5 7.5 10 12.5 15 17.5 20 y [0; 0.46] [20; 1.3]

Simulation time - t = 1.11 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0.5 0.6 0.7 0.8 0.9 1 1.1 1.2 1.3 0 2.5 5 7.5 10 12.5 15 17.5 20 y [0; 0.46] [20; 1.3]

Simulation time - t = 1.27 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0.5 0.6 0.7 0.8 0.9 1 1.1 1.2 1.3 0 2.5 5 7.5 10 12.5 15 17.5 20 y [0; 0.46] [20; 1.3]

Simulation time - t = 1.43 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0.5 0.6 0.7 0.8 0.9 1 1.1 1.2 1.3 0 2.5 5 7.5 10 12.5 15 17.5 20 y [0; 0.46] [20; 1.3]

Simulation time - t = 1.59 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0.5 0.6 0.7 0.8 0.9 1 1.1 1.2 1.3 0 2.5 5 7.5 10 12.5 15 17.5 20 y [0; 0.46] [20; 1.3]

Simulation time - t = 1.75 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0.5 0.6 0.7 0.8 0.9 1 1.1 1.2 1.3 0 2.5 5 7.5 10 12.5 15 17.5 20 y [0; 0.46] [20; 1.3]

Simulation time - t = 1.91 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0.5 0.6 0.7 0.8 0.9 1 1.1 1.2 1.3 0 2.5 5 7.5 10 12.5 15 17.5 20 y [0; 0.46] [20; 1.3]

Simulation time - t = 2.07 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0.5 0.6 0.7 0.8 0.9 1 1.1 1.2 1.3 0 2.5 5 7.5 10 12.5 15 17.5 20 y [0; 0.46] [20; 1.3]

Simulation time - t = 2.23 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.37]

Simulation time - t = 2.39 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.56]

Simulation time - t = 2.55 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.79]

Simulation time - t = 2.71 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 2.87 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 3.03 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 3.19 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 3.35 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 3.51 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 3.67 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 3.83 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 3.99 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 4.15 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 4.31 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 4.47 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 4.63 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 4.79 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 4.95 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 5.11 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 5.27 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 5.43 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 5.59 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 5.75 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 5.91 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 6.07 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 6.23 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 6.39 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 6.55 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 6.71 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 6.87 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 7.03 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 7.19 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 7.35 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 7.51 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 7.67 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 7.83 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 7.99 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 8.15 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 8.31 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 8.47 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 8.63 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 8.79 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 8.95 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 9.11 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 9.27 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 9.43 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 9.59 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 9.75 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 9.91 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 10.07 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 10.23 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 10.39 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 10.55 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 10.71 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 10.87 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 11.03 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 11.19 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 11.35 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 11.51 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 11.67 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 11.83 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 11.99 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 12.15 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 12.31 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 12.47 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 12.63 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 12.79 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 12.95 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 13.11 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 13.27 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 13.43 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 13.59 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 13.75 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 13.91 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 14.07 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 14.23 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 14.39 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 14.55 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 14.71 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 14.87 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 15.03 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 15.19 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 15.35 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 15.51 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 15.67 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 15.83 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 15.99 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 16.15 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 16.31 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 16.47 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 16.63 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 16.79 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 16.95 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 17.11 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 17.27 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 17.43 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 17.59 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 17.75 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 17.91 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 18.07 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 18.23 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 18.39 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 18.55 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 18.71 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 18.87 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 19.03 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 19.19 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 19.35 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 19.51 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 19.67 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 19.83 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Simulation time - t = 19.99 s

Angle - θ(t), [°]
-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -179.9] [20; 179.9]
Length - r(t), [m]
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 1.84]

Double Damped Pendulum 🎬

Damped double pendulum: two coupled rotational ODEs in \(θ_1\) and \(θ_2\) integrated with RK4. The chaotic trajectory of the lower bob is animated in SVG and traced as a phase plot.

Code:
#rad
'<table width="120%"><tr><td>
'<h4>Input parameters</h4>
'Gravitational acceleration -'g = 9.80665m/s^2
'Pendulum lengths -'l_1 = 1.5m', 'l_2 = 1m
'Total length -'l = l_1 + l_2
'Pendulum masses -'m_1 = 2kg', 'm_2 = 1kg
'Total mass -'m = m_1 + m_2
'Initial angles
θ_01 = -90°|rad', 'θ_02 = -120°|rad
'Initial angular velocities
ω_01 = 0rad/s', 'ω_02 = 0rad/s
'Damping factor (normalized) -'β = 0.01
'</td><td>
#hide
PlotWidth = 220','PlotHeight = 140','PlotSVG = 1
w = 1.2*l', 'h_ = w
W = 220', 'H = 200
k = W/w
L_1 = l_1*k
L_2 = l_2*k
L = l*k
R = L/15
r = 0.15*L
m_ave = m/2
R_1 = cbrt(m_1/m_ave)*R
R_2 = cbrt(m_2/m_ave)*R
x_1 = L_1*sin(θ_01)
y_1 = L_1*cos(θ_01)
x_2 = x_1 + L_2*sin(θ_02)
y_2 = y_1 + L_2*cos(θ_02)
δ = 15
δ_x = 0.25*δ
δ_y = -2*δ
y_g1 = y_1 - δ_y + R
y_g2 = y_2 - δ_y + R
#def svg$ = '<svg viewbox="'-W/2' '-H' 'W' '2*H'" xmlns="http://www.w3.org/2000/svg" version="1.1" style="font-family: Georgia Pro; font-size:14px; width:'W+20'pt; height:'H+50'pt;margin-left:-10pt;">
#def thin_style$ = class="thin"
#def thick_style$ = class="thick"
#def ball_style$ = class="ball"
#def solid_style$ = class="solid"
#def load_style$ = class="load"
#include svg_drawing.cpd
#show
#val
'<style>.thin{stroke:goldenrod; stroke-width:1; fill:none;} .thick{stroke:steelblue; stroke-width:1.5; fill:none;} .ball{stroke:steelblue; stroke-width:0.5;  fill:url(#ball);} .solid{stroke:black; stroke-width:1; fill:#eee;} .load{stroke:steelblue; stroke-width:1; fill:steelblue;}</style>
svg$
'<defs><radialGradient id="ball" cx="35%" cy="35%"><stop offset="0%" stop-color="lightcyan"/><stop offset="100%" stop-color="lightblue"/></radialGradient><pattern id="concrete" x="4" y="4" width="8" height="8" patternUnits="userSpaceOnUse"><rect x="0" y="0" width="8" height="8" fill="#eae9e8" /><circle cx="1" cy="1" r="1.2" fill="#ccb" /><circle cx="5" cy="2" r="1.6" fill="#dadad0" /><circle cx="4" cy="6" r="0.8" fill="#aa9" /><circle cx="3" cy="4" r="0.4" fill="#884" /><circle cx="7" cy="5" r="1.2" fill="#cacaba" /><circle cx="5" cy="3" r="0.9" fill="#fffded" /></pattern></defs>
'<polygon points="0,0 '-δ','-δ' 'δ','-δ'" solid_style$/>
line$(0; 0; 0; 5/3*r; thin_style$)
'<path d="M 0 '0.15*L' A 'r' 'r' 0 0 'θ_01 < 0°' 'r*x_1/L_1' 'r*y_1/L_1'" thin_style$/>
'<path d="M 'x_1' 'y_1 + r' A 'r' 'r' 0 0 'θ_02 < 0°' 'x_1 + r*(x_2 - x_1)/L_2' 'y_1 + r*(y_2 - y_1)/L_2'" thin_style$/>
texth$(-1.2*δ*sign(θ_01);0.2*L;'θ_01*180/π'°)
texth$(x_1-1.2*δ*sign(θ_02);y_1+0.2*L;'θ_02*180/π'°)
line$(0; 0; x_1; y_1; thick_style$)
line$(x_1; y_1; x_2; y_2; thick_style$)
text$(x_1/2-δ_x*y_1/L_1; y_1/2+δ_x*x_1/L_1;450°+θ_01;'l_1' m)
text$((x_1+x_2)/2-δ_x*(y_2-y_1)/L_2; (y_1+y_2)/2+δ_x*(x_2-x_1)/L_2;450°+θ_02;'l_2' m)
circle$(0; 0; R/2; solid_style$)
circle$(0; 0; R/8; solid_style$)
circle$(x_1; y_1; R_1; ball_style$)
circle$(x_2; y_2; R_2; ball_style$)
'<polygon points="'x_1','y_g1 + δ_y' 'x_1','y_g1' 'x_1 - δ_x','y_g1 + δ_y/3' 'x_1 + δ_x','y_g1 + δ_y/3' 'x_1','y_g1'" load_style$/>
'<polygon points="'x_2','y_g2 + δ_y' 'x_2','y_g2' 'x_2 - δ_x','y_g2 + δ_y/3' 'x_2 + δ_x','y_g2 + δ_y/3' 'x_2','y_g2'" load_style$/>
texth$(x_1+3*δ_x; y_g1+δ_x;g)
texth$(x_2+3*δ_x; y_g2+δ_x;g)
'</svg>
#equ
'</td></tr></table>
'Critical damping
b_cr,1 = 2*m_1*sqrt(g*l_1)','b_cr,2 = 2*m_2*sqrt(g*l_2)
'Damping factors (uncoupled)
b_1 = β*b_cr,1','b_2 = β*b_cr,2
'Maximum simulation time -'t_max = 20s
'<h4>Solution by Runge-Kutta RK4 method (explicit)</h4>
'Differential equations (<a href="https://seamplex.com/feenox/examples/daes.html#the-double-pendulum">https://seamplex.com</a>)
#noc
m*l_1^2*θ″_1 + m_2*l_1*l_2*θ″_2*cos(Δ_θ) + m_2*l_1*l_2*θ′_2^2*sin(Δ_θ) + l_1*m*g*sin(θ_1) + b_1*θ′_1 = 0
m_2*l_2^2*θ″_2 + m_2*l_1*l_2*θ″_1*cos(Δ_θ) - m_2*l_1*l_2*θ′_1^2*sin(Δ_θ) + l_2*m_2*g*sin(θ_2) + b_2*θ′_2 = 0
#equ
'The II order system of 2 equations is first reduced to the following I order system of 4 equations
#noc
θ′_1 = ω_1
ω_1′ = -(m_2*l_1*ω_1^2*sin(2*Δ(θ_1; θ_2)) + 2*m_2*sin(Δ(θ_1; θ_2))*(l_2*ω_2^2 + g*cos(θ_2)) + 2*g*m_1*sin(θ_1) + b_1*ω_1)*(1/(l_1*D(θ_1; θ_2)))
θ′_2 = ω_2
ω_2′ = (m_2*l_2*ω_2^2*sin(2*Δ(θ_1; θ_2)) + 2*m*sin(Δ(θ_1; θ_2))*(l_1*ω_1^2 + g*cos(θ_1)) - b_2*ω_2)*(W1/(l_2*D(θ_1; θ_2)))
'where'D = 2*(m_1 + m_2*sin(Δ_θ)^2)
#equ
'The solution is performed iteratively
'Step size -'h = 0.001s
'Number of steps -'n = t_max/h
#hide
N = min(n; 120)
k_N = floor(n/N)
N = n\k_N
#show
'Allocate vectors
θ_1 = vector(n)'<br/>'ω_1 = vector(n)
θ_2 = vector(n)'<br/>'ω_2 = vector(n)
'Set initial conditions
θ_1.1 = θ_01/1rad','ω_1.1 = ω_01/1rad
θ_2.1 = θ_02/1rad','ω_2.1 = ω_02/1rad
'Define the system of ODEs
Δ(θ_1; θ_2) = θ_1 - θ_2
D(θ_1; θ_2) = 2*(m_1 + m_2*sin(Δ(θ_1; θ_2))^2)
f_θ1(θ_1; ω_1; θ_2; ω_2) = ω_1
f_ω1(θ_1; ω_1; θ_2; ω_2) = -(m_2*l_1*ω_1^2*sin(2*Δ(θ_1; θ_2)) + 2*m_2*sin(Δ(θ_1; θ_2))*(l_2*ω_2^2 + g*cos(θ_2)) + 2*g*m_1*sin(θ_1) + b_1*ω_1)*(1/(l_1*D(θ_1; θ_2)))
f_θ2(θ_1; ω_1; θ_2; ω_2) = ω_2
f_ω2(θ_1; ω_1; θ_2; ω_2) = (m_2*l_2*ω_2^2*sin(2*Δ(θ_1; θ_2)) + 2*m*sin(Δ(θ_1; θ_2))*(l_1*ω_1^2 + g*cos(θ_1)) - b_2*ω_2)*(1/(l_2*D(θ_1; θ_2)))
#equ
'Perform Runge-Kutta 4 steps
#for i = 1 : n - 1
    θ_1i = θ_1.i', 'ω_1i = ω_1.i
    θ_2i = θ_2.i', 'ω_2i = ω_2.i
    k_1θ1 = h*ω_1i', 'k_1ω1 = h*f_ω1(θ_1i; ω_1i; θ_2i; ω_2i)
    k_1θ2 = h*ω_2i', 'k_1ω2 = h*f_ω2(θ_1i; ω_1i; θ_2i; ω_2i)
    θ_1i = θ_1.i + k_1θ1/2', 'ω_1i = ω_1.i + k_1ω1/2
    θ_2i = θ_2.i + k_1θ2/2', 'ω_2i = ω_2.i + k_1ω2/2
    k_2θ1 = h*ω_1i', 'k_2ω1 = h*f_ω1(θ_1i; ω_1i; θ_2i; ω_2i)
    k_2θ2 = h*ω_2i', 'k_2ω2 = h*f_ω2(θ_1i; ω_1i; θ_2i; ω_2i)
    θ_1i = θ_1.i + k_2θ1/2', 'ω_1i = ω_1.i + k_2ω1/2
    θ_2i = θ_2.i + k_2θ2/2', 'ω_2i = ω_2.i + k_2ω2/2
    k_3θ1 = h*ω_1i', 'k_3ω1 = h*f_ω1(θ_1i; ω_1i; θ_2i; ω_2i)
    k_3θ2 = h*ω_2i', 'k_3ω2 = h*f_ω2(θ_1i; ω_1i; θ_2i; ω_2i)
    θ_1i = θ_1.i + k_3θ1', 'ω_1i = ω_1.i + k_3ω1
    θ_2i = θ_2.i + k_3θ2', 'ω_2i = ω_2.i + k_3ω2
    k_4θ1 = h*ω_1i', 'k_4ω1 = h*f_ω1(θ_1i; ω_1i; θ_2i; ω_2i)
    k_4θ2 = h*ω_2i', 'k_4ω2 = h*f_ω2(θ_1i; ω_1i; θ_2i; ω_2i)
    'Update values for the next step
    θ_1.(i + 1) = θ_1.i + (k_1θ1 + 2*k_2θ1 + 2*k_3θ1 + k_4θ1)/6
    ω_1.(i + 1) = ω_1.i + (k_1ω1 + 2*k_2ω1 + 2*k_3ω1 + k_4ω1)/6
    θ_2.(i + 1) = θ_2.i + (k_1θ2 + 2*k_2θ2 + 2*k_3θ2 + k_4θ2)/6
    ω_2.(i + 1) = ω_2.i + (k_1ω2 + 2*k_2ω2 + 2*k_3ω2 + k_4ω2)/6
    #hide
#loop
t(i) = i*h - h
r2d = 180/π
x_1 = l_1*sin(θ_1)
y_1 = l_1*cos(θ_1)
x_2 = x_1 + l_2*sin(θ_2)
y_2 = y_1 + l_2*cos(θ_2)
#show
'...
' Kinetic energy of mass <var>m</var><sub>1</sub> -'E_k1(i) = m_1/2*l_1^2*ω_1.i^2
' Kinetic energy of mass <var>m</var><sub>2</sub
E_k2(i) = m_2/2*(l_1^2*ω_1.i^2 + l_2^2*ω_2.i^2 + 2*l_1*l_2*ω_1.i*ω_2.i*cos(θ_1.i - θ_2.i))
' Total kinetic energy -'E_k(i) = E_k1(i) + E_k2(i)
' Potential energy of mass <var>m</var><sub>1</sub> -'E_p1(i) = m_1*g*l_1*(1 - cos(θ_1.i))
' Potential energy of mass <var>m</var><sub>2</sub> -'E_p2(i) = m_2*g*(l - (l_1*cos(θ_1.i) + l_2*cos(θ_2.i)))
' Total potential energy -'E_p(i) = E_p1(i) + E_p2(i)
'<h4>Plot results</h4>
'<table><tr><td>Top angle - <var>θ</var><sub>1</sub>(<var>t</var>), [°]
$Plot{t(i)|θ_1.i*r2d @ i = 1 : n}
'</td><td>Bottom angle - <var>θ</var><sub>2</sub>(<var>t</var>), [°]
$Plot{t(i)|θ_2.i*r2d @ i = 1 : n}
'</td></tr><tr><td>Trajectory - <var>x</var>(<var>t</var>), <var>y</var>(<var>t</var>), [m]
$Plot{x_1.i|-y_1.i & 0m|0m & 0m|0m & 0m|0m & 0m|0m & x_2.i|-y_2.i @ i = 1 : n}
'</td><td>Еnergy - <var>E</var>(<var>t</var>), [J]
$Plot{t(i)|E_p(i) + E_k(i) & 0s|0J & 0s|0J & 0s|0J & t(i)|E_p(i) & t(i)|E_k(i) @ i = 1 : n}
'<br/><b style="color:MediumVioletRed">━━</b> Potential - <var>E</var><sub>p</sub>,
'<b style="color:DarkCyan">━━</b> Kinetic - <var>E</var><sub>k</sub>,
'<b style="color:Tomato">━━</b> Total - <var>E</var><sub>tot</sub>
'</td></tr></table>
'<style>.Series3, .Series4{stroke:none!Important; fill:none!Important;} .fr{display:none;} .fr svg{margin-right:64pt; align:center;} .trace{stroke:red; stroke-width:1; fill:none; opacity:0.5;}</style>
'<h4>Animate results</h4>
#format 0.00
#hide
k = W/w
x1 = round(x_1*k*10)/10','y1 = round(y_1*k*10)/10
x2 = round(x_2*k*10)/10','y2 = round(y_2*k*10)/10
p = join_cols(x2; y2)
n_tr = 40
#val
#show
'<script>var p ='p'</script>
#for i_N = 1 : N
    #hide
    i = i_N*k_N
    x_1i = x1.i','y_1i = y1.i
    x_2i = x2.i','y_2i = y2.i
    t = t(i)
    i_0 = max((i_N - n_tr)*k_N; 2)
    #show
    #val
    '<div class="fr" id="p3v2-fr-'i_N'">
    #equ
    #nosub
    'Simulation time -'t'<br/>
    '<table width="120%"><tr><td>Top angle - <var>θ</var><sub>1</sub>(<var>t</var>), [°]<br/>
    $Plot{t(i)|θ_1.i*r2d & t(j)|θ_1.j*r2d & t_max|θ_01/1rad*r2d & t_max|-θ_01/1rad*r2d @ j = 1 : i}
    'Bottom angle - <var>θ</var><sub>2</sub>(<var>t</var>), [°]<br/>
    $Plot{t(i)|θ_2.i*r2d & t(j)|θ_2.j*r2d & t_max|θ_02/1rad*r2d & t_max|-θ_02/1rad*r2d @ j = 1 : i}
    '</td><td>
    #val
    svg$
    '<polyline points="" class="trace" id="trace-'i_N'"/>' _
    '<polygon points="0,0 '-δ','-δ' 'δ','-δ'" solid_style$/>' _
    line$(0; 0; x_1i; y_1i; thick_style$)' _
    line$(x_1i; y_1i; x_2i; y_2i; thick_style$)' _
    circle$(0; 0; R/2; solid_style$)' _
    circle$(0; 0; R/8; solid_style$)' _
    circle$(x_1i; y_1i; R_1; ball_style$)' _
    circle$(x_2i; y_2i; R_2; ball_style$)
    '</svg></td></tr></table></div>
    '<script>$("#trace-'i_N'").attr("points", p.slice('i_0','i + 1').map(function(e){return e[0]+","+e[1];}).join(" "));</script>
#loop
'<script>(function(){$("#p3v2-fr-1").show();var i=1;var fr=$("#p3v2-fr-1");setInterval(function(){fr.hide();if(++i>'N')i=1;fr=$("#p3v2-fr-"+i);fr.show();},'900*h*k_N');})();</script>
#equ
Rendered Output:

Input parameters

Gravitational acceleration - g = 9.81 ms2

Pendulum lengths - l1 = 1.5 m , l2 = 1 m

Total length - l = l1 + l2 = 1.5 m + 1 m = 2.5 m

Pendulum masses - m1 = 2 kg , m2 = 1 kg

Total mass - m = m1 + m2 = 2 kg + 1 kg = 3 kg

Initial angles

θ01 = -90° = -1.57 rad , θ02 = -120° = -2.09 rad

Initial angular velocities

ω01 = 0 rads , ω02 = 0 rads

Damping factor (normalized) - β = 0.01

-90°-120°1.5 m1 mgg

Critical damping

bcr,1 = 2 · m1 ·    g · l1 = 2 · 2 kg ·     9.81 m ∕ s2 · 1.5 m = 15.34 kg · m ∕ s , bcr,2 = 2 · m2 ·    g · l2 = 2 · 1 kg ·     9.81 m ∕ s2 · 1 m = 6.26 kg · m ∕ s

Damping factors (uncoupled)

b1 = β · bcr,1 = 0.01 · 15.34 kg · m ∕ s = 0.153 kg · m ∕ s , b2 = β · bcr,2 = 0.01 · 6.26 kg · m ∕ s = 0.0626 kg · m ∕ s

Maximum simulation time - tmax = 20 s

Solution by Runge-Kutta RK4 method (explicit)

Differential equations (https://seamplex.com)

m · l12 · θ″1 + m2 · l1 · l2 · θ″2 · cos ( Δθ )  + m2 · l1 · l2 · θ′22 · sin ( Δθ )  + l1 · m · g · sin ( θ1 )  + b1 · θ′1 = 0

m2 · l22 · θ″2 + m2 · l1 · l2 · θ″1 · cos ( Δθ )  − m2 · l1 · l2 · θ′12 · sin ( Δθ )  + l2 · m2 · g · sin ( θ2 )  + b2 · θ′2 = 0

The II order system of 2 equations is first reduced to the following I order system of 4 equations

θ′1 = ω1

ω1′ = - ( m2 · l1 · ω12 · sin ( 2 · Δ  ( θ1; θ2 )  )  + 2 · m2 · sin ( Δ  ( θ1; θ2 )  )  ·  ( l2 · ω22 + g · cos ( θ2 )  )  + 2 · g · m1 · sin ( θ1 )  + b1 · ω1 )  · 1l1 · D  ( θ1; θ2 ) 

θ′2 = ω2

ω2′ =  ( m2 · l2 · ω22 · sin ( 2 · Δ  ( θ1; θ2 )  )  + 2 · m · sin ( Δ  ( θ1; θ2 )  )  ·  ( l1 · ω12 + g · cos ( θ1 )  )  − b2 · ω2 )  · W1l2 · D  ( θ1; θ2 ) 

where D = 2 ·  ( m1 + m2 · sin ( Δθ ) 2 ) 

The solution is performed iteratively

Step size - h = 0.001 s

Number of steps - n = tmaxh = 20 s0.001 s = 20000

Allocate vectors

θ1 = vector ( n )  = vector ( 20000 )  = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... 0]
ω1 = vector ( n )  = vector ( 20000 )  = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... 0]

θ2 = vector ( n )  = vector ( 20000 )  = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... 0]
ω2 = vector ( n )  = vector ( 20000 )  = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... 0]

Set initial conditions

θ1.1 = θ011 rad = -1.57 rad1 rad = -1.57 , ω1.1 = ω011 rad = 0 rad ∕ s1 rad = 0 s-1

θ2.1 = θ021 rad = -2.09 rad1 rad = -2.09 , ω2.1 = ω021 rad = 0 rad ∕ s1 rad = 0 s-1

Define the system of ODEs

Δ ( θ1; θ2 )  = θ1θ2

D ( θ1; θ2 )  = 2 ·  ( m1 + m2 · sin ( Δ  ( θ1; θ2 )  ) 2 ) 

fθ1 ( θ1; ω1; θ2; ω2 )  = ω1

fω1 ( θ1; ω1; θ2; ω2 )  = - ( m2 · l1 · ω12 · sin ( 2 · Δ  ( θ1; θ2 )  )  + 2 · m2 · sin ( Δ  ( θ1; θ2 )  )  ·  ( l2 · ω22 + g · cos ( θ2 )  )  + 2 · g · m1 · sin ( θ1 )  + b1 · ω1 )  · 1l1 · D  ( θ1; θ2 ) 

fθ2 ( θ1; ω1; θ2; ω2 )  = ω2

fω2 ( θ1; ω1; θ2; ω2 )  =  ( m2 · l2 · ω22 · sin ( 2 · Δ  ( θ1; θ2 )  )  + 2 · m · sin ( Δ  ( θ1; θ2 )  )  ·  ( l1 · ω12 + g · cos ( θ1 )  )  − b2 · ω2 )  · 1l2 · D  ( θ1; θ2 ) 

Perform Runge-Kutta 4 steps

θ1i = θ1.1 = -1.57 , ω1i = ω1.1 = 0 s-1

θ2i = θ2.1 = -2.09 , ω2i = ω2.1 = 0 s-1

k1θ1 = h · ω1i = 0.001 s · 0 s-1 = 0 , k1ω1 = h · fω1  ( θ1i; ω1i; θ2i; ω2i )  = 0.001 s · fω1  ( -1.57; 0 s-1; -2.09; 0 s-1 )  = 0.00654 s-1

k1θ2 = h · ω2i = 0.001 s · 0 s-1 = 0 , k1ω2 = h · fω2  ( θ1i; ω1i; θ2i; ω2i )  = 0.001 s · fω2  ( -1.57; 0 s-1; -2.09; 0 s-1 )  = 4×10-19s-1

θ1i = θ1.1 + k1θ12 = -1.57 + 02 = -1.57 , ω1i = ω1.1 + k1ω12 = 0.00327 s-1

θ2i = θ2.1 + k1θ22 = -2.09 + 02 = -2.09 , ω2i = ω2.1 + k1ω22 = 0 s-1 + 4×10-19s-12 = 2×10-19s-1

k2θ1 = h · ω1i = 0.001 s · 0.00327 s-1 = 3.27×10-6 , k2ω1 = h · fω1  ( θ1i; ω1i; θ2i; ω2i )  = 0.001 s · fω1  ( -1.57; 0.00327 s-1; -2.09; 2×10-19s-1 )  = 0.00654 s-1

k2θ2 = h · ω2i = 0.001 s · 2×10-19s-1 = 2×10-22 , k2ω2 = h · fω2  ( θ1i; ω1i; θ2i; ω2i )  = 0.001 s · fω2  ( -1.57; 0.00327 s-1; -2.09; 2×10-19s-1 )  = 1.07×10-8s-1

θ1i = θ1.1 + k2θ12 = -1.57 + 3.27×10-62 = -1.57 , ω1i = ω1.1 + k2ω12 = 0.00327 s-1

θ2i = θ2.1 + k2θ22 = -2.09 + 2×10-222 = -2.09 , ω2i = ω2.1 + k2ω22 = 0 s-1 + 1.07×10-8s-12 = 5.34×10-9s-1

k3θ1 = h · ω1i = 0.001 s · 0.00327 s-1 = 3.27×10-6 , k3ω1 = h · fω1  ( θ1i; ω1i; θ2i; ω2i )  = 0.001 s · fω1  ( -1.57; 0.00327 s-1; -2.09; 5.34×10-9s-1 )  = 0.00654 s-1

k3θ2 = h · ω2i = 0.001 s · 5.34×10-9s-1 = 5.34×10-12 , k3ω2 = h · fω2  ( θ1i; ω1i; θ2i; ω2i )  = 0.001 s · fω2  ( -1.57; 0.00327 s-1; -2.09; 5.34×10-9s-1 )  = 2.14×10-8s-1

θ1i = θ1.1 + k3θ1 = -1.57 + 3.27×10-6 = -1.57 , ω1i = ω1.1 + k3ω1 = 0.00654 s-1

θ2i = θ2.1 + k3θ2 = -2.09 + 5.34×10-12 = -2.09 , ω2i = ω2.1 + k3ω2 = 0 s-1 + 2.14×10-8s-1 = 2.14×10-8s-1

k4θ1 = h · ω1i = 0.001 s · 0.00654 s-1 = 6.54×10-6 , k4ω1 = h · fω1  ( θ1i; ω1i; θ2i; ω2i )  = 0.001 s · fω1  ( -1.57; 0.00654 s-1; -2.09; 2.14×10-8s-1 )  = 0.00654 s-1

k4θ2 = h · ω2i = 0.001 s · 2.14×10-8s-1 = 2.14×10-11 , k4ω2 = h · fω2  ( θ1i; ω1i; θ2i; ω2i )  = 0.001 s · fω2  ( -1.57; 0.00654 s-1; -2.09; 2.14×10-8s-1 )  = 6.41×10-8s-1

Update values for the next step

θ1.2 = θ1.1 + k1θ1 + 2 · k2θ1 + 2 · k3θ1 + k4θ16 = -1.57 + 0 + 2 · 3.27×10-6 + 2 · 3.27×10-6 + 6.54×10-66 = -1.57

ω1.2 = ω1.1 + k1ω1 + 2 · k2ω1 + 2 · k3ω1 + k4ω16 = 0 s-1 + 0.00654 s-1 + 2 · 0.00654 s-1 + 2 · 0.00654 s-1 + 0.00654 s-16 = 0.00654 s-1

θ2.2 = θ2.1 + k1θ2 + 2 · k2θ2 + 2 · k3θ2 + k4θ26 = -2.09 + 0 + 2 · 2×10-22 + 2 · 5.34×10-12 + 2.14×10-116 = -2.09

ω2.2 = ω2.1 + k1ω2 + 2 · k2ω2 + 2 · k3ω2 + k4ω26 = 0 s-1 + 4×10-19s-1 + 2 · 1.07×10-8s-1 + 2 · 2.14×10-8s-1 + 6.41×10-8s-16 = 2.14×10-8s-1

...

Kinetic energy of mass m1 - Ek1 ( i )  = m12 · l12 · ω1.i2

Kinetic energy of mass m2

Ek2 ( i )  = m22 ·  ( l12 · ω1.i2 + l22 · ω2.i2 + 2 · l1 · l2 · ω1.i · ω2.i · cos ( θ1.iθ2.i )  ) 

Total kinetic energy - Ek ( i )  = Ek1  ( i )  + Ek2  ( i ) 

Potential energy of mass m1 - Ep1 ( i )  = m1 · g · l1 ·  ( 1 − cos ( θ1.i )  ) 

Potential energy of mass m2 - Ep2 ( i )  = m2 · g ·  ( l −  ( l1 · cos ( θ1.i )  + l2 · cos ( θ2.i )  )  ) 

Total potential energy - Ep ( i )  = Ep1  ( i )  + Ep2  ( i ) 

Plot results
Top angle - θ1(t), [°] -80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.23] Bottom angle - θ2(t), [°] -400 -200 0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -466.28] [20; 926.94]
Trajectory - x(t), y(t), [m] -2.5 -2 -1.5 -1 -0.5 0 0.5 -2 -1 0 1 2 x y [-2.37; -2.49] [2.45; 0.622] Еnergy - E(t), [J] 0 0.01 0.02 0.03 0.04 0.05 0.06 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; 0] [20; 0.0588]
━━ Potential - Ep, ━━ Kinetic - Ek, ━━ Total - Etot
Animate results

Simulation time - t = 0.17 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 90]

Bottom angle - θ2(t), [°]

-100 -75 -50 -25 0 25 50 75 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -120] [20; 120]
'''''''

Simulation time - t = 0.33 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 90]

Bottom angle - θ2(t), [°]

-100 -75 -50 -25 0 25 50 75 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -120] [20; 120]
'''''''

Simulation time - t = 0.50 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 90]

Bottom angle - θ2(t), [°]

-100 -75 -50 -25 0 25 50 75 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -120] [20; 120]
'''''''

Simulation time - t = 0.66 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 90]

Bottom angle - θ2(t), [°]

-100 -75 -50 -25 0 25 50 75 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -120] [20; 120]
'''''''

Simulation time - t = 0.83 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 90]

Bottom angle - θ2(t), [°]

-100 -75 -50 -25 0 25 50 75 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -120] [20; 120]
'''''''

Simulation time - t = 1.00 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 90]

Bottom angle - θ2(t), [°]

-100 -75 -50 -25 0 25 50 75 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -120] [20; 120]
'''''''

Simulation time - t = 1.16 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 90]

Bottom angle - θ2(t), [°]

-100 -75 -50 -25 0 25 50 75 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -120] [20; 120]
'''''''

Simulation time - t = 1.33 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 90]

Bottom angle - θ2(t), [°]

-100 -75 -50 -25 0 25 50 75 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -120] [20; 120]
'''''''

Simulation time - t = 1.49 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 91.87]

Bottom angle - θ2(t), [°]

-100 -75 -50 -25 0 25 50 75 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -120] [20; 120]
'''''''

Simulation time - t = 1.66 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.01]

Bottom angle - θ2(t), [°]

-100 -75 -50 -25 0 25 50 75 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -120] [20; 120]
'''''''

Simulation time - t = 1.83 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.23]

Bottom angle - θ2(t), [°]

-100 -75 -50 -25 0 25 50 75 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -120] [20; 120]
'''''''

Simulation time - t = 1.99 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.23]

Bottom angle - θ2(t), [°]

-100 -75 -50 -25 0 25 50 75 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -120] [20; 120]
'''''''

Simulation time - t = 2.16 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.23]

Bottom angle - θ2(t), [°]

-100 -75 -50 -25 0 25 50 75 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -120] [20; 120]
'''''''

Simulation time - t = 2.32 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.23]

Bottom angle - θ2(t), [°]

-100 -75 -50 -25 0 25 50 75 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -120] [20; 120]
'''''''

Simulation time - t = 2.49 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.23]

Bottom angle - θ2(t), [°]

-100 -75 -50 -25 0 25 50 75 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -120] [20; 120]
'''''''

Simulation time - t = 2.66 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.23]

Bottom angle - θ2(t), [°]

-100 -75 -50 -25 0 25 50 75 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -120] [20; 120]
'''''''

Simulation time - t = 2.82 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.23]

Bottom angle - θ2(t), [°]

-100 -75 -50 -25 0 25 50 75 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -120] [20; 120]
'''''''

Simulation time - t = 2.99 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.23]

Bottom angle - θ2(t), [°]

-100 -75 -50 -25 0 25 50 75 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -120] [20; 120]
'''''''

Simulation time - t = 3.15 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.23]

Bottom angle - θ2(t), [°]

-100 -50 0 50 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -138.39] [20; 120]
'''''''

Simulation time - t = 3.32 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.23]

Bottom angle - θ2(t), [°]

-150 -100 -50 0 50 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -150.52] [20; 120]
'''''''

Simulation time - t = 3.49 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.23]

Bottom angle - θ2(t), [°]

-150 -100 -50 0 50 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -159.18] [20; 120]
'''''''

Simulation time - t = 3.65 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.23]

Bottom angle - θ2(t), [°]

-150 -100 -50 0 50 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 120]
'''''''

Simulation time - t = 3.82 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.23]

Bottom angle - θ2(t), [°]

-150 -100 -50 0 50 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 120]
'''''''

Simulation time - t = 3.98 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.23]

Bottom angle - θ2(t), [°]

-150 -100 -50 0 50 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 120]
'''''''

Simulation time - t = 4.15 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.23]

Bottom angle - θ2(t), [°]

-150 -100 -50 0 50 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 120]
'''''''

Simulation time - t = 4.32 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.23]

Bottom angle - θ2(t), [°]

-150 -100 -50 0 50 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 120]
'''''''

Simulation time - t = 4.48 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.23]

Bottom angle - θ2(t), [°]

-150 -100 -50 0 50 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 134.42]
'''''''

Simulation time - t = 4.65 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

-150 -100 -50 0 50 100 150 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 173.16]
'''''''

Simulation time - t = 4.81 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.23]

Bottom angle - θ2(t), [°]

-150 -100 -50 0 50 100 150 200 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 193.54]
'''''''

Simulation time - t = 4.98 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

-150 -100 -50 0 50 100 150 200 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 205.35]
'''''''

Simulation time - t = 5.15 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

-150 -100 -50 0 50 100 150 200 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 213.8]
'''''''

Simulation time - t = 5.31 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

-150 -100 -50 0 50 100 150 200 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 217.56]
'''''''

Simulation time - t = 5.48 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.23]

Bottom angle - θ2(t), [°]

-150 -100 -50 0 50 100 150 200 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 217.55]
'''''''

Simulation time - t = 5.64 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

-150 -100 -50 0 50 100 150 200 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 217.56]
'''''''

Simulation time - t = 5.81 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.23]

Bottom angle - θ2(t), [°]

-150 -100 -50 0 50 100 150 200 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 217.55]
'''''''

Simulation time - t = 5.98 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.23]

Bottom angle - θ2(t), [°]

-100 0 100 200 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 247.43]
'''''''

Simulation time - t = 6.14 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

-100 0 100 200 300 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 309.56]
'''''''

Simulation time - t = 6.31 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

-100 0 100 200 300 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 366.88]
'''''''

Simulation time - t = 6.47 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

-100 0 100 200 300 400 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 418.82]
'''''''

Simulation time - t = 6.64 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.23]

Bottom angle - θ2(t), [°]

-100 0 100 200 300 400 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 466.53]
'''''''

Simulation time - t = 6.81 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.23]

Bottom angle - θ2(t), [°]

-100 0 100 200 300 400 500 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 498.32]
'''''''

Simulation time - t = 6.97 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.23]

Bottom angle - θ2(t), [°]

-100 0 100 200 300 400 500 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 505.45]
'''''''

Simulation time - t = 7.14 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

-100 0 100 200 300 400 500 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 505.45]
'''''''

Simulation time - t = 7.30 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.23]

Bottom angle - θ2(t), [°]

-100 0 100 200 300 400 500 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 505.46]
'''''''

Simulation time - t = 7.47 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.23]

Bottom angle - θ2(t), [°]

-100 0 100 200 300 400 500 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 505.46]
'''''''

Simulation time - t = 7.64 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.23]

Bottom angle - θ2(t), [°]

-100 0 100 200 300 400 500 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 505.46]
'''''''

Simulation time - t = 7.80 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

-100 0 100 200 300 400 500 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 505.46]
'''''''

Simulation time - t = 7.97 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.23]

Bottom angle - θ2(t), [°]

-100 0 100 200 300 400 500 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 505.45]
'''''''

Simulation time - t = 8.13 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

-100 0 100 200 300 400 500 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 505.46]
'''''''

Simulation time - t = 8.30 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

-100 0 100 200 300 400 500 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 505.46]
'''''''

Simulation time - t = 8.47 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

-100 0 100 200 300 400 500 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 505.46]
'''''''

Simulation time - t = 8.63 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

-100 0 100 200 300 400 500 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 505.46]
'''''''

Simulation time - t = 8.80 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.23]

Bottom angle - θ2(t), [°]

-100 0 100 200 300 400 500 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 505.46]
'''''''

Simulation time - t = 8.96 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

-100 0 100 200 300 400 500 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 505.45]
'''''''

Simulation time - t = 9.13 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.23]

Bottom angle - θ2(t), [°]

-100 0 100 200 300 400 500 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 547.76]
'''''''

Simulation time - t = 9.30 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

-100 0 100 200 300 400 500 600 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 610.24]
'''''''

Simulation time - t = 9.46 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

-100 0 100 200 300 400 500 600 700 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 694.72]
'''''''

Simulation time - t = 9.63 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

-100 0 100 200 300 400 500 600 700 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 789.12]
'''''''

Simulation time - t = 9.79 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 854.24]
'''''''

Simulation time - t = 9.96 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 894.6]
'''''''

Simulation time - t = 10.13 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.23]

Bottom angle - θ2(t), [°]

0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 914.56]
'''''''

Simulation time - t = 10.29 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 923.29]
'''''''

Simulation time - t = 10.46 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 926.78]
'''''''

Simulation time - t = 10.62 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 926.94]
'''''''

Simulation time - t = 10.79 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 926.93]
'''''''

Simulation time - t = 10.96 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 926.94]
'''''''

Simulation time - t = 11.12 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.23]

Bottom angle - θ2(t), [°]

0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 926.94]
'''''''

Simulation time - t = 11.29 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 926.94]
'''''''

Simulation time - t = 11.45 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 926.93]
'''''''

Simulation time - t = 11.62 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 926.94]
'''''''

Simulation time - t = 11.79 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 926.94]
'''''''

Simulation time - t = 11.95 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 926.94]
'''''''

Simulation time - t = 12.12 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 926.94]
'''''''

Simulation time - t = 12.28 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 926.94]
'''''''

Simulation time - t = 12.45 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.23]

Bottom angle - θ2(t), [°]

0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 926.94]
'''''''

Simulation time - t = 12.62 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 926.94]
'''''''

Simulation time - t = 12.78 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 926.93]
'''''''

Simulation time - t = 12.95 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 926.94]
'''''''

Simulation time - t = 13.11 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.23]

Bottom angle - θ2(t), [°]

0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 926.94]
'''''''

Simulation time - t = 13.28 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -161.61] [20; 926.94]
'''''''

Simulation time - t = 13.45 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.23]

Bottom angle - θ2(t), [°]

-200 0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -188.03] [20; 926.94]
'''''''

Simulation time - t = 13.61 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

-200 0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -226.84] [20; 926.92]
'''''''

Simulation time - t = 13.78 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.23]

Bottom angle - θ2(t), [°]

-200 0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -264.96] [20; 926.94]
'''''''

Simulation time - t = 13.94 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

-200 0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -304.08] [20; 926.93]
'''''''

Simulation time - t = 14.11 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.23]

Bottom angle - θ2(t), [°]

-200 0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -342.16] [20; 926.94]
'''''''

Simulation time - t = 14.28 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

-400 -200 0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -389.76] [20; 926.94]
'''''''

Simulation time - t = 14.44 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

-400 -200 0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -446.25] [20; 926.92]
'''''''

Simulation time - t = 14.61 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.23]

Bottom angle - θ2(t), [°]

-400 -200 0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -466.26] [20; 926.92]
'''''''

Simulation time - t = 14.77 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

-400 -200 0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -466.27] [20; 926.92]
'''''''

Simulation time - t = 14.94 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

-400 -200 0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -466.26] [20; 926.92]
'''''''

Simulation time - t = 15.11 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

-400 -200 0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -466.28] [20; 926.93]
'''''''

Simulation time - t = 15.27 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.23]

Bottom angle - θ2(t), [°]

-400 -200 0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -466.27] [20; 926.94]
'''''''

Simulation time - t = 15.44 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

-400 -200 0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -466.28] [20; 926.93]
'''''''

Simulation time - t = 15.60 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

-400 -200 0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -466.28] [20; 926.93]
'''''''

Simulation time - t = 15.77 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

-400 -200 0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -466.27] [20; 926.94]
'''''''

Simulation time - t = 15.94 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

-400 -200 0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -466.28] [20; 926.94]
'''''''

Simulation time - t = 16.10 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

-400 -200 0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -466.26] [20; 926.93]
'''''''

Simulation time - t = 16.27 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

-400 -200 0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -466.28] [20; 926.94]
'''''''

Simulation time - t = 16.43 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

-400 -200 0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -466.28] [20; 926.94]
'''''''

Simulation time - t = 16.60 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

-400 -200 0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -466.26] [20; 926.93]
'''''''

Simulation time - t = 16.77 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

-400 -200 0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -466.27] [20; 926.92]
'''''''

Simulation time - t = 16.93 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

-400 -200 0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -466.27] [20; 926.91]
'''''''

Simulation time - t = 17.10 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

-400 -200 0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -466.28] [20; 926.91]
'''''''

Simulation time - t = 17.26 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

-400 -200 0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -466.28] [20; 926.92]
'''''''

Simulation time - t = 17.43 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

-400 -200 0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -466.28] [20; 926.93]
'''''''

Simulation time - t = 17.60 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.21]

Bottom angle - θ2(t), [°]

-400 -200 0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -466.28] [20; 926.94]
'''''''

Simulation time - t = 17.76 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

-400 -200 0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -466.27] [20; 926.94]
'''''''

Simulation time - t = 17.93 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

-400 -200 0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -466.26] [20; 926.92]
'''''''

Simulation time - t = 18.09 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

-400 -200 0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -466.27] [20; 926.94]
'''''''

Simulation time - t = 18.26 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.23]

Bottom angle - θ2(t), [°]

-400 -200 0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -466.29] [20; 926.94]
'''''''

Simulation time - t = 18.43 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

-400 -200 0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -466.28] [20; 926.92]
'''''''

Simulation time - t = 18.59 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

-400 -200 0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -466.28] [20; 926.94]
'''''''

Simulation time - t = 18.76 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.21]

Bottom angle - θ2(t), [°]

-400 -200 0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -466.28] [20; 926.92]
'''''''

Simulation time - t = 18.92 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

-400 -200 0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -466.28] [20; 926.94]
'''''''

Simulation time - t = 19.09 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.23]

Bottom angle - θ2(t), [°]

-400 -200 0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -466.24] [20; 926.93]
'''''''

Simulation time - t = 19.26 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

-400 -200 0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -466.28] [20; 926.94]
'''''''

Simulation time - t = 19.42 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.21]

Bottom angle - θ2(t), [°]

-400 -200 0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -466.23] [20; 926.94]
'''''''

Simulation time - t = 19.59 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

-400 -200 0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -466.28] [20; 926.94]
'''''''

Simulation time - t = 19.75 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.23]

Bottom angle - θ2(t), [°]

-400 -200 0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -466.28] [20; 926.91]
'''''''

Simulation time - t = 19.92 s

Top angle - θ1(t), [°]
-80 -60 -40 -20 0 20 40 60 80 100 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -90] [20; 99.22]

Bottom angle - θ2(t), [°]

-400 -200 0 200 400 600 800 0 2.5 5 7.5 10 12.5 15 17.5 20 x y [0; -466.28] [20; 926.94]
'''''''

Comparison of Different Methods for Analysis of Simple Undamped Pendulum

Side-by-side study of the simple undamped pendulum solved four ways: the small-angle analytical solution, the elliptic-integral exact period, an RK4 numerical integration and a CalcpadCE $Find shooting solver. Errors and orbits are plotted together.

Code:
#rad
'<table><tr><td>
'<h4>Input parameters</h4>
'Gravitational acceleration (m/s²) - 'g = 9.80665m/s^2
'Pendulum length -'l = 1m
'Pendulum mass -'m = 1kg
'Initial angle -'θ_0 = -60°|rad
'Maximum simulation time -'t_max = 10s
'<h4>Analytical solution for small rotations</h4>
'<p class="eq"><var>θ</var> ≪ 1 or <b>sin</b>(<var>θ</var>) ≈ <var>θ</var></p>
'</td><td>
#hide
Precision = 10^-6','ε = 10^-12rad
PlotWidth = 300','PlotHeight = 150','PlotSVG = 1
w = 1.2*l', 'h_ = 2/3*w
W = 120', 'H = 120
k = W/w
L = l*k
R = L/10
x = L*sin(θ_0)
y = L*cos(θ_0)
δ = 16
δ_x = 0.25*δ
δ_y = -2*δ
y_g = y - δ_y + R
#def svg$ = '<svg viewbox="'-50 - W/2' '-20' 'W + 50' 'H + 20'" xmlns="http://www.w3.org/2000/svg" version="1.1" style="font-family: Georgia Pro; font-size:12px; width:'W + 30'pt; height:'H + 20'pt;">
#def thin_style$ = style="stroke:goldenrod; stroke-width:1; fill:none"
#def thick_style$ = style="stroke:steelblue; stroke-width:2; fill:none"
#def ball_style$ = style="stroke:steelblue; stroke-width:0.5;  fill:url(#ball)"
#def solid_style$ = style="stroke:black; stroke-width:1; fill:#eee"
#def load_style$ = style="stroke:steelblue; stroke-width:1; fill:steelblue;"
#include svg_drawing.cpd
#show
#val
svg$
'<defs><radialGradient id="ball" cx="35%" cy="35%"><stop offset="0%" stop-color="lightcyan"/><stop offset="100%" stop-color="lightblue"/></radialGradient><pattern id="concrete" x="4" y="4" width="8" height="8" patternUnits="userSpaceOnUse"><rect x="0" y="0" width="8" height="8" fill="#eae9e8" /><circle cx="1" cy="1" r="1.2" fill="#ccb" /><circle cx="5" cy="2" r="1.6" fill="#dadad0" /><circle cx="4" cy="6" r="0.8" fill="#aa9" /><circle cx="3" cy="4" r="0.4" fill="#884" /><circle cx="7" cy="5" r="1.2" fill="#cacaba" /><circle cx="5" cy="3" r="0.9" fill="#fffded" /></pattern></defs>
'<polygon points="0,0 '-δ','-δ' 'δ','-δ'" solid_style$/>
line$(0; 0; 0; l*k; thin_style$)
'<path d="M 0 '0.2*L' A '0.2*L' '0.2*L' 0 0 'θ_0 < 0°' '0.2*x' '0.2*y'" thin_style$/>
texth$(-1.2*δ*sign(θ_0);0.25*L;'θ_0*180/π'°)
line$(0; 0; x; y; thick_style$)
text$(x/2-δ_x*y/L; y/2+δ_x*x/L;if(θ_0<0°;450°+θ_0;450°-θ_0);'l'm)
circle$(0; 0; R/2; solid_style$)
circle$(0; 0; R/8; solid_style$)
circle$(x; y; R; ball_style$)
'<polygon points="'x','y_g + δ_y' 'x','y_g' 'x - δ_x','y_g + δ_y/3' 'x + δ_x','y_g + δ_y/3' 'x','y_g'" load_style$/>
texth$(x+3*δ_x; y_g-δ;g)
'</svg>
#equ
'</td></tr></table>
#noc
'Differential equation -'θ″ + g/l*θ = 0
#equ
'Angular frequency -'ω = sqrt(g/l)*rad|rad/s
'Cyclic frequency -'f = ω/(2*π*rad)|Hz
'Period -'T = 1/f
'Equation of motion -'θ(t) = θ_0*cos(ω*t)
'<h4>Analytical solution for large rotations (exact)</h4>
#noc
'Differential equation -'θ″ + g/l*sin(θ) = 0
#equ
'Incomplete elliptic integral of the first kind
F(φ; k) = $Integral{1/sqrt(1 - k^2*sin(θ)^2) @ θ = 0 : φ}
'Jacobi elliptic functions
'Modulus -'k = sin(θ_0/2)
am(u; k) = $Root{F(φ; k) = u @ φ = 0 : 10*π}
sn(u; k) = sin(am(u; k))','cn(u; k) = cos(am(u; k))
dn(u; k) = sqrt(1 - k*sn(u; k)^2)','cd(u; k) = cn(u; k)/dn(u; k)
'Period -'T_e = 4*sqrt(l/g)*F(π/2; k)
'Error -'δ_T = abs(T - T_e)/T_e|%
'Cyclic frequency -'f_e = 1/T_e|Hz
'Angular frequency -'ω_e = 2*π*rad*f_e|rad/s
'Equation of motion -'θ_e(t) = 2*asin(k*cd(sqrt(g/l)*t; k))
'Energy -'E_0 = m*l*g*(1 - cos(θ_0))|J
'Relative error <span class="eq"><var>δ</var><sub>T</sub></span> [%] of small displacements period versus initial angle <span class="eq"><var>θ</var><sub>0</sub></span> [°] plot
#hide
'Period -'T_e(θ_0) = 4/rad*sqrt(l/(2*g))*$Integral{1/sqrt(cos(θ) - cos(θ_0)) @ θ = 0rad : θ_0 - ε}
'Error -'δ_T(θ_0) = abs(T - T_e(θ_0))/T_e(θ_0)|%
#show
$Plot{δ_T(θ_0) @ θ_0 = 0.01° : 90°}
'<h4>Solution by forward Euler method (explicit)</h4>
'For that purpose, the II order equation is reduced to thefollowing system of I order equations
#noc
θ′ = ω'and'ω′ = (g/l)*sin(-θ)
#equ
'The solution will be performed iteratively
'Step size -'h = 0.05s
'Number of steps -'n = t_max/h
'For each time step'n'the values for the next step will be obtained by using the following equstions
#noc
'<p class="eq" style="border-left:solid 1pt black; margin-left:24pt; padding-left:3pt;"><var>θ</var><sub>n+1</sub> = <var>θ</var><sub>n</sub> + <var>h</var>·<var>ω</var><sub>n</sub><br/> <var>ω</var><sub>n+1</sub> = <var>ω</var><sub>n</sub> + 'h*(g/l)'· <b>sin</b><var>θ</var><sub>n</sub></p>
#equ
'Allocate vectors
θ_fwE = vector(n)'<br/>'ω_fwE = vector(n)'<br/>'E_fwE = vector(n)
'Set initial conditions
θ_fwE.1 = θ_0/1rad','ω_fwE.1 = 0/s
'Perform Euler steps
#for i = 1 : n - 1
    'Rotation -'θ_fwE.(i + 1) = θ_fwE.i + h*ω_fwE.i
    'Angular velocity -'ω_fwE.(i + 1) = ω_fwE.i + h*(g/l)*sin(-θ_fwE.i)
    'Energy -'E_fwE.i = m*l^2*(1/2*ω_fwE.i^2 + (g/l)*(1 - cos(θ_fwE.i)))|J
    #hide
#loop
E_fwE.n = m*l^2*(1/2*ω_fwE.n^2 + (g/l)*(1 - cos(θ_fwE.n)))|J
#show
'. . .
'<h4>Solution by backward Euler method (implicit)</h4>
'The following iterative procedure is applied:
#noc
'<p class="eq" style="border-left:solid 1pt black; margin-left:24pt; padding-left:3pt;"><var>θ</var><sub>n+1</sub> = <var>θ</var><sub>n</sub> + <var>h</var>·<var>ω</var><sub>n+1</sub><br/> <var>ω</var><sub>n+1</sub> = <var>ω</var><sub>n</sub> + 'h*(g/l)'· <b>sin</b><var>θ</var><sub>n+1</sub></p>
#equ
'Allocate vectors
θ_bwE = vector(n)'<br/>'ω_bwE = vector(n)'<br/>'E_bwE = vector(n)
'Set initial conditions
θ_bwE.1 = θ_0/1rad','ω_bwE.1 = 0/s
'Perform Euler steps
#for i = 1 : n - 1
    f(θ) = θ_bwE.i + h*(ω_bwE.i + h*(g/l)*sin(-θ)) - θ
    'Rotation -'θ_bwE.(i + 1) = $Root{f(θ) @ θ = -2*π : 2*π}
    'Angular velocity -'ω_bwE.(i + 1) = ω_bwE.i + h*(g/l)*sin(-θ_bwE.(i + 1))
    'Energy -'E_bwE.i = m*l^2*(1/2*ω_bwE.i^2 + (g/l)*(1 - cos(θ_bwE.i)))|J
    #hide
#loop
E_bwE.n = m*l^2*(1/2*ω_bwE.n^2 + (g/l)*(1 - cos(θ_bwE.n)))|J
#show
'. . .
'<h4>Solution by Crank–Nicolson method (IMEX)</h4>
'The following iterative procedure is applied:
#noc
'<p class="eq" style="border-left:solid 1pt black; margin-left:24pt; padding-left:3pt;"><var>θ</var><sub>n+1</sub> = <var>θ</var><sub>n</sub> +'h/2'(&thinsp;<var>ω</var><sub>n</sub> + <var>ω</var><sub>n+1</sub>&thinsp;)<br/> <var>ω</var><sub>n+1</sub> = <var>ω</var><sub>n</sub> + 'h*g/(2*l)'(&thinsp;<b>sin</b><var>θ</var><sub>n</sub> + <b>sin</b><var>θ</var><sub>n+1</sub>&thinsp;)</p>
#equ
'Allocate vectors
θ_CN = vector(n)'<br/>'ω_CN = vector(n)'<br/>'E_CN = vector(n)
'Set initial conditions
θ_CN.1 = θ_0/1rad','ω_CN.1 = 0/s
'Perform Euler steps
#for i = 1 : n - 1
    f(θ) = θ_CN.i + h/2*(2*ω_CN.i + h*g/(2*l)*(sin(-θ_CN.i) + sin(-θ))) - θ
    'Rotation -'θ_CN.(i + 1) = $Root{f(θ) @ θ = -2*π : 2*π}
    'Angular velocity -'ω_CN.(i + 1) = ω_CN.i + h*g/(2*l)*(sin(-θ_CN.i) + sin(-θ_CN.(i + 1)))
    'Energy -'E_CN.i = m*l^2*(1/2*ω_CN.i^2 + (g/l)*(1 - cos(θ_CN.i)))|J
    #hide
#loop
E_CN.n = m*l^2*(1/2*ω_CN.n^2 + (g/l)*(1 - cos(θ_CN.n)))|J
#show
'. . .
'<h4>Solution by Runge-Kutta RK4 method (explicit)</h4>
'The following iterative procedure is applied:
#noc
'<table class="eq" style="margin-left:24pt;">
'<tr><td>First step (k₁) -</td><td>'k_1,θ = ω_i', </td><td>' _
k_1,ω = (g/l)*sin(-θ_i)'</td></tr>
'<tr><td>Second step (k₂) -</td><td>'k_2,θ = ω_i + 0.5*h*k_1,ω', </td><td>'k_2,ω = (g/l)*sin(-(θ_i + 0.5*h*k_1,θ))'</td></tr>
'<tr><td>Third step (k₃) -</td><td>'k_3,θ = ω_i + 0.5*h*k_2,ω', </td><td>'k_3,ω = (g/l)*sin(-(θ_i + 0.5*h*k_2,θ))'</td></tr>
'<tr><td>Fourth step (k₄) -</td><td>'k_4,θ = ω_i + h*k_3,ω', </td><td>'k_4,ω = (g/l)*sin(-(θ_i + h*k_3,θ))'</td></tr>
'</table>
'Update values using weighted averages
'<p class="eq" style="border-left:solid 1pt black; margin-left:24pt; padding-left:3pt;"><var>θ</var><sub>n+1</sub> ='θ_i + (h/6)*(k_1,θ + 2*k_2,θ + 2*k_3,θ + k_4,θ)'<br/> <var>ω</var><sub>n+1</sub> = 'ω_i + (h/6)*(k_1,ω + 2*k_2,ω + 2*k_3,ω + k_4,ω)'</p>
#equ
'Allocate vectors
θ_RK4 = vector(n)'<br/>'ω_RK4 = vector(n)'<br/>'E_RK4 = vector(n)
'Set initial conditions
θ_RK4.1 = θ_0/1rad','ω_RK4.1 = 0/s
'Perform Runge-Kutta 4 steps
#for i = 1 : n - 1
    'RK4 factors
    k_1,θ = ω_RK4.i', ' _
    k_1,ω = (g/l)*sin(-θ_RK4.i)
    k_2,θ = ω_RK4.i + 0.5*h*k_1,ω
    k_2,ω = (g/l)*sin(-(θ_RK4.i + 0.5*h*k_1,θ))
    k_3,θ = ω_RK4.i + 0.5*h*k_2,ω
    k_3,ω = (g/l)*sin(-(θ_RK4.i + 0.5*h*k_2,θ))
    k_4,θ = ω_RK4.i + h*k_3,ω
    k_4,ω = (g/l)*sin(-(θ_RK4.i + h*k_3,θ))
    'Update values using weighted averages
    'Rotation -'θ_RK4.(i + 1) = θ_RK4.i + (h/6)*(k_1,θ + 2*k_2,θ + 2*k_3,θ + k_4,θ)
    'Angular velocity -'ω_RK4.(i + 1) = ω_RK4.i + (h/6)*(k_1,ω + 2*k_2,ω + 2*k_3,ω + k_4,ω)
    'Energy -'E_RK4.i = m*l^2*(1/2*ω_RK4.i^2 + (g/l)*(1 - cos(θ_RK4.i)))|J
    #hide
#loop
E_RK4.n = m*l^2*(1/2*ω_RK4.n^2 + (g/l)*(1 - cos(θ_RK4.n)))|J
t(i) = i*h - h
r2d = 180/π
#show
'. . .
'<style>.Series3{stroke-dasharray: 10, 15;} .Series4{stroke-dasharray: 20, 10;} .Series5{stroke-dasharray: 10, 20, 40, 20;}</style>
'<h4>Plot results</h4>
 '<table><tr><td>
'Rotation <var>θ</var> [deg] versus time <var>t</var> [s] plot
$Plot{t(i)|θ(t(i))/deg & t(i)|θ_e(t(i))*r2d & t(i)|if(abs(θ_fwE.i*r2d) < 150; θ_fwE.i*r2d; 1/0) & t(i)|θ_bwE.i*r2d & t(i)|θ_CN.i*r2d @ i = 1 : n}
'</td><td><br/><br/><br/>
'<b style="color:Tomato">╺━━</b> Small rotations<br/>
'<b style="color:YellowGreen">╺━━</b> Large rotations<br/>
'<b style="color:CornflowerBlue">&nbsp;· · · ·</b> Forward Euler<br/>
'<b style="color:Gold">╺╺╺</b> Backward Euler<br/>
'<b style="color:MediumVioletRed">·╺&ensp;·╺</b> Crank–Nicolson
'</td></tr></table>
'Energy <var>E</var> [J] versus time <var>t</var> [s] plot
$Plot{0s|0J & t(i)|E_0 & t(i)|E_fwE.i & t(i)|E_bwE.i & t(i)|E_CN.i @ i = 1 : n}
'<h4>Comparison of Crank–Nicolson and Runge-Kutta 4 methods</h4>
'<style>.Series2{stroke-dasharray: 30, 10;}</style>
'<table><tr><td>
'Rotation <var>θ</var> [deg] versus time <var>t</var> [s] plot
$Plot{t(i)|θ_e(t(i))*r2d & t(i)|θ_CN.i*r2d & t(i)|θ_RK4.i*r2d @ i = 1 : n}
'</td><td><br/><br/><br/>
'<b style="color:Tomato">╺━━</b> Theoretical (large rot.)<br/>
'<b style="color:YellowGreen">╺╺╺</b> Crank–Nicolson (IMEX)<br/>
'<b style="color:CornflowerBlue">&nbsp;· · · ·</b> Runge-Kutta 4 (explicit)
'</td></tr><tr><td>
'Absolute error Δθ [°] versus time <var>t</var> [s] plot
$Plot{t(i)|(θ_CN.i - θ_e(t(i)))*r2d & t(i)|(θ_RK4.i - θ_e(t(i)))*r2d @ i = 1 : n}
'</td><td><br/><br/><br/>
'<p><b style="color:Tomato">╺━━</b> Crank–Nicolson (IMEX)<br/>
'<b style="color:YellowGreen">╺╺╺</b> Runge-Kutta 4 (explicit)
'</td></tr><tr><td>
'Energy <var>E</var> [J] versus time <var>t</var> [s] plot
$Plot{t(i)|E_0 & t(i)|E_CN.i & t(i)|E_RK4.i & 0s|0.999*E_0 @ i = 1 : n}
'</td><td><br/><br/><br/>
'<b style="color:Tomato">╺━━</b> Theoretical (large rot.)<br/>
'<b style="color:YellowGreen">╺╺╺</b> Crank–Nicolson (IMEX)<br/>
'<b style="color:CornflowerBlue">&nbsp;· · · ·</b> Runge-Kutta 4 (explicit)
'</td></tr></table>
Rendered Output:

Input parameters

Gravitational acceleration (m/s²) - g = 9.81 ms2

Pendulum length - l = 1 m

Pendulum mass - m = 1 kg

Initial angle - θ0 = -60° = -1.05 rad

Maximum simulation time - tmax = 10 s

Analytical solution for small rotations

θ ≪ 1 or sin(θ) ≈ θ

-60°1mg

Differential equation - θ″ + gl · θ = 0

Angular frequency - ω =   gl · rad =   9.81 m ∕ s21 m · rad = 3.13 rad ∕ s

Cyclic frequency - f = ω2 · π · rad = 3.13 rad ∕ s2 · 3.14 · rad = 0.498 Hz

Period - T = 1f = 10.498 Hz = 2.01 s

Equation of motion - θ ( t )  = θ0 · cos ( ω · t ) 

Analytical solution for large rotations (exact)

Differential equation - θ″ + gl · sin ( θ )  = 0

Incomplete elliptic integral of the first kind

F ( φ; k )  = φ1    1 − k2 · sin ( θ ) 2 dθ

Jacobi elliptic functions

Modulus - k = sin(θ02) = sin(-1.05 rad2) = -0.5

am ( u; k )  = $Root{F  ( φ; k )  = u; φ ∈ [0; 10 · π]}

sn ( u; k )  = sin ( am  ( u; k )  )  , cn ( u; k )  = cos ( am  ( u; k )  ) 

dn ( u; k )  =     1 − k · sn  ( u; k ) 2 , cd ( u; k )  = cn  ( u; k ) dn  ( u; k ) 

Period - Te = 4 ·   lg · F(π2; k) = 4 ·   1 m9.81 m ∕ s2 · F(3.142; -0.5) = 2.15 s

Error - δT = |TTe|Te = | 2.01 s − 2.15 s|2.15 s = 6.82 %

Cyclic frequency - fe = 1Te = 12.15 s = 0.464 Hz

Angular frequency - ωe = 2 · π · rad · fe = 2 · 3.14 · rad · 0.464 Hz = 2.92 rad ∕ s

Equation of motion - θe ( t )  = 2 · asin(k · cd(  gl · t; k))

Energy - E0 = m · l · g ·  ( 1 − cos ( θ0 )  )  = 1 kg · 1 m · 9.81 m ∕ s2 ·  ( 1 − cos ( -1.05 rad )  )  = 4.9 J

Relative error δT [%] of small displacements period versus initial angle θ0 [°] plot

0 2 4 6 8 10 12 14 0 10 20 30 40 50 60 70 80 90 x y [0.01; 0] [90; 15.28]
Solution by forward Euler method (explicit)

For that purpose, the II order equation is reduced to thefollowing system of I order equations

θ′ = ω and ω′ = gl · sin ( -θ ) 

The solution will be performed iteratively

Step size - h = 0.05 s

Number of steps - n = tmaxh = 10 s0.05 s = 200

For each time step n = 200 the values for the next step will be obtained by using the following equstions

θn+1 = θn + h·ωn
ωn+1 = ωn + h · gl · sinθn

Allocate vectors

θfwE = vector ( n )  = vector ( 200 )  = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... 0]
ωfwE = vector ( n )  = vector ( 200 )  = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... 0]
EfwE = vector ( n )  = vector ( 200 )  = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... 0]

Set initial conditions

θfwE.1 = θ01 rad = -1.05 rad1 rad = -1.05 , ωfwE.1 = 0s = 0 s-1

Perform Euler steps

Rotation - θfwE.2 = θfwE.1 + h · ωfwE.1 = -1.05 + 0.05 s · 0 s-1 = -1.05

Angular velocity - ωfwE.2 = ωfwE.1 + h · gl · sin ( -θfwE.1 )  = 0 s-1 + 0.05 s · 9.81 m ∕ s21 m · sin ( - ( -1.05 )  )  = 0.425 s-1

Energy - EfwE.1 = m · l2 · (12 · ωfwE.12 + gl ·  ( 1 − cos ( θfwE.1 )  ) ) = 1 kg · 1 m2 · (12 · 0 s-12 + 9.81 m ∕ s21 m ·  ( 1 − cos ( -1.05 )  ) ) = 4.9 J

. . .

Solution by backward Euler method (implicit)

The following iterative procedure is applied:

θn+1 = θn + h·ωn+1
ωn+1 = ωn + h · gl · sinθn+1

Allocate vectors

θbwE = vector ( n )  = vector ( 200 )  = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... 0]
ωbwE = vector ( n )  = vector ( 200 )  = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... 0]
EbwE = vector ( n )  = vector ( 200 )  = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... 0]

Set initial conditions

θbwE.1 = θ01 rad = -1.05 rad1 rad = -1.05 , ωbwE.1 = 0s = 0 s-1

Perform Euler steps

f ( θ )  = θbwE.i + h · (ωbwE.i + h · gl · sin ( -θ ) )θ

Rotation - θbwE.2 = $Root{f  ( θ )  = 0; θ ∈ [-2 · π; 2 · π]} = -1.03

Angular velocity - ωbwE.2 = ωbwE.1 + h · gl · sin ( -θbwE.2 )  = 0 s-1 + 0.05 s · 9.81 m ∕ s21 m · sin ( - ( -1.03 )  )  = 0.419 s-1

Energy - EbwE.1 = m · l2 · (12 · ωbwE.12 + gl ·  ( 1 − cos ( θbwE.1 )  ) ) = 1 kg · 1 m2 · (12 · 0 s-12 + 9.81 m ∕ s21 m ·  ( 1 − cos ( -1.05 )  ) ) = 4.9 J

. . .

Solution by Crank–Nicolson method (IMEX)

The following iterative procedure is applied:

θn+1 = θn + h2 ( ωn + ωn+1 )
ωn+1 = ωn + h · g2 · l ( sinθn + sinθn+1 )

Allocate vectors

θCN = vector ( n )  = vector ( 200 )  = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... 0]
ωCN = vector ( n )  = vector ( 200 )  = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... 0]
ECN = vector ( n )  = vector ( 200 )  = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... 0]

Set initial conditions

θCN.1 = θ01 rad = -1.05 rad1 rad = -1.05 , ωCN.1 = 0s = 0 s-1

Perform Euler steps

f ( θ )  = θCN.i + h2 · (2 · ωCN.i + h · g2 · l ·  ( sin ( -θCN.i )  + sin ( -θ )  ) )θ

Rotation - θCN.2 = $Root{f  ( θ )  = 0; θ ∈ [-2 · π; 2 · π]} = -1.04

Angular velocity - ωCN.2 = ωCN.1 + h · g2 · l ·  ( sin ( -θCN.1 )  + sin ( -θCN.2 )  )  = 0 s-1 + 0.05 s · 9.81 m ∕ s22 · 1 m ·  ( sin ( - ( -1.05 )  )  + sin ( - ( -1.04 )  )  )  = 0.423 s-1

Energy - ECN.1 = m · l2 · (12 · ωCN.12 + gl ·  ( 1 − cos ( θCN.1 )  ) ) = 1 kg · 1 m2 · (12 · 0 s-12 + 9.81 m ∕ s21 m ·  ( 1 − cos ( -1.05 )  ) ) = 4.9 J

. . .

Solution by Runge-Kutta RK4 method (explicit)

The following iterative procedure is applied:

First step (k₁) - k1,θ = ωi , k1,ω = gl · sin ( -θi ) 
Second step (k₂) - k2,θ = ωi + 0.5 · h · k1,ω , k2,ω = gl · sin ( - ( θi + 0.5 · h · k1,θ )  ) 
Third step (k₃) - k3,θ = ωi + 0.5 · h · k2,ω , k3,ω = gl · sin ( - ( θi + 0.5 · h · k2,θ )  ) 
Fourth step (k₄) - k4,θ = ωi + h · k3,ω , k4,ω = gl · sin ( - ( θi + h · k3,θ )  ) 

Update values using weighted averages

θn+1 = θi + h6 ·  ( k1,θ + 2 · k2,θ + 2 · k3,θ + k4,θ ) 
ωn+1 = ωi + h6 ·  ( k1,ω + 2 · k2,ω + 2 · k3,ω + k4,ω ) 

Allocate vectors

θRK4 = vector ( n )  = vector ( 200 )  = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... 0]
ωRK4 = vector ( n )  = vector ( 200 )  = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... 0]
ERK4 = vector ( n )  = vector ( 200 )  = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... 0]

Set initial conditions

θRK4.1 = θ01 rad = -1.05 rad1 rad = -1.05 , ωRK4.1 = 0s = 0 s-1

Perform Runge-Kutta 4 steps

RK4 factors

k1,θ = ωRK4.1 = 0 s-1 , k1,ω = gl · sin ( -θRK4.1 )  = 9.81 m ∕ s21 m · sin ( - ( -1.05 )  )  = 8.49 s-2

k2,θ = ωRK4.1 + 0.5 · h · k1,ω = 0 s-1 + 0.5 · 0.05 s · 8.49 s-2 = 0.212 s-1

k2,ω = gl · sin ( - ( θRK4.1 + 0.5 · h · k1,θ )  )  = 9.81 m ∕ s21 m · sin ( - ( -1.05 + 0.5 · 0.05 s · 0 s-1 )  )  = 8.49 s-2

k3,θ = ωRK4.1 + 0.5 · h · k2,ω = 0 s-1 + 0.5 · 0.05 s · 8.49 s-2 = 0.212 s-1

k3,ω = gl · sin ( - ( θRK4.1 + 0.5 · h · k2,θ )  )  = 9.81 m ∕ s21 m · sin ( - ( -1.05 + 0.5 · 0.05 s · 0.212 s-1 )  )  = 8.47 s-2

k4,θ = ωRK4.1 + h · k3,ω = 0 s-1 + 0.05 s · 8.47 s-2 = 0.423 s-1

k4,ω = gl · sin ( - ( θRK4.1 + h · k3,θ )  )  = 9.81 m ∕ s21 m · sin ( - ( -1.05 + 0.05 s · 0.212 s-1 )  )  = 8.44 s-2

Update values using weighted averages

Rotation - θRK4.2 = θRK4.1 + h6 ·  ( k1,θ + 2 · k2,θ + 2 · k3,θ + k4,θ )  = -1.05 + 0.05 s6 ·  ( 0 s-1 + 2 · 0.212 s-1 + 2 · 0.212 s-1 + 0.423 s-1 )  = -1.04

Angular velocity - ωRK4.2 = ωRK4.1 + h6 ·  ( k1,ω + 2 · k2,ω + 2 · k3,ω + k4,ω )  = 0 s-1 + 0.05 s6 ·  ( 8.49 s-2 + 2 · 8.49 s-2 + 2 · 8.47 s-2 + 8.44 s-2 )  = 0.424 s-1

Energy - ERK4.1 = m · l2 · (12 · ωRK4.12 + gl ·  ( 1 − cos ( θRK4.1 )  ) ) = 1 kg · 1 m2 · (12 · 0 s-12 + 9.81 m ∕ s21 m ·  ( 1 − cos ( -1.05 )  ) ) = 4.9 J

. . .

Plot results

Rotation θ [deg] versus time t [s] plot

-100 -50 0 50 100 0 1 2 3 4 5 6 7 8 9 10 x y [0; -127.98] [9.95; 126.34]



╺━━ Small rotations
╺━━ Large rotations
 · · · · Forward Euler
╺╺╺ Backward Euler
·╺ ·╺ Crank–Nicolson

Energy E [J] versus time t [s] plot

0 5 10 15 20 25 30 0 1 2 3 4 5 6 7 8 9 10 x y [0; 0] [9.95; 29.85]
Comparison of Crank–Nicolson and Runge-Kutta 4 methods

Rotation θ [deg] versus time t [s] plot

-60 -40 -20 0 20 40 60 0 1 2 3 4 5 6 7 8 9 10 x y [0; -60] [9.95; 60]



╺━━ Theoretical (large rot.)
╺╺╺ Crank–Nicolson (IMEX)
 · · · · Runge-Kutta 4 (explicit)

Absolute error Δθ [°] versus time t [s] plot

-15 -10 -5 0 5 10 15 0 1 2 3 4 5 6 7 8 9 10 x y [0; -16.17] [9.95; 15.23]



╺━━ Crank–Nicolson (IMEX)
╺╺╺ Runge-Kutta 4 (explicit)

Energy E [J] versus time t [s] plot

4.9 4.9 4.9 4.9 4.9 0 1 2 3 4 5 6 7 8 9 10 y [0; 4.9] [9.95; 4.9]



╺━━ Theoretical (large rot.)
╺╺╺ Crank–Nicolson (IMEX)
 · · · · Runge-Kutta 4 (explicit)

Spotted an error? Edit these examples.