Graph plot and visualisation of percentage error between approximated time period formula used in IB Physics and exact time period, against initial angle of bob.
pendulum.cpp: C++ program that calculates the percentage error for different initial angles.plot_pendulum_data.py: Python script that reads the data generated by the C++ program and plots a graph.
Compile the C++ program:
g++ pendulum.cpp -o pendulumRun the compiled program:
./pendulumEnsure you have the required Python packages installed:
pip3 install numpy matplotlib scipyRun the Python script to plot the data and fit a quadratic curve:
python3 plot_pendulum_data.pyThe generated graph illustrates the relationship between the initial angle and the percentage error. A quadratic curve has been fitted to the data to capture the underlying trend.
The fitted equation for the quadratic curve is:
The fitted equation for the quadratic curve is:
This equation can be used to predict the percentage error for a given initial angle.
For a good measurement system, the accuracy error should be within 5% and the precision error should be within 10%.
