How to plot the normal distribution?

97 Views Asked by At

According to 'An Introduction to Probability Theory and Its Applications', Vol. 1 by Feller the number of inversions in a random permutations at large numbers satisfy CLT with dedicated mean and variance.

However, I am practically intrested in how to plot the figure of the normal distribution (what to calculate for it)?

I understand that the figure may depends on the fact of how large the numbers are. Any explanations to clarify the topic are highly welcomed. Thank you in advance.

1

There are 1 best solutions below

4
On BEST ANSWER

Here is how to plot the density function of $N(0,1)$: $$ f(x) = \frac{e^{-\frac{x^2}{2}}}{\sqrt{2 \pi}} . $$

In Mathematica, a one-liner:

Plot[PDF[NormalDistribution[], x], {x, -4, 4}]

enter image description here

In Python, slightly more verbose:

import numpy as np
import matplotlib.pyplot as plt

x = np.linspace(-4, 4, 101)
y = np.exp(-x*x/2) / np.sqrt(2*np.pi)

plt.plot(x, y)
plt.show()

enter image description here