Saturday, February 8, 2025

RPN with HP 15C & DM32: Min, Max, Midrange, Log Mean

RPN with HP 15C & DM32: Min, Max, Midrange, Log Mean



Introduction


These set of programs calculates four statistics:


(1) Minimum

(2) Maximum

(3) Midrange = (minimum + maximum) / 2

(4) Log Mean, using the maximum and minimum points. The general formula is:


log mean(T1, T2) = (T2 – T1) / ln(T2 / T1)


The program also enters data points into the statistics registers, allowing for one-variable statistics to be performed.



DM 32 Code


Initialization: LBL I


I01 LBL I

I02 STO M

I03 STO N

I04 CLΣ

I05 Σ+

I06 RTN


Enter data, maximum on the Y stack, minimum on the X stack: LBL T


T01 LBL T

T02 STO J

T03 Σ+

T04 RCL M

T05 RCL J

T06 x<y?

T07 STO M

T08 RCL N

T09 RCL J

T10 x>y?

T11 STO N

T12 RCL N

T13 RCL M

T14 STOP

T15 GTO T


Midrange: LBL M


M01 LBL M

M02 RCL N

M03 RCL+ M

M04 2

M05 ÷

M06 RTN


Log-Mean – Use maximum and minimum to determine the log-mean: LBL L


L01 LBL L

L02 RCL N

L03 RCL- M

L04 RCL N

L05 RCL÷ M

L06 LN

L07 ÷

L08 RTN



Variables Used:


J: temporary value

M = minimum

N = maximum


Instructions:


Step 1: Enter the first point and start the process by executing label I.

Step 2: Enter subsequent points and execute label T. The minimum is shown on the X stack, and the maximum is shown on the Y stack.

Step 3: To calculate the midrange, execute label M. To calculate the log mean, execute label L.



HP 15C Code


Initialization: LBL A


001

42, 21, 11

LBL A

002

44, 0

STO 0

003

44, 8

STO 8

004

44, 9

STO 9

005

44, 32

CLΣ

006

45, 0

RCL 0

007

49

Σ+

008

43, 32

RTN



Enter data, maximum on the Y stack, minimum on the X stack: LBL B


009

42, 21, 12

LBL B

010

44, 0

STO 0

011

49

Σ+

012

45, 8

RCL 8

013

45, 0

RCL 0

014

43, 30, 8

TEST 8, x<y?

015

44, 8

STO 8

016

45, 9

RCL 9

017

45, 0

RCL 0

018

43, 30, 7

TEST 7, x>y?

019

44, 9

STO 9

020

45, 9

RCL 9

021

45, 8

RCL 8

022

31

R/S

023

22, 12

GTO B



Midrange: LBL C


024

42, 21, 13

LBL C

025

45, 8

RCL 8

026

45, 40, 9

RCL + 9

027

2

2

028

10

÷

029

43, 32

RTN



Log-Mean – Use maximum and minimum to determine the log-mean: LBL D


030

42, 21, 14

LBL D

031

45, 9

RCL 9

032

45, 30, 8

RCL - 8

033

45, 9

RCL 9

034

45, 10, 8

RCL ÷ 8

035

43, 12

LN

036

10

÷

037

43, 32

RTN



Variables Used:


R0: temporary value

R8 = minimum

R9 = maximum



Statistical variables used (as default):


R2 = n

R3 = Σx

R4 = Σx^2

R5 = Σy

R6 = Σy^2

R7 = Σxy


Instructions:


Step 1: Enter the first point and start the process by executing label A.

Step 2: Enter subsequent points and execute label B. The minimum is shown on the X stack, and the maximum is shown on the Y stack.

Step 3: To calculate the midrange, execute label C. To calculate the log mean, execute label D.


Examples


Example 1:


0.2322

0.8252

0.8005

0.9262


Maximum: 0.9262

Minimum: 0.2322

Midrange: 0.5792

Log Mean: 0.5016


Example 2:


96

54

29

64

48

27


Maximum: 96

Minimum: 27

Midrange: 61.5

Log Mean: 54.3945




Sources


Volk, William. Engineering Statistics With A Programmable Calculator. McGraw-Hill Book Company: New York. 1982. pp. 8-9. ISBN 0-07-067552-X.


“Logarithmic Mean” Wikipedia. Last updated September 30, 2024. https://en.wikipedia.org/wiki/Logarithmic_mean. Last retrieved October 10, 2024.



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.

Saturday, February 1, 2025

TI-84 Plus CE and DM42: RLC Circuits

TI-84 Plus CE and DM42: RLC Circuits


The program RLC calculates:


(1) The total impedance across the entire circuit

(2) The phase angle, sometimes known as a power factor angle

(3) The total supply current


An RLC circuit is a circuit that connects one power supply to a resistor, an inductor, and a capacitor. The resistor, inductor, and capacitor can be connected in one of two ways: series or parallel. To calculate the total impedance (Z) and phase angle (θ), the rectangular to polar conversion function can be utilized.


In a general rectangular to polar conversion, (x, y) to (r, θ):

r = √(x^2 + y^2)

θ = arctan(y / x)


Formulas


Angular Frequency: ω = 2 * π * F


