Showing posts with label finance. Show all posts
Showing posts with label finance. Show all posts

Saturday, July 11, 2026

HP 20S: The July 2026 Program Collection

HP 20S: The July 2026 Program Collection


Triangulation






d = l * sin(α) * sin(ß) ÷ sin(α + ß)


Store in the following registers before calculation:

R1 = measure of angle A

R2 = measure of angle B

R3 = length l from point A to B


Solve:

R4: distance


Code:

01: LBL A; 61, 41 ,A

02: DEG; 61, 23

03: RCL 1; 22, 1

04: SIN; 23

05: ×; 55

06: RCL 2; 22, 2

07: SIN; 23

08: ÷; 45

09: (; 33

10: RCL 1; 22, 1

11: +; 75

12: RCL 2; 22, 2

13: ); 34

14: SIN; 23

15: ×; 55

16: RCL 3; 22, 3

17: =; 74

18: STO 4; 21, 4

19: RTN; 61, 26


Examples


Example 1:

Inputs: R1 = 60°, R2 = 50°, R3 = 10

Output: R4: 7.05990377592


Example 2:

Input: R1 = 30°, R2 = 80°, R3 = 27.5

Output: R4: 14.4101446626


Source:

“Triangulation (surveying)” Wikipedia. https://en.wikipedia.org/wiki/Triangulation_(surveying) (last edited October 24, 2025). Retried March 17, 2026


Payment: Continuous Compounding


PMT = PV * (e^r – 1) ÷ (1 – e^(-r * t))


Store in the following registers before calculation:

R1 = t: number of payments

R2 = r: periodic interest rate (as a decimal)

R3 = PV: present value


Solve:

R4: PMT: present


Code:

01: GTO B; 61, 41, b

02: RCL 3; 22, 3

03: ×; 55

04: (; 33

05: RCL 2; 22, 2

06: e^x; 12

07: -; 65

08: 1; 1

09: ); 34

10: ÷; 45

11: (; 33

12: 1; 1

13: -; 65

14: (; 33

15: RCL 1; 22, 1

16: ×; 55

17: RCL 2; 22, 2

18: ); 34

19: +/-; 32

20: e^x; 12

21: ); 34

22: =; 74

23: STO 4; 21, 4

24: RTN; 61, 26


Examples


Example 1:

Input: t: 36, r: 0.10 ÷ 12, PV: 5,000.00

Output: PMT: 161.434037378


Example 2:

Input: t: 60, r: 0.05 ÷ 12; PV: 26,349.56

Output: PMT: 497.374636585


Electrical Engineering: System Temperature to Noise Figure


When an amplifier is activated, two ways to express noise are the noise temperature (in Kelvin) and the noise figure (in decibels, dB). Using a reference temperature of 290 K, when the noise temperature (T) is known, the noise figure (F) can be calculated by:


F = 10 * log((T + 290) ÷ 290)


If temperature is given in degrees Celsius (°C), then the formula for noise figure becomes:


F = 10 * log((T°C + 563.15) ÷ 290)


since T = T°C + 273.15.


The following program assumes that temperature is given in degrees Celsius.


Store in the following registers before calculation:

R1 = T°C; temperature in degrees Celsius


Solve:

R2: F: noise figure


Code:

01: LBL C; 61, 41, C

02: RCL 1; 21, 1

03: +; 75

04: 5; 5

05: 6; 6

06: 3; 3

07 . ; 73

08: 1; 1

09: 5; 5

10: =; 74

11: ÷; 45

12: 2; 2

13: 9; 9

14: 0; 0

15: =; 74

16: LOG; 51, 13

17: ×; 55

18: 1; 1

19: 0; 0

20: =; 74

21: STO 2; 21, 2

22: RTN; 61, 26


Examples


Example 1:

Input: T = -160 °C (store in R1)

Output: F: 1.43068666235 dB


Example 2:

Input: T = 15°C

Output: F: 2.99642532081 dB


Source:

Ball, John A. Algorithms for RPN Calculators John Wiley & Sons: New York. 1978. ISBN 0-47-03070-8. pp. 266-267


