Class 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.
      double getDeltaThreshold()  
      int getIterationLimit()  
      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 rule
      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 to PDF.getUnnormalizedProbabilityAt(double)
      protected double integrateToInfinitum​(PDF pdf, boolean logAxis, double minR, double step)  
      void setDeltaThreshold​(double deltaThreshold)  
      void setIterationLimit​(int iterationLimit)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CdfIntegration

        public CdfIntegration()
    • 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 see setDeltaThreshold(double) and setIterationLimit(int)
        Parameters:
        pdf - Probability Distribution Function
        logAxis - True if the points should be distributed logaritmically, false otherwise
        nPoints - Number of points to be calculated in the range
        rMin - Minimum value of the range, in parsecs
        rMax - 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 integrate
        min - 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 to PDF.getUnnormalizedProbabilityAt(double)
        Parameters:
        pdf - probability distribution function to integrate
        min - Minimum value of x (in linear units)
        max - Maximum value of x (in linear units)
        pdfAtMin - Value of the PDF at min
        pdfAtMax - 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)