Plot of expectation values in the Bloch Sphere

27 views
Skip to first unread message

joseantoni...@gmail.com

unread,
Nov 30, 2016, 12:57:47 AM11/30/16
to QuTiP: Quantum Toolbox in Python
Hi! I am new using Qutip, and I am trying to plot the expectation values of sigma x, sigma y and sigma z in Bloch Sphere, but when I add the values, only 2 values are plotted.  Here I let the code:

import matplotlib.pyplot as plt
import numpy as np
from qutip import*

# initial state
psi0=basis (2,0)
Omega=0.2
# hamiltonian
H=Omega*sigmax()

# list of times for which the solver should store the state vector
tlist = np.linspace(0, 90, 200)

# evolve and calculate expectation values
result = mesolve(H, psi0, tlist, [], [sigmax(), sigmay(), sigmaz()])

expt0 = result.expect[0]
expt1 = result.expect[1]
expt2 = result.expect[2]

b=Bloch()
b.add_states(psi0)
b.add_points(expt0, expt1,expt2)
b.show()

Could you help me please?




Paul Nation

unread,
Nov 30, 2016, 1:01:38 AM11/30/16
to QuTiP Group
You need to make the following change:

b.add_points([expt0, expt1, expt2])


-P


--
You received this message because you are subscribed to the Google Groups "QuTiP: Quantum Toolbox in Python" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qutip+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages