I am trying to replace two characters in my equation for the matrix form of each of them.
I created a switching function that formed my expression:
t, vS, = sy.symbols('t, vS', commutative = False) hS = t + vS eta = myComm(t,hS) dHs = myComm(eta,hS) print dHs.expand()
to get the correct expression I want:
2*t*vS*t + t*vS**2 - t**2*vS - 2*vS*t*vS - vS*t**2 + vS**2*t
So now I want to replace the characters t and vS with matrices, however when using subs I get the error message: "unhashable type:" list "" I assume that this is due to my initialization of the matrices or how they should be replaced correctly, since I am new to both numPy and symPy.
The rest of the code:
tRel = ([e0, 0],[0,e1]) vtmp = ([v0, v1],[v2,v3]) dHs = dHs.subs(t, tRel) dHs = dHs.subs(vS, vtmp) print dHs
source share