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, May 16, 2026

Python (TI-84 Plus CE) and Swiss Micros DM32: The Integral of y = abs(r * x + s)

Python (TI-84 Plus CE) and Swiss Micros DM32: The Integral of y = abs(r * x + s)




The Integral of y = abs(r * x + s)



This algorithm calculates the integral of ∫ abs(r * x + s) dx, from x = a, x = b), where r and s are constants. For clarity, I am using abs to stand for absolute value instead of the customary pipe characters (|x|).



Let the function y = abs(r * x + s). Then the function can be defined as a piecewise function (without loss of generality):

y =

{ -(r * x + s), x < xc

{ (r * x + s), x ≤ xc



The point x = xc is the critical point because it is the root (zero) of this function:

abs(r * x + s) = 0

Because abs(0) = 0:

r * x + s = 0

r * x = -s

x = -s/r



and:

-(r * x + s) = 0

r * x + s = 0

x = -s/r



Let the critical point xc = -s/r



Taking the indefinite integral of y(x) yields:

∫ y(x) dx =

{ -r * x^2 ÷ 2 – s * x + C, x < xc

{ r * x^2 ÷ 2 + s * x + C, x ≥ xc

and C is an arbitrary integration constant.



Let f(x) = r * x^2 ÷ 2 + s * x and find the definite integral from x = a to x = b.



Case 1: a ≥ xc and b ≥ xc, where both a and b are greater than the critical point. This is the simplest case.



∫ ( r * x + s dx, x = a to x = b)

= (r * b^2 ÷ 2 + s * b) - (r * a^2 ÷ 2 + s * a)

= f(b) – f(a)



Case 2: a < xc and b < xc, both a and b are less than the critical point.

∫ ( r * x + s dx, x = a to x = b)

= -(r * b^2 ÷ 2 + s * b) - -(r * a^2 ÷ 2 + s * a)

= -(r * b^2 ÷ 2 + s * b) + (r * a^2 ÷ 2 + s * a)

= (-r * b^2 ÷ 2 - s * b) + (r * a^2 ÷ 2 + s * a)

= -f(b) + f(a)

= -(f(b) - f(a))



Combining cases 1 and 2, the area can be calculated as:

area = abs(f(b) – f(a))

with (a – xc) * (b – xc) ≥ 0



Case 3: a < xc and b ≥ xc

∫ ( r * x + s dx, x = a to x = b)

= ∫ ( -(r * x + s) dx, x = a to x = xc) + ∫ ( r * x + s dx, x = xc to b)

= -(r * xc^2 ÷ 2 + s *xc) + (r * a^2 ÷ 2 + s * a) + (r * b^2 ÷ 2 + s * b) – (r * xc^2 ÷ 2 + s * xc)

= -f(xc) + f(a) + f(b) – f(xc)

= f(a) – 2 * f(xc) + f(b)

Since area must be positive: abs(f(a) – 2 * f(xc) + f(b)).

Consequently: (a – xc) * (b – xc) < 0.



In summary:

Let xc = -r/s

If (a – xc) * (b – xc) ≥ 0: area = abs(f(b) – f(a))

Else if (a – xc) * (b – xc) < 0: area = abs(f(a) – 2 * f(xc) + f(b))

where f(x) = r * x^2 ÷ 2 + s * x



Please note: ∫ abs(r * x + s) dx ≠ abs(a * x^2 ÷ b * x)



TI-84 Plus CE Python Edition: abslin1.py



Programmed with TI-84 Plus CE Python, but can be used on any calculator with Python since only the math module is used.



# Math Calculations
from math import *

# Python Version
# 2026-01-05 EWS

print("integral of abs(rx+s)")
r=eval(input("r? "))
s=eval(input("s? "))
a=eval(input("lower limit? "))
b=eval(input("upper limit? "))

# critical point
c=-s/r

# integral
f=lambda x:r*x**2/2+s*x
f0=f(c)
f1=f(a)
f2=f(b)

if (a-c)*(b-c)>=0:
  t=abs(f2-f1)
else:
  t=abs(f1-2*f0+f2)

print("area = ",str(t))



Swiss Micros DM32 Program: asblin



Three labels are used: A (172 bytes), Z (20 bytes), Y (17 bytes), total 209 bytes

Text strings can be eliminated.



A01 LBL A

A02 SF 10

A03 “AREA ABS(RX +S)”

A04 INPUT R

A05 INPUT S

A06 x<>y

A07 ÷

A08 +/-

A09 STO C

A10 XEQ Y

A11 STO D

A12 “LOW=A HIGH=B”

A13 INPUT A

A14 XEQ Y

A15 STO E

A16 INPUT B

A17 XEQ Y

A18 STO F

A19 RCL B

A20 RCL- C

A21 RCL A

A22 RCL- C

A23 ×

A24 x≥0?

A25 GTO Z

A26 RCL E

A27 RCL D

A28 2

A29 ×

A30 -

A31 RCL+ F

A32 ABS

A33 STO Z

A34 CF 10

A35 RTN



Z01 LBL Z

Z02 RCL E

Z03 RCL- F

Z04 ABS

Z05 STO Z

Z06 CF 10

Z07 RTN



Y01 LBL Y (Note: f(x) = r*x^2 ÷ 2 + s*x)

Y02 ENTER

Y03 x^2

Y04 RCL× R

Y05 2

Y06 ÷

Y07 x<>y

Y08 RCL× S

Y09 +

Y10 RTN



Examples



Example 1:

y = abs(4 * x + 3)

r = 4, s = 3, xc = -0.75





Lower Limit (a)

Higher Limit (b)

Area

-4

5

87.25

-4

-1

21

0

5

65



Example 2:

y = abs(-3 * x + 6)

r = -3, s = 6, xc = 2



Lower Limit (a)

Higher Limit (b)

Area

-5

5

87

3

5

12

-5

1

72


Hope you find this helpful and have a great day,


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 9, 2026

Solving Simple Arcsine and Arccosine Equations

 Solving Simple Arcsine and Arccosine Equations



Angle Measure

This document will focus on angle measurement in degrees. For radians and grads, please use the appropriate measurement.


90° = Ï€/2 rad = 100 grad

180° = Ï€ rad = 200 grad



Simple Arcsine Equations


The calculator arcsine function gives: Domain: -1 ≤ x ≤ 1, Range: -90° ≤ Θ ≤ 90°


Note that for any angle x: sin(180° - x) = sin(x), sin(x) = sin(x ± 360°*z) (z is an integer)


Given n, solve for Θ:

n = sin(Θ) = sin(180° - Θ)


Base Solution 1:

n = sin(Θ)

⇒ Θ = arcsin(n)


Base Solution 2:

n = sin(180° - Θ)

arcsin(n) = 180° - Θ

⇒ Θ = 180° - arcsin(n)


Example:

0.67 = sin(Θ)

Base Solution 1: Θ = arcsin(0.67) ≈ 42.0670648025°

Base Solution 2: Θ = 180° - arcsin(0.67) ≈ 137.932935198°


Given n and α, solve for Θ:

n = sin(α + Θ)


Base Solution 1:

n = sin(α + Θ)

arcsin(n) = α + Θ

⇒ Θ = arcsin(n) – α


Base Solution 2:

n = sin(180° - (α + Θ))

n = sin(180° - α – Θ)

arcsin(n) = 180° - α – Θ

⇒ Θ = 180° - α – arcsin(n)


Example:

0.7757 = sin(Θ + 76°)

Base Solution 1: Θ = arcsin(0.7757) – 76° ≈ -25.1314549842°

Base Solution 2: Θ = 180° - 76° - arcsin(0.7757) = 104° - arcsin(0.7757) ≈ 53.131459842°


To get all the possible angles, add and subtract multiples of 360°.



Solving Simple Arccosine Equations


The calculator arccosine function gives: Domain: -1 ≤ x ≤ 1, Range: -90° ≤ Θ ≤ 90°


Note that for any angle x: cos(180° - x) = -cos(x), cos(x) = cos(x ± 360°*z) (z is an integer)


Given n, solve for Θ:

n = cos(Θ), n = cos(-Θ)


Base Solution 1:

n = cos(Θ)

⇒ Θ = arccos(n)


Base Solution 2:

n = cos(-Θ)

⇒ Θ = -arccos(n)


Example:

0.58 = cos(Θ)

Base Solution 1: Θ = arccos(0.58) ≈ 54.54945736°

Base Solution 2: Θ = -arccos(0.58) ≈ -54.54945736°


Given n and α, solve for Θ:

n = cos(α + Θ)


Base Solution 1:

n = cos(α + Θ)

arccos(n) = α + Θ

⇒ Θ = arccos(n) – α


Base Solution 2:

n = cos(-(α + Θ))

n = cos(-α – Θ)

arccos(n) = -α – Θ

-arccos(n) = α + Θ

⇒ Θ = -arccos(n) – α


Example:

0.6 = cos(35° + Θ)

Base Solution 1: Θ = arccos(0.6) – 35° ≈ 18.13012035°

Base Solution 2: Θ = -arccos(0.6) – 35° ≈ -88.13010235°



To get all the possible angles, add and subtract multiples of 360°.



I hope you find this useful and helpful,


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.


Sunday, May 3, 2026

HP 65 Programs: Triangulation, Percentile, Roots of Unity, Partial Fractions

 HP 65 Programs: Triangulation, Percentile, Roots of Unity, Partial Fractions


Triangulation

(done with HP-65 Emulator for Windows, Bernhard Emese)




Given:

Side angle α

Side angle ß

r = Length of base

Find:

h = height which crosses the base line at right angles



Code:

23: LBL

12: B

35: g

41: DEG

33 01: STO 1

35 08: R↓

41: ENTER

41: ENTER

44: CLX

51: -

31: f

04: SIN

35 09: R↑

31: f

04: SIN

71: *

33: STO

71: *

01: 1

35 08: R↓

61: +

31: f

04: SIN

33: STO

81: ÷

01: 1

34 01: RCL 1

24: RTN



Example: ß = 50°, α = 30°, r = 10

Result: h ≈ 3.89


Source:

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


Percentile in a Range


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


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


Stack:

Z: x

Y: a

X: b


23: LBL

11: B

35 07: x<>y

51: -

35 00: LSTx

35 07: R↓

51: -

35 09: R↑

81: ÷

02: 2

32: f^-1

08: LOG (10^x)

71: ×

24: RTN


Example: The range: [210, 470], x = 376

Stack: Z: 376, Y: 210, X: 470

Result: 63.85



Roots of Unity

(done with HP-65 Emulator for Windows, Bernhard Emese)


w^n = 1

Registers used: R1 = n, R8 = n (counter)


n [ A ]


Cycle:

root # [ R/S ]

real part [ R/S ]

imaginary part [ R/S ] (the cycle starts again)


Repeat the cycle until the display is flashing zeros (forced 1/0 error). Hit [ CLx ] to stop the flashing.


This program switches the mode to radians angle measurement.



Code:

23: LBL

11: A

33 01: STO 1

33 08: STO 8

35: g

42: RAD

23: LBL

00: 0 (LBL 0 - subroutine)

34 08: RCL 8

84: R/S (show root #)

35: g

02: π

71: ×

02: 2

71: ×

34 01: RCL 1

81: ÷

01: 1

32: f^-1

01: R->P (->rect)

84: R/S (show real part)

35 07: x<>y

84: R/S (show imaginary part)

35: g

83: DSZ (decrement R8 by 1)

22: GTO

00: 0 (GOTO LBL 0)

34 08: RCL 8

35: g

04: 1/x

24: RTN


Example (FIX 4):

w^3 = 1

#; R/S; real part; R/S; imaginary part

3; 1.0000; -0.0000

2; -0.5000; -0.8660

1; -0.5000; 0.8660

(flashing zeroes)




Partial Fractions

(w is the variable, and T, Z, Y, and X are the stack contents)

(Tw+Z) ÷ ((w+Y)(w+X)) → B÷(w+Y) + A÷(w+X)

Input Stack: T, Z, Y, X 

Output Stack: B, A


Code: 

23: LBL 

11: A 

35, 07: x<>y 

51: - 

35, 00: LST x 

35, 09: R↑ 

71: × 

35, 00: LST x 

35, 07: x<>y 

35, 09: R↑ 

35, 07: x<>y 

51: - 

35, 09: R↑ 

81: ÷ 

41: ENTER 

35, 08: R↓ 

51: - 

35, 09: R↑ 

35, 07: x<>y 

24: RTN



Example 1: 

(12*w + 28) ÷ ((w+2) * (w+3)) = 4 ÷ (w+2) + 8 ÷ (w+3) 

Input Stack: T: 12, Z: 28, Y: 2, X: 3 press [ A ] 

Output Stack: Y (B): 4, X (A): 8



Example 2: 

(33) ÷ ((w-5) * (w+6)) = 3 ÷ (w-5) + -3 ÷ (w+6) 

Input Stack: T: 0, Z: 33, Y: -5, X: 6 press [ A ] 

Output Stack: Y (B): 3, X (A): -3



Example 3: 

(2*w - 3) ÷ ((w-1) * (w+4)) = -0.2 ÷ (w-1) + 0.2 ÷ (w+4) 

Input Stack: T: 2, Z: -3, Y: -1, X: 4 press [ A ] 

Output Stack: Y (B): -0.2, X (A): 0.2





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.

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. ...