Python in the classroom - lesson 8

This is already the last lesson of this series. Hopefully the students have gained a lot of experience with programming in Python. A lot of physics was also discussed. In this lesson, we will try to compare our model of Felix Baumgartner's fall with the data recorded during the fall. We will then optimize the biggest unknown, namely the coefficient of friction, to get the smallest possible difference between the real values ​​and our model.

Load recorded fall data

HandiHow has already processed the fall data in a csv file, and published this csv file on Github in a public repo. This is also a handy way to be able to load other files in the future. There are also other ways, such as putting the file in your Google Drive and reading it there, or loading the file from a local computer. More information about this can be found in this blog about 3 ways of loading csv files into Google Colab.

import pandas as pd

url = ''
df1 = pd.read_csv(url)

jump_times = df1['Time (s)']
jump_altitudes = df1['Altitude (m)']
jump_speeds_kmh = df1['Speed (Km/h)']

jump_positions = []
jump_velocities = []

i = 0

for time in jump_times:
  jump_positions.append(total_height - jump_altitudes[i])
  i += 1


To load the csv file, we use the Python library “pandas”. We first import “pandas”. Then we give the online address of the csv file on Github. Using the “read_csv” function of pandas we can load this url. The data is now in a so-called “Pandas Dataframe”. We can then save the different columns in lists. Pandas automatically gives these columns the index of the first line of the file. If you view the file via the url, you will see that the column headers are "Time (s)", "Altitude (m)" and "Speed ​​(Km / h)". We store these lists in the variables "jump_times", "jump_altitudes" and "jump_speeds_kmh".

Then we create a “for loop” to transform the data so that we can put it in our charts. We therefore need to convert altitude into displacement and convert the speeds to meters per second. This is also a good exercise for students! So let them try this for themselves first.

With the print statement we check whether our two new lists are complete and meet our expectations.

Plotting model and observations

We now want to be able to compare our model with the observations. We are therefore going to graph the observed speeds and displacements in our model.

import matplotlib.pyplot as plt

plt.plot(times, velocities)
plt.plot(jump_times, jump_velocities)
plt.ylabel('v (m/s)')
plt.xlabel('t (s)')

plt.plot(times, positions)
plt.plot(jump_times, jump_positions)
plt.ylabel('x (m)')
plt.xlabel('t (s)')

Actually, we're just adding the two bold lines. It's really not that difficult! We now get the following picture.

Beautiful! We see that our model is in the right direction. Still, the speed is a bit too high, so that the displacement is skewed. The problem mainly starts when air friction starts to play a greater role. Discuss with the students if this makes any sense!

Adjust initial values

We initially assumed that the value of the drag coefficient is 0.6. First, let's try to pick a slightly better value for this. Since our model gives too high a speed almost everywhere, this value must be increased. On Wikipedia page of drag coefficient states that a ski jumper is on average between 1.1 and 1.3. So let's try 1.2. This produces the following graphs of (v, t) and (x, t) diagrams:

We now see that the total displacement during the free fall better matches the measurements. It is interesting to discuss with the class what other ideas there are to make the model more accurate. A few options:

  • The density of air can be more accurately calculated with the gas law. We only approximated this by halving the density every 5,500 meters.
  • Felix got into a dangerous spin after about 0:40. This lasted until approximately 1:10. What would be the effect of this spin on air friction? It appears that Felix was slowed down more during this time than our model predicts.
  • It is likely that the frontal area varied during the fall. After all, Felix could vary his position from falling straight down (minimum frontal area) to falling flat on his stomach (maximum frontal area). Can this be included in the model?
  • Was there any wind? The speed curve gets a bit bumpier after about 2 minutes.

Final assignments

You can complete this lesson series with a final assignment. Some ideas for models are, each time asking for the (x, t) diagram and the (v, t) diagram of this movement. You can award extra points if friction is included in the model:

  • The motion of a bouncing ball that falls from a height of 10 meters. If the ball hits the ground, the direction of the ball's speed must be reversed. Bounce the ball 10 times.
  • The motion of a mass on a spring. The spring is stretched, creating a spring force that is proportional to the extension. The spring force must be calculated in each time step, which causes an acceleration. Let the mass move back and forth 10 times.

The mark for this final assignment is a 6 without friction and a 7 with friction. You can award an extra point if the code is very neatly structured and functions have been used to split the code.

You may have students who have gotten the hang of it and are looking for even more challenges. For these students you can come up with challenging assignments that have not been covered and that require a lot of your own research work. You will be amazed by some of the students! These are ideas for two-dimensional assignments:

  • Shooting a cannon. Make sure the angle of the cannon can be adjusted.
  • Earth-Moon or Sun-Earth-Moon. You can also model this motion very nicely.

There is Python library that makes it possible to visualize movements of planets: VPython. This can be programmed on the website The two-dimensional final assignments can yield the grades 8 and a 9 with friction (cannon), or a 9 (earth-moon) or 10 (sun-earth-moon).

That was it!

This was the end of this series. You can find the link to the Google Colab Notebook of this lesson. HandiHow would like to help schools make Python programming a success in the classroom. Ask for the possibilities! And we are very curious about your experiences with programming in the classroom.


About the author

Roeland is the HandiHow company owner and lead education developer.

Leave A Reply

Your email address will not be published. Required fields are marked *


Contact HandiHow for an informal exploratory meeting.