Go to the first, previous, next, last section, table of contents.
The roots of polynomial equations cannot be found analytically beyond
the special cases of the quadratic, cubic and quartic equation. The
algorithm described in this section uses an iterative method to find the
approximate locations of roots of higher order polynomials.
- Function: gsl_poly_complex_workspace * gsl_poly_complex_workspace_alloc (size_t n)
-
This function allocates space for a
gsl_poly_complex_workspace
struct and a workspace suitable for solving a polynomial with n
coefficients using the routine gsl_poly_complex_solve
.
The function returns a pointer to the newly allocated
gsl_poly_complex_workspace
if no errors were detected, and a null
pointer in the case of error.
- Function: void gsl_poly_complex_workspace_free (gsl_poly_complex_workspace * w)
-
This function frees all the memory associated with the workspace
w.
- Function: int gsl_poly_complex_solve (const double * a, size_t n, gsl_poly_complex_workspace * w, gsl_complex_packed_ptr z)
-
This function computes the roots of the general polynomial
@math{P(x) = a_0 + a_1 x + a_2 x^2 + ... + a_{n-1} x^{n-1}} using
balanced-QR reduction of the companion matrix. The parameter n
specifies the length of the coefficient array. The coefficient of the
highest order term must be non-zero. The function requires a workspace
w of the appropriate size. The @math{n-1} roots are returned in
the packed complex array z of length @math{2(n-1)}, alternating
real and imaginary parts.
The function returns GSL_SUCCESS
if all the roots are found and
GSL_EFAILED
if the QR reduction does not converge.
Go to the first, previous, next, last section, table of contents.