import numpy as np
from numpy.linalg import *
创建一个数值范围为0-1,间隔为0.01的数组
my_array1 = np.arange(0,1,0.01)
print(my_array)
print('my_array的个数:',np.size(my_array))
my_array3 = np.arange(1,7).reshape(3,2)#3行两列,1-6
my_array4 = np.arange(3,9).reshape(3,2)#3行两列,3-8
print(my_array3)
print("----------")
print(my_array4)
print("my_array3与my_array4,数组相加:")
print(my_array3+my_array4)
print("----------------")
print("my_array3与my_array4,数组相减:")
print(my_array3-my_array4)
print("----------------")
print("my_array3与my_array4,数组相乘:")
# y = my_array3.transpose() #2*3 2*3 ,把其中一个转置
# print(np.shape(y))
# print(np.shape(my_array4))
print(my_array4*my_array3) #2*3 3*2
print("----------------")
print("my_array3与my_array4,数组相除:")
print(my_array4/my_array3)
print("一维度求和")
print(np.sum(my_array3,axis = 0))
print("----------------")
print("二维度求和")
print(np.sum(my_array3,axis = 1))
print("----------------")
print("数组复制")
y = np.copy(my_array)
print(y)
print("----------------")
print("求逆矩阵")
#这里必须是方阵
x = np.array( [ [1,2,3] ,[4,5 ,6],[7,8,9] ])
print(x)
print(x)
y = inv(x)
print("----------------")
print("转置")
print("原维度: ",np.shape(my_array3))
y = my_array3.transpose()
print(y)
print("修改后维度: ",np.shape(y))
print("----------------")
print("求行列式")
#这里也必须为方阵
x = np.array( [ [1,2] ,[3,4] ])
print(det(x))#1*4-2*3
print("----------------")
print("求特征值与特征向量,(特征值,特征向量)")
print(eig(x))#
print("----------------")
print("相关系数")
x=np.corrcoef([1,0,1],[0,2,1])
print(x)
print("----------------")
print("求和")
print(np.sum(my_array3))
print("----------------")
print("最大")
print(np.max(my_array3))
print("----------------")
print("最小")
print(np.max(my_array3))
print("----------------")
print("均值")
print(np.mean(my_array3))
print("----------------")
print("方差")
print(np.var(my_array3))
print("----------------")
print("标准差")
print(np.var(my_array3))
print("----------------")