In Julia, matrices can store heterogeneous elements. It dynamically decides the type of the value. In this shot, we will learn how to get the inverse of a matrix using Julia.
The inverse of a matrix is another matrix which, upon multiplication with the given matrix, gives the identity matrix.
For instance, if
We can get the inverse of the matrix in Julia using the inv()
function.
inv(matrix)
It accepts a matrix as a parameter and returns the inverse matrix of it.
Let us take a look at an example.
#give matrixA = [1 -1; 0 2]#get inverse of matrixdisplay(inv(A))
In the code snippet above:
A
.inv()
function to get the inverse of the matrix A
and display the returned inverse matrix of A
.