Recipe: How to invert a matrix or nArray in Python?
DATA MUNGING PYTHON MATRIX

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]]


Stuck at work?
Can't find the recipe you are looking for. Let us know and we will find an expert to create the recipe for you. Click here
Companies using this Recipe
1 developer from KPMG
1 developer from Renovite Technologies
1 developer from Altimetrik
1 developer from LTI
1 developer from Vodafone
1 developer from ANAC
1 developer from MudraCircle
1 developer from YASH Technologies
1 developer from HvH
1 developer from New Delhi DataPoint