Moderate Exercise: Target Heart Rate Range


The following equations calculate the target heart range for a typical person engaging in moderate exercise. According to the particle by Jenna Fletcher (see Source), the American Heart Society (AHA) states the person is engaged in moderate exercise when their heart rate is 50% to 70% of their maximum heart rate. The maximum heart rate is 220 minus the person’s age.


Disclaimer: This is not medical advice, any questions should be discussed with a doctor or health professional.


The moderate range is determined by:

high = (220 – age) * 0.7 = low * 1.4

low = (220 – age) * 0.5 = high * 5/7


For high intensity, use the range 70% to 85%.


Code:

01: LBL D; 61, 41, d

02: +/-; 32

03: +; 75

04: 2; 2

05: 2; 2

06: 0; 0

07: =; 74

08: ÷; 2

09: 2; 2

10: =; 74

11: R/S; 26

12: ×; 55

13: 1; 1

14: . ; 73

15: 4 ; 4

16: =; 74

17: RTN; 61, 26


Examples


Example 1:

Input: Age 49 (my age at the time of this blog)

Output: low: 85.5, high: 119.7


Example 2:

Input: Age 25

Output: low: 97.5, high: 136.5


Source:

Fletcher, Jenna. “What a target heart rate is and how to calculate it”. Medically Reviewed by Debra Sullivan Ph. D. Medical News Today. January 22, 2024. https://www.medicalnewstoday.com/articles/target-heart-rate-calculator March 16, 2026.



Percentile in a Range


The program calculates the percentile of x in the range [a, b].


percentile = (x – a) ÷ (b – a) * 100%


Store before calculating:

R1 = a, R2 = b, R3 = x


Code:

01: LBL E; 61, 42, E

02: ( ; 33

03: RCL 3; 22, 3

04: - ; 65

05 RCL 1; 22, 1

06: ) ; 34

07: ÷; 45

08: ( ; 33

09: RCL 2; 22, 2

10: - ; 65

11: RCL 1; 22, 1

12: ) ; 34

13: ×; 55

14: 2; 2

15: 10^x; 51, 12

16: =; 74

17: RTN; 61, 26


Examples


Example 1:

Input: R1 = 10, R2 = 50, R3 = 30 (30 in [10, 50])

Output: 50 (50%)


Example 2:

Input: R1 = 85.5, R2 = 117.5, R3 = 110 (110 in [85.5, 117.5])

Output: 76.5625 (76.5625%)


Programming all five of these programs will fill the program space of the HP 20S entirely (99 steps)!


Eddie


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

Saturday, May 23, 2026

HP 12C Platinum: Present Value of a Fractional Year

 HP 12C Platinum: Present Value of a Fractional Year



This blog features the HP 12C Platinum, HP 10BII+, and HP 22S calculators.



Short Term Transactions


Here is the scenario: A bank offers a short term bond, which last less than one year, which pays $100.00 at maturity date. The interest rate stated is an annual interest rate. While determining a pricing schedule, one banker uses an HP 12C Platinum calculator while another uses the HP 10BII+ calculator. They both use the TVM (time value of money) keys. A 365-day year is used.


FV = -100, I% (see table), N (see table), PMT = 0, Solve for PV, P/Y = 1


Term (days)

N = term ÷ 365

(to five decimal places) (for reference)

I%

HP 12C Platinum (to 5 decimal places)

HP 10BII+ (to 5 decimal places)

89

0.24384

5

98.79551

98.81737

141

0.38630

5

97.99973

98.02800

181

0.49589

5

97.58054

97.60958

365

1

5

95.23810

95.23810

89

0.24384

8

98.08664

98.14091

141

0.38630

8

96.83753

96.90714

181

0.49589

8

96.18425

96.25548

365

1

8

92.59259

92.59259


As you can see, the results are different! Why?


According to HP-12C Solutions Handbook (see the Source section), when it comes to fractional periods, simple interest is used instead of compound interest in the TVM solver. Most financial calculators, such as HP 10BII+ always uses compound interest.


