Numeric computation of certain symbols in numpy array of sympy expressions Numeric computation of certain symbols in numpy array of sympy expressions numpy numpy

Numeric computation of certain symbols in numpy array of sympy expressions


Just use sympy. No need for numpy, at least not for the substitution:

In [117]: import sympyIn [118]: a,b,c=sympy.symbols('a b c')In [120]: M=sympy.Matrix([[a**2, a+b],[a*c+b, b/c]])In [121]: MOut[121]: Matrix([[   a**2, a + b],[a*c + b,   b/c]])In [123]: M.subs({b:2})Out[123]: Matrix([[   a**2, a + 2],[a*c + 2,   2/c]])


array is not an expression, therefore it has not the method subs