Navigation

The standard Matrix class in SymPy is mutable. This is important for
performance reasons but means that standard matrices cannot interact well with
the rest of SymPy. This is because the Basic object, from which most
SymPy classes inherit, is immutable.

The mission of the ImmutableDenseMatrix class, which is aliased as
ImmutableMatrix for short, is to bridge the tension
between performance/mutability and safety/immutability. Immutable matrices can
do almost everything that normal matrices can do but they inherit from
Basic and can thus interact more naturally with the rest of SymPy.
ImmutableMatrix also inherits from MatrixExpr, allowing it to
interact freely with SymPy’s Matrix Expression module.

You can turn any Matrix-like object into an ImmutableMatrix by calling
the constructor

A matrix is zero if every element is zero. A matrix need not be square
to be considered zero. The empty matrix is zero by the principle of
vacuous truth. For a matrix that may or may not be zero (e.g.
contains a symbol), this will be None