The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (FreeBSD)
File Line Function
/showthread.php 795 errorHandler->error





Post Reply 
(42S) Roots of Complex Numbers
12-30-2019, 04:47 PM
Post: #1
(42S) Roots of Complex Numbers
The program CROOTS calculates the roots of a complex number.

(a+bi)^n (n is a positive integer).

The roots are determined by the formula:

(a + bi)^(1/n) = r^(1/n) * e^(i * (θ + 2*k*π)/n) (k = 0, 1, 2, ... , n-1)

The results are stored in matrix MATZ. The calculator is switched to Radians mode during execution.

Stack when running CROOTS:

Y: complex number
X: n

HP 42 & DM42 Program CROOTS
Code:

00 { 108-Byte Prgm }
01▸LBL "CROOTS"
02 RAD
03 STO 01
04 R↓
05 STO "ZC"
06 1
07 RCL 01
08 NEWMAT
09 ENTER
10 COMPLEX
11 STO "MATZ"
12 RCL 01
13 1
14 -
15 1ᴇ3
16 ÷
17 STO 02
18 INDEX "MATZ"
19 RCL "ZC"
20 COMPLEX
21 X<>Y
22 →POL
23 RCL 01
24 1/X
25 Y↑X
26 STO 03
27 R↓
28 STO 04
29▸LBL 01
30 RCL 04
31 2
32 PI
33 ×
34 RCL 02
35 IP
36 ×
37 +
38 RCL÷ 01
39 0
40 ENTER
41 1
42 COMPLEX
43 ×
44 E↑X
45 RCL 03
46 ×
47 1
48 RCL 02
49 IP
50 1
51 +
52 STOIJ
53 R↓
54 R↓
55 STOEL
56 ISG 02
57 GTO 01
58 EDITN "MATZ"
59 .END.

Link to download croots.raw: https://drive.google.com/open?id=1YtxgNT...SZuiYc-RaA

Example:
(FIX 4 mode)

Find the three roots of 5+4i. (5+4i)^(1/3)

Y: 5.0000 i4.0000
X: 3

Result:
1:1=1.8102 i0.4141
1:2=-1.2637 i1.3606
1:3=-0.5464 -i1.7747

(approximately 1.8102+0.4141i, -1.2637+1.3606i, -0.5464-1.7747i)

Blog link: http://edspi31415.blogspot.com/2019/12/h...-year.html
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(42S) Roots of Complex Numbers - Eddie W. Shore - 12-30-2019 04:47 PM



User(s) browsing this thread: 2 Guest(s)