Numerical methods in enginering with python3 (1)

< > (1)

Numpy library

The matrix function Numpy

  1. np.diagonal (A) Returns the one-dimensional matrix by A in the main diagonal elements of
  2. np.diagonal (A, 1) returned by the one-dimensional matrix A in the first sub-diagonal elements of
  3. np.trace (A) A, and return to the main diagonal elements
  4. np.argmax (A, axis = 0) 0 axis, the minimum number of
  5. np.identity (3) returns a three-dimensional matrix
  6. np.dot (a, b)
    commonly used:
  • If a, b are the rows of the matrix, which is returned the inner product (multiplied by the corresponding elements, and finally adding the returned value is a scalar)
  • If a, b are n-dimensional matrix, the a, b return matrix multiplication
  • When a is n-dimensional, b is a row of the matrix, each matrix element is returned, multiplying corresponding elements of the various elements of a matrix and b rows of a matrix, and then summed. (Similar to matrix multiplication, but instead of rows, columns by relationship, but trekking ride)
  1. np.inner (a, b)
    commonly
  • If a, b are the rows of the matrix, which is returned the inner product (multiplied by the corresponding elements, and finally adding the returned value is a scalar)
  • When multiplying a, b are n-dimensional matrix, each matrix element is returned as the corresponding elements of each row of a certain row of the matrix elements of a matrix multiplication and b, the resulting values ​​are added (similar to the matrix but instead of rows, columns by the relationship, but trekking ride)
  1. np.outer (a, b) returns a, b, all the elements of the product matrix composed of

    Linear algebra module

    from numpy.linalg import inv,solve
  2. Inverse inv (A) matrix
  3. Solving Ax = x solve (A, b) b equation

    Deep copy matrix

    Instead of creating a matrix of view, but a new creation of an object
    b = a.copy ()

    The operation of the quantization matrix

    Mathematics this statement:

Guess you like

Origin www.cnblogs.com/greatljg/p/11407782.html