Analyzing the Motion of Soccer Ball using a Camera and Calculus

Animation showing the motion of the ballistic motion of a soccer ball.

If you throw a soccer ball up into the air and take a quick series of photographs you can capture the motion of the ball over time. The height of the ball can be measured off the photographs, which can then be used for some interesting physics and mathematics analysis. This assignment focuses on the analysis. It starts with the height of the ball and the time between each photograph already measured (Figure 1 and Table 1).

Figure 1. Height of a thrown ball, measured off a series of photographs. The photographs have been overlaid to create this image of multiple balls.

Table 1: Height of a thrown soccer ball over a period of approximately 2.5 seconds. This data were taken from a previous experiment on projectile motion.

Photo Time (s) Measured Height (m)
P0 0 1.25
P1 0.436396062 6.526305882
P2 0.849230104 9.825317647
P3 1.262064145 11.40310588
P4 1.674898187 11.30748235
P5 2.087732229 9.657976471
P6 2.50056627 6.191623529

Assignment

  1. Pre-Algebra: Draw a graph showing the height of the ball (y-axis) versus time (x-axis).
  2. Algebra/Pre-calculus: Determine the equation that describes the height of the ball over time: h(t). Plot it on a graph.
  3. Calculus: Determine the equation that shows how the velocity of the ball changes over time: v(t).
  4. Calculus: Determine the equation that shows how the acceleration of the ball changes with time: a(t)
  5. Physics: What does this all mean?

Rates of change: 4 cm/liter

The first stage rocket booster separates. Image from NASA via Wikipedia.

Fully loaded, the first stage of the Saturn V rockets that launched the Apollo missions would burn through a liter of fuel for every four centimeters it moved. That’s 5 inches/gallon, which, for comparison, is a lot less than your modern automobile that typically gets over 20 miles/gallon.

Ski Trip (to Hidden Valley)

Approaching a change in slope.

We took a school trip to the ski slopes in Hidden Valley. It was the interim, and it was a day dedicated to taking a break. However, it would have been a great place to talk about gradients, changes in slopes, and first and second differentials. The physics of mass, acceleration, and friction would have been interesting topics as well.

Calculus student about to take the second differential.

This year has been cooler than last year, but they’ve still struggled a bit to keep snow on the slopes. They make the snow on colder nights, and hope it lasts during the warmer spells. The thermodynamics of ice formation would fit in nicely into physics and discussion of weather, while the impact of a warming climate on the economy is a topic we’ve broached in environmental science already.

The blue cannon launches water into the air, where, if it’s cold enough, it crystallizes into artificial snow. The water is pumped up from a lake at the bottom of the ski slopes.

Influence Explorer: Data on Campaign Contributions by Politician and by Major Contributors

Influence Explorer is an excellent resource for assessing data about money in politics.

The website Influence Explorer has a lot of easily accessible data about the contributions of companies and prominent people to lawmakers. As a resource for civics research it’s really nice, but the time series data also makes it a useful resource for math; algebra and pre-calculus, in particular.

Warming of the West Antarctic Ice Sheet

… a breakup of the ice sheet, … could raise global sea levels by 10 feet, possibly more.

— Gillis (2012): Scientists Report Faster Warming in Antarctica in The New York Times.

In an excellent article, Justin Gillis highlights a new paper that shows the West Antarctic Ice sheet to be one of the fastest warming places on Earth.

The black star shows the Byrd Station. The colors show the number of melting days over Antarctica in January 2005. This number increases with warming temperatures (image from supplementary material in Bromwich et al., 2012).

Note to math students: The scientists use linear regression to get the rate of temperature increase.

The record reveals a linear increase in annual temperature between 1958 and 2010 by 2.4±1.2 °C, establishing central West Antarctica as one of the fastest-warming regions globally.

— Bromwich et al., (2012): Central West Antarctica among the most rapidly warming regions on Earth in Nature.

Seeing Functions at the City Museum

The slide on the third floor of the City Museum. A co-ordinate system is overlayed, and points showing the curve of the slide are selected.
Elegant curves.

I asked my students to take pictures of the curves they found while on our field trip to the scrap metal playground that is the City Museum. The plan is to see if we can determine what functions best fit the curves. To do so, we need to transfer the curves from the images to a co-ordinate system. Since I’m primarily interested in what type of functions might best fit the data, the scale of the co-ordinates does not matter that much.

