Hi Florent,

It would be better to open a GitHub issue with this as it is a bug.

The output should be None in both cases rather than True or False
because it is possible that X*Z is symmetric (for example if X and Z
are diagonal) but also possible that it is not.

Thanks,
Oscar

On Mon, 13 Oct 2025 at 19:54, Florent Périat <[email protected]> wrote:
>
> Hi everyone,
>
> I just read the documentation and noticed that there is, as I understood it, 
> a mathematical mistake (and also at the execution).
>
> If you look at this section, it seems to assert that the product (not the 
> Hadamard product, but usual one) of two symmetric matrices is also symmetric, 
> which is True if and only if both matrices commutes; but as their shape is 
> (in the example) defined as 2x2, they do not necessarily.
>
> from sympy import Q, ask, MatrixSymbol, Equality
>
> X = MatrixSymbol('X', 2, 2)
> Z = MatrixSymbol('Z', 2, 2)
>
> print(ask(Q.symmetric(X * Z), Q.symmetric(X) & Q.symmetric(Z))) # True
> print(ask(Equality(X * Z, Z * X), Q.symmetric(X) & Q.symmetric(Z))) # False
>
> Here both output should give False.
>
> Best regards,
>
> F. Périat
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion visit 
> https://groups.google.com/d/msgid/sympy/d029d408-66cb-4531-a548-b7e455a0387dn%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/sympy/CAHVvXxQo%2BpdFPBrE9X6n2L%3DRVDiZ%2B4G8_OSQ33EUGnWHuVfRvQ%40mail.gmail.com.

Reply via email to