DM42: all complex roots

Discussion around the SwissMicros DM42 calculator
Post Reply
User avatar
salvomic
Posts: 186
Joined: Sat Dec 30, 2017 10:09 am
Location: Ragusa, Sicily
Contact:

DM42: all complex roots

Post by salvomic »

hi,
I wonder for a simple, short program to get all complex roots from a number (real or complex), like the function which is in the Math 1 pack for HP41CX.

Maybe with a simple menu...

In the 41 + Math 1 pack we have this:

Code: Select all

Z "img"
Y "real"
X nRth
XEQ "Z↑1/N"
then R/S nth times, that displays U= and V=

In DM42 we could input directly a complex (u, v) and with XEQ (and R/S) get all the roots...
Any help?

Thank you.
Salvo
∫aL√0mic (IT9CLU) :: DM42 (SN: 00881), DM41X (SN 00523), DM16, HP Prime, 50g, 41CX, 42s, 71b, 15C, 12C, 35s, WP34s -- Free42
DaveGary
Posts: 10
Joined: Fri Jul 21, 2017 11:08 pm

Re: DM42: all complex roots

Post by DaveGary »

salvomic,

This is not exactly what you were looking for, but it is a complex root finder for real and complex numbers. I wrote this a few years ago for use on my HP 28S (different code) calculator. I did a quick and dirty adaptation for the DM42. Put the .raw file into the Programs file of your disk. Exit out to the main screen and XEQ cplxr. Go in to the Solver, Shift-7, and hit the CPLXR menu key. You should see the menu keys: Z N K.

Example: Put in -27 for Z. Put in 3 for N and then put 0 into K. Hit R/S. The 0th root of a negative number is complex. You should see a 0 in Y and the complex result in X. Now, put a 1 into K and hit R/S. You should see a 1 in Y and the real root in X (obviously, a -3). For the final root, put a 2 into K and hit R/S. You should see a 2 in Y and the other complex root in X. That's all the roots for the cube root of -27. You just need to remember that to calculate all of the roots of a real or complex number the K value should always start at zero and end with a number one less that the number of roots you are calculating.

I edited the cplxr.raw program to make it a little more convenient to use. First, download the "KPLXR.raw" to the USB disk of your calculator. Load the program. Go the the main screen of your calculator and hit the "XEQ" button. Select "KPLXR". Go to the "SOLVER", shift-7. Select "KPLXR". A menu should appear on your calculator screen...Z, N, K, Step. Now, find the first 3 roots of -8. Put -8 into Z. Put 3 into N. Put 2 into K (remember K=N-1).

Finally, put 1 into "Step" (or nothing, it will default to Step=1). Hit R/S...you should see X=1.0000 i1.7321. Hit R/S again...you should see X=-2.0000 i0.0000. Hit R/s again...you should see 1.0000 -i1.7321. That's the first 3 roots of -8. Now, if you hit R/S again, the program will loop back to the first answer. If you hit "Exit" everything will clear out of the stack.

Dave
Attachments
KPLXR.raw
Solver program to calculate complex roots. Look at post for further instructions.
(121 Bytes) Downloaded 55 times
cplxr.raw
Solver program to calculate real and complex roots of any real or complex number.
(53 Bytes) Downloaded 178 times
Last edited by DaveGary on Sat Oct 22, 2022 6:21 pm, edited 6 times in total.
User avatar
salvomic
Posts: 186
Joined: Sat Dec 30, 2017 10:09 am
Location: Ragusa, Sicily
Contact:

Re: DM42: all complex roots

Post by salvomic »

hi Dave,
many thanks.
I'll try it soon.
For now I wish you a Merry Christmas :)

Salvo
∫aL√0mic (IT9CLU) :: DM42 (SN: 00881), DM41X (SN 00523), DM16, HP Prime, 50g, 41CX, 42s, 71b, 15C, 12C, 35s, WP34s -- Free42
DaveGary
Posts: 10
Joined: Fri Jul 21, 2017 11:08 pm

Re: DM42: all complex roots

Post by DaveGary »

Merry Christmas to you, also.

Modify the code any way you wish to get the output however you want it.
User avatar
salvomic
Posts: 186
Joined: Sat Dec 30, 2017 10:09 am
Location: Ragusa, Sicily
Contact:

Re: DM42: all complex roots

Post by salvomic »

DaveGary wrote:
Fri Dec 25, 2020 8:32 pm
Merry Christmas to you, also.

Modify the code any way you wish to get the output however you want it.
thank you!
I installed it it is ok and it seems to be very nice.
I'll test this evening and tomorrow.

Salvo
∫aL√0mic (IT9CLU) :: DM42 (SN: 00881), DM41X (SN 00523), DM16, HP Prime, 50g, 41CX, 42s, 71b, 15C, 12C, 35s, WP34s -- Free42
Post Reply