37 lines
470 B
Python
37 lines
470 B
Python
import numpy as np
|
|
|
|
x = np.ones((2, 3, 4,5 ))
|
|
print('x:')
|
|
print(x.shape)
|
|
print(x)
|
|
|
|
y = np.transpose(x)
|
|
print('y:')
|
|
print(y.shape)
|
|
print(y)
|
|
|
|
x = np.array([1,2,3,4,5])
|
|
|
|
print(x)
|
|
print(x.mean())
|
|
print(x.std())
|
|
print(10**(1/2))
|
|
|
|
|
|
data = np.array([
|
|
[1,3+1],
|
|
[2,6+1],
|
|
[3,9+1],
|
|
[4,12+1],
|
|
[5,15+1],
|
|
])
|
|
|
|
n = data.shape[0]
|
|
x_init = data[:,0]
|
|
x = np.c_[x_init.reshape(n, -1), np.ones((n, 1))]
|
|
print(x)
|
|
|
|
x = np.array([1,2,3,4,5,6,7,8,9,10])
|
|
print(x**2)
|
|
x = x**2
|
|
print(x.sum()) |