diff options
| author | KunoiSayami <[email protected]> | 2022-07-22 16:40:36 +0800 |
|---|---|---|
| committer | KunoiSayami <[email protected]> | 2022-07-22 16:40:36 +0800 |
| commit | 3c745606e9494917763313e821e3722d010e2e97 (patch) | |
| tree | 48e00fe898477c2ce4bdb7c1b992e13372d1ada0 /ex_normal_distribution.py | |
| parent | 3f1bd23b3432441dbaaa6499f084ffafb531ab06 (diff) | |
refactor: Rename files
Signed-off-by: KunoiSayami <[email protected]>
Diffstat (limited to 'ex_normal_distribution.py')
| -rwxr-xr-x | ex_normal_distribution.py | 35 |
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) |
