forked from secondtonone1/python-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestmatplotlab.py
More file actions
71 lines (58 loc) · 1.56 KB
/
testmatplotlab.py
File metadata and controls
71 lines (58 loc) · 1.56 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import numpy as np
import matplotlib.pyplot as plt
class PointData(object):
def __init__(self,x,y):
self.x = x
self.y = y
def getPoint(self):
return (self.x, self.y)
def GongZhenFunc(n):
y=1.08722 * (70000*20 - n*n - (float)(n/3.0)*(n/3.0) - (float)(n/5.0)*(n/5.0) -
(float)(n/8.0)*(n/8.0) - (float)(250000-(n-499)*(n-499))*2.2)
return (n,y)
def eocgongzhen(n ):
return 0.945 * (40000*20 - n*n - (float)(n/3)*(n/3) - (float)(n/5)*(n/5) -
(float)(n/8)*(n/8) - (float)(250000-(n-499)*(n-499))*2.2)
if __name__ == "__main__":
'''
x = np.linspace(0, 2 * np.pi, 100)
y1, y2 = np.sin(x), np.cos(x)
plt.plot(x, y1)
plt.plot(x, y2)
plt.title('line chart')
plt.xlabel('x')
plt.ylabel('y')
plt.show()
'''
'''
sum = 0.0
xslice = []
yslice = []
for i in range(1000):
res = GongZhenFunc(i)
sum = sum + res[1]
yslice.append(res[1])
xslice.append(i)
print("tokennum is %f, totalnum is %f" %(res[1], sum))
plt.plot(xslice, yslice)
plt.title('gognzhen chart')
plt.xlabel('x')
plt.ylabel('y')
#plt.legend()
plt.show()
'''
sum = 0.0
xslice = []
yslice = []
for i in range(465):
res = eocgongzhen(i)
sum = sum + res
yslice.append(res)
xslice.append(i)
print("tokennum is %f, totalnum is %f" %(res, sum))
plt.plot(xslice, yslice)
plt.title('gognzhen chart')
plt.xlabel('x')
plt.ylabel('y')
#plt.legend()
plt.show()