Cash flow convention states that:

1. Cash inflows, such as deposits, are positive.

2. Cash outflows, such as payments, are negative.

3. In most problems, the present value and future value have opposite signs.


Respecting cash flow convention, the formulas for present value are:


Simple Interest:

P = -F ÷ (1 + D ÷ 365 × I ÷ 100)


Compound Interest:

P = -F ÷ (1 + I ÷ 100) ^ (D ÷ 365)


where:

P = present value (PV)

F = future value (FV)

I = annual interest rate

D = number of days


If leap years, substitute 366 for 365. If we are working with 30/360 day years, substitute 360 for 365.


These formulas are set up to be entered in calculators with equation solvers such as the HP 22S. I have used the HP 22S to verify each of the results above.


Now why is the results the say when the term exactly 365? It’s pretty simple to prove:


Simple Interest:

P_simple = -F ÷ (1 + 365 ÷ 365 × I ÷ 100) = -F ÷ (1 + I ÷ 100)

Compound Interest:

P_compound = -F ÷ (1 + I ÷ 100) ^ (365 ÷ 365) = -F ÷ (1 + I ÷ 100) = P_simple



When the Term Exceeds One Year


Let’s say the $100.00 bond lasts for 545 days, about one year and a half. This time the interest rate is 7%.


On the HP 12C, any fractional period is treated with simple interest. The HP 12C’s TVM solver (and the HP 12C Platinum) treats the timeline as such.


365 days: full period, compound interest

180 days: partial year, simple interest

PV

FV = -$100.00




To break it down, the HP 12C starts determining the value after 365 days.

N = 180 ÷ 365

I = 7

FV = -100

PV ≈ 96.66314

P = -(-100) ÷ (1 + 180 ÷ 365 × 7 ÷ 100) ≈ 96.66314


365 days: full period, compound interest

180 days: partial year, simple interest

PV

FV = -$100.00


96.66314


From here, the HP 12C uses that value to calculate final present value. Since we are now working with a full period (one year in this case), compound interest is used with n = 1:

N = 1

I = 7

FV ≈ -96.66314 (treated as an outflow and becoming the acting future value)

