-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_initial_increase.py
More file actions
49 lines (32 loc) · 992 Bytes
/
plot_initial_increase.py
File metadata and controls
49 lines (32 loc) · 992 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#! /usr/bin/python
import os
import numpy as np
import matplotlib.pyplot as plt
plt.rcParams.update(
{"text.usetex": True, "lines.markersize": plt.rcParams["lines.markersize"] * 0.8}
)
def grow_function(begin, exp, count):
output = np.zeros(count)
for i in range(count):
output[i] = begin
begin **= exp
return output
def create_if_missing(dir_path):
if not os.path.isdir(dir_path):
os.mkdir(dir_path)
def save_figure(base_dir, file_name):
create_if_missing(base_dir)
file_name = os.path.join(base_dir, file_name)
plt.savefig(file_name)
def main():
begin = 0.01
count = 30
for i in range(2, 6):
exp = (i - 1) / i
grow = grow_function(begin, exp, count)
plt.scatter(np.arange(count), grow, marker="o")
plt.plot(grow)
plt.legend([f"$\sqrt[{i}]{{ur^{i-1}}}$" for i in range(2, 6)])
save_figure("images", "plot_initial_increase.eps")
if __name__ == "__main__":
main()