Sympy "not all arguments converted during string formatting" when using zeros ((n, n))

I run sympy on an external computer, but when I do a simple command

M=sympy.zeros((2,2))

      

I am getting the error

 Traceback (most recent call last):
  File "test.py", line 8, in <module>
    M=sp.zeros((2,2))
  File "/apps/brussel/magnycours/software/sympy/0.7.6-intel-2015a-Python-2.7.9/lib/python2.7/site-packages/sympy/matrices/dense.py", line 1229, in zeros
    return cls.zeros(r, c)
  File "/apps/brussel/magnycours/software/sympy/0.7.6-intel-2015a-Python-2.7.9/lib/python2.7/site-packages/sympy/matrices/dense.py", line 513, in zeros
    r = as_int(r)
  File "/apps/brussel/magnycours/software/sympy/0.7.6-intel-2015a-Python-2.7.9/lib/python2.7/site-packages/sympy/core/compatibility.py", line 389, in as_int
    raise ValueError('%s is not an integer' % n)
TypeError: not all arguments converted during string formatting

      

However, when I run it on my computer, there is no problem. How can I fix this?

The version on my computer is 0.7.1.rc1 and the one on the cluster is 0.7.6. Should I ask them to install the (older?) Version or is there an easier fix?

+3


source to share


1 answer


If you want a 2x2 matrix with zeros, try this:

In [6]: zeros(2,2)
Out[6]: 
Matrix([
[0, 0],
[0, 0]])

      



or

In [7]: zeros(2)
Out[7]: 
Matrix([
[0, 0],
[0, 0]])

      

0


source







All Articles