panthrMath/distributions/lognormal.js
function dlnorm(meanlog, sdlog, logp) {
      logp = logp === true;

      if (utils.hasNaN(meanlog, sdlog) || sdlog < 0) {
         return function() { return NaN; };
      }

      return function(x) {
         var z;

         if (utils.hasNaN(x)) { return NaN; }
         if (sdlog === 0) {
            return Math.log(x) === meanlog ? Infinity
                                    : logp ? -Infinity
                                           : 0;
         }
         if (x <= 0) { return logp ? -Infinity : 0; }

         z = (Math.log(x) - meanlog) / sdlog;
         return logp ? -(logRoot2pi + 0.5 * z * z + Math.log(x * sdlog))
                     : recipRoot2pi * Math.exp(-0.5 * z * z) / (x * sdlog);
      };
   }
function dlnorm(meanlog, sdlog, logp) {
      logp = logp === true;

      if (utils.hasNaN(meanlog, sdlog) || sdlog < 0) {
         return function() { return NaN; };
      }

      return function(x) {
         var z;

         if (utils.hasNaN(x)) { return NaN; }
         if (sdlog === 0) {
            return Math.log(x) === meanlog ? Infinity
                                    : logp ? -Infinity
                                           : 0;
         }
         if (x <= 0) { return logp ? -Infinity : 0; }

         z = (Math.log(x) - meanlog) / sdlog;
         return logp ? -(logRoot2pi + 0.5 * z * z + Math.log(x * sdlog))
                     : recipRoot2pi * Math.exp(-0.5 * z * z) / (x * sdlog);
      };
   }
function dlnorm ( meanlog , sdlog , logp ) { logp = logp === true ; if ( utils . hasNaN ( meanlog , sdlog ) || sdlog < 0 ) { return function ( ) { return NaN ; } ; } return function ( x ) { var z ; if ( utils . hasNaN ( x ) ) { return NaN ; } if ( sdlog === 0 ) { return Math . log ( x ) === meanlog ? Infinity : logp ? - Infinity : 0 ; } if ( x <= 0 ) { return logp ? - Infinity : 0 ; } z = ( Math . log ( x ) - meanlog ) / sdlog ; return logp ? - ( logRoot2pi + 0.5 * z * z + Math . log ( x * sdlog ) ) : recipRoot2pi * Math . exp ( - 0.5 * z * z ) / ( x * sdlog ) ; } ; }
Evaluates the lognormal distribution's density function at `x`.

Expects $x > 0$ and $\textrm{sdlog} > 0$.
@fullName dlnorm(meanlog, sdlog, logp)(x)
@memberof lognormal
Evaluates the lognormal distribution s density function at x .