Saturday, May 10, 2025

RPN with HP 15C and DM32: Complex Mode

RPN with HP 15C and DM32: Complex Mode



HP 15C Complex Mode


This section also applies to the Swiss Micros DM15 family.


Complex mode is a separate mode for the HP 15C. Complex mode is turned on by setting flag 8. Complex mode is on when there is a “C” indicator in the display.


In complex mode, the stack is expanded. Each stack level now includes a real part and a complex part. What is in the display is always the real part.


Stack T

Real part of T

Imaginary part of T

Stack Z

Real part of Z

Imaginary part of Z

Stack Y

Real part of Y

Imaginary part of Y

Stack X

Real part of X

Imaginary part of X


The great news is that the stack handles up to four complex numbers, one for each of the stack levels.


To display the imaginary part, we have two methods:


Temporary View: Press [ f ] and hold [ COS ] (i) to temporarily view the complex part. The stack remains unaffected.


Switch: Switch the real part and the imaginary part by pressing [ f ] [ - ] (Re<>Im). Doing this switches the real and imaginary parts of the X stack.


For example: X = 9 – 8i


Enter the complex number as such: 9 [ ENTER ] 8 [ CHS ] [ I ] * (see note).

The displays shows 9.

Press [ f ] [ - ] (Re<>Im). The display shows -8 and the X stack now has the complex number X = -8 + 9i.

Press [ f ] [ - ] (Re<>Im) to switch the parts back to the original complex number.


* Note: If complex mode is turned off (no C indicator), using this key sequence sets flag 8, turning on complex mode automatically.


The switching of parts is important, because memory registers can not hold an entire complex number, but it’s separate parts. Thus, we will need two registers, one for the real part and one for the imaginary part.



HP 15C: Leaving Complex Mode


To leave complex mode, clear flag 8 (CF 8). The imaginary parts of the stack are lost.



Angle Mode


In complex mode, the trigonometric functions operate as the angles are always in radian measure regardless of the angle setting. The only functions that recognize the angle setting are the polar/rectangular conversions. To take the cosine and sine of angle that respects the conversion, use the following sequence:


angle [ENTER] 1 [ f ] [ →R ]: X stack: cos(angle), Y stack: sin(angle)



HP 15C - Solving Monic Quadratic Equations


The HP 15C’s solver only works for real numbers, so manual methods and formulas must be used to solve equations for complex numbers.



Z^2 + w1 * Z + w0 = 0


Solution: Z = (w1 ± √(w1^2 – 4 * w0)) / 2

(D = √(w1^2 – 4 * w0), Z+ = (w1 + D) / 2 Z- = Z+ - D)


Store the following:


Complex coefficient w1: Real part in register 4, Imaginary part in register 5

Complex coefficient w2: Real part in register 1, Imaginary part in register 2


The results are stored in the following registers:


Discriminant (D): Real part in register 6, imaginary part in register 3

Complex root Z+: Real part in register .0 (decimal point-0), imaginary party in register 8

Complex root Z-: Real part in register 9, imaginary part in register 7


Code (use any label you want, I use label A for example):


Key

Key Code


Key

Key Code

LBL A

42, 21, 11


RCL 4

45, 4

SF 8

43, 4, 8


RCL 1

45, 1

RCL 4

45, 4


I

42, 25

RCL 1

45, 1


-

30

I

42, 25


2

2

x^2

43, 11


÷

10

RCL 5

45, 5


STO .0

44, .0

RCL 2

45, 2


Re<>Im

42, 30

I

42, 25


STO 8

44, 8

4

4


Re<>Im

42, 30

×

20


R/S

31

-

30


RCL 6

45, 6

√

11


RCL 3

45, 3

STO 6

44, 6


I

42, 25

Re<>Im

42, 30


-

30

STO 3

44, 3


STO 9

44, 9

Re<>Im

42, 30


Re<>Im

42, 30




STO 7

44, 7




Re<>Im

42, 30




RTN

43, 32



Example:

Z^2 + (4 + i) * Z + (2 - 5i) = 0

w1: 4 STO 4, 1 STO 1

w2: 2 STO 5, 5 CHS STO 2


[ f ] A or [ GSB ] A:

0.11724 [ f ] hold (i) 1.15309 (Z+ ≈ 0.11724 + 1.15309i)

[ R/S ]

-4.11724 [ f ] hold (i) -2.15309 (Z- ≈ -4.11724 – 2.15309i)



DM32 Complex Mode


This section also applies to the HP 32Sii, HP 32S, and the HP 41C/DM41X with the Advantage ROM plugged in. The names of the functions vary.


There is no “separate” complex mode for the DM32, all the functions are access with shifted CMPLX prefix function. The complex number functions available on the DM32 are:


CMPLX+, CMPLX-, CMPLX×, CMPLX÷

CMPLX+/- (change sign, multiply the complex number by -1)

CMPLX1/x, CMPLXe^x, CMPLXLN, CMPLXy^x

CMPLXSIN, CMPLXCOS, CMPLXTAN


The complex functions grabs the values from the four stack levels and uses them as up to two complex numbers:

Z

Imaginary part of T + Zi

T

Real part of T + Zi

Y

Imaginary part of X + Yi

X

Real part of X + Yi


Memory registers can not hold an entire complex number, but it’s separate parts. Thus, we will need two registers, one for the real part and one for the imaginary part.


To enter complex numbers, enter the imaginary part, press [ ENTER ], then enter the real part.



Square Root and Square (√ and x^2)


There is no complex square root or complex square function. We will need some creativity to tackle these functions. Here is just one way we can accomplish this task.


Assume the complex number A + Bi have the real part stored in A and imaginary part stored in B.


Square Root (√):

RCL B

RCL A

0.5

ENTER

Clx

x<>y

CMPLXy^x


Square (x^2):

RCL B

RCL A

RCL B

RCL A

CMPLX×


Angle Mode


In complex mode, the trigonometric functions operate as the angles are always in radian measure regardless of the angle setting. The only functions that recognize the angle setting are the polar/rectangular conversions. To take the cosine and sine of angle that respects the conversion, use the following sequence:


1 [ENTER] angle [ blue shift ] [ →y,x ]: X stack: cos(angle), Y stack: sin(angle)


(HP 32SII late editions: lavender/purple shift)



DM32 - Solving Monic Quadratic Equations


Like the HP 15C, the DM32’s solver only works for real numbers, so manual methods and formulas must be used to solve equations for complex numbers.


Z^2 + w1 * Z + w0 = 0


Solution: Z = (w1 ± √(w1^2 – 4 * w0)) / 2

(D = √(w1^2 – 4 * w0), Z+ = (w1 + D) / 2 Z- = Z+ - D)


Store the following:


Complex coefficient w1: Real part in A, Imaginary part in B

Complex coefficient w2: Real part in C, Imaginary part in D

The program will prompt for A, B, C, and D, in the order of imaginary part, then real part

Z^2 + (Bi + A) * Z + (Di + C) = 0


The results are stored in the following registers:


Discriminant (D): Real part in E, imaginary part in F

Complex root Z+: Real part in R, imaginary party in S

Complex root Z-: Real part in U, imaginary part in V


Code:

A01 LBL A

A24 x<>y

A02 INPUT B

A25 RCL B

A03 INPUT A

A26 RCL A

A04 INPUT D

A27 CMPLX-

A05 INPUT C

A28 2

A06 RCL B

A29 ENTER

A07 RCL A

A30 CLx

A08 RCL B

A31 x<>y

A09 RCL A

A32 CMPLX÷

A10 CMPLX×

A33 STO S

A11 4

A34 x<>y

A12 RCL× D

A35 STO R

A13 4

A36 x<>y

A14 RCL× C

A37 STOP

A15 CMPLX-

A38 RCL F

A16 0.5

A39 RCL E

A17 ENTER

A40 CMPLX-

A18 CLx

A41 STO U

A19 x<>y

A42 x<>y

A20 CMPLXy^x

A43 STO V

A21 STO E

A44 x<>y

A22 x<>y

A45 RTN

A23 STO F




Example:

Z^2 + (4 + i) * Z + (2 - 5i) = 0

[ XEQ ] A

B? 1 [R/S]

A? 4 [R/S]

D? -5 (5 [+/-] ) [R/S]

C? 2 [R/S]


Y: 1.15309, X: 0.11724 (Z+ ≈ 0.11724 + 1.15309i)

[R/S]

Y: -2.15309, X: -4.11724 (Z- ≈ -4.11724 – 2.15309i)




I hope you enjoyed this edition of RPN with HP 15C and DM2,


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 3, 2025

Casio fx-3900Pv: Linear System, Poisson Kernel, Normal Distribution, 3 x 3 Matrix Determinant

Casio fx-3900Pv: Linear System, Poisson Kernel, Normal Distribution, 3 x 3 Matrix Determinant


Today, we feature four programs for the classic Casio fx-3900Pv calculator. The fx-3900Pv has 300 steps.


My review from 2023: https://edspi31415.blogspot.com/2023/05/retro-review-casio-fx-3900pv.html


One of the great features of the early “inexpensive” algebraic keystroke programmable calculators (1980s) is that the programs can be seen and edited.


The programs listed will require inputs to be stored in to the memory registers prior to running the program by using the [ Kin ] key.



