14
14
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" version="5.0-subset Scilab" xml:id="roots" xml:lang="en">
16
<refname>roots</refname>
17
<refpurpose>roots of polynomials</refpurpose>
20
<title>Calling Sequence</title>
27
<title>Arguments</title>
33
a polynomial with real or complex coefficients, or
34
a m-by-1 or 1-by-m matrix of doubles, the polynomial coefficients in decreasing degree order.
42
a string, the algorithm to be used (default algo="f").
43
If algo="e", then the eigenvalues of the companion matrix are returned.
44
If algo="f", then the Jenkins-Traub method is used (if the polynomial is real and
45
has degree lower than 100).
46
If algo="f" and the polynomial is complex, then an error is generated.
47
If algo="f" and the polynomial has degree greater than 100, then an error is generated.
54
<title>Description</title>
56
This function returns in the complex vector
57
<literal>x</literal> the roots of the polynomial <literal>p</literal>.
60
The "e" option corresponds to method based on the eigenvalues of the
64
The "f" option corresponds to the fast RPOLY algorithm, based on
68
For real polynomials of degree <=100, users may consider the "f" option,
69
which might be faster in some cases.
70
On the other hand, some specific polynomials are known to be able to
71
make this option to fail.
75
<title>Examples</title>
77
In the following examples, we compute roots of polynomials.
79
<programlisting role="example"><![CDATA[
16
<refname>roots</refname>
17
<refpurpose>roots of polynomials</refpurpose>
20
<title>Calling Sequence</title>
27
<title>Arguments</title>
33
a polynomial with real or complex coefficients, or
34
a m-by-1 or 1-by-m matrix of doubles, the polynomial coefficients in decreasing degree order.
42
a string, the algorithm to be used (default algo="f").
43
If algo="e", then the eigenvalues of the companion matrix are returned.
44
If algo="f", then the Jenkins-Traub method is used (if the polynomial is real and
45
has degree lower than 100).
46
If algo="f" and the polynomial is complex, then an error is generated.
47
If algo="f" and the polynomial has degree greater than 100, then an error is generated.
54
<title>Description</title>
56
This function returns in the complex vector
57
<literal>x</literal> the roots of the polynomial <literal>p</literal>.
60
The "e" option corresponds to method based on the eigenvalues of the
64
The "f" option corresponds to the fast RPOLY algorithm, based on
68
For real polynomials of degree <=100, users may consider the "f" option,
69
which might be faster in some cases.
70
On the other hand, some specific polynomials are known to be able to
71
make this option to fail.
75
<title>Examples</title>
77
In the following examples, we compute roots of polynomials.
79
<programlisting role="example"><![CDATA[
80
80
// Roots given a real polynomial
81
81
p = poly([1 2 3],"x")
94
94
]]></programlisting>
96
The polynomial representation can have a significant
98
In the following example, suggested by Wilkinson in the 60s and presented by Moler,
99
we consider a diagonal matrix with diagonal entries equal to 1, 2, ..., 20.
100
The eigenvalues are obviously equal to 1, 2, ..., 20.
101
If we compute the associated characteristic polynomial and compute its roots,
102
we can see that the eigenvalues are significantly different from the expected
104
This implies that just representing the coefficients as IEEE doubles changes the
107
<programlisting role="example"><![CDATA[
96
The polynomial representation can have a significant
98
In the following example, suggested by Wilkinson in the 60s and presented by Moler,
99
we consider a diagonal matrix with diagonal entries equal to 1, 2, ..., 20.
100
The eigenvalues are obviously equal to 1, 2, ..., 20.
101
If we compute the associated characteristic polynomial and compute its roots,
102
we can see that the eigenvalues are significantly different from the expected
104
This implies that just representing the coefficients as IEEE doubles changes the
107
<programlisting role="example"><![CDATA[
111
111
]]></programlisting>
113
The "f" option produces an error if the polynomial is complex or
114
if the degree is greater than 100.
116
<programlisting role="example"><![CDATA[
113
The "f" option produces an error if the polynomial is complex or
114
if the degree is greater than 100.
116
<programlisting role="example"><![CDATA[
117
117
// The following case produces an error.
123
123
]]></programlisting>
125
<refsection role="see also">
126
<title>See Also</title>
127
<simplelist type="inline">
129
<link linkend="poly">poly</link>
132
<link linkend="spec">spec</link>
135
<link linkend="companion">companion</link>
140
<title>References</title>
142
The RPOLY algorithm is described in "Algorithm 493: Zeros of a Real
143
Polynomial", ACM TOMS Volume 1, Issue 2 (June 1975), pp. 178-189
145
<para>Jenkins, M. A. and Traub, J. F. (1970), A Three-Stage Algorithm for
146
Real Polynomials Using Quadratic Iteration, SIAM J. Numer. Anal., 7(1970), 545-566.
148
<para>Jenkins, M. A. and Traub, J. F. (1970), Principles for Testing Polynomial Zerofinding Programs.
149
ACM TOMS 1, 1 (March 1975), pp. 26-34
153
<title>Used Functions</title>
154
<para>The rpoly.f source codes can be found in the directory
155
SCI/modules/polynomials/src/fortran of a Scilab source distribution. In the case where the
156
companion matrix is used, the eigenvalue computation is perfomed using
157
DGEEV and ZGEEV LAPACK codes.
125
<refsection role="see also">
126
<title>See Also</title>
127
<simplelist type="inline">
129
<link linkend="poly">poly</link>
132
<link linkend="spec">spec</link>
135
<link linkend="companion">companion</link>
140
<title>References</title>
142
The RPOLY algorithm is described in "Algorithm 493: Zeros of a Real
143
Polynomial", ACM TOMS Volume 1, Issue 2 (June 1975), pp. 178-189
145
<para>Jenkins, M. A. and Traub, J. F. (1970), A Three-Stage Algorithm for
146
Real Polynomials Using Quadratic Iteration, SIAM J. Numer. Anal., 7(1970), 545-566.
148
<para>Jenkins, M. A. and Traub, J. F. (1970), Principles for Testing Polynomial Zerofinding Programs.
149
ACM TOMS 1, 1 (March 1975), pp. 26-34
153
<title>Used Functions</title>
154
<para>The rpoly.f source codes can be found in the directory
155
SCI/modules/polynomials/src/fortran of a Scilab source distribution. In the case where the
156
companion matrix is used, the eigenvalue computation is perfomed using
157
DGEEV and ZGEEV LAPACK codes.