Saturday, June 14, 2025

RPN With DM32: Interest Conversions

RPN With DM32: Interest Conversions



Today’s edition of RPN will focus on the Swiss Micros DM32 and HP 32SII calculator family (32SII, 33s 35s). My plan is to expand the range of calculators used in the RPN series to include the HP 41C/DM41X, HP 42S/DM42(n), HP 11C in addition to the HP 32SII and HP 15C families.



Nominal Interest Rate (EFF/NOM) and Effective Interest Rate (EFF)


When loans, annuities, mortgage, and other time-valued financial instruments are executed, the interest rate typically given is known as the nominal interest rate (NOM), also known as the APR. In mortgages and auto loans where the payments typically take place every month (12 per year), the periodic interest rate is divided by 12 to come up with the periodic rate. The periodic rate is compounded every month.


For example, if a loan has an APR (nominal rate, NOM) of 6% and payments take place monthly, the periodic interest rate is:


6% / 12 = 0.5%


The effective interest (EFF) rate is the nominal interest rate calculated as if was compounded annually.


Paid in Arrears


Typically, payments are paid in arrears, meaning payments are made after the service or the use of associated goods were provided. An example is the mortgage payment for the month of June is paid in the beginning of July.


The effective rate for payments paid in arrears is:


EFF% = (1 + NOM% / PY) ^ PY - 1


EFF%: effective interest rate

NOM%: nominal interest rate, APR

PY: payments per year


The effective rate for a APR of 6%, compounded monthly, paid in arrears is:


EFF% = (1 + 6% / 12) ^ 12 – 1 = (1 + 0.06 / 12)^12 – 1 ≈ 0.06168 (6.168%)



Paid in Advance


Sometimes, payments are paid in advance, where payments are made before the service or use of associated goods are provided. For example, the mortgage payment for the month of June is paid at the beginning of June or the end of May. The mortgage is paid in advance.


The effective rate for payments paid in arrears is:


EFF% = (1 - NOM% / PY) ^ (-PY) - 1


EFF%: effective interest rate

NOM%: nominal interest rate, APR

PY: payments per year


The effective rate for a APR of 6%, compounded monthly, paid in advance is:


EFF% = (1 - 6% / 12) ^ (-12) – 1 = (1 - 0.06 / 12)^(-12) – 1 ≈ 0.06200 (6.2%)



Conversion Formulas


The conversion formulas are (see source):

Payments in Arrears


EFF% = (1 + NOM% / PY) ^ PY – 1

NOM% = PY * ((1 + EFF%) ^ (1 / PY) – 1)


Payments in Advance


EFF% = (1 – NOM% / PY) ^ (-PY) – 1

NOM% = PY * (1 – (1 + EFF%)^(-PY))



DM32: Two Ways to Solve


There are two approaches to converting interest rates: directly through a program and using the solver.


Direct Programs


LBL A: NOM to EFF, Payments in Arrears


LBL A
STO Z
÷
1
x<>y
%
+
RCL Z
y^x
1
-
2
10^x
×
RTN


Syntax:

Y: NOM

X: PY

XEQ A


(Y: 5, X: 12, XEQ A: 5.11619)



LBL B: NOM to EFF, Payment in Advance


LBL B
STO Z
÷
1
x<>y
%
-
RCL Z
+/-
y^x
1
-
2
10^x
×
RTN


Syntax:

Y: NOM

X: PY

XEQ B


(Y: 5, X: 12, XEQ B: 5.13809)



LBL C: EFF to NOM, Payments in Arrears


LBL C
STO Z
1/x
x<>y
1
x<>y
%
+
x<>y
y^x
1
-
RCL× Z
2
10^x
×
RTN


Syntax:

Y: EFF

X: PY

XEQ C


(Y: 5, X: 12, XEQ C: 4.88895)



LBL D: EFF to NOM, Payment in Advance


LBL D
STO Z
1/x
+/-
x<>y
1
x<>y
%
+
x<>y
y^x
1
x<>y
-
RCL× Z
2
10^x
×
RTN


Syntax:

Y: EFF

X: PY

XEQ D


(Y: 5, X: 12, XEQ D: 4.86911)



Using The Solver


The DM32, and by extension, the HP 32SII, HP 33s, and HP 35s, has a solver that can solve for any variable. The solver uses a program in the format:


LBL α

INPUT (var)

INPUT (var)

function(var) = 0

RTN


To solve the equation (DM32, HP 32SII):


1. Press [ blue shift/right shift ] [ XEQ ] (FN=). An FN= prompt appears asking for a label.

2. Press [ blue shift/right shift ] [ 7 ] (SOLVE). You will be prompted to enter the variable to be solved.

3. The calculator prompts for values for any of the values. Press [ R/S ] to accept.

4. The solution is shown. I think the values and solutions are stored in the solutions. It is the case for the DM32, HP 32SII, and HP 32S.


Notes:

* HP 32S has the FN= and SOLVE in the SOLVE/∫ menu ([orange shift ] [ 1 ]).

* The right shift turned lavender in later HP 32SII calculators (late 1990s/early 2000s).


LBL S: Solver

LBL S
INPUT E
INPUT M
INPUT N
1
RCL M
RCL÷ N
+
RCL N
y^x
1
-
RCL- E
RTN


The equation is:

E = (1 + M/N) ^ N – 1


E = EFF%

M = NOM% (or APR%)

N = payments per year


The EFF% and NOM% must be entered in decimal. For payments in arrears, enter N as positive. For payments in advance, enter N as negative.


Example


Set function as:


FN= S

NOM to EFF, pmts in arrears


Solve E


M = 5% = 0.05

N = 12


E = 0.05116

(5.116%)

NOM to EFF, pmts in advance


Solve E


M = 5% = 0.05

N = -12


E = 0.05138

(5.138%)

EFF to NOM,

pmts in arrears


Solve M


E = 5% = 0.05

N = 12


M = 0.04889

(4.889%)

EFF to NOM,

pmts in advance


Solve M


E = 5% = 0.05

N = -12


M = 0.04869

(4.869%)


Source


J.J. Rose and E.M. Reeves VALPAC: A Discounted Cash Flow Approach To Property Valuation. (user manual) The Incorporated Society of Valuers and Auctioneers. An HP 41C Pac.


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.

Sunday, June 8, 2025

HP Prime and TI-84 Plus CE Python: Quartiles of a Data Set

HP Prime and TI-84 Plus CE Python: Quartiles of a Data Set



25th, 50th, and 75th Percentiles


The following code finds five points of a list of data points:


Minimum: the data point of least value

Q1: the first quartile, known as the 25th percentile. The first quartile is median of the lower half of the data.

Median: also known as the 50th percentile, this is the median, or middle point of the data.

Q3: the third quartile, known as the 75th percentile. The third quartile is the median of the upper half of the data.

Maximum: the data point of the most value


The list of data is first sorted in ascending order.


The median is determined as follows:


If the number of data points is odd: Take the number that lies in the middle.

If the number of data points is even: Take the average of the middle two numbers.


The way quartile values are determine vary depending by country and jurisdiction. The program presented uses Method 1, which is used in the United States. (see Source)


If the number of data points is odd: The data is split in half, do not include the median.

If the number of data points is even: The data is split in half.



Python File: quartiles.py, quartile.py


This script does not use any module, so it should work on every calculator that has Python, along with the full-computer editions of Python. Results are shown as floating point numbers, rounded to 5 decimal places.


This was code was made with the HP Prime emulator, and was tested on with an HP Prime, a TI-84 Plus CE Python edition, and a TI-83 Premium CE Python Edition calculator.


# quartiles program

# method 1, median divides data in half

# is used (US method)


# halfway subroutine

def halfway(l):

  n=len(l)

  # get halfway point

  # Python index starts at 0

  h=int(n/2)

  # even

  if n%2==0:

    return(l[h]+l[h-1])/2

  # odd 

  else:

    return(l[h])


print("Use list brackets. [ ]")  

data=eval(input("List of Data: "))


# length of the list

nw=len(data)


# sort the list

data.sort()

print("Sorted Data: "+str(data))


# maximum and minimum

q0=min(data)

q4=max(data)


# get sublists 

h=int(nw/2)

if nw%2==0:

  l1=data[0:h]

  l3=data[h:nw]

else:

  l1=data[0:h]

  l3=data[h+1:nw]


# list check

print("1st half: "+str(l1))

print("2nd half: "+str(l3))

  

# quartiles, q2 is the median

q1=halfway(l1)

q2=halfway(data)