Casio fx-3900Pv: 2 x 2 Systems


This program solves 2 x 2 linear systems. The Constant memory registers (K1 – K6) are mapped as follows:


K4 * x + K5 * y = K6

K1 * x + K2 * y = K3


The equations are solved as follows:

x = (K2 * K6 – K5 * K3) / M

y = (-K1 * K6 + K4 * K3) / M

where M = (K4 * K2 – K1 * K5)


This program takes 36 steps.


Code:

Kout 4 (determinant)

×

Kout 2

-

Kout 1

×

Kout 5

=

Min

HLT (Pause program, shows determinant. We want a nonzero-determinant.)


(

Kout 2

×

Kout 6

-

Kout 5

×

Kout 3

)

÷

MR

=

HLT (Solve for x)


(

Kout 1

+/-

×

Kout 6

+

Kout 4

×

Kout 3

)

÷

MR

= (Solve for y)


Examples


Example 1

x – y = 5

x + 3 * y = 9


Store the parameters: 1 Kin 4, -1 Kin 5, 5 Kin 6; 1 Kin 1, 3 Kin 2, 9 Kin 3

Results: det = 4, x = 6, y = 1


Example 2

3 * x + 16 * y = 49

5 * x – 2 * y = 22


Store the parameters: 3 Kin 4, 16 Kin 5, 49 Kin 6; 5 Kin 1, -2 Kin 2, 22 Kin 3

Results: det = -86, x = 5.23255814, y = 2.081395349



Casio fx-3900Pv: Poisson Kernel


The program calculates the kernel using the formula:


Pr(θ) = (1 – r^2) / (1 – 2 * r * cos θ + r^2),

0 ≤ r < 1, -Ï€ < θ ≤ Ï€


This program takes 22 steps.


Store r in register 1, θ in register 2.


Code:

Rad (Mode 5)

(

1

-

Kout 1

x^2

)

÷

(

1

-

2

×

Kout 1

×

Kout 2

cos

+

Kout 1

x^2

)

=


Examples


Example 1:

r = 0.5, θ = 2.1

0.5 Kin 1, 2.1 Kin 2

Result: 0.4273879049


Example 2:

r = 0.268, θ = 0.842

0.268 Kin 1, 0.842 Kin 2

Result: 1.298397221


Source:

“Poisson Kernel” Wikipedia. May 28, 2024. https://en.wikipedia.org/wiki/Poisson_kernel

Retrieved November 26, 2024


Casio fx-3900Pv: Normal Distribution (Integration)


The program, which is ran in Integration Mode (Mode 1):


∫( e^(-t^2 / 2) / √(2 * Ï€) dt, a, b)


To calculate, really approximate the integral:

MODE 1 P#

Store a level n (1-9), SHIFT RUN

Lower limit RUN

Upper limit RUN


The level n corresponds to the integration intervals 2^n. The higher n is, the longer the calculation takes but the accurate the integral is.


The integrated variable is stored in memory M. Start the function using Min.


Code:

Min

(

MR

x^2

+/-

÷

2

)

e^x

÷

(

2

×

Ï€

)

√

=


Examples


The following examples will use n = 4.


Example 1: lower limit = 0, upper limit = 3. Result: 0.49865

(actual ≈ 0.4986501019)


Example 2: lower limit = -1, upper limit = 1. Result: 0.6827

(actual ≈ 0.6826894921)


Example 3: lower limit = -2, upper limit = 1.5. Result: 0.910443

(actual ≈ 0.910 4426667)



Casio fx-3900Pv: 3 x 3 Determinant


This program calculates the determinant of a 3 x 3 matrix. How are we to do this with only seven memory registers?


The program sets the matrix as:


[ [ 1st input, 2nd input, 3rd input ] [ K4, K5, K6 ], [ K1, K2, K3 ] ]


The user will be stop execution three times. At each time, enter the element corresponding to the top row.


For example:


[ [ 1, 2, 3 ] [ 4, 5, 6 ] [ 7, 8, 9 ] ]


Store 4 in K4, 5 in K5, 6 in K6; 7 in K1, 8 in K2, 9 in K3. While running, enter 1, 2, then 3 during program execution.


The determinant is stored to memory M. This program takes 40 steps.


Code:

(

Kout 5

×

Kout 3

-

Kout 2

×

Kout 6

)

×

ENT # (enter a legitimate number to continue, prompt for row 1, column 1)

=

Min


(

Kout 4

×

Kout 3

-

Kout 6

×

Kout 1

)

×

ENT # (prompt for row 1, column 2)

=

M-


(

Kout 4

×

Kout 2

-

Kout 5

×

Kout 1

)

×

