Skip to content
DeepForgeby svx
All problems
MediumProbabilitypr-365

Lognormal Mean Value

Problem

If log X is normal with mean mu and standard deviation sigma, then E[X] = exp(mu + sigma^2 / 2).

Given mu and sigma, return the mean.

Hint

The mean is shifted above exp(mu) by half the log-variance.

Test cases

case 1
in: [0,1]
expected: 1.6487212707001282
case 2
in: [1,0.5]
expected: 3.080216848918031
case 3
in: [0,0]
expected: 1
Starter codePython
def lognormal_mean_value(mu, sigma):
    # Your code here
    pass

3 test cases · run your code against them in the editor