# How can I be sure of my numerical result?

Tags:
1. Sep 26, 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) = c*v2, where c=0.500 kg/m and is constant. You should be able to compare your result to an analytic result from problem 3.

2. Relevant equations

3. The attempt at a solution
this is my program

import numpy as np

# numerical calculation for falling body with constant

#gravitational force only

#

# gravitational acceleration in m/s^2

g = 9.81

# mass in kg

m = 75.

#drag coeffcient in kg/m

c = 0.5

# initial position (measuring down to be positive) in m

y = 0.

# initial velocity in m/s

y1 = 0.

# time interval in seconds

dt = 0.01

a = [] # acceleration array

v = [] # velocity array

p = [] # position array

i = 0

while y<30000.:

i = i + 1

y2 = g - (c*y1**2.)/m # this the differential equation that describes the motion (y2 = a )

y = y + y1 * dt

y1 = y1 + y2 * dt

p.append(y)

v.append(y1)

a.append(y2)

print(i*dt)

in the end i get t = 784.78 s for the total time but how can i be sure about this number?

2. Sep 26, 2016

### Simon Bridge

What do you mean by "sure"?

You can, for example, do an experiment to verify the model you used to arrive at that number.
You can check to see if the result is consistent with what you know of the rest of physics.
ie. for (a) the problem tells you to compare your result, in the case of zero air resistance, to the analytic result. Did you do this?
When you do the problem including air resistance, do you expect the result to be bigger or smaller than without air resistance? What did you get?

3. Sep 26, 2016

### Elvis 123456789

Yes I did part a and got the answer to be within about 1 part in 10000 compared with the analytic result. When air resistance is included i expect the amount of time to be significantly larger because the acceleration is not just "g" anymore, its g minus a constant times the square of the velocity, so the acceleration is decreasing at all times until the drag force cancels the gravitational force ( if its in the air that long). So the time I got for part a was like 78.2 seconds which is much smaller than the result in part b (785 s). So at least I know that it has a chance of being right, but I can technically say that about the range 78.2 s < t < infinity, obviously this is an exaggeration but still.

4. Sep 26, 2016

### Simon Bridge

... you can do better than that, you can work out the analytical terminal velocity and figure the time to fall the whole distance at that constant speed. Since some of the time is spent falling faster than that, this will be an upper limit.

What this does is show that the computer calculation is consistent with the physical model you are using. ie. helps you be confident that what the computer is calculating from the physical model (the math equation) that you want to compare with reality.

5. Sep 26, 2016

### Elvis 123456789

ah i didn't think of that. my result does indeed lie below that upper limit but barely. I'm assuming this is because the drag force very quickly balances out the gravitational force due to the v^2 term

6. Sep 26, 2016

### haruspex

Did you mean more slowly?

7. Sep 26, 2016

### Simon Bridge

Hmmm... with greater acceleration grrr. So the expect correct time to fall close to or bigger than that.

8. Sep 26, 2016

### phyzguy

One way to check the consistency of your numerical calculation is to decrease the time step dt. If your numerical calculation is accurate, it should be independent of dt. So you could start with a large time step, like 0.1, and then decrease dt to 0.01, 0.001, 0.0001, etc. Once dt is small enough, the result should converge to a limit that is independent of dt.