I am trying to multiply a symbol with a matrix which is defined by QuTip quantum object, but I got this error:

TypeError: Incompatible object for multiplication

I used:

from qutip import *
import sympy as sp
w0 = sp.Symbol('\omega_{0}')

Did I miss something?


1 Answer 1


well, you can either convert destroy(4) to a sympy matrix or a numpy array like that:

a = destroy(4)
destroy_ = sp.Matrix(a)
destroy_ = w0*destroy_

And here is the result :enter image description here

or try numpy array:

destroy = np.array(a)
result = w0*destroy

After you finished all stuff (like finding w0 or doing all computations), then, you can convert your final matrix to Qobj


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.