|
|
◆ WRpzero2()
| Function WRpzero2 |
( |
N As |
Long, |
|
|
A As |
Variant |
|
) |
| |
Roots of a polynomial with real coefficients by Newton method (complex numbers in pairs of cells)
- Purpose
- WRpzero2 computes all roots of a polynomial p(z) with real coefficients by Newton method.
p(z) = a0*z^n + a1*z^(n-1) + ... + an
The obtained zeros are output to the separate cells for real and imaginary parts.
- 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 (25*N) 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 1) or (1 x N+1) Real 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^5 + 2*x^3 + 2*x^2 - 15*x + 10 = 0
The exact solutions are 1(multiple root), -2, and ±√5i.
|