summaryrefslogtreecommitdiff
path: root/ex_normal_distribution.py
diff options
context:
space:
mode:
Diffstat (limited to 'ex_normal_distribution.py')
-rwxr-xr-xex_normal_distribution.py35
1 files changed, 0 insertions, 35 deletions
diff --git a/ex_normal_distribution.py b/ex_normal_distribution.py
deleted file mode 100755
index 272b9b6..0000000
--- a/ex_normal_distribution.py
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/usr/bin/env python3
-import numpy as np
-import matplotlib.pyplot as plt
-from matplotlib.ticker import PercentFormatter
-
-
-def function_pdf(element: list[int]):
- plt.hist(element, bins=500, histtype='step')
- plt.show()
-
-
-def function_cdf(element: list[int]):
- plt.hist(element, bins=500, cumulative=True, histtype='step')
- plt.show()
-
-
-def function_1000_cdf(element: list[int]):
- plt.hist(element, bins=250, histtype='step', label='x', cumulative=True,
- weights=np.ones(len(element)) / len(element))
- plt.hist(element[:1000], bins=100, histtype='step', label='y', cumulative=True, weights=np.ones(1000) / 1000)
- plt.gca().yaxis.set_major_formatter(PercentFormatter(1))
- plt.show()
-
-
-def normal_distribution() -> list[int]:
- with open('normal_distribution.txt') as fin:
- context = fin.read()
- return list(map(int, context.splitlines()))
-
-
-if __name__ == '__main__':
- elements = normal_distribution()
- function_pdf(elements)
- function_cdf(elements)
- function_1000_cdf(elements)