Package com.irurueta.numerical
Class PolynomialEvaluator
java.lang.Object
com.irurueta.numerical.PolynomialEvaluator
- Direct Known Subclasses:
ComplexPolynomialEvaluator
,RealPolynomialEvaluator
Utility class to evaluate polynomials having either real or complex
coefficients.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic double
evaluate
(double[] polyParams, double x) Evaluates polynomial formed by provided polynomial parameters at provided point x.static com.irurueta.algebra.Complex
evaluate
(com.irurueta.algebra.Complex[] polyParams, com.irurueta.algebra.Complex x) Evaluates polynomial formed by provided polynomial parameters at provided point x.
-
Constructor Details
-
PolynomialEvaluator
protected PolynomialEvaluator()Empty constructor.
-
-
Method Details
-
evaluate
public static double evaluate(double[] polyParams, double x) Evaluates polynomial formed by provided polynomial parameters at provided point x. The polynomial of degree n is defined as: p(x) = a0 * x^n + a1 * x^(n - 1) + ... a(n-1) * x + an hence, the array of parameters is [a0, a1, ... a(n-1), an].- Parameters:
polyParams
- array of polynomial parameters.x
- point where polynomial is evaluated.- Returns:
- result of evaluation.
- Throws:
IllegalArgumentException
- if provided array is null or has length 0.
-
evaluate
public static com.irurueta.algebra.Complex evaluate(com.irurueta.algebra.Complex[] polyParams, com.irurueta.algebra.Complex x) Evaluates polynomial formed by provided polynomial parameters at provided point x. The polynomial of degree n is defined as: p(x) = a0 * x^n + a1 * x^(n - 1) + ... a(n-1) * x + an hence, the array of parameters is [a0, a1, ... a(n-1), an].- Parameters:
polyParams
- array of polynomial parameters.x
- point where polynomial is evaluated.- Returns:
- result of evaluation.
- Throws:
IllegalArgumentException
- if provided array is null or has length 0.
-