Write a computer program to solve for time of a falling body

In summary: Then in the for loop it would look likex = x + dxI just need someone to walk me through this step by step. I'm really lost at this point.
  • #1
Elvis 123456789
158
6

Homework Statement


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

Homework Equations


a = dv/dt
v = dy/dt

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?
 
Physics news on Phys.org
  • #3
jedishrfu said:
YOu could download freemat and use it to write you program.

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

http://freemat.sourceforge.net/
Thanks for the recommendation, but I downloaded python already for this. Though the programming language is really the least of my worries...
 
  • #4
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:
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
jedishrfu said:
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:
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
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
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.
 

1. How do you define a falling body in a computer program?

In a computer program, a falling body is typically defined as an object that is accelerating due to the force of gravity and experiencing a constant downward acceleration of 9.8 meters per second squared.

2. What variables are needed to solve for the time of a falling body?

The variables needed to solve for the time of a falling body include the initial height of the object, the acceleration due to gravity, and the final height (usually assumed to be 0).

3. How do you incorporate the equations of motion into the program?

The equations of motion can be incorporated into the program by using the appropriate formulas, such as t = sqrt((2 * h) / g) for the time of a falling body. The values for h and g can be stored in variables and the computer can perform the necessary calculations using these values.

4. Can the program account for air resistance?

This depends on how the program is designed and whether or not the equations of motion used consider air resistance. If the program uses the basic equations of motion, it will not account for air resistance. However, if more complex equations are used, it is possible to include air resistance in the calculations.

5. How accurate is the program's calculation of the time of a falling body?

The accuracy of the program's calculation depends on the precision of the input variables and the equations used. With precise input and accurate equations, the program should provide an accurate calculation of the time of a falling body. However, there may be slight discrepancies due to factors such as air resistance and the limitations of the computer's processing power.

Similar threads

  • Introductory Physics Homework Help
Replies
7
Views
1K
  • Classical Physics
Replies
12
Views
1K
  • Introductory Physics Homework Help
Replies
14
Views
1K
  • Introductory Physics Homework Help
Replies
1
Views
1K
  • Introductory Physics Homework Help
Replies
11
Views
1K
  • Introductory Physics Homework Help
Replies
4
Views
2K
  • Introductory Physics Homework Help
Replies
1
Views
747
  • Introductory Physics Homework Help
Replies
8
Views
2K
  • Introductory Physics Homework Help
Replies
1
Views
693
Replies
13
Views
1K
Back
Top