All Downloads are FREE. Search and download functionalities are using the official Maven repository.

toolgood.algorithm.mathNet.Distributions.Exponential Maven / Gradle / Ivy

package toolgood.algorithm.mathNet.Distributions;

public class Exponential {
      /// 
        /// Computes the probability density of the distribution (PDF) at x, i.e. ∂P(X ≤ x)/∂x.
        /// 
        /// The rate (λ) parameter of the distribution. Range: λ ≥ 0.
        /// The location at which to compute the density.
        /// the density at .
        ///// 
        public static double PDF(double rate, double x)
        {
            //if (rate < 0.0) {
            //    throw new ArgumentException("InvalidDistributionParameters");
            //}

            return x < 0.0 ? 0.0 : rate * Math.exp(-rate * x);
        }

        /// 
        /// Computes the cumulative distribution (CDF) of the distribution at x, i.e. P(X ≤ x).
        /// 
        /// The location at which to compute the cumulative distribution function.
        /// The rate (λ) parameter of the distribution. Range: λ ≥ 0.
        /// the cumulative distribution at location .
        ///// 
        public static double CDF(double rate, double x)
        {
            //if (rate < 0.0) {
            //    throw new ArgumentException("InvalidDistributionParameters");
            //}

            return x < 0.0 ? 0.0 : 1.0 - Math.exp(-rate * x);
        }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy