# Homework Help: Write a computer program to solve for time of a falling body

Tags:
1. Sep 25, 2016

### Elvis 123456789

1. The problem statement, all variables and given/known data
In this problem you will do numerical computer calculations. A skydiver of mass 75.0 kg jumps out of a plane at an altitude of 30.0 km above the surface of the Earth. His parachute fails to open. Assume there is no horizontal motion and the initial velocity is zero. We ultimately will want to do a calculation that includes variation in the drag force due to variation in atmospheric density as well as the variation of the gravitational force with altitude. But we will start simple.

a) Calculate the time to fall to the ground with no air resistance and no variation in g. Compare your result to the analytical result and refine the computer code to achieve no worse than 0.1% accuracy by adjusting the time step.

b) Now include a retarding force of F(v) = c2, where c=0.500 kg/m and is constant. You should be able to compare your result to an analytic result from problem 3.

c) Now include a height dependence in the drag force due to atmospheric density. The new drag coefficient is c = 0.5*e-y/H, where H=8.00 km is the scale height of the atmosphere and y is the height above the ground.

d) Now include the fact that g is not constant with height but given by g = 9.8/(1+y/Re)2 m/s2, where Re is the radius of the Earth and is 6370 km.

e) For the last case, make a plot of acceleration, velocity, and height as a function of time. Is there anything odd here? Comment on the acceleration. Include your results, plots, and a print out of your program with your submission. This problem will be fully graded

2. Relevant equations
a = dv/dt
v = dy/dt

3. The attempt at a solution
Hey guys and gals. I'm completely stumped on this question. I have never programmed before, and the professor did not go over how to make a computer program, nor did he give any tips on how to do so. I'm not complaining, just trying to get you all to sympathize with me for not even being able to start this.

I feel like i'm probably supposed to use the concept of riemann sums to do this problem, but I just don't know how to implement it in a computer program.

for the first part i was thinking of the graph of acceleration vs time. It would just be a horizontal line for all t up until the skydiver hits the ground with a value of 9.8 m/s^2.
If I consider t=0 to be the time that the skydiver jumps off the plane, then I can break up the graph of acceleration vs time into various rectangles of width "Δt" and height "g" going from Δt1 to Δtn. If i then calculated the area under the graph id get ΔV = Σ g*Δti where 1≤ i ≤ n but then I get Δt = ΔV/a
which is just Δt = ΣΔti which makes sense but it doesn't really help me in implementing it. I know the analytical solution to part a is t = sqrt (2y/g) but don't know how to get an approximate numerical solution.

could anybody give me any hints?

2. Sep 25, 2016

### Staff: Mentor

Freemat works a lot like matlab but doesn't have the breadth of matlab.

http://freemat.sourceforge.net/

3. Sep 25, 2016

### Elvis 123456789

Thanks for the recommendation, but I downloaded python already for this. Though the programming language is really the least of my worries...

4. Sep 25, 2016

### Staff: Mentor

The key part to writing a simulation of this is to use the differential equations you have.

As an example, I am given dy/dy=2x and so I rewrite it to:

dy = 2 * x * dx

next I create a loop around it as in the example below in pseudo-code (ie you get to code it in python)

Code (Text):

x=0
dx=0.001
y=0
dy=0

for i = 0 to 100:
dy = 2 * x * dx
y = y + dy
print x,y

x = x + dx

5. Sep 25, 2016

### Elvis 123456789

so for the first part of this problem
i have d2y/dt2 = g (taking down to be positive)

my program would be
g = 9.81
y = 0 initial position
dy/dt = initial velocity
Δt= 0.01 time interval

for i in range(1, 7821): # i chose 1 to 7821 because 7820*0.01 = 78.2 seconds the time I calculated analytically for the person to fall
d2y/dt2 = g
y = y + dy/dt * Δt
dy/dt = dy/dt + d2y/dt2 * Δt
return[ y/(dy/dt) ]

does this look correct?

6. Sep 25, 2016

### rcgldr

I assume that b) should be F(v) = c v2 (otherwise the units are wrong).

You could use Runge Kutta fourth order, known as RK4. Wiki article:

http://en.wikipedia.org/wiki/Runge–Kutta_methods

However the article doesn't explain how to handle the two step process to get from acceleration to velocity to position. As a brief explanation, for each of the four Runge Kutta steps, calculate position before calculating velocity. I could post psuedo code, but it's probably too soon to do this at this point in this thread.