My program is meant to calculate the speed at which I hit the ground if I jump off a cliff.
I solved a differential equation. (Air resistance force is proportional to square of velocity.)
dv/dt = g (1 - v^2 / V_terminal^2)
positive v is downwards
now use the trick dv/dt = dv/dz dz/dt = dv/dz * v (z = height)
and integrate
integral v / (1-v^2/V_terminal^2) dv = integral g dz
gives you
(V_terminal^2 / 2) * ln(1-V_final^2/V_terminal^2) = gH
so
V_final = V_terminal*(1-e^(-2gh/V_terminal^2))^(1/2)
Now I put it in a program but whatever height I put in, it just comes out as the terminal velocity.
What am I doing wrong?
PROGRAM JUMP
IMPLICIT NONE
REAL GETV
REAL V
REAL H
REAL HGAPING
C https://en.wikipedia.org/wiki/Gaping_Gill
PARAMETER (HGAPING=98.)
WRITE(6,*) 'EXAMPLE YOU JUMP ',HGAPING,' METRES'
WRITE(6,*) 'YOU HIT GROUND AT ',GETV(HGAPING),' MPH'
10 WRITE(6,*) 'HOW HIGH DO I JUMP FROM (METRES)?'
READ(5,*) H
WRITE(6,*) 'YOU JUMP FROM ',H,' METRES'
WRITE (6,*) 'YOU HIT GROUND AT ',GETV(H),' MPH'
GOTO 10
END
FUNCTION GETV(H)
REAL GETV
REAL H
REAL G
C https://en.wikipedia.org/wiki/Standard_gravity
PARAMETER (G=9.81)
REAL VTERMIN
C https://en.wikipedia.org/wiki/Free_fall
PARAMETER (VTERMIN=53.)
REAL METPS2MPH
PARAMETER (METPS2MPH=2.2369363)
GETV=VTERMIN*SQRT(1.-EXP(-2*G*H/(VTERMIN*VERMIN)))
1 *METPS2MPH
END
NOTE here is what you expect if it is working correctly. If you put in a big number then you should get approximately the terminal velocity, but if you put in a small number then you should get approximately SQRT(2*G*H). Both of these converted to mph by the scale factor included in the program.
Here is working version of the program neglecting air resistance
(1/2) m V_final^2 = m g H (simple energy equation)
PROGRAM JUMP
IMPLICIT NONE
REAL GETV
REAL V
REAL H
REAL HGAPING
C https://en.wikipedia.org/wiki/Gaping_Gill
PARAMETER (HGAPING=98.)
WRITE(6,*) '*** THIS PROGRAM NEGLECTS AIR RESISTANCE ***'
WRITE(6,*) 'EXAMPLE YOU JUMP ',HGAPING,' METRES'
WRITE(6,*) 'YOU HIT GROUND AT ',GETV(HGAPING),' MPH'
10 WRITE(6,*) 'HOW HIGH DO I JUMP (METRES)?'
READ(5,*) H
WRITE(6,*) 'YOU JUMP',H
WRITE (6,*) 'YOU HIT GROUND AT ',GETV(H),' MPH'
GOTO 10
END
FUNCTION GETV(H)
REAL GETV
REAL H
REAL G
C https://en.wikipedia.org/wiki/Standard_gravity
PARAMETER (G=9.81)
REAL METPS2MPH
PARAMETER (METPS2MPH=2.2369363)
GETV=SQRT(2*G*H)
1 *METPS2MPH
END
But the calculation including air resistance is going wrong somewhere.