- #1
njo
- 20
- 0
Homework Statement
Write a C program to simulate a falling object. The program should ask for the initial height of the object, in feet. The output of the program should be the time for the object to fall to the ground, and the impact velocity, in ft/s and miles/hour. Your program should use Euler’s method to numerically solve the differential equations describing the motion of a falling object. In Euler’s method, the state of the object at some small future time is calculated using the values at the present time. This small future timestep is typically called delta time, or dt. Thus the position (p) and speed (v) of the object in the next timestep t + dt is written as a simple function of the position and speed at the current timestep t (g is the acceleration due to gravity): v(t+dt) = v(t) + g * dt p(t+dt) = p(t) + v(t+dt) * dt You should actually start out with the velocity as zero, and the position at the initial height of the object. Then your position (above the ground) would be: p(t+dt) = p(t) - v(t+dt) * dt And you would integrate until the position becomes less than or equal to zero.
I'm having difficulty understanding what to do here. I don't really understand what the point of using these equations when t=sqrt(2d/g) gives us time of free fall.
Thanks for the help.
Homework Equations
v(t+dt) = v(t) + g * dt
p(t+dt) = p(t) + v(t+dt) * dt
p(t+dt) = p(t) - v(t+dt) * dt
The Attempt at a Solution
p(t+dt) = p(t) - v(t+dt) * dt