-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtariffs.py
More file actions
43 lines (33 loc) · 811 Bytes
/
tariffs.py
File metadata and controls
43 lines (33 loc) · 811 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
import matplotlib.pyplot as plt
from mpl_toolkits import mplot3d
import numpy as np
m = np.linspace(0, 300, 51)
g = np.linspace(0, 50, 41)
def tar1(m, g):
base = 200
p = base
if m > 100:
p += (m - 100) * 1.5
if g <= 4:
pass
elif 4 < g <= 8:
p += 100
elif 8 < g <= 20:
p += 200
else:
p += 300
return p
p = np.zeros((len(m), len(g)))
f = tar1
for gc in range(len(g)):
for mc in range(len(m)):
p[mc][gc] = f(m[mc], g[gc])
gg, mm = np.meshgrid(g, m, sparse=True)
ax = plt.axes(projection='3d')
ax.plot_surface(mm, gg, p, rstride=1, cstride=1,
cmap='viridis', edgecolor='none')
ax.set_title('Тариф')
ax.set_xlabel('Минуты')
ax.set_ylabel('Гигабайты')
ax.set_zlabel('Руб')
plt.show()