In computer science, the Knuth–Eve algorithm is an algorithm for polynomial evaluation. It preprocesses the coefficients of the polynomial to reduce the numbe
Ideas used in the algorithm were originally proposed by Donald Knuth in 1962. His procedure opportunistically exploits structure in the polynomial being evaluated.[1] In 1964, James Eve determined for which polynomials this structure exists, and gave a simple method of "preconditioning" polynomials (explained below) to endow them with that structure.[2][note 1]
Algorithm
Preliminaries
Consider an arbitrary polynomial of degree. Assume that . Define such that: if is odd then , and if is even then .[2]
Unless otherwise stated, all variables in this article represent either real numbers or univariate polynomials with real coefficients.[1][2] All operations in this article are done over .[2]
Again, the goal is to create an algorithm that returns given any . The algorithm is allowed to depend on the polynomial itself, since its coefficients are known in advance.[1]
where is the divisor. Picking a value for fixes both the quotient and the coefficients in the remainder and . The key idea is to cleverly choose such that , so that
[4] This way, no operations are needed to compute the remainder polynomial, since it's just a constant. We apply this procedure recursively to , expressing
After recursive calls, the quotient is either a linear or a quadratic polynomial. In this base case, the polynomial can be evaluated with (say) Horner's method.[1][4][5]
"Preconditioning"
For arbitrary , it may not be possible to force at every step of the recursion.[1] Consider the polynomials and with coefficients taken from the even and odd terms of respectively, so that
If every root of is real, then it is possible to write in the form given above. Each is a different root of , counting multiple roots as distinct.[4] Furthermore, if at least roots of lie in one half of the complex plane, then every root of is real.[2]
Ultimately, it may be necessary to "precondition" by shifting it — by setting for some — to endow it with the structure that most of its roots lie in one half of the complex plane. At runtime, this shift has to be "undone" by first setting .[2]
Preprocessing step
The following algorithm is run once for a given polynomial .[1][4] At this point, the values of that will be evaluated on are not known.[1]
Let be the complex roots of , sorted in descending order by real part
Choose any
Set
Let and be the polynomials such that
Let be the roots of . All of its roots will be real.
Initialize
For :
Divide by to get quotient and remainder . The remainder will be a constant polynomial — a number.
Set
Output: The derived values , , and ; as well as the base-case polynomial
Better choice of t
While any can work, it is possible to remove one addition during evaluation if is also chosen such that two roots of are symmetric about the origin. In that case, can be chosen such that the shifted polynomial has a factor of , so . It is always possible to find such a .[2]
In total, evaluation using the Knuth–Eve algorithm for a polynomial of degree requires additions and multiplications, assuming is chosen optimally.[2]
No algorithm to evaluate a given polynomial of degree can use fewer than additions or fewer than multiplications during evaluation. This result assumes only addition and multiplication are allowed during both preprocessing and evaluation.[6][better source needed]
^Erickson, Jeff (10 March 2003). "Evaluating polynomials"(PDF). CS 497: Concrete Models of Computation. University of Illinois Urbana-Champaign. Retrieved 25 July 2025.
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.