Class FunctionExpander
java.lang.Object
com.github.gbenroscience.math.numericalmethods.FunctionExpander
Uses Chebyshev Polynomials to expand, evaluate, differentiate and integrate
functions
- Author:
- GBEMIRO
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classHigh-precision Piecewise Chebyshev approximation engine.static final class -
Constructor Summary
ConstructorsConstructorDescriptionFunctionExpander(Function function, double lower, double upper, double tolerance) FunctionExpander(Function function, double lower, double upper, int degree) FunctionExpander(MethodHandle function, double lower, double upper, double tolerance) FunctionExpander(MethodHandle function, double lower, double upper, int degree) -
Method Summary
Modifier and TypeMethodDescriptiondoublederivative(double x) Computes the derivative of the approximation at point x.doubleevaluate(double x) Evaluate the approximated polynomial using Clenshaw's Algorithm.doublegetLower()doubleEstimates the truncation error of the current approximation.doublegetUpper()doubleIntegrates the approximated polynomial analytically using Kahan summation.static voidvoidsetLower(double lower) voidsetUpper(double upper)
-
Constructor Details
-
FunctionExpander
public FunctionExpander(MethodHandle function, double lower, double upper, int degree) throws Throwable - Throws:
Throwable
-
FunctionExpander
public FunctionExpander(MethodHandle function, double lower, double upper, double tolerance) throws Throwable - Throws:
Throwable
-
FunctionExpander
-
FunctionExpander
-
-
Method Details
-
setLower
public void setLower(double lower) -
getLower
public double getLower() -
setUpper
public void setUpper(double upper) -
getUpper
public double getUpper() -
evaluate
public double evaluate(double x) Evaluate the approximated polynomial using Clenshaw's Algorithm. This is O(N) and much more stable than evaluating a^n + b^n-1... -
derivative
public double derivative(double x) Computes the derivative of the approximation at point x. This is an exact derivative of the surrogate polynomial. -
integrateApproximation
public double integrateApproximation()Integrates the approximated polynomial analytically using Kahan summation. This preserves the precision of the high-frequency coefficients. -
buildPolynomial
-
getTailError
public double getTailError()Estimates the truncation error of the current approximation. For 16dp accuracy, this should be invalid input: '<' 1e-16. -
main
-