Showing posts with label solver. Show all posts
Showing posts with label solver. Show all posts

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.

Saturday, August 10, 2024

Some Equations for the HP 22S

 Some Equations for the HP 22S




The [ 2 ] key has the letter X.  


These equations should work for the HP 27S, HP 32S/DM32, or Plus42.


Equations


Answers are shown to five decimal places.


Snell’s Law


Equation: Set Degrees Mode

N × SIN(T) = M × SIN(I)


T, I: reflection angles

N, M: refractive indices (1 for air, about 1.33 for water, etc.)


Examples:

Inputs: N = 1, T = 30°, I = 60°, Result: M ≈ 0.57735

Inputs: N = 1, M = 1.3333, I = 35.4°, Result: T ≈ 50.56589°

Inputs: N = 1, M = 1.3333, T = 100°, Result: I ≈ 47.61436°



Gudermannian and Inverse Gudermannian Functions


Equation: Set Radians Mode

G = 2 × ATAN( TANH( X ÷ 2 ) )


G = gd(X)

X = gd^-1(G)


Examples:

Input: X = 0.5, Result: G ≈ 0.48038

Input: X = 2.3, Result: G ≈ 1.37095

Input: G = -0.1, Result: X ≈ -0.10017

Input: G = 1, Result: X ≈ 1.22619



AC Current Equation


Equation: Set Radians Mode

I = P × SIN( W × T + H )


I = current at time T seconds in amps

P = peak current in amps

W = radian frequency = 2 * π * f

H = phase angle in radians


Examples:

Inputs: P = 10, W = 0.8, H = 0, T = 10, Result: I ≈ 9.89358

Inputs: P = 10, W = 2 * π * 60, H = 0.7, T = 10, Result: I ≈ 6.44218

Inputs: I = 15, W = 2 * π * 60, H = 0.6, T = 10, Result: P ≈ 26.56548



Air Pressure Up to 36,089 Feet


Equation:

P = 29.92126 × (1 – 6.875E-6 × H) ^ 5.255876329


H = height in feet

P = standard pressure in inHg (inches of Mercury)

The equation is giving with all the constants calculated.


