With Symbolics.jl how do I get the determinant of a symbolic matrix?
I tried this:
@variables a[1:2, 1:2]
det(a)
The only thing I can get is: Symbolics._det(a, true)
With Symbolics.jl how do I get the determinant of a symbolic matrix?
I tried this:
@variables a[1:2, 1:2]
det(a)
The only thing I can get is: Symbolics._det(a, true)
You need to do using LinearAlgebra
for the det
function. This notebook (from my linear algebra course) has some examples of symbolic determinants: Notes on determinants
The issue is that det
is lazy on symbolic arrays, so if you want the component-wise version you need to collect:
using Symbolics, LinearAlgebra
@variables a[1:2, 1:2]
det(collect(a)) # a[1, 1]*a[2, 2] - a[1, 2]*a[2, 1]
How does Symbolics.jl make det lazy on symbolic arrays? Can you point me to a file or function in Symbolics.jl that implements this feature so that I can ape/extend it on other functions?
I’d like to be able to write equations like
@variables c, y1, y2, y3
c ~ argmax([y1, y2, y3])
I’m guessing that I need to add a method to argmax so that it is lazy with Num type?
Thanks BTW, I’m really excited by everything you are accomplishing.
I’m not sure, you’ll need to open an issue and ask @shashi that one.