I am trying to substitute a sympy symbolic matrix that I created with some real numbers. However, I get an error which I am not able to solve. Can anyone provide me a working solution to fix this issue in Python 2.7, sympy 1.0?
This is the code :
import sympy as sy
from sympy import Symbol
x1 = sy.MatrixSymbol('x1', 2, 2)
x2 = 2*x1
print x2.subs({x1: sy.Matrix([[2,1],[1,-3]])})
However, when I run the above code, I get the following error:
Traceback (most recent call last):
File "ID.py", line 5, in <module>
print x2.subs({x1: sy.Matrix([[2,1],[1,-3]])})
File "/usr/lib/python2.7/dist-packages/sympy/core/basic.py", line 859, in subs
ops = o.count_ops(), len(o.args)
File "/usr/lib/python2.7/dist-packages/sympy/core/basic.py", line 1484, in count_ops
return count_ops(self, visual)
File "/usr/lib/python2.7/dist-packages/sympy/core/function.py", line 2321, in count_ops
ops = [count_ops(i, visual=visual) for i in expr]
File "/usr/lib/python2.7/dist-packages/sympy/core/function.py", line 2252, in count_ops
if a.is_Rational:
AttributeError: 'str' object has no attribute 'is_Rational'
Firebase Cloud Functions: PubSub, "res.on is not a function"
TypeError: Cannot read properties of undefined (reading 'createMessageComponentCollector')
I have a dict of nested dicts and key-values
I am trying to automate google search but unfortunately my IP is blockedAfter some searches, it seems like using Tor could get me a new IP dynamically
This is what I still am left with
Let's say that I am writing a Python program on LinuxAnd I want to run a binary manually-installed command called "foo" using its path