How to invert a matrix or nArray in Python?
0

How to invert a matrix or nArray in Python?

This recipe helps you invert a matrix or nArray in Python
In [1]:
## How to Invert a Matrix or nArray
def Kickstarter_Example_6():
    print()
    print(format('How to Invert a Matrix or ndArray', '*^72'))
    # Load library
    import numpy as np
    # Create a 3x3 matrix
    matrix = np.array([[1, 2, 3],
                       [4, 5, 6],
                       [7, 8, 9]])
    # Calculate inverse of matrix
    Im = np.linalg.inv(matrix)
    print()
    print(Im)
Kickstarter_Example_6()
*******************How to Invert a Matrix or ndArray********************

[[ 3.15251974e+15 -6.30503948e+15  3.15251974e+15]
 [-6.30503948e+15  1.26100790e+16 -6.30503948e+15]
 [ 3.15251974e+15 -6.30503948e+15  3.15251974e+15]]