3
<title>General Polynomial Equations - GNU Scientific Library -- Reference Manual</title>
4
<meta http-equiv="Content-Type" content="text/html">
5
<meta name="description" content="GNU Scientific Library -- Reference Manual">
6
<meta name="generator" content="makeinfo 4.8">
7
<link title="Top" rel="start" href="index.html#Top">
8
<link rel="up" href="Polynomials.html#Polynomials" title="Polynomials">
9
<link rel="prev" href="Cubic-Equations.html#Cubic-Equations" title="Cubic Equations">
10
<link rel="next" href="Roots-of-Polynomials-Examples.html#Roots-of-Polynomials-Examples" title="Roots of Polynomials Examples">
11
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
13
Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 The GSL Team.
15
Permission is granted to copy, distribute and/or modify this document
16
under the terms of the GNU Free Documentation License, Version 1.2 or
17
any later version published by the Free Software Foundation; with the
18
Invariant Sections being ``GNU General Public License'' and ``Free Software
19
Needs Free Documentation'', the Front-Cover text being ``A GNU Manual'',
20
and with the Back-Cover Text being (a) (see below). A copy of the
21
license is included in the section entitled ``GNU Free Documentation
24
(a) The Back-Cover Text is: ``You have freedom to copy and modify this
25
GNU Manual, like GNU software.''-->
26
<meta http-equiv="Content-Style-Type" content="text/css">
27
<style type="text/css"><!--
28
pre.display { font-family:inherit }
29
pre.format { font-family:inherit }
30
pre.smalldisplay { font-family:inherit; font-size:smaller }
31
pre.smallformat { font-family:inherit; font-size:smaller }
32
pre.smallexample { font-size:smaller }
33
pre.smalllisp { font-size:smaller }
34
span.sc { font-variant:small-caps }
35
span.roman { font-family:serif; font-weight:normal; }
36
span.sansserif { font-family:sans-serif; font-weight:normal; }
42
<a name="General-Polynomial-Equations"></a>
43
Next: <a rel="next" accesskey="n" href="Roots-of-Polynomials-Examples.html#Roots-of-Polynomials-Examples">Roots of Polynomials Examples</a>,
44
Previous: <a rel="previous" accesskey="p" href="Cubic-Equations.html#Cubic-Equations">Cubic Equations</a>,
45
Up: <a rel="up" accesskey="u" href="Polynomials.html#Polynomials">Polynomials</a>
49
<h3 class="section">6.5 General Polynomial Equations</h3>
51
<p><a name="index-general-polynomial-equations_002c-solving-229"></a>
52
The roots of polynomial equations cannot be found analytically beyond
53
the special cases of the quadratic, cubic and quartic equation. The
54
algorithm described in this section uses an iterative method to find the
55
approximate locations of roots of higher order polynomials.
58
— Function: gsl_poly_complex_workspace * <b>gsl_poly_complex_workspace_alloc</b> (<var>size_t n</var>)<var><a name="index-gsl_005fpoly_005fcomplex_005fworkspace_005falloc-230"></a></var><br>
59
<blockquote><p>This function allocates space for a <code>gsl_poly_complex_workspace</code>
60
struct and a workspace suitable for solving a polynomial with <var>n</var>
61
coefficients using the routine <code>gsl_poly_complex_solve</code>.
63
<p>The function returns a pointer to the newly allocated
64
<code>gsl_poly_complex_workspace</code> if no errors were detected, and a null
65
pointer in the case of error.
66
</p></blockquote></div>
69
— Function: void <b>gsl_poly_complex_workspace_free</b> (<var>gsl_poly_complex_workspace * w</var>)<var><a name="index-gsl_005fpoly_005fcomplex_005fworkspace_005ffree-231"></a></var><br>
70
<blockquote><p>This function frees all the memory associated with the workspace
72
</p></blockquote></div>
75
— Function: int <b>gsl_poly_complex_solve</b> (<var>const double * a, size_t n, gsl_poly_complex_workspace * w, gsl_complex_packed_ptr z</var>)<var><a name="index-gsl_005fpoly_005fcomplex_005fsolve-232"></a></var><br>
76
<blockquote><p>This function computes the roots of the general polynomial
77
<!-- {$P(x) = a_0 + a_1 x + a_2 x^2 + ... + a_{n-1} x^{n-1}$} -->
78
P(x) = a_0 + a_1 x + a_2 x^2 + ... + a_{n-1} x^{n-1} using
79
balanced-QR reduction of the companion matrix. The parameter <var>n</var>
80
specifies the length of the coefficient array. The coefficient of the
81
highest order term must be non-zero. The function requires a workspace
82
<var>w</var> of the appropriate size. The n-1 roots are returned in
83
the packed complex array <var>z</var> of length 2(n-1), alternating
84
real and imaginary parts.
86
<p>The function returns <code>GSL_SUCCESS</code> if all the roots are found and
87
<code>GSL_EFAILED</code> if the QR reduction does not converge. Note that due
88
to finite precision, roots of higher multiplicity are returned as a
89
cluster of simple roots with reduced accuracy. The solution of
90
polynomials with higher-order roots requires specialized algorithms that
91
take the multiplicity structure into account (see e.g. Z. Zeng,
92
Algorithm 835, ACM Transactions on Mathematical Software, Volume 30,
93
Issue 2 (2004), pp 218–236).
94
</p></blockquote></div>