JuliaSymbolics / Symbolics.jl

Symbolic programming for the next generation of numerical software
https://docs.sciml.ai/Symbolics/stable/
Other
1.35k stars 151 forks source link

No LU factorization for Complex Symbolic matrices #861

Open Gregstrq opened 1 year ago

Gregstrq commented 1 year ago

I wanted to compute the determinant and inverse of a Matrix{Complex.Num}, but stumbled upon

TypeError: non-boolean (Symbolics.Num) used in boolean context

because the generic version of LU factorization from LinearAlgebra.jl was used. I've checked it for Symbolics.jl v5.1.0 and Julia v1.7.2

I know that there is a special version of LU factorization sym_lu defined for real Symbolic matrices. Can it be reused for Complex Symbolic matrices as well?

If you want an MWE to play with, here is one:

@variables Ω ω₀ Δ
M = [-ω₀ 2im*Ω 0; -2im*Ω -ω₀ 2im*Δ; 0 -2im*Δ -ω₀]
det(M)
ChrisRackauckas commented 1 year ago

It probably just needs some <:Real to <:Number

Gregstrq commented 1 year ago

Ok, I have created a PR.