Feet, inches, meters, centimeters, pixels, or any other units can be used. In fact, I use a purely arbitrary set of coordinates in the image above. All I require is that the grid be evenly spaced (although the vertical and horizontal spacing don’t have to be the same, it’s more straightforward if they are).

Now we take a set of points that lie on our shape and try to match them to some sort of curve using a spreadsheet, and, if we’re able, least squares regression.

There were lots of shapes to choose from.

There were lots of shapes to choose from, including the nice sinusoid in the background.

Least Squares Regression with Excel

Here I’ll go over how to do Least Squares Regression, as simply as possibly, using Excel and its Solver*. Least Squares Regression can be used to match pretty much any type of function to any type of data. Most spreadsheet programs, like Excel, will do some curve matching for you when you add trendlines to graphs, but for more sophisticated work — in pre-Calculus and beyond for example — you need a more general approach.

Figure 1. Selected annual average carbon dioxide concentrations since 1959 (see Table 1 for data). Data from NOAA.

We’ll start with a data set that we want to match. The atmospheric CO2 data from Mauna Loa is a convenient dataset. It’s also an important data set to model because matching a function to the data will allow us to predict the change in CO2 over the next 100 years, and those predictions are the ones the IPCC uses in their estimates of the impact of global climate change around the world. Billions, if not trillions of dollars depend on those predictions (and how governments decide to respond). For ease of demonstration, I’ve picked a few of the annual average CO2 concentration measurements at random to work with:

Table 1: CO2 Data

Year (x) CO2 concentration (ppm) (y)
1959 315.97
1964 319.62
1969 324.62
1981 340.10
1985 346.04
1996 362.59
2003 375.77

Now, looking at the data, we can see there is some sort of trend. Our first decision is about how to model it.

Straight Line Model

The simplest approach, and the one we’ll try first is to fit a straight line through the data. (The final spreadsheet is here).

The equation of a straight line is:

 y = mx + b

In this case, as we can see from the graph (Figure 1), the y axis is CO2 concentration, and the x axis is the year. m and b are our two unknown constants that set the slope of the line (m) and move it up and down (b). If you need to get a better feel for what this means, try changing the slope and intercept in the Straight Line Grapher (I used this in class to demonstrate).

To match our straight line model to the data we need to determine the values of m and b that give the best fit.

Figure 2. The formula ("=C$3*$A8+C$4") for our straight line model uses the year (column A) and the m and b coefficients (cells C3 and C4 respectively) . You'll note the $ signs in the C3 and C4 references in the formula (i.e. $C$3 and $C$4); these tell Excel to always refer to these specific cells when the formula is copied and pasted down the entire column.

So we create a spreadsheet with the data and in the adjacent column set up the straight line function by setting two cells to the values of the constants (m and b) and using those values to calculate the modeled CO2 concentration.

Figure 3. The initial values for m and b (1 and -1600 respectively) don't match the data very well.

You’ll notice that I have values of m = 1 and b = -1600 . These are just my initial estimates of these values. The initial values are not crucial, as you’ll see, but are just there for me to check that my formula is in right.

Once I have the correct formulas in, I can play around with these values until my line matches the data. However, this is where Solver comes in to save a lot of time.

Finding a match

First we need a quantitative way of telling if we have a good match or not. We can start by taking the difference between each real data point and the modeled value. We’ll call this the error.

Figure 4. Calculating the error -- the difference between the actual and modeled data.

Now we could get a single value for the total error by adding up all the individual error values, or taking the average. However, as one of my students pointed out, we could end up with a case where the modeled line crossed through the data and we’d end up with positive differences of the data points above the line canceling out the negative differences of the data points below the line. His solution was to take the absolute value of the differences (errors) instead, which should actually work just as well in the method we’re taking here.

Instead of using the absolute value, however, we’ll square the errors instead. This achieves the same effect we need because the squares of both negative and positive numbers are positive. This approach is where the “squares” in Least Squares Regression comes from. The “Least” part comes from the fact that we’re now going to try adjusting our coefficients until we get the average of the squares of the errors to be as small as possible.

Figure 5. Calculating the square of the error.

