Package uk.ac.starlink.dpac.math
Class FuncUtils
java.lang.Object
uk.ac.starlink.dpac.math.FuncUtils
Utility methods associated with functions.
This class contains only static methods.
- Since:
- 15 Mar 2018
- Author:
- Mark Taylor
-
Method Summary
Modifier and TypeMethodDescriptionstatic doublefindValueMonotonic(Function f, double xlo, double xhi, double y0, double ytol) Locates the X value where a supplied monotonically non-decreasing function is within a specified tolerance of a given Y value.static FunctionReturns a function which represents an interpolated representation of the given sample set, using linear interpolation.static FunctionReturns a function which represents an interpolated representation of the given sample set, using quadratic interpolation with Legendre polynomials.static FunctionReturns a function which represents an interpolated representation of the given sample set, using splines.
-
Method Details
-
interpolateQuadratic
Returns a function which represents an interpolated representation of the given sample set, using quadratic interpolation with Legendre polynomials.- Parameters:
nf- input numeric function- Returns:
- interpolated version of function
-
interpolateSpline
Returns a function which represents an interpolated representation of the given sample set, using splines.- Parameters:
nf- input numeric function- Returns:
- interpolated version of function
-
interpolateLinear
Returns a function which represents an interpolated representation of the given sample set, using linear interpolation.- Parameters:
nf- input numeric function- Returns:
- interpolated version of function
-
findValueMonotonic
Locates the X value where a supplied monotonically non-decreasing function is within a specified tolerance of a given Y value. The bisection method is used. Behaviour is undefined if the supplied function is not monotonic.- Parameters:
f- monotonic functionxlo- lowest X value to considerxhi- highest X value to considery0- required Y valueytol- tolerance in Y- Returns:
- X value corresonding to
y0, or NaN if it's not in range
-