q3=halfway(l3)


# set up  answer strings

txt1=["min = ","Q1 = ","median = ", 

"Q2 = ","max = "]

results=[q0,q1,q2,q3,q4]

for i in range(5):

  txt2="{0:.5f}"

  print(txt1[i]+txt2.format(results[i]))




Examples


Data Set: [1, 2, 3, 4, 5]

Min = 1.00000

Q1 = 1.50000

Med = 3.00000

Q3 = 4.50000

Max = 5.00000



Data Set: [76, 46, 49, 46, 56, 52, 59, 130, 80]

Min = 46.00000

Q1 = 47.50000

Med = 56.00000

Q3 = 78.00000

Max = 130.00000


Date Set: [55, 35, 40, 50, 60, 50, 55]

Min = 35.00000

Q1 = 40.00000

Med = 50.00000

Q3 = 55.00000

Max = 60.00000


Note: A Way to Format Numbers


To format numbers to have a set number of decimal places, use the code

{ identifier : .5f }.


The identifier can be almost anything, I usually call it 0 for the 1st number to be formatted. The number before the “f” (floating point indicator) is the number of decimal places. For example:


2 decimal places: { identifier : .2f }

5 decimal places: { identifier : .5f }

(spaces added for readability)


The text string will need to have a .format(arg) at the end of the string.


Example code:

n = 14.758119

txt = “The rounded value is {0:.5f}”

print(txt.format(n))


returns 14.75812


Source

Wikipedia. “Quartile” Last edited on February 21, 2025. https://en.wikipedia.org/wiki/Quartile Accessed May 12, 2025.



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.

Saturday, June 7, 2025

TI-84 Plus CE: Birefringence

TI-84 Plus CE: Birefringence


Introduction


Essentially, birefringence is the double refraction of light in material, drive by the differences in the refractive indices of both materials. Mathematically, birefringence between two materials is defined as:


B = | n_e – n_o |


n_o: refractive index of light where the ordinary ray originates

n_e: refractive index of light where the extraordinary ray originates


If n_e > n_o, we have positive birefringence, and the wave polarizes quickly.

If n_e < n_o, we have negative birefringence, and the wave polarizes slowly.


The relative retardation (delay or angle in radians) with one ray respected to another is calculated by the equation:


R = T * B


T = the thickness of the material, typically in meters



The program features 10 common materials, with the 11th allowing the user to enter their own refractive index, particularly useful for crystals.



TI-84 Plus CE Program: BIREF


Full

{1,1.000293,1.000132,1.333,1.31,1.46,1.49,1.52,1.69,2.417}→L₁

“ORDEXT”→Str0


For(I,1,2)

ClrHome

Output(9,1,"BIREFRINGENCE")

Output(3,1,"1. VACUUM")

Output(4,1,"2. AIR")

Output(5,1,"3. HYDROGEN")

Output(6,1,"4. WATER")

Output(7,1,"5. ICE")

Output(3,12,"6. QUARTZ")

Output(4,12,"7. PLEXIGLASS")

Output(5,12,"8. WINDOW GLASS")

Output(6,12,"9. FLINT GLASS")

Output(7,12,"10. DIAMOND")

Output(8,12,”11. YOUR OWN”)

Input sub(Str0,3(I-1)+1,3)+” RAY? ”,J


If J=11:Then:

Input “ENTER REF INDEX: “,X

If I=1:Then:X→O

Else:X→E:End

Else

If I=1:Then:L₁(J)→O

Else:L₁(J)→E:End

End

End


Input "THICKNESS? ",T

abs(E-O)→B

T*B→G


ClrHome

If E≥O:Then:Disp "POSITIVE"

Else:Disp "NEGATIVE":End

Disp "BIREFRINGENCE:",B,"DELAY:",G


Note: The Full mode sets the TI-84 to full screen mode.



Examples


Example 1: Diamond (ordinary ray) to Air (extraordinary ray), 0.5 m thick

Negative Birefringence: 1.416707

Delay: 0.7083535 (radians)



Example 2: Air (ordinary ray) to Ice (extraordinary ray), 3.6 m deep


Positive Birefringence: 0.309707

Delay: 1.1149452 (radians)



Sources


