Skip to main content
Logo image

Section 8.4 Numerical Modeling with Euler’s Method

Many differential equations cannot be solved analytically, yet we still need solutions for practical applications. Euler’s method provides a straightforward numerical approach to approximate solutions by following the tangent line direction step by step.
In this section, we’ll model a nonlinear pendulumβ€”a system whose differential equation cannot be solved in closed formβ€”and use Euler’s method to understand its motion.

Subsection The Problem: The Nonlinear Pendulum

A pendulum consists of a mass attached to a rigid rod or string, free to swing. For large angles, the motion is governed by a nonlinear differential equation. Unlike the simple harmonic motion approximation (\(\sin\theta \approx \theta\)), the true pendulum exhibits complex behavior.
How does the period of oscillation depend on amplitude for large swings?

Subsection Assumptions

  • The pendulum rod is rigid and massless.
  • All mass is concentrated at the bob.
  • There is no friction or air resistance.
  • The pivot point is fixed.
  • Motion is constrained to a vertical plane.

Subsection Building the Model

Let \(\theta(t)\) be the angle from vertical at time \(t\text{.}\) The torque equation gives:
\begin{equation*} \frac{d^2\theta}{dt^2} + \frac{g}{L}\sin\theta = 0 \end{equation*}
where \(L\) is the length of the pendulum and \(g = 9.8 \text{ m/s}^2\text{.}\)
This is a second-order nonlinear differential equation. To apply Euler’s method, we convert it to a system of first-order equations:
\begin{align*} \frac{d\theta}{dt} \amp = \omega \\ \frac{d\omega}{dt} \amp = -\frac{g}{L}\sin\theta \end{align*}
where \(\omega\) is the angular velocity.
Parameters:
  • \(g = 9.8 \text{ m/s}^2\text{:}\) gravitational acceleration
  • \(L\text{:}\) length of pendulum (m)
  • \(\theta_0\text{:}\) initial angle (radians)
  • \(\omega_0\text{:}\) initial angular velocity (radians/s)
Euler’s Method for Systems:
Starting from initial conditions \((\theta_0, \omega_0)\text{,}\) update using:
\begin{align*} \theta_{n+1} \amp = \theta_n + h\omega_n \\ \omega_{n+1} \amp = \omega_n - h\frac{g}{L}\sin\theta_n \end{align*}
where \(h\) is the time step size.

Subsection Numerical Simulation Activity

Objective: Implement Euler’s method to simulate pendulum motion and investigate how period depends on amplitude.
Implementation:
Use a computational tool (spreadsheet, Python, MATLAB, or provided code template):
  1. Set parameters: \(g = 9.8\text{,}\) \(L = 1.0\) (gives period \(\approx 2\) seconds for small angles)
  2. Set initial conditions: \(\omega_0 = 0\text{,}\) various \(\theta_0\) values
  3. Choose time step: \(h = 0.01\) (or smaller for better accuracy)
  4. Implement the update formulas
  5. Run simulation for sufficient time to observe several complete oscillations
Part 1: Small Angle Approximation
  1. Simulate with \(\theta_0 = 0.1\) radians (\(\approx 5.7Β°\))
  2. Plot \(\theta(t)\) and \(\omega(t)\)
  3. Measure the period \(T\) (time for one complete oscillation)
  4. Compare with the small-angle formula: \(T_0 = 2\pi\sqrt{\frac{L}{g}}\)
Part 2: Large Amplitude Effects
  1. Repeat simulations for \(\theta_0 = 0.2, 0.5, 1.0, 1.5, 2.0\) radians
  2. For each, measure the period \(T\)
  3. Create a table: \(\theta_0\text{,}\) \(T\text{,}\) \(T/T_0\)
  4. Plot period versus initial amplitude
Part 3: Phase Space Portrait
  1. For several initial amplitudes, plot \(\omega\) versus \(\theta\) (phase portrait)
  2. Observe the shape of the trajectoriesβ€”they should be closed loops for oscillatory motion
  3. What happens as \(\theta_0\) approaches \(\pi\) (upside-down position)?

Subsection Physical Pendulum Activity

Optional Experimental Validation:
Materials:
Procedure:
  1. Measure the length \(L\) of your pendulum.
  2. For various starting angles (5Β°, 15Β°, 30Β°, 45Β°, 60Β°), release from rest and time 10 complete oscillations.
  3. Calculate the period: \(T = \text{total time}/10\)
  4. Compare experimental periods with your Euler’s method simulations.

Subsection Analytical Questions

  1. How does the step size \(h\) affect the accuracy of Euler’s method? Test with \(h = 0.1, 0.01, 0.001\text{.}\)
  2. For the small-angle approximation (\(\sin\theta \approx \theta\)), the equation becomes \(\frac{d^2\theta}{dt^2} + \frac{g}{L}\theta = 0\text{.}\) Solve this analytically and compare with your numerical solution.
  3. Energy should be conserved: \(E = \frac{1}{2}mL^2\omega^2 + mgL(1-\cos\theta)\text{.}\) Calculate \(E\) at each time step in your simulation. How well is energy conserved? Why might it drift?
  4. What happens if you start the pendulum with \(\theta_0 = \pi\) (exactly upside down)? Is this a stable or unstable equilibrium?
  5. For what initial angle does the period equal \(1.1 T_0\) (10% longer than the small-angle period)?

Subsection Extensions

Modify your code to explore:
  • Damping: Add a term \(-b\omega\) to model air resistance. How does the amplitude decay?
  • Driving force: Add \(F_0\cos(\omega_d t)\) to model a periodically driven pendulum. Can you observe resonance?
  • Chaotic pendulum: For strong driving and damping, the pendulum can exhibit chaotic motion. Explore parameter ranges where chaos occurs.

Subsection Final Report

Submit a comprehensive report (4-5 pages) including:
  1. Derivation of the pendulum differential equation from Newton’s laws or energy principles.
  2. Explanation of how the second-order equation is converted to a system of first-order equations.
  3. Description of your Euler’s method implementation (include code snippets or pseudocode).
  4. Graphs of \(\theta(t)\) and \(\omega(t)\) for multiple amplitudes.
  5. Period versus amplitude data and graph, with comparison to small-angle theory.
  6. Phase space portraits showing closed orbits.
  7. Energy conservation analysis throughout your simulations.
  8. Discussion of numerical accuracy and how step size affects results.
  9. If conducted, comparison with experimental pendulum data.
  10. Exploration of at least one extension (damping, driving, or chaos).
Euler’s method, though simple, is a powerful tool for understanding differential equations that resist analytical solution. The nonlinear pendulum demonstrates why numerical methods are essential in applied mathematicsβ€”the real world often gives us equations we cannot solve exactly, yet we can still extract meaningful predictions through careful numerical approximation. This approach extends to weather prediction, rocket trajectories, circuit simulation, and countless other applications where exact solutions are unattainable.
You have attempted of activities on this page.