I've spent a lot of time on this issue and I can't figure it out yet.

So, a lognormal distribution is being defined as follow: X=e^(μ + σ Z), where Z is a standard normal variable.

Now, I want to estimate σ from the standard deviation of the resulting random variable X. Notice how the sigma is the sigma of the Z in the log space instead of the veritable standard deviation of the resulting X (that means: the sqrt of the second moment of X).

I've tried to start from the equation of the second moment here and here and here to estimate the variance of X from its σ, however I couldn't get wolfram alpha to invert the equation (or maybe I don't understand how to use the answer) to get σ in function of the variance of X (or in function of the standard deviation of X. Wolfram always finds that σ is equal to zero or to some imaginary numbers, and there seems to have problems with these imaginary numbers and transcendental numbers.

Also, as stated on Wikipedia, the base e is not important in the expression X=e^(μ + σ Z):

This relationship is true regardless of the base of the logarithmic or exponential function. if log_a(X) is normally distributed, then so is log_b(X) for any two positive numbers a or b that are not equal to 1.

I am working with base two (2) instead of the natural exponential base (e) to reduce numerical errors in binary floating point numbers when manipulating the numbers in Python.

To sum up, I am looking for a way to find σ from the standard deviation of X. I would like to do that ideally in base two, and ideally in Python. I would like to find one simple formula that works.

  • $\begingroup$ What you request is impossible. Generally, given one equation in two unknowns ($\mu$ and $\sigma$) you cannot obtain a unique solution. $\endgroup$
    – whuber
    Sep 5, 2023 at 14:12
  • $\begingroup$ BTW, working in base 2 does nothing to improve accuracy or precision. $\endgroup$
    – whuber
    Sep 7, 2023 at 12:15

1 Answer 1


EDIT: finally this answer is not good. It is close to be good, however I get a difference of close 0.85 compared to the real standard deviation of X when I measure back what it gives.

I seem to have finally found my answer with the following formula with one of the imaginary roots:


where x is the regular std of X, and where y is the μ parameter.

In Python and in base 2, this makes:

def from_regular_mean_std(
    mean: float,
    std: float,
    hard_clip_min: float = None,
    hard_clip_max: float = None
    log2_space_mean = math.log2(mean)

    y = log2_space_mean
    x = std
    log2_space_std = math.sqrt(math.log2(
        0.5 * 2**(-2 * y) * (2**(2 * y) + math.sqrt(2**(4 * y) + 4 * 2**(2 * y) * x**2))

    from neuraxle.hyperparams.distributions import LogNormal
    return LogNormal(

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.