I wrote a lot of for loops before programming, because the time is too long, I thought of changing to a matrix to reduce the operation.
- The radians, cos, sin, asin, sqrt in the math package can only calculate single values, not matrices.
So change to np.radians, np.cos, np.sin, np.arcsin, np.sqrt - In addition, the square of the previous single value should be changed to np.square ()
and the dot multiplication of the matrix np.multiply (a, b) - Create a new empty matrix
a = np.empty (shape = [rownum, colnum])
for i in range (n):
a [i ,: ] =