Class MappedExpander
java.lang.Object
com.github.gbenroscience.math.numericalmethods.MappedExpander
How to use these in your Platform When you want the derivative of a badly
behaved function at a point : Map x to u using toChebyshev(x). Compute the
derivative of the Chebyshev series at (standard algorithm). Multiply that
result by map.derivativeFactor(u). When you want the integral: Sample f(x)
at mapped nodes. Multiply by map.dx_du(u). Sum using Clenshaw-Curtis weights.
Pro-Tip for Precision In the SemiInfiniteMap, as * , *
. In your code, you should clamp to something like 0.9999999999 if you hit a
NaN in the physical domain to prevent the platform from crashing on a hard
infinity. Would you like the Clenshaw-Curtis weight generator to ensure your
integration reaches full 16-digit precision?
- Author:
- GBEMIRO
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classstatic interfacestatic classA DomainMap that clusters nodes tightly at BOTH the lower bound (a) and the upper bound (b).static classstatic classstatic classLogarithmic map that clusters nodes near the upper bound B.static classAlgebraic map for the semi-infinite interval [0, infinity) Hardens against functions with "tails".static final class -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMappedExpander(Function function, MappedExpander.DomainMap map, int N) Uses Chebyshev Extrema nodes: u_k = cos(k * PI / N) for k = 0...N. -
Method Summary
Modifier and TypeMethodDescriptionautoSelectMap(Function f, double a, double b) Detection heuristicdoubleevaluate(double x) doubledoubledoubleintegrateAdaptive(Function f, MappedExpander.DomainMap map, double tol, int depth) doubleintegrateFinal(double[] ccWeights) O(N) Integration: Direct sum using pre-sampled values and CC weights.doublebooleanstatic void
-
Field Details
-
MAX_DEPTH
public static final int MAX_DEPTH- See Also:
-
-
Constructor Details
-
MappedExpander
Uses Chebyshev Extrema nodes: u_k = cos(k * PI / N) for k = 0...N. This matches Clenshaw-Curtis weights perfectly.
-
-
Method Details
-
getTailError
public double getTailError() -
evaluate
public double evaluate(double x) -
integrate
public double integrate() -
integrateSeamless
public double integrateSeamless() -
integrateFinal
public double integrateFinal(double[] ccWeights) O(N) Integration: Direct sum using pre-sampled values and CC weights. -
integrateAdaptive
-
isAliasing
public boolean isAliasing() -
autoSelectMap
Detection heuristic- Parameters:
f-a-b-- Returns:
-
main
-