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

Click For Summary

Homework Help Overview

The problem involves numerical calculations for a skydiver falling from an altitude of 30.0 km, considering various factors such as air resistance and gravitational variation with height. The original poster is tasked with developing a computer program to calculate the time of fall under different conditions, starting with no air resistance and progressing to include drag forces and changing gravitational acceleration.

Discussion Character

  • Exploratory, Problem interpretation, Assumption checking

Approaches and Questions Raised

  • The original poster expresses difficulty in starting the programming task, mentioning a lack of prior programming experience and guidance from the professor. They consider using Riemann sums for numerical integration but are unsure how to implement this in code. Some participants suggest using specific programming environments like Freemat or Python, while others provide pseudo-code examples to illustrate how to approach the problem using differential equations.

Discussion Status

Participants are actively discussing potential programming approaches and sharing insights on numerical methods. Suggestions for using differential equations and specific programming techniques have been offered, but there is no consensus on a single method or solution yet. The conversation is ongoing, with various interpretations and suggestions being explored.

Contextual Notes

The original poster notes that they have not received instruction on programming from their professor, which adds to their challenge in tackling the problem. There is also mention of needing to achieve a specific accuracy in the calculations, which may influence the choice of numerical methods discussed.

Elvis 123456789
Messages
158
Reaction score
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
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...
 
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
 
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?
 
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.
 

Similar threads

  • · Replies 9 ·
Replies
9
Views
1K
  • · Replies 7 ·
Replies
7
Views
2K
Replies
14
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 12 ·
Replies
12
Views
3K
Replies
4
Views
2K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 8 ·
Replies
8
Views
3K