You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
678 B
31 lines
678 B
import numpy as np
|
|
import math
|
|
|
|
def x1_4(ProblemIndex):
|
|
step = 3 # 步长
|
|
y = []
|
|
i, c = 0, 0
|
|
number = 1000 # 个数
|
|
while (True):
|
|
if (c == number):
|
|
break
|
|
else:
|
|
y.append(i)
|
|
i += step
|
|
c += 1
|
|
y = np.array(y)
|
|
xyMap = np.random.rand(1000, 2)
|
|
if (ProblemIndex == 1):
|
|
for i in range(len(y)):
|
|
xyMap[i][0] = y[i]
|
|
xyMap[i][1] = 2 * y[i] + 1
|
|
return xyMap
|
|
elif (ProblemIndex == 2):
|
|
for i in range(len(y)):
|
|
xyMap[i][0] = y[i]
|
|
xyMap[i][1] = y[i] / 3
|
|
return xyMap
|
|
|
|
|
|
if __name__ == '__main__':
|
|
print(x1_4(1)) |