|
|
◆ WCpzero2()
| Function WCpzero2 |
( |
N As |
Long, |
|
|
A As |
Variant |
|
) |
| |
Roots of a polynomial with complex coefficients by Newton method (complex numbers in pairs of cells)
- Purpose
- WCpzero2 computes all roots of a polynomial p(z) with complex coefficients by Newton method.
p(z) = a0*z^n + a1*z^(n-1) + ... + an
To represent complex numbers, a real part and an imaginary part are stored in a pair of adjacent cells (a real part in a left cell, and an imaginary part in a right cell). The computed results are stored in the same way.
- Returns
- N+1 x 3
| Column 1 | Columns 2 | Column 3 |
| Rows 1 to N | Real parts of the roots | Imaginary parts of the roots | Error bound for the computed roots |
| Row N+1 | Return code | Number of iterations performed to converge | 0 |
Return code.
= 0: Successful exit.
= 1: Maximum number of iterations exceeded. Best current estimates of the zeros are returned. Error bounds are not calculated.
- Parameters
-
| [in] | N | Degree of polynomial. (N >= 1) |
| [in] | A | (N+1 x 2) Complex coefficients a0 to an of polynomial a0 x^n + a1 x^(n-1) + … + a(n-1)x + an. |
- Reference
- SLATEC
- Example
- Solve the following algebraic equation.
x^3 + (-19-14i)*x^2 + (67+191i)*x + 116-612i = 0
The exact solutions are 8 + 4i, 4 + 9i and 7 + i.
|