I would like to know the shape of a sympy matrix for debugging purposes. The documentation suggests the following:
from sympy import shape
M = Matrix([[1, 2, 3], [-2, 0, 4]])
shape(M)
However this doesn't seem to work on my version of sympy and it doesn't even work in the life shell that is integrated into the sympy documentation website.
In the life shell on docs.sympy.org it throws the following error:
>>> from sympy import shape
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: cannot import name shape
Any help would be appreciated. Thank you.
try this
import sympy
M = sympy.Matrix([[1, 2, 3], [-2, 0, 4]])
M.shape
I get
(2, 3)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With