Is there a way to calculate eigenvalues for symbolic matrices?

I’d like to calculate the eigenvalues for the matrix like

[1 1; x x]

in julia. is there a way to do it? I tried the following but didn’t work.

using SymPy

@syms x
A = [1 1; x x]

eigen(A)

You may use

julia> using GenericLinearAlgebra

julia> GenericLinearAlgebra.eigvals(A)
2-element Vector{Sym{PyCall.PyObject}}:
     0
 x + 1

eigen isn’t available, though.

1 Like

thank you so much! Can i further ask what about eigen vectors?

I don’t think it’s implemented yet

This doesn’t cover all the bases, but perhaps what is being asked for:

using LinearAlgebra
function LinearAlgebra.eigen(A::AbstractMatrix{T}) where {T <: Sym}
    LinearAlgebra.Eigen(eigvals(A), eigvecs(A))
end
@syms x
eigen([1 1; x x])
1 Like

this is so helpful! thank you! works well!