ENT # (prompt for row 1, column 3)

=

M+


MR


Examples


Example 1:

[ [ 1, 5, 6 ] [ 2, 7, 8 ] [ 11, 4, 3 ] ]


Store:

(2nd row) 2 Kin 4, 7 Kin 5, 8 Kin 6

(3rd row) 11 Kin 1, 4 Kin 2, 3 Kin 3

Run the program (P1-P4): 1 RUN, 5 RUN, 6 RUN

Result: -15


Example 2:

[ [ -3, 0, 9 ] [ 0 , -3, 9 ] [ 9, -3, 0 ] ]


Store:

(2nd row) 0 Kin 4, -3 Kin 5, 9 Kin 6

(3rd row) 9 Kin 1, -3 Kin 2, 0 Kin 3

Run the program (P1-P4): -3 RUN, 0 RUN, 9 RUN

Result: 162


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.

Wednesday, April 30, 2025

Casio fx-CG 100 in Pictures and First Impressions

Casio fx-CG 100 in Pictures and First Impressions


Quick Facts:


Model: fx-CG 100

Company: Casio

Battery: 4 x AAA (included with the calculator)

Memory: 61,440 bytes for regular memory. However, Python scripts are stored in Storage Memory, which is 4,793,072 bytes (almost 4.8 MB).

Price (US): $119.99

Site: https://www.casio.com/us/scientific-calculators/product.FX-CG100/

Display: 216 x 384 pixels

Programming Language: Python

Connection: USB Port, USB-C (a cord was not provided in the box, but this cord is easily obtainable because the USB-C fits works with most smart phones, tablets, and current Numworks N120)

Languages: English, Spanish, French, Italian, Portuguese

Country Settings: International, Portugal, United Kingdom, United States (this seems to arrange the order the apps, but I'm not sure what else is effected)

Python Modules available at the beginning: Math, Random, PyPlot, Turtle, CasioPlot including getkey()


The fx-CG 100 is a graphing calculator that is modeled after the ClassWiz series, like it’s non-graphing flagship fx-991 CW. Instead of function keys (F1 – F6), navigation is done using tab keys ( [ |< ] and [ >| ]), and the [CATALOG] and [ TOOLS ] keys. The options available in the CATALOG and TOOLS change depending on the current app operated.


At default the [ FORMAT ] key toggles between exact answers and approximates. We can set the format key to act like the fx-991 CW, which it brings up menu which gives formatting options exact, approximate, sexagesimal, and engineering. For me personally, I will leave it as toggle. We can always bring up the format menu by pressing [ SHIFT ] [ FORMAT ].


The menus include short cut option numbers. We can disable them, but I don’t think there is a reason to.


The Calculate app is now only in Math Input/Output (textbook). No more linear (one-line) entry, despite the current manual mentioning Linear Input. I have not found that setting (yet).


The list brackets are no longer on the keyboard, but instead only in the CATALOG-Statistics menu.


Pressing the [ HOME ] key will bring up the following apps:


Calculate (includes Unit Conversions)

Graph & Table (used to be two separate apps – function, parametric, polar, x=, inequality)

Statistics

Equation (solve linear systems, polynomials, general solver)

Recursion (sequences)

Dynamic Graph

Distribution (Binomial, Normal, Poisson, Geometric, Hypergeometric, Student-t, Chi Square, F)

Numeric Inequality Solver

Base-N (base conversions and logic returns to its own app instead of being integrated in Calculate)

Conic Graphs

Spreadsheet (better access to the cell functions)

Geometry

Financial

3D Graph (including z(x,y), parametric (x(s,t), y(s,t), z(s,t), conic sections)

Probability Simulations

Python

Database – Periodic Table, Scientific Constants (which can be stored in variables A-Z). Scientific constants are in SI units (meters, kilograms, seconds, Joules, Kelvins, etc.)

Memory Management

Exam Mode (which personally I’ll never use)


Given a quick glance, except for the loss of Casio basic, all of the functionality of the fx-CG 50 make it over to the fx-CG 100. Python scrips are stored in Storage Memory (about 4.8 MB).


The keyboard feels nice. And the contrast of the green, orange, and white against the black background makes the keyboard easy to read.


[SHIFT] [ 0 ]: Select. Press [ OK ] or [EXE] to cut or past

[SHIFT] [ 1 ]: Paste

[SHIFT] [ 2 ]: Screen Capture



Pictures:














Overall, the fx-CG 100 is impressive and I will have to get used to the catalog/tools keys.



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.

HP 15C: The I Squared Rule and HHC 2026

HP 15C: The I Squared Rule and HHC 2026 HHC 2026 Videos Before we start, the videos for HHC 2026 are up! Please take a look, ev...