Saturday, December 31, 2022

HP Prime: Free Fall with Air Friction

HP Prime:   Free Fall with Air Friction 



Introduction


The program FALLS will calculate the position and velocity of an object falling with friction proportional to square of the object's speed.   The program is aimed towards large objects in free fall.  The half-increment method is used.


With the initial conditions:


y = 0  (initial position, assumed to be at zero)

g = gravitational constant

α = f/m  (force-mass ratio)

dy/dt = 0 (velocity, assume to be at rest from the beginning)


With Δt with the change of time:


dy/dt_1/2 = dy/dt_0 + C * Δt/2  where C = g - α * (dy/dt_0)^2


dy/dt_(i+1/2) = dy/dt_(i-1/2) + C * Δt where C =   g - α * (dy/dt_(i-1/2))^2


y_i+1 = y_i + dy/dt_(i+1/2) * Δt



HP Prime Program: FALLS


EXPORT FALLS()

BEGIN

// EWS 2022-11-03


HFormat:=1;

HDigits:=4; 


LOCAL t,g,a,n;

LOCAL i,d,c,y,m;

LOCAL l0,l1,l2;

LOCAL l3,l4,m0;

 

INPUT({t,g,a,n},"Fall-Air Resistance",

{"Δt =","g =","α =","n ="},

{"charge in time","gravity",

"force/mass","number of steps"});


l0:={m};

l1:={d};

l2:={y};


// for section here

FOR i FROM 1 TO n DO

c:=g-a*d^2;

IF t==0 THEN

c:=c/2;

END;

d:=d+c*t;

m:=m+t;

y:=y+d*t;

l0:=CONCAT(l0,{m});

l1:=CONCAT(l1,{d});

l2:=CONCAT(l2,{y});  

END;


l3:=CONCAT(l0,l1);

l4:=CONCAT(l3,l2);

m0:=list2mat(l4,SIZE(l0));

m0:=TRN(m0);

RETURN m0;

 

END;


The result is a matrix wit the columns:


Column 1:  time  (t = m)

Column 2:  velocity  (dy/dt = d)

Column 3:  position (y)


The program assumes that the object or person being dropped is well above the ground or floor.  




Example


Go 10 steps with Δ = 0.25 sec, g = 9.80665 m/s^2, and α = 0.028




Velocity ≈ 18.6716 m/s

Position ≈ 76.1314 m


The program assumes that the object or person being dropped is well above the ground or floor.  



Source


Eisberg, Robert M.  Applied Mathematical Physics with Programmable Pocket Calculators  McGraw-Hill Book Company:  New York  1976.   ISBN 0-07-019109-3




I want to wish you a Happy New Year. May you have a healthy, prosperous, and happy 2023!


Note:  For January and February 2023, my posting schedule will be on Saturdays only, starting January 7.  This doesn't include any firmware updates or reviews, they will be on Mondays should they occur.    One of my resolutions for 2023 is to catch up on my reading of math books and articles.


Eddie 


All original content copyright, © 2011-2022.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author. 


Spotlight: Akron Brass FireCalc Pocket Computer

Spotlight: Akron Brass FireCalc Pocket Computer Welcome to a special Monday Edition of Eddie’s Math and Calculator blog. Thi...