forked from prakharcode/Numpy-stack-tutorial
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathex2.py
More file actions
17 lines (15 loc) · 608 Bytes
/
ex2.py
File metadata and controls
17 lines (15 loc) · 608 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
'''
Central Limit Theorem
If Y is a sum of infinte X where X is a random variable from any distribution
Then distribution of Y becomes Gaussian.
Here we draw 1000*1000 matrix of random number and take sum row wise hence it
gives 1000 points which we assume are from some distribution Y we plot these
points to enquire the distribution and we get a bell shaped curve indeed.
'''
import numpy as np
import matplotlib.pyplot as plt
Y = map(np.sum,np.random.ranf((1000,1000))) #continuos uniform dist
Y_norm = map(np.sum,np.random.randn(1000,1000))
plt.hist(Y, bins=100)
plt.hist(Y_norm, bins=100)
plt.show()