1
$\begingroup$

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}')
w0*destroy(4)

Did I miss something?

$\endgroup$
1

1 Answer 1

1
$\begingroup$

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_
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

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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