Package ffx.numerics.integrate
Class FunctionDataCurve
java.lang.Object
ffx.numerics.integrate.FunctionDataCurve
- All Implemented Interfaces:
DataSet
- Direct Known Subclasses:
CompositeCurve,CosineWave,PolynomialCurve,SinWave
A FunctionDataCurve represents a set of points along a 1-dimensional, analytically integrable
function.
- Author:
- Jacob M. Litman
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanIf ends should have 1/2 regular separation.protected doubleLower bound.protected double[]Function values.protected doubleUpper bound.protected double[]Input points. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoubleEvaluates the functions analytical integral over the entire range of points.doubleanalyticalIntegral(double lb, double ub) Evaluates the function's analytical integral over a range.static booleanapproxEquals(double x1, double x2) Checks for equality to +/- 10 ulp.static booleanapproxEquals(double x1, double x2, double ulpMultiple) Compare two doubles to machine precision.protected final voidUsed to check that x array is composed of equally-spaced points from lb to ub.doublebinWidth()Separation between points along x; should be uniform.abstract doublefX(double x) Evaluates the function at x.double[]Returns copy of the array of points f(x) to integrate (y-axis).doublegetFxPoint(int index) Point f(x) at index.double[]getX()Returns copy of the array of points x (x-axis).booleanDoes this data set have half-width start/end bins.abstract doubleintegralAt(double x) Analytical integral at a point.doubleLower bound of the points along x.intNumber of points along x.toString()doubleUpper bound of the points along x.
-
Field Details
-
lb
protected double lbLower bound. -
ub
protected double ubUpper bound. -
points
protected double[] pointsFunction values. -
x
protected double[] xInput points. -
halfWidthEnd
protected boolean halfWidthEndIf ends should have 1/2 regular separation.
-
-
Constructor Details
-
FunctionDataCurve
public FunctionDataCurve()Constructor.
-
-
Method Details
-
approxEquals
public static boolean approxEquals(double x1, double x2) Checks for equality to +/- 10 ulp.- Parameters:
x1- a double.x2- a double.- Returns:
- a boolean.
-
approxEquals
public static boolean approxEquals(double x1, double x2, double ulpMultiple) Compare two doubles to machine precision.- Parameters:
x1- The first point.x2- The second point.ulpMultiple- A multiple to apply to the ULP of the larger of the two values.- Returns:
- True if the two values are within the specified ULPs of each other.
-
analyticalIntegral
public double analyticalIntegral()Evaluates the functions analytical integral over the entire range of points.- Returns:
- Exact finite integral
-
analyticalIntegral
public double analyticalIntegral(double lb, double ub) Evaluates the function's analytical integral over a range.- Parameters:
lb- Lower integration boundub- Upper integration bound- Returns:
- Exact finite integral of range
-
binWidth
public double binWidth()Separation between points along x; should be uniform. -
fX
public abstract double fX(double x) Evaluates the function at x.- Parameters:
x- x- Returns:
- f(x)
-
getAllFxPoints
public double[] getAllFxPoints()Returns copy of the array of points f(x) to integrate (y-axis).- Specified by:
getAllFxPointsin interfaceDataSet- Returns:
- an array of double values.
-
getFxPoint
public double getFxPoint(int index) Point f(x) at index.- Specified by:
getFxPointin interfaceDataSet- Parameters:
index- the index of the point to return.- Returns:
- a double.
-
getX
public double[] getX()Returns copy of the array of points x (x-axis). -
halfWidthEnds
public boolean halfWidthEnds()Does this data set have half-width start/end bins. Intended for OST, where the first and last bins are half the regular width.- Specified by:
halfWidthEndsin interfaceDataSet- Returns:
- a boolean.
-
integralAt
public abstract double integralAt(double x) Analytical integral at a point.- Parameters:
x- Point- Returns:
- Exact finite integral of 0 to this point
-
lowerBound
public double lowerBound()Lower bound of the points along x.- Specified by:
lowerBoundin interfaceDataSet- Returns:
- a double.
-
numPoints
public int numPoints()Number of points along x. -
toString
-
upperBound
public double upperBound()Upper bound of the points along x.- Specified by:
upperBoundin interfaceDataSet- Returns:
- a double.
-
assertXIntegrity
protected final void assertXIntegrity()Used to check that x array is composed of equally-spaced points from lb to ub.
-