Package gaia.cu9.tools.parallax.util
Class CdfIntegration
java.lang.Object
gaia.cu9.tools.parallax.util.CdfIntegration
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondouble[][]
getCdf
(PDF pdf, boolean logAxis, int nPoints, double rMin, double rMax, boolean normalisePdf, boolean integrateToInfinite) Calculate the CDF by integrating the PDF in a finite interval.double
int
double[]
getPercentiles
(double[][] cdf, double... percentiles) protected double
integrateBooleRule
(PDF pdf, double min, double max) Integrate the PDF over a finite interval using Boole's ruleprotected double
integrateBooleRule
(PDF pdf, double min, double max, double pdfAtMin, double pdfAtMax) Integrate the PDF over a finite interval using Boole's rule This implementation uses the value of the PDF at the boundaries that has already been calculated externally, thus avoiding unnecesary calls toPDF.getUnnormalizedProbabilityAt(double)
protected double
integrateToInfinitum
(PDF pdf, boolean logAxis, double minR, double step) void
setDeltaThreshold
(double deltaThreshold) void
setIterationLimit
(int iterationLimit)
-
Constructor Details
-
CdfIntegration
public CdfIntegration()
-
-
Method Details
-
getCdf
public double[][] getCdf(PDF pdf, boolean logAxis, int nPoints, double rMin, double rMax, boolean normalisePdf, boolean integrateToInfinite) Calculate the CDF by integrating the PDF in a finite interval. It is assumed the the PDF below the minimum value is 0. The algorithm will continue integrating towards infinity until the increment added is lower than a threshold or a limit of iterations is reached so that the CDF can be normalized To set these thresholds please seesetDeltaThreshold(double)
andsetIterationLimit(int)
- Parameters:
pdf
- Probability Distribution FunctionlogAxis
- True if the points should be distributed logaritmically, false otherwisenPoints
- Number of points to be calculated in the rangerMin
- Minimum value of the range, in parsecsrMax
- Maximum value of the range, in parsecs- Returns:
- CDF
-
integrateBooleRule
Integrate the PDF over a finite interval using Boole's rule- Parameters:
pdf
- probability distribution function to integratemin
- Minimum value of x (in linear units)max
- Maximum value of x (in linear units)- Returns:
- Value of the integral of the pdf in the interval (min,max)
-
integrateBooleRule
protected double integrateBooleRule(PDF pdf, double min, double max, double pdfAtMin, double pdfAtMax) Integrate the PDF over a finite interval using Boole's rule This implementation uses the value of the PDF at the boundaries that has already been calculated externally, thus avoiding unnecesary calls toPDF.getUnnormalizedProbabilityAt(double)
- Parameters:
pdf
- probability distribution function to integratemin
- Minimum value of x (in linear units)max
- Maximum value of x (in linear units)pdfAtMin
- Value of the PDF at minpdfAtMax
- Value of the PDF at max- Returns:
- Value of the integral of the pdf in the interval (min,max)
-
integrateToInfinitum
-
getPercentiles
public double[] getPercentiles(double[][] cdf, double... percentiles) -
getDeltaThreshold
public double getDeltaThreshold() -
setDeltaThreshold
public void setDeltaThreshold(double deltaThreshold) -
getIterationLimit
public int getIterationLimit() -
setIterationLimit
public void setIterationLimit(int iterationLimit)
-