Fun with the HP 71B II
Four years ago, I had fun with the HP 71B programming:
That has been too long ago. Time to pull out the 71B again.
Digital Root of an Integers
Add all the numbers of an integer and repeat until you
have a single digit (1-9).
Program DROOT (52 bytes)
10 DESTROY N
20 INPUT “INTEGER:”;N
22 N=IP(N)
30 D=1+MOD(N-1,9)
40 DISP D
Easy Traverse Calculation
Calculates the new point knowing the original
coordinates, direction, and angle of travel. The angle 0° comes from due
east and rotates counterclockwise (see diagram below).
Program TRAVEZ (216 bytes)
15 DEGREES
20 INPUT “INIT. EASTING:”;E
25 INPUT “INIT. NORHTING:”;N
30 D=0
40 INPUT “DISTANCE:”;I
45 INPUT “ANGLE:”;A
50 E=I*COS(A)+E
55 N=I*SIN(A)+N
57 D=D+I
60 DISP N;’,’;E
65 PAUSE
70 INPUT “DONE? (Y=1,N=0)”;X
75 IF X=0 THEN 40
90 DISP “TOTAL DIST:”;D
Integral Using Simpson’s Rule
∫ FNF(X) dX from X = a to X = b
Line 10 is where you have to define your function
(of X).
Program
SIMPSON (200+ bytes)
10 DEF
FNF(X)=insert function of X here
30
INPUT “LOWER:”;A
32
INPUT “UPPER:”;B
34
INPUT “# PART’NS (EVEN):”;N
36
RADIANS
38
T=FNF(A)+FNF(B)
40
H=(B-A)/N
50 FOR
I=1 TO N-1
52 IF
FP(I/2)=0 THEN 54 ELSE 56
54
T=2*FNF(A+I*H)+T @ GOTO 58
56
T=4*FNF(A+I*H)+T
58 NEXT
I
60
T=T*H/3
62 DISP
“INTEGRAL:”;T
Expanding
the Binomial (ax+b)^n
BINOMEXP
gives the coefficients of the expansion of (ax+b)^n.
Program
BINOMEXP (about 189 bytes)
10
DESTROY A,B,N,L,I,C
12
OPTION BASE 0
14 DISP
‘exapand(Ax+B)^N’ @ WAIT 1
16
INPUT “A,B,N”;A,B,N
18 DIM
L(N)
20 FOR
I=0 TO N
22
C=FACT(N)/(FACT(I)*FACT(N-I)) \\ FACT is
the factorial function
24
L(I)=C*A^(N-I)*B^I
26 DISP
“L(“; I; ”):”; L(I); “x^”; N-I @ PAUSE
28 NEXT
I
40 DISP
“DONE, CHECK L.”
Synthetic Division
Divide the polynomial p(x) by (x-R). P is the array of p(x), Q is the array
representing the quotient q(x), and E is the remainder. Hence:
P(x)/(x-R) = Q(x) + E/(x-R)
Program SYNTH (304 bytes)
10 DESTROY P,I,Q,R,E
12 OPTION BASE 0
14 DIPS “P(X)/(X-R)” @ WAIT 1
16 INPUT “DEGREE OF P(X):”;N
18 DIM P(N),Q(N)
20 FOR I=0 TO N
22 DISP “COEF OF x^”;N-1 @ PAUSE
24 INPUT P(I) @ P(I)=Q(I)
26 NEXT I
30 INPUT “R:’;R
40 FOR I=0 TO N-1
42 Q(I+1)=R*Q(I)+P(I+1)
44 NEXT I
50 E=Q(N)
60 DIM Q(N-1)
70 DISP “COEF OF Q(X)”
72 FOR I=0 TO N-1
74 DISP Q(I); “x^”; N-I-1 @ PAUSE
76 NEXT I
80 DISP “REMAIN:”; E; “/(x-“; R; “)”
Dew Point Measurement (in °F)
Program DEWPOINT (159 bytes)
10 DESTROY T,H,V,W,C,D
20 INPUT “TEMP °F”;T
22 C=(T-32)*5/9
26 INPUT “REL HUMIDITY (%):”;H
30 V=(LOG(H%1)+17.27*C/(237.3+C))/17.27
32 W=237.3*V/(1-V)
40 D=9/5*W+32
42 DISP “DEW POINT °F:”;D
// Degree symbol:
[ g ] [RUN] (CTRL) [ A ]