Pendulum Motion Data Visualization

This Python project uses NumPy and Matplotlib to calculate and visualize key parameters of pendulum motion—such as displacement, velocity, kinetic and gravitational potential energy, and acceleration—at every point in time throughout the motion.

View the live version of my visualization here and give it a try yourself.

Objective

My goal with this project was to create a calculation and visualization tool for simple harmonic motion (SHM) that plots displacement, potential and kinetic energy, velocity, and acceleration, over two full oscillations. The computed values, as well as the user inputs, are outlined below the four graphs.

Motivation

I wanted to develop a tool that summarizes the key parameters of SHM, making it easy to break down a complex topic into simpler constituents that are easy to understand. This tool allows for the cross-comparison between displacement, kinetic and potential energy, velocity, and acceleration, making the tool particularly suitable for people studying the topic for the first time.

After taking basic user inputs for mass, amplitude, and string length, the code computes the time period, displacement, velocity, kinetic and gravitational potential energy, and acceleration. It then generates plots for displacement, velocity, kinetic and gravitational potential energy, and acceleration over time, providing a comprehensive view of the oscillatory motion dynamics.

A summary is displayed below the plots, highlighting key information such as the time period and maximum velocity, along with the user-provided inputs on which the calculations and plots are based.

Technical Overview

Project Code