I have a function that is in the form of a probability distribution function, as shown below:

Although I discover some lib submission function to get the result, as the above formula did; but I participate in its implementation, therefore, if possible, I would like to do it myself.
Below I can come up with a function
public double pdf (double x) {
double mean = mean ();
double variance = variance ();
double base = 1 / Math.sqrt (2 * Math.PI * variance);
double pow = - (Math.pow ((x-mean), 2) / 2 * variance);
return Math.pow (base, pow);
}
Is this the right way to implement pdf? Or what parts are I missing?
I appreciate any help.
Alex jones
source share