Page 1 of 1

### DM42: all complex roots

Posted: Thu Oct 08, 2020 9:11 pm
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.

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

### Re: DM42: all complex roots

Posted: Fri Dec 25, 2020 8:12 pm
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 hope this helps.
cplxr.raw
Solver program to calculate real and complex roots of any real or complex number.
Dave

### Re: DM42: all complex roots

Posted: Fri Dec 25, 2020 8:19 pm
hi Dave,
many thanks.
I'll try it soon.
For now I wish you a Merry Christmas

Salvo

### Re: DM42: all complex roots

Posted: 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.

### Re: DM42: all complex roots

Posted: Fri Dec 25, 2020 8:47 pm
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