PV ≈ -(-96.6314 ÷ (1 + 7 ÷ 100) ^ (1) ≈ 90.33938


The final present value (and price) of this bond is 90.33938.


If we enter following the HP 12C Platinum:

N: 545 [ ENTER ] 365 [ ÷ ] [ N ] (≈ 1.49315)

I: 7 [ i ]

FV: 100 [ CHS ] [ FV ]

PMT: 0 [ PMT ]

[ PV ] → PV ≈ 90.33938


Enter the same problem on most other financial calculators, like the HP 10BII+, will result in a final present value of 90.39108. (P/Y = 1) This is because compounding interest is used for the entire time:


P = -(-100) ÷ (1 + 7 ÷ 100) ^ (545 ÷ 365) ≈ 90.39108


HP 12C Program: Present Value Using Compounding Interest Including Fractional Periods


The program calculates present value given the future value, interest, and the number of days using compounding interest for the entire period. A 365 day year is assumed.



Code: Key; Key Code

ENTER; 36

3; 3

6; 6

5; 5

÷; 10

1; 1

RCL i; 45, 12

%; 25

+; 40

x<>y; 34

y^x; 21

RCL FV; 45, 15

x<>y; 34

÷; 10

CHS; 16

GTO 000; 43,33,000 (GTO 00; 43, 33,00 for HP 12C Classic)


Future value is stored in FV and interest rate is stored in i. The number of days is on the X stack.



Source


Hewlett Packard. HP-12C Solutions Handbook. 2004. pg. 45 https://literature.hpcalc.org/official/hp12c-sh-en.pdf




Eddie


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


Saturday, April 18, 2026

DM41X: Interest Rate of a Forward-Forward Agreement

DM41X: Interest Rate of a Forward-Forward Agreement



A Future Interest Contract: Forward-Forward Agreement


A forward-forward agreement (yes, forward-forward is not a typo, that is what’s really called) is a financial transaction which starts on a forward date and ends on another forward date. An example transaction involves one party borrowing a sum amount to be paid back, only at the same time to deposit such amount in another short-term investment. The forward-forward rate, which I designate as FFR, is combined interest rate taking both transactions at the same time. The FFR is calculated as such:


FFR = [ (1 + IL * DL ÷ 365) ÷ (1 + IS * DS ÷ 365) – 1 ] * (365 ÷ (DL – DS))


IL: interest rate for the longer period, in decimal

DL: length of the long period

IS: interest rate for the shorter period, in decimal

DS: length of the short period

365: number of days in a year. It gets replaced with 360 if a 30/360 year is used.


If the loan lasts longer, the FFR represents the interest cost.

If the deposit lasts longer, the FFR represents the interest earned.



DM41X and HP 41C Code: FFR


01 LBL T^FFR

02 ^T FWD-FWD RATE

03 AVIEW

04 PSE

05 ^T LONG TRM DYS?

06 PROMPT

07 STO 01

08 STO 06

09 ^T LONG TRM %?

10 PROMPT

11 STO 02

12 %

13 365

14 /

15 1

16 +

17 STO 05

18 ^T SHORT TRM DYS?

19 PROMPT

20 STO 03

21 ST- 06

22 ^T SHORT TRM %?

23 PROMPT

24 STO 04

25 %

26 365

27 /

28 1

29 +

30 ST/ 05

31 RCL 05

32 1

33 -

34 365

35 *

36 RCL 06

37 /

38 2

39 10↑X

40 *

41 STO 07

42 ^T FFR=_

43 ARCL 07

44 AVIEW

45 RTN


Notes:

^T: It starts an alpha string.

Line 42: ^T FFR+_: The underscore is used as a space

Alpha strings are abbreviated in attempt for the message to fit the screen without scrolling.

Periods are assumed to be one year or less, and a 365-day year is assumed.


Examples


Example 1:

Longer Period (borrow): 49 days, 11%

Shorter Period (deposit): 30 days, 8%

Result: FFR= 15.6340


Example 2:

Longer Period (borrow): 63 days, 10.2%

Shorter Period (deposit): 31 days, 11.1%

Result: FFR= 9.2410


Source


Steiner, Bob. Mastering Financial Calculations. Second Edition. Prentice Hall: Financial Times. 2007. ISBN 978-0-273-70444-7. pp. 68-70



Eddie


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

Saturday, September 6, 2025

HP 71B Programs: September 2025

HP 71B Programs: September 2025


One of my favorite calculators/pocket calculators of all time is the HP 71B.



ADDMOD: (a + b) mod n = a mod n + b mod n


10 DESTROY A, B, N

20 DISP “(A+B) MOD N” @ WAIT .5

30 INPUT “A? “; A

40 INPUT “B? “; B

50 INPUT “C? “; C

60 S = MOD(A, N) + MOD(B, N)

70 S = MOD(S, N)

80 DISP “SUM = “; S


MULTMOD: (a * b) mod n = a mod n * b mod n


10 DESTROY A, B, N

20 DISP “(A*B) MOD N” @ WAIT .5

30 INPUT “A? “; A

40 INPUT “B? “; B

50 INPUT “N? “; N

60 P = MOD(A, N) * MOD(B, N)

70 P = MOD(P, N)

80 DISP “PRODUCT = “; P


Examples:

A

630

48

15

B

320

99

47

N

700

15

7

SUM:

250

12

6

PRODUCT:

0

12

5



GABLE: Area of a Gable Roof


10 DESTROY P, S, L

20 DEGREES

30 INPUT “PITCH (IN.)? “; P

40 INPUT “SPAN (FT.)? “; S

50 INPUT “LENGTH (FT.)? “; L

60 A = 2 * S * L / COS(ATAN(P/12))

70 DISP “AREA = “; A; “ FT^2”


Input: Pitch (P)

6”

3”

4”

Input: Span (S)

110” (110/12 ft)

5’ 8” (5 + 8/12 ft)

15 ft

Input: Length (L)

100” (100/12 ft)

10’

10 ft

Output: Area (A)

170.81074828 ft^2

116.821326059 ft^2

316.227766017 ft^2



INTENSE: Light Intensity of a Spherical or a Cylindrical Light Source


intensity = power / surface area

intensity (W/m^2), power (W), surface area (m^2)

Surface area: sphere = 4 * π * r^2, cylinder = 2 * π * (r * h + r^2)


10 DESTROY P, K$, R, H

20 DISP “INTENSITY OF LIGHT!” @ WAIT .5

30 INPUT “POWER (W)? “; P


40 DISP “1. SPHERE 2. CYLINDER”

50 DELAY 0,0

60 K$ = KEY$

70 IF K$ = “1” OR K$ = “S” THEN GOTO 100

80 IF K$ = “2” OR K$ = “C” THEN GOTO 200

90 GOTO 40


100 INPUT “RADIUS (M)? “; R

110 A = 4 * PI * R^2

120 GOTO 300


200 INPUT “RADIUS (M)? “; R

210 INPUT “HEIGHT (M)? “; H

220 A = 2 * PI * (R * H + R^2)

230 GOTO 300


300 I = P / A

310 DISP I; “W/M^2”


Examples:


Sphere: r = 4 m, Power = 60 W: Intensity = .298415518297 W/M^2


Cylinder: r = 1.25 m, h = 0.75 m, Power = 70 W; Intensity = 4.45633840656 W/M^2



SIMPLE: Simple Interest – Banker’s Rule


interest = amount * rate% / 100 * #days / 360

final = principal + interest (final, maturity value)


10 DESTROY P, R, I, M

20 DISP “SIMPLE INTEREST” @ WAIT .5

30 INPUT “AMT? “; P

40 INPUT “RATE%? “; R

50 INPUT “# DAYS? “; D

60 I = P * R * D / 360 / 100

70 M = P + I

80 IMAGE K, M10D.2D

90 DISP USING 80; “INT.=”, I @ PAUSE

100 DISP USING 80; “FINAL=”, M


Notes:


* When the HP 71B is in pause, press [ f ] [ + ] to continue (CONT).

* To stop execution, press [ ON ] (ATTN).

* IMAGE K, M10D.2D: display “prompt string”, number rounded to 2 decimal places. The number is right-justified, make the prompt string 7 characters or less to fit both the string and number on the screen.


Examples


Input: Amount

1500

2000

2800

Input: Rate %

4.00%

8.00%

6.65%

Input: # Days

180

90

60

Output: Interest

30

40

31.03

Output: Final

1530

2040

2831.03



AIRSOUND: Speed of Sound in Air


S = 331.5 + .606 * T

S = speed of sound in air, m/s

T = temperature in °C


10 DESTROY K$, S, T

20 DISP “SPEED OF SOUND IN AIR” @ WAIT .5

30 DISP “SOLVE FOR…” @ WAIT .5

40 DISP “1. SPEED 2. TEMP”

60 K$ = KEY$

70 IF K$=”1” OR K$=”S” THEN GOTO 100

80 IF K$=”2” OR K$=”T” THEN GOTO 200

90 GOTO 40


100 INPUT “TEMP (°C)? “; T

110 S = 331.5 + .606 * T

120 DISP “S=”; S; “ M/S”

130 END


200 INPUT “SPEED (M/S)? “; S

210 T = (S- 331.5) / .606

220 DISP “T=”; T ; “°C”

230 END



Examples:


Input: T = 74 °F = (32 + 1/3) °C

Output: S = 345.64 m/s

Input: S = 350 m/s

Output: T = 30.5280528053 °C

Input: T = -8.5 °C

Output: S = 326.349 m/s

Input: S = 382 m/s

Output: T = 83.3333333333 °C



Eddie


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

The author does not use AI engines and never will.

TI-60 and HP 65: Distance by Stadia Tacheometry

TI-60 and HP 65: Distance by Stadia Tacheometry Introduction The stadia calculation measures the distance from the level or theod...