Now that you have seen how to build probability density functions, let's try to implement a new one.
The distribution we will be implementing in this exercise is called the log-normal distribution. It has the following PDF:
Note that the log-normal distribution is only defined for positive numbers (since the logarithm is only defined for such numbers).
Implement a function called lognormal
that takes as input three values: one for , one for and one for . The function must return the value of the PDF. Thus funtion should have the following definition:
def lognormal(x, mu, sigma): # Your implementation here
The input can be either a scalar or a numpy array.