Here you can find the source of gaussianDensity(double x, double mean, double standardDeviation)
Parameter | Description |
---|---|
x | the point to evaluate at |
mean | the mean of the distribution |
standardDeviation | the standard deviation of the distribution |
public static double gaussianDensity(double x, double mean, double standardDeviation)
//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); } }