Nikon with contributing authors Douglas B. Murphy, Kenneth R. Spring, Thomas J. Fellers, and Michael W. Davidson. “Principles of Birefringence: Introduction to Optical Birefringence” Nikon. MicroscopyU: The Source for Microscopy Education. 2024/2025. Retrieved November 16, 2024. https://www.microscopyu.com/techniques/polarized-light/principles-of-birefringence#:~:text=Birefringence%20is%20formally%20defined%20as,dependent%20differences%20in%20refractive%20index.


“Refractive index.” Wikipedia https://en.wikipedia.org/wiki/Refractive_index At the time of retrieval, it was edited November 17, 2024. Retrieved December 1, 2024.



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.

Saturday, May 31, 2025

Casio fx-991CW: Recurrence Sequences

Casio fx-991CW: Recurrence Sequences



Introduction


Today’s edition we will work with recurring sequences, which can take the form of:


u_n = f(u_n-1), with initial condition u0


u_n = f(u_n-1, u_n-2) with initial conditions u0, u1


In general:


u_n = f(u_n-1, u_n-2, … u_n-k) with initial conditions u0, u1, u2, …, u_n-(k-1)


There is no app on the Casio fx-991CW that is dedicated to be recurrence sequences.



Recurring Sequences the Quick and Easy Way with the Calculate App


A quick way to tackle recurrence sequences and involves the use of the last answers key ( [Ans] ). This works on recurrence sequences with only one initial condition, u0.


Start by entering u0 and press [ EXE ]. Then enter the recurrence function, using Ans as u_(n-1).


Example:

u_n = 0.75 * u_(n-1)^2 + 1.03 * u_(n-1) with u0 = 1


Settings: MathI/DecimalO (Input/Output), Number Format (Norm 1)


1 [ EXE ]


0.75×Ans²+1.03×Ans [ EXE ] (Disp: 1.78)

[ EXE ] (Disp: 4.2097)

[ EXE ] (Disp: 17.62717157)

[ EXE ] (Disp: 251.1938698)

[ EXE ] (Disp: 47582.49986)


Recurrence Sequences with the Spreadsheet App


A way to generate recurrence sequences is to use the Spreadsheet app. The app contains a spreadsheet of size 5 columns (A, B, C, D, E) by 45 rows. Depending on the number of the initial conditions, up to 44 terms can be generated.


For the purposes of this blog, we’ll use column A, but we can use any column, as long as there is memory in the Spreadsheet.


u_n = f(u_n-1), with initial condition u0


Set A1 as the value of u0.

At cell A2:

1. Press [ TOOLS ].

2. Select Fill Formula and press [ OK ].

3. Enter the recurrence function, using A1 as u_(n-1).

4. At the range, set as A2:A#, to create a list of #-1 terms. For example, the range A2:A11 to create a list of 10 terms.

5. Select Confirm and press [ OK ].


Example:


Under Show Cell, Value (using the [TOOLS] menu)


u_n = (u_(n-1) + 0.5) * u_(n-1) with u0 = 0.65 for 7 terms.


Cell A1 = 0.65

Cell A2:

Fill Formula:

Form = (A1+0.5)×A1

Range: A2:A8



A (display)

1

0.65

2

0.7475

3

0.93250625

4

1.335821031

5

2.452328343

6

7.240078475

7

56.03877556

8

3168.363754



u_n = f(u_n-1, u_n-2), with initial condition u0, u1


Set A1 as the value of u0.

Set A2 as the value of u1.

At cell A3:

1. Press [ TOOLS ].

2. Select Fill Formula and press [ OK ].

3. Enter the recurrence function, using A1 as u_(n-2) and A2 as u_(n-1).

4. At the range, set as A3:A#, to create a list of #-2 terms. For example, the range A2:A11 to create a list of 9 terms.

5. Select Confirm and press [ OK ].


Example:


u_n = u_(n-1) + u_(n-2), u0 =1 , u1 = 1 for 7 terms.

Yes, this is ripe for the Fibonacci sequence.


Cell A1 = 1

Cell A2 = 1

Cell A3:

Fill Formula:

Form = A1+A2

Range: A3:A9



A (display)

1

1

2

1

3

2

4

3

5

5

6

8

7

13

8

21

9

34



Until next time,


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.

RPN With DM32: Interest Conversions

RPN With DM32: Interest Conversions Today’s edition of RPN will focus on the Swiss Micros DM32 and HP 32SII calculator family (32S...