mesolve error

27 views
Skip to first unread message

Hossein Davoodi Yeganeh

unread,
Dec 15, 2022, 4:42:01 AM12/15/22
to QuTiP: Quantum Toolbox in Python
Hi everyone I have simple code for time evaluation Hamiltonian.
I need to consider psi0 as ground state of an operator . for example

H=sigmaz()
psi0=sigmax().groundstate()
taulist = np.linspace(0, 1, 100)
result = mesolve(H, psi0, taulist, [],[])


print(result)

I get following error

"in mesolve
    if (not (rho0.isoper or rho0.issuper)) or (rho0.dims[0] != rho0.dims[1]):
AttributeError: 'tuple' object has no attribute 'isoper' "

 I have another question
How we can compute amplitude of state in mesolve result . I mean |a(t)|^2 in psi(t).
can you help?

Simon Cross

unread,
Dec 15, 2022, 6:48:53 AM12/15/22
to qu...@googlegroups.com
Hi Hossein,

You can extract the probability for being in particular state psi, but
looking at the expectation value of its projector, e.g.:

qutip.expect(state.proj(), rho)

where rho is the density matrix returned by mesolve and state is the
state whose probability you want to extract.

Note that this is not exactly the same as the magnitude of the
amplitude of a pure state, because rho might not be a pure state -- it
might be an ensemble of pure states. Also note that the amplitude for
a state is just a(t) -- i.e. a complex number. |a(t)|^2 is the
probability.

Regards,
Simon
Reply all
Reply to author
Forward
0 new messages