Now we take the calculate the average of the errors (the sum of the errors would work just as well) using the spreadsheet’s “AVERAGE” function.

Figure 6. Calculating the average error using the "AVERAGE" function.

Now we can adjust m and b and not just see how they compare to the data points on a graph, but know that we have the best fit if we minimize the average error.

Solver

Instead of changing m and b by hand, we can use Excel’s Solver to minimize the average error for us. The matching of a straight line can be done using algebra (e.g. here and here) but that approach won’t help us when we get to more complex functions.

We select the average error cell (E16) and tell Solver to minimize its value by changing the values of m and b.

Figure 7. Setting up Excel's Solver.

When we hit solve, Solver should converge on a solution. Because of the way the problem is set up — using the square of the error for example — makes this a non-linear problem for the solver to solve. As of this writing, Excel is the only spreadsheet program I know of that has a built-in, non-linear solver.

Figure 8. The Solver solution.

You’ll notice that Solver’s solution gives:

  • m = 1.360
  • b = -2351.9

So now we have the equation for the best fit line (our model) being:

 y = 1.360 x - 2351.9

Prediction

Using this model we can predict the atmospheric CO2 concentration for the year 2050 by setting x = 2050 in the modeled equation, which gives 436.5 ppm.

Figure 9. The straight line model matches the data very well and can be projected to predict atmospheric carbon dioxide concentrations in the future.

The final spreadsheet I used to do these calculations can be found here.

Parabolic Model

As good as the straight line model seems to be, it does not account for the slight upward curve the data seems to have (see Figure 1). So instead of a straight line, perhaps we could try a parabolic function. Just as before, we’ll need to figure out the coefficients for the parabolic function. In this case the general equation we’ll use is:

 y = ax^2 + bx + c

and we’ll need to find the coefficients a, b and c. To see how changing these coefficients change the curve, you can play around with the interactive parabola model.

We set up our spreadsheet in the same way as for the straight line, but with our new coefficients.

Figure 10. Setting the equation for a parabolic model.

Note that the only column that needs to change from the straight-line spreadsheet is the “Model” column (column C), to add the coefficients and to change the formula to that of a parabola.

Now we can use Solver to minimize the average of the squares of the errors, just as we did before, only having it change the three coefficients instead of two.

  • a = 0.00060091
  • b = -1.018
  • c = 0.9933

and a final equation:

 y = 0.00060091 x^2 + -1.018 x + 0.9933

Figure 11. Matching data using a parabolic function.

Prediction

The parabolic model predicts for the year 2050 (x = 2050) that the CO2 concentration will be 439.4 ppm.

The Excel spreadsheet for the parabolic model is here.

Which model is better?

The easiest way to compare the two models is to see which did better at minimizing the squared errors.

Table 2: Comparison of models.

Model Average Squared Error
Straight Line 4.94
Parabola 4.47

So the parabolic model does better, but not by much.

Conclusions

With this approach, you can use any type of function — exponential, sinusoidal etc. — or combination of functions to match any data, and be able to compare among the models. A better measure of how well the models match the data is the regression coefficient or coefficient of determination, but I’ll save those for another post.

Conclusions

* UPDATE (Dec 31, 2012): Gnumeric’s Solver works.
* You’ll need to use Microsoft’s Excel, or better yet Gnumeric for this because, as of this writing, none of the other common spreadsheet options — OpenOffice, Google Docs, and Mac’s Calc — have a non-linear solver built in — and even some of the newer versions of Excel seem buggy.

And the Snakes Ate the Birds who Ate the Spiders

The introduction of snakes to Guam has reverberated through the ecosystem.

Accidentally introduced to the island in the 1940s, the snake decimated the island’s native bird species in one of the most infamous ecological disasters from an invasive species.

By the 1980s, 10 of 12 native bird species had been wiped out.

Since many birds consume spiders, compete with spiders for insect prey and utilize spider webs in their nests, their loss has led to a spider explosion on the island, researchers said.

UPI (2012): Bird loss has island overrun with spiders

Note (for the Algebra students): The scientific article includes a nice box and whisker plot showing how many more spiderwebs there are on Guam compared to other islands.

Number of spider webs on different islands. Guam is the only island shown that has had a severe reduction in birds. Image from Rogers et al., 2012.