Boost logo

Boost :

From: Brad Hanson (bradh_at_[hidden])
Date: 2001-11-14 08:36:39


Jens Maurer wrote:
>
> > Brad Hanson wrote:
> > It looks to me the way the lognormal_distribution
> > constructor is written that the mean and sigma arguments are
> > in fact the mean and standard deviation of the lognormal
> > distribution, as opposed to the mean and standard deviation
> > of the underlying normal distribution.
>
>
> However, I'm wondering whether this is actually the
> right design decision: It appears that people will
> likely want to specify the mean and sigma of the
> underlying normal distribution, and don't care too much
> about mean and sigma of the lognormal distribution.
>
> Do we need both options?

I needed to specify the mean and standard deviation of the underlying
normal distribution. So instead of creating a lognormal_distribution
object I created a norm_distribution object and transformed the generated
values using std::exp. It would be nice to have both options. If only one
option is provided I recommend staying with the way it is now, since it is
easy to generate lognormal random variables with a specified mean and
standard deviation of the underlying normal distribution using a
normal_distribution object and the std::exp function.

> Also, the default values (mean = 0, sigma = 1)
> given in my code for the lognormal distribution do not
> make sense (mean = 0 leads to log(0) which is undefined).

Even though the documentation indicated those were the default arguments
for the constructor, the actual constructor does not have any default
arguments. This is an error in the documentation, not in the code.

Brad Hanson


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk