Eigenvalues and eigenvectors allow us to "reduce" a linear operation to a more straightforward problem.
Consider the equation above when reading the explanation below:
Here A represents out matrix and X represents our eigen vector.
The product of our matrix and eigen vector results in the matrix B.
Now B can be written as a product of a scalar numeric (λ) that is the eigen value and the eigen vector X.
From the above example we can see that the resultant matrix B is the equivalent of λ times the eigen vector (X) where λ is the eigen value.
We can use built-in functions in Julia to find the eigenvectors and eigenvalues of a given matrix.
To calculate the eigenvalues and eigenvectors of a given matrix, we first need to import the LinearAlgebra
library in Julia.
using LinearAlgebra
We then declare and initialize a matrix in Julia. The size of the matrix arr
is 3x3.
arr = [1 2 3; 4 5 6; 7 8 9]
We can now call the eigen
function.
The eigen
function has two components:
eigen.values
eigen.vectors
data = eigen(arr)
To display the eigenvalues we simply print data.values
print(data.values)
To display the eigen vectors we simply print the data.vectors
component of the eigen function
print(data.vectors)
using LinearAlgebra arr = [1 2 3; 4 5 6; 7 8 9] data = eigen(arr) print(data.values) print(data.vectors)