The operations between Pauli matrices defined by different sympy modules

See my following testing with Pauli matrices defined by different sympy modules:

In [57]: init_printing(wrap_line=False)
    ...: from sympy.physics.paulialgebra import Pauli
    ...: from sympy.physics.matrices import msigma

In [58]: Pauli(1) == msigma(1)
Out[58]: False

Why can’t the same Pauli matrices defined by different modules be considered the same?

Regards,
HY

Hi Hongyi,

there is a sympy group too. It may be, that such sympy-specific questions are better off there.

Pauli(1) looks very strange to me, but I did not find suitable documentation for that, so…

Whereas msigma(1) at least behaves like a matrix, you e.g. can multiply it sensefully with numpy.array-s.

So, I personally would prefer msigma(1). But who knows, what the inventor or Pauli(1) intended and what hidden treasure lies in that…?

Cheers, Dominik

As far as I understand from Pauli Algebra — SymPy 1.8 documentation (and the source code at sympy/paulialgebra.py at master · sympy/sympy · GitHub), Pauli matrices as implemented by sympy.physics.paulialgebra are purely symbolic. The class is derived from Symbol. So there are three unique values, with operations between them, but no interface linking them with matrices (but that is my understanding; you may want to ask on a Sympy-specific forum as Dominik proposed, such as https://groups.google.com/g/sympy).

Thank you all very much.