(see https://edspi31415.blogspot.com/2024/06/casio-fx-4000p-programs-i-took-on.html , Prog 8)


Inputs: H = 1347, Result: P ≈ 28.49332

Inputs: H = 4126, Result: P ≈ 25.72143

Inputs: P = 22, Result: H ≈ 8266.49833




Law of Cosines





SQ(Z) = SQ(X) + SQ(Y) – 2 × X × Y × COS( C )


SQ: square function (x^2)

X, Y, Z = sides

C = angle that correspond to side Z


Examples:

Inputs: X = 10, Y = 12, C = 30°

Result: Z ≈ 6.01281 or Z ≈ 14.38679 (depending on the initial guess for Z)


Inputs: X = 55.44, Y = 37.85, Z = 62.17

Result: C ≈ 81.21305°



Ellipse Equation


The center of the ellipse is set at (0, 0).





Equation:

SQ(X ÷ A) + SQ(Y ÷ B) = 1


If A = B, we are working with a circle.


Examples:

Inputs: A = 5, B = 5, X = 4.9,

Result: Y ≈ 0.99499 (1 as a guess)

or Y gives a no solution error (0 as a guess)

(Your mileage may vary)


Inputs: A = 10, X = 8, Y = 12, Result: B = 20


Inputs: A = 10, X = -4, Y = 6

Result: B ≈ 6.54654 (10 as a guess)

but returns a divide by zero error for other guesses (20)


To store an initial guess on the HP 22S, be out of equation mode and store the guess in the variable you are trying to solve for.


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.


Saturday, March 9, 2024

Casio FX-702P, Swiss Micros DM42, HP 27S: Design of Coil Spring

Casio FX-702P, Swiss Micros DM42, HP 27S: Design of Coil Spring


Today’s blog calculates the load of a coil spring.


Variables Used


P

LOAD

Load (kg)

G

SHEAR

Shear Modulus (kg/mm^2)

A

WDIA, W.DIA

Diameter of the wire (mm)

Y

DEFL

Deflection (mm)

N, NA

#COIL

Number of Coils

D

CDIA, C.DIA

Diameter of the coil (mm)

K = (G×A^4)÷(8×N×D)


Spring Constant (kg/mm)
(FX-702P only)



Casio FX-702P Code


The original BASIC programs are listed here (Casio, pg. 72, Program Library FX-702P, see sources):

5 FOR L=1 TO 5

10 INP “K,P:1,A:2,D:3,NA:4”,I

20 FOR J=1 TO 4

30 IF I=J THEN 100

40 NEXT J

50 GOTO 10


100 INP “G=”,G

110 G=G/8

120 IF I=2 THEN 150

130 INP “A=”,A:A=A↑4

140 IF I=3 THEN 170

150 INP “D=”,D:D=D↑3

160 IF I=4 THEN 180

170 INP “NA”=,N

180 INP “Y=”,Y

190 IF I=1;K=G*A/N/D:P=K*Y:PRT “K=”;K,”P=”;P:GOTO 240

200 INP “P=”,P

210 IF I=2;A=(P*D*N/G/Y)↑(1/4):PRT “A=”;A:GOTO 240

220 IF I=3;D=(A*G*Y/N/P)↑(1/3):PRT “D=”;D:GOTO 240

230 N=G*A*Y/D/R:PRT “NA=”;N

240 NEXT L

250 END


INP: input

PRT: print


Swiss Micros DM42 Solver Code: SPRING


Also for HP 42S, Free42, Plus42.


00 { 103-Byte Prgm }
01▸LBL "SPRING"
02 MVAR "LOAD"
03 MVAR "SHEAR"
04 MVAR "W.DIA"
05 MVAR "C.DIA"
06 MVAR "#COIL"
07 MVAR "DEFL"
08 RCL "SHEAR"
09 RCL "W.DIA"
10 4
11 Y↑X
12 ×
13 RCL× "DEFL"
14 8
15 RCL× "#COIL"
16 RCL "C.DIA"
17 3
18 Y↑X
19 ×
20 ÷
21 +/-
22 RCL+ "LOAD"
23 RTN
24 .END.


Run SPRING through the SOLVER.



HP 27S Equation: SPRING


Spaces added for readability.


SPRING: SHEAR × WDIA^4 × DEFL ÷ (8 ×#COIL × CDIA^3)



Example: Copper Spring Coil


Shear: G = 4558.131472 kg/mm^2

Coil Diameter: D = 10 mm

Wire Diameter: A = 0.7 mm

Deflection: Y = 5 mm

Number of Coils: N = 4


Result: Load: P: 0.17100 kg



Calculate the wire diameter if the load is 0.25 kg.


Result: Wire Diameter: A: 0.79672 mm



What if instead we have 8 coils? Wire diameter resets to 0.7 mm.


Result: Load: P: 0.08550 kg




Table of Shear Modulus Values


These are the shear modulus of various mediums. The higher the shear modulus is, the more rigid the solid is. If the solid’s modulus is smaller, it is easier to deform or change its shape. For liquids, the modulus is zero. The table below has two units, GPa (gigapascal) and kg/mm^2. The conversion rate is approximately 1 GPa = 101.9716212978 kg/mm^2.


The values in are from the “What is the Shear Modulus?” article by Dr. Helmenstine (see the Sources section) in GPa.


Shear Modulus

GPa

kg/mm^2

Rubber

0.0006

0.06118297278

Plywood

0.62

63.2224052

Nylon

4.1

418.0836473

Lead

13.1

1335.828239

Aluminum

25.5

2600.276343

Brass

40

4078.864852

Copper

44.7

4558.131472

Titanium

41.1

4191.033635


Source:


Casio. Program Library: FX-702P pp. 71-72 (English)

Helmenstine, Anne Marie, Ph.D. "What Is the Shear Modulus?" ThoughtCo, Feb. 17, 2021, thoughtco.com/shear-modulus-4176406. Retrieved January 21, 2024.

TranslatorsCafe.com “Convert gigapascal [GPa] to kilogram-force/millimeter² [kgf/mm²]”

https://www.translatorscafe.com/unit-converter/en-US/pressure/5-28/gigapascal-kilogram-force/millimeter%C2%B2/ Retrieved January 21, 2024



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.


Saturday, September 23, 2023

HP 15C: Quadratic Solver Using Solve and Flags

HP 15C:  Quadratic Solver Using Solve and Flags



Introduction


This program solves the quadratic equation for real roots:


a x^2 + b x + c = 0


Instructions:


1.  Key:  a [ENTER], b [ENTER], c [ f ] [ A ]   (enter coefficients into label A)

2.  The first root is displayed. 

3.  Press [ R/S ] for the second root.


Registers Used:


R1 = a

R2 = b

R3 = c

R4 = root 1

R5 = root 2

R6 = abs((R1 + R2 + R3) ÷ 3),  I use [-R6, R6] as my initial guesses.


Flag 0: used to adjust the equation to be solved

Equation 1:  finding the first root:   (a x^2 + b x + c)  (flag 0 is set)

Equation 2:  finding the first root:   (a x^2 + b x + c) ÷ (x - root)  (flag 0 is clear, this is a depressed equation)


When a function with multiple roots is present, we can take out roots already found by dividing f(x) by (x - root).  




HP 15C Program:  Quadratic Solver

Steps:  47, Bytes:  57


Code:


Step : Key Code : Key


001 : 42,21,11 : LBL A

002 : 44, 3 : STO 3

003 : 44, 6 : STO 6

004 : 33 : R↓

005 : 44, 2 : STO 2

006 : 44,40, 6 : STO+ 6

007 : 33 : R↓

008 : 44, 1 : STO 1

009 : 44,40, 6 : STO+ 6

010 : 45, 6 : RCL 6

011 : 3 : 3

012 : 10 : ÷

013 : 43,16 : ABS

014 : 44, 6 : STO 6

015 : 43, 4, 0 : SF 0

016 : 42,21, 0 : LBL 0

017 : 45, 6 : RCL 6

018 : 16 : CHS

019 : 45, 6 : RCL 6

020 : 42,10, 1 : SOLVE 1

021 : 43, 6, 0 : F? 0

022 : 22, 2 : GTO 2

023 : 22, 3 : GTO 3

024 : 42,21, 2 : LBL 2

025 : 44, 4 : STO 4

026 : 43, 5, 0 : CF 0

027 : 22, 0 : GTO 0

028 : 42,21, 1 : LBL 1

029 : 36 : ENTER

030 : 36 : ENTER

031 : 45,20, 1 : RCL× 1

032 : 45,40, 2 : RCL+ 2

033 : 20 : ×

034 : 45,40, 3 : RCL+ 3

035 : 43, 6, 0 : F? 0

036 : 43, 32 : RTN

037 : 34 : x<>y

038 : 45, 4 : RCL 4

039 : 30 : -

040 : 10 : ÷

041 : 43,32 : RTN

042 : 42,21, 3 : LBL 3

043 : 44, 5 : STO 5

044 : 45, 4 : RCL 4

045 : 31 : R/S

046 : 34 : x<>y

047 : 43, 32 : RTN



Examples


x^2 - 5 x - 24 = 0

a = 1

b = -5

c = -24


1 [ ENTER ] 5 [CHS] [ ENTER ] 24 [ CHS ] [ f ] [ A ]

Roots:  8 [ R/S ] -3   (x = 8, x= -3)


2 x^2 + 8 x - 2 = 0

a = 2

b = 8

c = -2


2 [ ENTER ] 8 [ ENTER ] 2 [ CHS ] [ f ] [ A ]

Roots:  0.2361 [ R/S ] -4.2361  (x ≈ 0.2361, x ≈ -4.2361)


Eddie


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

Solving Integral Equations

Solving Integral Equations



Solving integral equations (for the variable A) of any of the following forms:


∫( f(x) dx, x = constant to x = A) = area


∫( f(x) dx, x = A to x = constant) = area


∫( f(x) dx, x = constant to x = constant) = A


is fairly easy with the solve feature on non-graphing scientific calculators such as:


Casio fx-115ES Plus 

Casio fx-991EX

Casio fx-991CW

TI-30X Pro Math Print

TI-36X Pro


The screen shots below show an example, from the Casio fx-991CW (Equation - Solver):




The function must have the variable x as the independent variable. We can designated any other variable to be limit to be solved for; I used the variable a.  


Here, we don't have to worry about the value of x when solving the equation because x is considered a dummy variable in the integral.  



Examples


Solve for A.


Example 1:


∫( e^(-x^2) dx, x = 0 to x = A) = 0.7


Casio fx-991EX:  

A = 0.8861430055,  L-R = 0


TI-30X Pro MathPrint:  

A = 0.8861430055201,  L-R = 0  (this solve took a little time)



Example 2:


∫( e^(-x^2) dx, x = A to x = 2) = 0.13


Casio fx-991EX:  

A = 1.014499933,  L-R = 0


TI-30X Pro MathPrint:  

A = 1.014499933366,  L-R = 0  



Example 3:


∫( A*x + 1 dx, x = 1 to x = 5 ) = 10


Casio fx-991EX:  

A = 0.4,  L-R = 0


TI-30X Pro MathPrint:  

A = 0.4,  L-R = 0  



Eddie 


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


Python: Drawing a Ring of Circles

Python: Drawing a Ring of Circles The goal: Draw a number of circles that revolve around the origin (0,0). The center of each circle i...