Content deleted Content added
m Clarify |
m v2.05 - Fix errors for CW project (DEFAULTSORT missing for titles with special letters) |
||
(33 intermediate revisions by 6 users not shown) | |||
Line 1:
{{Short description|Algorithm for
== Algorithm ==
Line 14 ⟶ 9:
=== Preliminaries ===
Consider an arbitrary polynomial <math>p \in \mathbb{R}[x]</math> of [[Degree of a polynomial|degree]] <math>n</math>. Assume that <math>n \geq 3</math>. Define <math>m</math> such that: if <math>n</math> is odd then <math>n = 2m+1</math>, and if <math>n</math> is even then <math>n = 2m+2</math>.<ref name="eve1964"/>
Unless otherwise stated, all variables in this article represent either [[
Again, the goal is to create an algorithm that returns <math>p(x)</math> given any <math>x</math>. The algorithm is allowed to depend on the polynomial <math>p</math> itself, since its coefficients are known in advance.<ref name="knuth1962"/>
=== Overview ===
Line 32 ⟶ 27:
<math display="block"> p(x) = q(x) \cdot (x^2 - \alpha) + \gamma. </math>
<ref name="overill1997"/> This way, no operations are needed to compute the remainder polynomial, since it's just a constant. We apply this procedure [[Recursion (computer science)|recursively]] to <math>q</math>, expressing
<math display="block"> p(x) = \left( \left( q(x) \cdot (x^2 - \alpha_m) + \gamma_m \right) \cdots \right) \cdot (x^2 - \alpha_1) + \gamma_1. </math>
After <math>m</math> recursive calls, the quotient <math>q</math> is either a [[Linear function (calculus)|linear]] or a [[Quadratic function|quadratic]] polynomial. In this base case, the polynomial can be evaluated with (say) [[Horner's method]].<ref name="knuth1962"/><ref name="overill1997"/><ref name="muller2016"/>
==== "Preconditioning" ====
Line 44 ⟶ 39:
<math display="block"> p(x) = p^e(x^2) + x \cdot p^o(x^2). </math>
If every [[Zero of a function#Polynomial roots|root]] of <math>p^o</math> is real, then it is possible to write <math>p</math> in the form given above. Each <math>\alpha_i</math> is a different root of <math>p^o</math>, counting [[Multiplicity (mathematics)#Multiplicity of a root of a polynomial|multiple roots]] as distinct.<ref name="overill1997"/> Furthermore, if at least <math>n-1</math> roots of <math>p</math> lie in one half of the [[
Ultimately, it may be necessary to "precondition" <math>p</math> by shifting it {{--}} by setting <math>p(x) \gets p(x + t)</math> for some <math>t</math> {{--}} 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 <math>x \gets x - t</math>.<ref name="eve1964"/>
=== Preprocessing step ===
The following algorithm is run once for a given polynomial <math>p</math>.<ref
<div style="margin-left: 35px;">
Line 74 ⟶ 67:
==== Better choice of t ====
While any <math>t \geq \text{Re}(r_2)</math> can work, it is possible to remove one addition during evaluation if <math>t</math> is also chosen such that two roots of <math>p(x + t)</math> are symmetric about the origin. In that case, <math>\alpha_1</math> can be chosen such that the shifted polynomial has a factor of <math>x^2 - \alpha_1</math>, so <math>\gamma_1 = 0</math>. It is always possible to find such a <math>t</math>.<ref name="eve1964"/>
<div style="margin-left: 35px;">
Line 89 ⟶ 82:
=== Evaluation step ===
The following algorithm evaluates <math>p</math> at some, now known, point <math>x</math>.<ref
<div style="margin-left: 35px;">
Line 107 ⟶ 100:
<math display="block">y \gets y \cdot (s - \alpha_i),</math>
saving an addition.<ref name="eve1964"/>
== Analysis ==
In total, evaluation using the
No algorithm to evaluate a given polynomial of degree <math>n</math> can use fewer than <math>n</math> additions or fewer than <math>\lceil n/2 \rceil</math> multiplications during evaluation. This result assumes only addition and multiplication are allowed during both preprocessing and evaluation.<ref name="erickson2003"/>{{Better source needed|date=July 2025}}
The
==
{{Reflist|group=note}}
== References ==▼
{{reflist |refs=
<ref name="knuth1962">{{cite journal |last1=Knuth |first1=Donald |title=Evaluation of polynomials by computer |journal=Communications of the ACM |date=December 1962 |volume=5 |issue=12 |pages=
<ref name="eve1964">{{cite journal |last1=Eve |first1=
<ref name="overill1997">{{cite journal |last1=Overill |first1=Richard |title=Data parallel evaluation of univariate polynomials by the Knuth-Eve algorithm |journal=Parallel Computing |date=12 June 1997 |volume=23 |issue=13 |pages=
<ref name="erickson2003">{{cite web |last1=Erickson |first1=Jeff |title=Evaluating polynomials |date=10 March 2003 |url=https://jeffe.cs.illinois.edu/teaching/497/08-polynomials.pdf |website=CS 497: Concrete Models of Computation |publisher=University of Illinois Urbana-Champaign |access-date=25 July 2025}}</ref>
<ref name="mesztenyi1967">{{cite journal |last1=Mesztenyi |first1=
}}
{{DEFAULTSORT:Knuth-Eve algorithm}}
▲== References ==
[[Category:Algorithms]]
[[Category:Polynomials]]
▲* {{cite book |last1=Muller |first1=Jean-Michel |title=Elementary functions: Algorithms and implementation |date=17 November 2016 |publisher=Birkhäuser Boston |___location=Boston, MA |isbn=978-1-4899-7983-4 |doi=10.1007/978-1-4899-7983-4_5 |pages=82-84 |url=https://link.springer.com/chapter/10.1007/978-1-4899-7983-4_5#citeas |access-date=25 July 2025}}
[[Category:Algorithms and data structures]]
|