домрачева 2лр

 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
__author__ = 'vladimirtsvetkov'
import numpy as np
import matplotlib.pyplot as plt
k = 0.7
h0 = 2
eps = 0.01
step = 0
harr = []
steparr = []
harr.append(h0)
steparr.append(step)
step += 1
hnext = k * k * h0
while hnext > eps:
harr.append(hnext)
steparr.append(step)
step += 1
hnext = k * k * hnext
harr.append(hnext)
steparr.append(step)
step += 1
for i in harr:
print(repr(i) + " ")
for i in steparr:
print(repr(i) + " ")
plt.bar(steparr, harr)
plt.show()