Package gaia.cu9.tools.parallax.util
Class CdfIntegration
- java.lang.Object
-
- gaia.cu9.tools.parallax.util.CdfIntegration
-
public class CdfIntegration extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description CdfIntegration()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.doublegetDeltaThreshold()intgetIterationLimit()double[]getPercentiles(double[][] cdf, double... percentiles)protected doubleintegrateBooleRule(PDF pdf, double min, double max)Integrate the PDF over a finite interval using Boole's ruleprotected doubleintegrateBooleRule(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 doubleintegrateToInfinitum(PDF pdf, boolean logAxis, double minR, double step)voidsetDeltaThreshold(double deltaThreshold)voidsetIterationLimit(int iterationLimit)
-
-
-
Method Detail
-
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
protected double integrateBooleRule(PDF pdf, double min, double max)
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
protected double integrateToInfinitum(PDF pdf, boolean logAxis, double minR, double step)
-
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)
-
-