diff options
| author | KunoiSayami <[email protected]> | 2022-06-20 16:15:34 +0800 |
|---|---|---|
| committer | KunoiSayami <[email protected]> | 2022-06-20 16:15:34 +0800 |
| commit | 85296957a8d755cda80c5dc00dcef4555ff14ebc (patch) | |
| tree | 2de6d0d4f7aaef5eff0eec7a98b5e39376fca83c /ex_normal_distribution.py | |
| parent | e0fa8c3a324f0b8b155058d4f05ea69a4df1f5bf (diff) | |
fix(script): Fix normal distribution generator
* feat(script): Add p.d.f. and c.d.f. painter
Signed-off-by: KunoiSayami <[email protected]>
Diffstat (limited to 'ex_normal_distribution.py')
| -rwxr-xr-x | ex_normal_distribution.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/ex_normal_distribution.py b/ex_normal_distribution.py new file mode 100755 index 0000000..f82df93 --- /dev/null +++ b/ex_normal_distribution.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python3 +import matplotlib.pyplot as plt + + +def function_pdf(element: list[int]): + plt.hist(element, bins=500) + plt.show() + + +def function_cdf(element: list[int]): + plt.hist(element, bins=500, cumulative=True) + plt.show() + + +def normal_distribution(): + with open('normal_distribution.txt') as fin: + context = fin.read() + elements = list(map(int, context.splitlines())) + function_pdf(elements) + function_cdf(elements) + + +if __name__ == '__main__': + normal_distribution() |
