Java Gauss gaussianDensity(double x, double mean, double standardDeviation)

Here you can find the source of gaussianDensity(double x, double mean, double standardDeviation)

Description

This function evaluates the 1-dimensional gaussian density function with specified mean and standard deviation.

License

Open Source License

Parameter

Parameter Description
x the point to evaluate at
mean the mean of the distribution
standardDeviation the standard deviation of the distribution

Return

the gaussian density evaluated at x

Declaration

public static double gaussianDensity(double x, double mean, double standardDeviation) 

Method Source Code

//package com.java2s;

public class Main {
    /**//from  www  .j  a  v  a2  s .  co m
     * This function evaluates the standard gaussian density
     * with mean 0 and variance 1.
     * 
     * @param x the point to evaluate at
     * @return the standard normal density evaluated at x
     */
    public static double gaussianDensity(double x) {
        double constant = Math.sqrt(2 * Math.PI);
        return (Math.exp(0.5 * x * x) / constant);
    }

    /**
     * This function evaluates the 1-dimensional gaussian
     * density function with specified mean and standard deviation.
     * 
     * @param x the point to evaluate at
     * @param mean the mean of the distribution
     * @param standardDeviation the standard deviation of the distribution
     * @return the gaussian density evaluated at x
     */
    public static double gaussianDensity(double x, double mean, double standardDeviation) {
        return (gaussianDensity((x - mean) / standardDeviation) / standardDeviation);
    }
}

Related

  1. gaussian(double[] d, double sigma, double mean)
  2. gaussian(double[][] A, double[] b)
  3. gaussian(float x, float mean, float sd)
  4. gaussian(int size, double sigma)
  5. gaussianBlur(int[][] pixels, float sigma)
  6. gaussianDerivative(double x)
  7. gaussianFilter(float[] weights, float sigma)
  8. gaussianIntegral(double x)
  9. gaussianPDF(double mean, double variance, double x)