Note
Go to the end to download the full example code.
The gamma distribution generalizes the exponential#
A Gamma(shape=1, rate) distribution is exactly an Exponential(rate); increasing the shape parameter builds up a sum of exponentials.
import numpy as np
from mathematicskit.probability import Exponential, Gamma, Normal
from mathematicskit.probability.visualizers.plots import plot_distribution
Gamma(1, rate) matches Exponential(rate) exactly#

max |gamma(1,r) - exponential(r)| pdf difference: 0.0
<Axes: title={'center': 'Gamma'}, xlabel='x', ylabel='f(x)'>
The normal distribution and its MGF#

normal MGF at t=1: 1.6487212707001282 expected exp(0.5): 1.6487212707001282
<Axes: title={'center': 'Normal'}, xlabel='x', ylabel='f(x)'>
Total running time of the script: (0 minutes 0.046 seconds)