Closed jeksterslab closed 3 years ago
Hi,
Yeah, you've stumbled upon a serious issue in the very core of yacas, which is not transforming the expressions to the well-defined canonical form. As a result, in
{{beta*alpha^2+gamma,alpha*beta},{beta*alpha,beta}}
the off-diagonal terms have different order of alpha
and beta
. Hence they are not considered equal.
As a quick workaround I'd suggest using
Simplify(Transpose(A)-A) = 0
to check A
symmetry. It involves Simplify()
which should deal with the ordering issues just fine, but which in general case can be very computationally expensive - that's why I'd rather not put it in the standard IsSymmetric()
predicate.
Cheers, Grzesiek
Thanks very much.
In the example below, I am symbolically deriving several symmetric matrices, namely
Sigma
which is a covariance matrix,Diag
which is the inverse of the diagonal matrix consisting of the diagonal elements ofSigma
, andR
which is a correlation matrix. Shouldn'tIsSymmetric
returnTrue
for all matrices? The arrangement of variables may be different forSigma
andR
but the lower and upper triangular elements are symbolically equivalent.Input
Output