Class HornerScheme
- java.lang.Object
-
- dev.nm.analysis.function.polynomial.HornerScheme
-
public class HornerScheme extends Object
Horner scheme is an algorithm for the efficient evaluation of polynomials in monomial form. It can also be seen as a fast algorithm for dividing a polynomial by a linear polynomial with Ruffini's rule. The polynomial remainder theorem says:P(x) = Q(x)(x - x0) + P(x0)
We thus can compute the value of a polynomial P(x) at x0, i.e., P(x0), and at the same time the quotient Q(x).- See Also:
- Wikipedia: Horner scheme
-
-
Constructor Summary
Constructors Constructor Description HornerScheme(Polynomial polynomial, double x)
Evaluate a polynomial at x.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Polynomial
quotient()
Get the quotient, Q(x).double
remainder()
Get the remainder, P(x0).
-
-
-
Constructor Detail
-
HornerScheme
public HornerScheme(Polynomial polynomial, double x)
Evaluate a polynomial at x.- Parameters:
polynomial
- a polynomialx
- a point to evaluate the polynomial at
-
-
Method Detail
-
remainder
public double remainder()
Get the remainder, P(x0).- Returns:
- the remainder
-
quotient
public Polynomial quotient()
Get the quotient, Q(x).- Returns:
- the quotient
-
-