NormalDistribution bug

Bug #1287774 reported by Felix Lee
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
JQuantLib
New
Undecided
Unassigned

Bug Description

Hi,

Currently the NormalDistribution class member probability density function always return the probability of N(0,1). i.e. the standardized one, instead of N(average, sigma).

The function could return the correct N(average, sigma) after fixing the following 2 lines in jquantlib/src/main/java/org/jquantlib/math/distributions/NormalDistribution.java :

        public double op(final double x) /* @ReadOnly */ {
// final double exponent = -0.5*x*x;
                final double exponent = -(average-x)*(average-x)/this.denominator;
                if (exponent <= -690.0) return 0.0;
// return Constants.M_1_SQRT2PI*Math.exp(exponent);
                return this.normalizationFactor*Math.exp(exponent);

Thanks.

Felix

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.