Java Gauss gaussianPDF(double mu, double sigma, double x)

Here you can find the source of gaussianPDF(double mu, double sigma, double x)

Description

gaussian PDF

License

Open Source License

Declaration

public static double gaussianPDF(double mu, double sigma, double x) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static double gaussianPDF(double mu, double sigma, double x) {
        // density of beta distribution with (a, b) given x
        double val_exp = -0.5 * ((x - mu) / sigma) * ((x - mu) / sigma);
        double val = 1 / sigma * Math.exp(val_exp);
        return _checkBounded(val);
    }//w  w  w  . jav a  2  s.  c  om

    private static double _checkBounded(double x) {
        // Check if a value `x` is bounded within finite or not
        if (Double.isInfinite(x)) {
            return 1e6;
        } else if (Double.isNaN(x)) {
            return 0;
        } else {
            return x;
        }
    }
}

Related

  1. gaussianDensity(double x, double mean, double standardDeviation)
  2. gaussianDerivative(double x)
  3. gaussianFilter(float[] weights, float sigma)
  4. gaussianIntegral(double x)
  5. gaussianPDF(double mean, double variance, double x)
  6. gaussianWindow(double mean1, double mean2, double std)
  7. gaussJordanElimination(boolean[][] matrix)
  8. gaussTable(final int steps)