Saturday, November 23, 2024

Fun with the HP 30b

Fun with the HP 30b



Introduction





The following programs are for the HP 30b Business Professional. Did you know that the 30b has a programming mode? The program mode has room for 10 programs with a total of 290 steps, where each key press is counted. Thankfully, shifts and hold-shifts are merged steps.


I couldn’t get the MSG or R/S commands to work properly. Therefore I use an approach that I often use for the Voyager calculators (HP 11C, 12C, 15C): store everything first and then run the program.


Disp5 is like the PSE (pause) command, it stops the execution for a second. Disp can be set to 1-9. Disp1 lasts for 1/5 second.


All programs are done in the Algebraic instead of the RPN I usually do on HP calculators.


All the results in the examples, except the last one, are rounded to four decimal places.



Program 0: f(x,y) = (x * y) / (x + y)


f(x, y) = (x * y) / (x + y)


Store x in memory 1 and y in memory 2.


Prog 0 =

RCL 1

×

RCL 2

÷

( ↓

RCL 1

+

RCL 2

) Swap

=

Stop


Examples:

x = 1.5, y = 16; Result: 1.3714

x = 3.6, y = 32; Result: 3.2360

x = 8.7, y = 10; Result: 4.6524



Program 1: PITI – Principal, Interest, Taxes, and Insurance


This program calculates the monthly payment of PI (principal and interest) and PITI (principal, interest, taxes, and insurance). The program assumes that payments per year setting (P/YR) is set to 12.


Store to Memory:

M1: Annual insurance rate.

M2: Annual property tax rate.

N: number of payments

I/YR: interest rate of the loan

PV: amount of the loan


It assumed that there is no balloon payment (FV = 0), although this program can be modified to include balloon payments by removing the first two steps (0 FV).


Prog 1 =

0

FV

PMT

Disp5

Disp5

-

( R↓

RCL 1

+

RCL 2

) Swap

/

1

2

0

0

*

RCL PV

=

Stop


Examples:


N = 360

I/YR = 8.9%

PV = 289000

Insurance Rate = 1% (1 STO 1)

Property Tax Rate = 1.3% (1.3 STO 2)


Result:

PMT: -2304.60

PITI: -2858.51



N = 360

I/YR = 8.9%

PV = 289000

Insurance Rate = 1% (1 STO 1)

Property Tax Rate = 1.3% (1.3 STO 2)


Result:

PMT: -2304.60

PITI: -2858.51



Program 2: Quadratic Equation – Po-Shen Lo Method

This program solves the monic quadratic polynomial:


x^2 + B * x + C = 0


where the solutions:

U^2 = B^2 / 4 – C

x1, x2 = - B / 2 ± √(U^2)


Store to Memory:

M1: B

M2: C


Prog 2 =

RCL 1

X^2

/

4

-

RCL 2

=

STO 0

-

RCL 1

/

2

=

STO 3

Disp5

Disp5

-

2

*

RCL 0

=

STO 4

Stop


M3: root 1 ( -B / 2 + √(U^2) )

M4: root 1 ( -B / 2 + √(U^2) )


This program finds real roots only. If there are no real roots, then the program displays an error.


Examples:


x^2 – 2 * x – 24 = 0

B = -2 STO 1

C = -24 STO 2

Roots: 6, -4


x^2 – 10 * x + 21 = 0

B = -10 STO 1

C = 21 STO 2

Roots: 3, 7



Program 3: Lease with Advanced Payments (HP 12C – see source)


This program calculates the regular monthly payment of a lease when the borrower pays a set number of payments in advance. Payments per year (P/YR) is assumed to be set at 12 while the calculator is set to End of Period payments.


Store in Memory:

number of payments [ N ]

annual lease rate [ I/YR ]

residual value [ FV ]

number of payments to be made in advance [ STO ] 0

loan amount [ STO ] 1 (not PV)


Prog 3 =

0

PMT

0

PV

PV

+

RCL 1

=

STO 2

0

FV

RCL N

-

RCL 0

=

N

1

+/-

PMT

( R↓

PV

+

RCL 0

) Swap

1/X

*

RCL 2

=

Stop


Examples:


Total Payments: 48 [ N ]

Rate: 13 [ I/YR ]

Residual Value: 7,000 [ FV ]

Payments in Advance: 1 [ STO ] 0

Loan Amount: 25,000 [ STO ] 1


Result: -536.06



Total Payments: 60 [ N ]

Rate: 8.8 [ I/YR ]

Residual Value: 12,000 [ FV ]

Payments in Advance: 3 [ STO ] 0

Loan Amount: 118,000 [ STO ] 1


Result: -2,229.71



For those of you in the United States, Happy Thanksgiving!


Source


Hewlett Packard. HP 12C Financial Calculator: User’s Guide. Edition 5. 2008. San Diego, CA. pp. 124-126


Eddie


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