F = frequency in Hz

V = supply voltage (volts)

R = resistor in Ω (ohms)

L = inductor in H (henrys)

C = capacitance (farads)

I = overall current (amps)

Series RLC Circuit - Formulas


Z = √(R^2 + (ω*L – 1 / (ω*C))^2)

θ = arctan ( (ω*L – 1 / (ω*C)) / R)

I = V / Z

Series RLC Circuit – Set up for Rectangular to Polar Conversion


x = ω*L – 1 / (ω*C)

y = R


Z = r

Parallel RLC Circuit - Formulas


1 / Z = √( (1/R)^2 + (1/(ω*L) – ω*C)^2)

θ = arctan ( (1/(ω*L) – ω*C) / (1/R))

I = V / Z

Parallel RLC Circuit – Set up for Rectangular to Polar Conversion


x = 1/(ω*L) – ω*C

y = 1/R


Z = 1/r


TI-84 Plus Program: RLC


ClrHome

Disp “RLC CIRCUIT”

Input “SUPPLY VOLTAGE? “, V

Input “FREQUENCY (HZ)? “, F

Input “RESISTANCE (OHMS)? “, R

Input “INDUCTOR (HENRYS)? “, L

Input “CAPACITOR (FARADS)? “, C

a+bi

Degree

2*π*F → W

Menu(“TYPE”, “SERIES”, 1, “PARALLEL”, 2)


Lbl 1

R+i*(W*L-1/(W*C)) → Z

abs(Z) → N

Goto 3


Lbl 2

(1/R)+i*(1/(W*L)-W*C) → Z

abs(Z)⁻¹ → N


Lbl 3

angle(Z) → θ

V/N → I


ClrHome

Disp “IMPEDANCE:”, N

Disp “PHASE ANGLE:”, θ

Disp “SUPPLY CURRENT:”, I



DM42, HP 42S Program: RLC


00 { 216-Byte Prgm }
01▸LBL "RLC"
02 "SUPPLY VOLTAGE?"
03 PROMPT
04 STO 01
05 "FREQUENCY?"
06 PROMPT
07 STO 02
08 "RESISTANCE?"
09 PROMPT
10 STO 03
11 "INDUCTOR?"
12 PROMPT
13 STO 04
14 "CAPACITOR?"
15 PROMPT
16 STO 05
17 DEG
18 2
19 STO 06
20 PI
21 STO× 06
22 RCL 02
23 STO× 06
24 "TYPE?"
25 AVIEW
26 PSE
27 "SERIES"
28 KEY 1 GTO 01
29 "PARA."
30 KEY 2 XEQ 02
31 MENU
32▸LBL 00
33 STOP
34 GTO 00
35▸LBL 01
36 CLMENU
37 EXITALL
38 RCL 06
39 RCL× 04
40 RCL 06
41 RCL× 05
42 1/X
43 -
44 RCL 03
45 →POL
46 STO 07
47 GTO 03
48▸LBL 02
49 CLMENU
50 EXITALL
51 RCL 06
52 RCL× 04
53 1/X
54 RCL 06
55 RCL× 05
56 -
57 RCL 03
58 1/X
59 →POL
60 1/X
61 STO 07
62▸LBL 03
63 "PHASE:"
64 AVIEW
65 PSE
66 VIEW ST Y
67 STOP
68 "IMPEADANCE:"
69 AVIEW
70 PSE
71 VIEW ST X
72 STOP
73 RCL 01
74 RCL÷ 07
75 "SUPPLY CURRENT:"
76 AVIEW
77 PSE
78 VIEW ST X
79 .END.


Examples


Examples are rounded to five digits.



Series Circuit


Inputs:


SUPPLY VOLTAGE: 300 V

FREQUENCY: 70 Hz

RESISTANCE: 80 Ω

INDUCTOR: 0.09 H

CAPACITOR: 150 μF (150E-6)


Results:


IMPEDANCE (Z) ≈ 83.64599 Ω

PHASE ANGLE (θ) ≈ 16.97904°

CURRENT (I) ≈ 3.58654 A



Parallel Circuit


Inputs:


SUPPLY VOLTAGE: 240 V

FREQUENCY: 90 Hz

RESISTANCE: 60 Ω

INDUCTOR: 20 mH (20E-3)

CAPACITOR: 140 μF (140E-6)


Results:


IMPEDANCE (Z) ≈ 52.46010 Ω

PHASE ANGLE (θ) ≈ 29.05363°

CURRENT (I) ≈ 4.57491 A



Sources



“Impedance and Complex Impedance” https://www.electronics-tutorials.ws/accircuits/impedance.html


“Parallel RLC Circuit Analysis” https://www.electronics-tutorials.ws/accircuits/parallel-circuit.html


“Series RLC Circuit Analysis” https://www.electronics-tutorials.ws/accircuits/series-circuit.html


Electronics Tutorials. AspenCore, Inc. 2024. Retrieved October 7, 2024 and October 17, 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.

RPN with HP 15C & DM32: Min, Max, Midrange, Log Mean

RPN with HP 15C & DM32: Min, Max, Midrange, Log Mean Introduction These set of programs calculates four statistics: (1) ...