Here you can find the source of gaussianPDF(double mu, double sigma, double x)
public static double gaussianPDF(double mu, double sigma, double x)
//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; } } }