Previous page Next page Navigation bar

Calculator Programming Tutorial

Programming Building Blocks I


Ballistic Pumpkins

Problem Statement

The problem statement presented to us is:

Simulate the dropping of a medium pumpkin from 100,000 feet. Do not neglect air resistance. Find the time it takes for the pumpkin to fall to the ground and the velocity with which it impacts the ground. Find the height and time after dropping at which the pumpkin achieves maximum velocity. Find the height, time after dropping, and velocity at which the pumpkin has maximum upwards acceleration. Determine whether the pumpkin ever exceeds the speed of sound; if so, find the height, time after dropping, and velocity at which this first happens.

Credit for this problem, incidentally, goes to the fabulous Lisette, the æsthetics consultant for this site. Blame her when it gets hairy.

Problem Analysis

Well, it sounds like we need to research motion, pumpkins, gravity, air resistance, and the speed of sound. Let us take them in that order.

We remember from our high school physics class that distance is velocity times time, velocity is acceleration times time, and acceleration depends on the force applied to a body. These can be summarized:

s = ½at2 + v0t + s0
v = at + v0
a = F/m

where s is distance, v is velocity, and a is the uniform acceleration. We can also imagine that if we choose t small enough, we can treat acceleration as uniform, even if the forces on the body (such as drag) are changing. So our simulation will involve setting initial conditions, solving the equations of motion repeatedly with, say, 0.5 second periods, and figuring a current acceleration, velocity, and height until splat! height becomes zero.

A quick trip to the local market reveals a medium pumpkin weighs about 12 pounds, and is roughly spherical with a diameter of about 1 foot.

Gravity, we remember from high school, imposes an acceleration downwards of about 9.8 meters/second2. However, gravity also depends upon height, or, more properly, the distance between the centers of masses of the two bodies. The encyclopædia reveals the radius of the Earth is about 6371 km. One hundred thousand feet is 18.93 miles, or 30.48 kilometers. At this height, gravity is (6371/6401)2 as strong as at the Earth’s surface, or 99.06% of its strength at the surface. It seems we can neglect the effect of height on gravity for this problem. The force of gravity acting upon the pumpkin is therefore

Fg = 12 pounds = 12 lb × 4.448 N/lb = 53.38 kg m/sec2

This gravitational force is directed down.

Air resistance, though, is not as simple. A little poking around on the web finds a NASA web page explaining drag. This page gives the force of drag as:

Fd = ½CDAρv2

where Fd is the force imposed by drag, CD is a (dimensionless) coefficient of drag that depends upon the shape of the body, A is the cross-sectional area presented to the direction of travel through the air, ρ is the air density, and v is the velocity through the air. The force is directed opposite to the direction of travel through the air. The coefficient of drag, CD, for a sphere varies from 0.07 to 0.5. For our purposes, we can take the geometric mean of these extreme values, 0.18.

Well, now we need to know air density. We can look at a barometer and get the air pressure, but who ever needs to know air density? Well, we do, now.

A little more poking around on the NASA web site finds a web page explaining air density. This page reminds us of the ideal gas law:


where P is the pressure, V is the volume, n is the number of moles (gram molecular weights) of gas, R is the universal gas constant (8.314 kg m2 per mole °K sec2), and T is the temperature in an absolute scale.

So now, if we only had temperature and pressure, we could figure air density. Luckily, NASA has a web page explaining air pressure and density, also. This page tells us the pressure in pounds/foot2 at a height h in feet and a temperature T in degrees Fahrenheit is:

Equations for air pressure, click for description

Similarly, the temperature in degrees Fahrenheit at a height h in feet is:

Equations for air temperature, click for description

Finally, NASA also has another web page explaining the speed of sound, which states that the speed of sound is

Equation for speed of sound, click for description

where γ is the ratio of specific heats, whatever that is (but it is 1.4 for air), R is the universal gas constant, and T is the temperature in an absolute scale.

Well, it seems we have enough information now. As we go along, we will convert everything into SI units, as we are scientific types.

While this problem is self-contained, it is much larger than the previous two examples. Instead of doing all the analysis in one step, then all the coding, then all the testing, we will do this problem in pieces. In order to figure out which pieces to do first, though, it helps to know which pieces depend upon other pieces.

We have the following pieces, and the following needs:

So we will first break off these pieces of the problem, in this order, and do what we need to do with them.

[ Previous page | Top of page | Next page ]

Previous page Top of page Next page Navigation bar

Copyright © 2002 Brian Hetrick
Page last updated 27 January 2002.

Brian’s Casio Calculator Corner







Building Blocks I



Data Types




Control Flow I

Control Flow II


Basic I/O


A First Program



Logical Ops

Bitwise Ops












Data Structures I


Program Attributes

Building Blocks II

Algorithm Analysis


Data Structures II

Abstract Types


Problem Analysis

Reference Card



Site Information

Your Privacy

Site Map


Site Technical Data