Sorted independent finance guides are full of helpful information on everyday money matters.

# HP 71B: Product of f(x), Nested Radicals, How Much Can I Afford?, Cardiac Analysis

HP 71B:  Product of f(x), Nested Radicals, How Much Can I Afford?, Cardiac Analysis

Product of a Function

∏ f(x)

Edit f(x) at line 10

PROGRAM PRODFX
At least 90 bytes, 1/23/2019

10 DEF FNF(X)=[ insert f(X) here ]
20 INPUT “Lower=”;L
30 INPUT “Upper=”;U
40 P=1
50 FOR X=L TO U @ P=P*FNF(X) @ NEXT X
60 DISP ‘P=’;P

Example:  f(X) = FNF(X) = 1/X
Lower:  1
Upper:  5
Result:  6.61375661376E-6

Trigonometric Simplification

Original blog entry (11/15/2018):  http://edspi31415.blogspot.com/2018/11/ti-84-and-casio-fx-cg-50-micropython.html

Source: Dugopolski, Mark  Trigonometry Addison Wesley: Boston 2003 pp 211-212  ISBN 0-201-70338-6

Simply the expression:

a sin x + b cos x = r * sin( θ + x )
where r = √(a^2 + b^2), θ = angle(a,b) = arg(a+bi)

PROGRAM SCTOSIN
114 bytes, 1/23/2019

10 DESTROY A,B,R,T
30 DISP “A*SIN(X)+B*COS(X)” @ PAUSE
40 INPUT “A=”;A
50 INPUT “B=”;B
60 R=SQR(A^2+B^2) @ T=ANGLE(A,B)
70 DISP R;”*SIN(“;T;”+X)”

Line 70 can use PRINT
SQR is √

Example:
A = 2.25,  B = 1.76
Result:
R = 2.85658887486  (scroll left)
θ = .663806440909
Output:
2.85658887486  *SIN( .663806440909 +X)

How Much Car Can You Afford?

Original blog entry (3/13/2018):  https://edspi31415.blogspot.com/2018/03/hp-prime-car-payment-and-affordability.html

Calculate how much the buyer can afford, considering sales tax, discounts, and down payment.  All amounts are entered as positive.

PROGRAM AFFORD
221 bytes, 1/24/2019

10 DESTROY N,I,S,X,W,D,P
20 INPUT “# MONTHS:”;N
30 INPUT “RATE %:”;I @ I=I/1200
40 INPUT “PAYMENT \$”;X
50 INPUT “SALES TAX %:”;S
60 INPUT “DISCOUNT %:”;D
70 INPUT “DOWN PMT \$”;W
80 P=1/I*(1-(1+I)^(-N))
85 P=P*X
90 P=(P+W)/((1+.01*S)*(1-.01*D))
95 PRINT USING “‘AMT: \$’7D.DD”;P

Example:
Term: N = 60 months
Interest Rate:  I = 4.8%
Desired Payment: X = \$295
Sales Tax: S = 9.5%
Discount: D = 10%
Down Payment: W=\$1500

Result:
AMT: \$17657.09

HP 71B: Cardiac Programs

Source:  Hewlett Packard.  “HP-65 Medical Pac 1” 1974.

Valve Area

Variables:

Input:
P = pressure gradient data (mmHg), enter an average or data points
C = cardiac output (CO) (l/min)
R = R-R interval (seconds)
T = the time the valve is open (seconds)

The program offers a choice between calculating an  area of a regular valve or a mitral valve.

Program VALVE
433 bytes, 1/28/2019

10 DESTROY K,P,N,D,P1,C,R,T,F,V
20 P1=0 @ N=0 @ P=0
30 PRINT “PRESSURE (mmHg)” @ WAIT .5
35 INPUT “P: 1=AVG 2=DATA “;K
38 IF K=1 THEN 50 ELSE 40
40 INPUT “P DATA: “;D
42 P=P+D @ N=N+1 @ P1=P/N
44 INPUT “DONE? 1=YES 2=NO “;K
46 IF K=2 THEN 40 ELSE 60
50 INPUT “P AVG. :”;P1
60 INPUT “CO (l/min): “;C
62 INPUT “R-R (sec): “;R
64 INPUT “OPEN TIME (sec/min):”;T
66 F=C*R/(60*T) @ V=F/(.0445*SQR(P1))
68 INPUT “MITRAL 1=YES 2=NO “;K
70 IF K=1 THEN LET V=V/.7
72 PRINT “MEAN FLOW (l/sec) :”;F @ PAUSE
74 PRINT “AREA (cm^2) :”;V

Anatomic Shunts

The program SHUNTS calculates the bi-directional shunts as a percentage.  The shunts are R-L (right-left) shunt and the L-R (left-right) shunts.

Variables:

Input:
R1:  right pulmonary artery
R2:  right atrium
L1:  left pulmonary artery
L2:  left ventricle

Program SHUNT
230 bytes, 1/27/2019

10 DESTROY L1,L2,R1,R2,L3,R3
20 INPUT “R-PULMONARY%:”;R1
30 INPUT “R.ATRIUM%:”;R2
40 INPUT “L-PULMONARY%:”;L1
50 INPUT “L.ATRIUM%”;L2
60 R3=(L1-L2)/(L1-R2)*100
65 L3=(R1-R2)/(L1-R2)*100
70 PRINT USING ‘ “R-L SHUNT:”4D.DD”%” ‘;R3 @ PAUSE
75 PRINT USING ‘ “L-R SHUNT:”4D.DD”%” ‘;L3
90 END

Stroke Work

The program STRKWORK calculates stroke work and stroke work index based on pressure, cardiac output (CO), R-R interval (seconds), and body surface area (BSA).  The BSA is optional but is needed to calculate stroke work index.

Program STRKWORK
404 bytes, 1/28/2019

10 DESTROY S,S1,P,P1,R,C,N,K,D,B
14 DISP “P=PRESSURE mmHg” @ WAIT .5
20 N=0 @ P=0
25 INPUT “P 1:AVG 2:DATA “;K
30 IF K=1 THEN 50
40 INPUT “P. DATA PT: “;D
42 P=P+D @ N=N+1 @ P1=P/N
44 INPUT “DONE? 1=YES 2=NO “;K
46 IF K=2 THEN 40 ELSE 60
50 INPUT “AVG P: “;P1
60 INPUT “R-R INTERVAL (sec):”;R
62 INPUT “CO (L/MIN): “;C
70 S=13.6*P1*C*R/60
72 PRINT “SW =”;S;”(gm m)” @ PAUSE
80 INPUT “BSA? (m^2) (0=NONE): “;B
82 IF B=0 THEN 90
84 S1=S/B
86 PRINT “SWI: “;S1;”gm m/m^2”
90 END

Eddie

All original content copyright, © 2011-2019.  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.