J.R. Johansson and P.D. Nation
For more information about QuTiP see http://qutip.org
from numpy import pi
from qutip import *
omega = 1.0
es1 = eseries(sigmax(), 1j * omega)
es1
ESERIES object: 1 terms Hilbert space dimensions: [[2], [2]] Exponent #0 = 1j Quantum object: dims = [[2], [2]], shape = (2, 2), type = oper, isherm = True Qobj data = [[ 0. 1.] [ 1. 0.]]
omega = 1.0
es2 = eseries(0.5 * sigmax(), 1j * omega) + eseries(0.5 * sigmax(), -1j * omega)
es2
ESERIES object: 2 terms Hilbert space dimensions: [[2], [2]] Exponent #0 = 1j Quantum object: dims = [[2], [2]], shape = (2, 2), type = oper, isherm = True Qobj data = [[ 0. 0.5] [ 0.5 0. ]] Exponent #1 = -1j Quantum object: dims = [[2], [2]], shape = (2, 2), type = oper, isherm = True Qobj data = [[ 0. 0.5] [ 0.5 0. ]]
esval(es2, 0.0)
tlist = [0.0, 1.0 * pi, 2.0 * pi]
esval(es2, tlist)
array([ Quantum object: dims = [[2], [2]], shape = (2, 2), type = oper, isherm = True Qobj data = [[ 0. 1.] [ 1. 0.]], Quantum object: dims = [[2], [2]], shape = (2, 2), type = oper, isherm = True Qobj data = [[ 0. -1.] [-1. 0.]], Quantum object: dims = [[2], [2]], shape = (2, 2), type = oper, isherm = True Qobj data = [[ 0. 1.] [ 1. 0.]]], dtype=object)
es2
ESERIES object: 2 terms Hilbert space dimensions: [[2], [2]] Exponent #0 = 1j Quantum object: dims = [[2], [2]], shape = (2, 2), type = oper, isherm = True Qobj data = [[ 0. 0.5] [ 0.5 0. ]] Exponent #1 = -1j Quantum object: dims = [[2], [2]], shape = (2, 2), type = oper, isherm = True Qobj data = [[ 0. 0.5] [ 0.5 0. ]]
expect(sigmax(), es2)
ESERIES object: 2 terms Hilbert space dimensions: [[1, 1]] Exponent #0 = 1j 1.0 Exponent #1 = -1j 1.0
es1 = eseries(sigmax(), 1j * omega)
es1
ESERIES object: 1 terms Hilbert space dimensions: [[2], [2]] Exponent #0 = 1j Quantum object: dims = [[2], [2]], shape = (2, 2), type = oper, isherm = True Qobj data = [[ 0. 1.] [ 1. 0.]]
es2 = eseries(sigmax(), -1j * omega)
es2
ESERIES object: 1 terms Hilbert space dimensions: [[2], [2]] Exponent #0 = -1j Quantum object: dims = [[2], [2]], shape = (2, 2), type = oper, isherm = True Qobj data = [[ 0. 1.] [ 1. 0.]]
es1 + es2
ESERIES object: 2 terms Hilbert space dimensions: [[2], [2]] Exponent #0 = 1j Quantum object: dims = [[2], [2]], shape = (2, 2), type = oper, isherm = True Qobj data = [[ 0. 1.] [ 1. 0.]] Exponent #1 = -1j Quantum object: dims = [[2], [2]], shape = (2, 2), type = oper, isherm = True Qobj data = [[ 0. 1.] [ 1. 0.]]
es1 - es2
ESERIES object: 2 terms Hilbert space dimensions: [[2], [2]] Exponent #0 = 1j Quantum object: dims = [[2], [2]], shape = (2, 2), type = oper, isherm = True Qobj data = [[ 0. 1.] [ 1. 0.]] Exponent #1 = -1j Quantum object: dims = [[2], [2]], shape = (2, 2), type = oper, isherm = True Qobj data = [[ 0. -1.] [-1. 0.]]
es1 * es2
ESERIES object: 1 terms Hilbert space dimensions: [[2], [2]] Exponent #0 = 0j Quantum object: dims = [[2], [2]], shape = (2, 2), type = oper, isherm = True Qobj data = [[ 1. 0.] [ 0. 1.]]
(es1 + es2) * (es1 - es2)
ESERIES object: 2 terms Hilbert space dimensions: [[2], [2]] Exponent #0 = 2j Quantum object: dims = [[2], [2]], shape = (2, 2), type = oper, isherm = True Qobj data = [[ 1. 0.] [ 0. 1.]] Exponent #1 = -2j Quantum object: dims = [[2], [2]], shape = (2, 2), type = oper, isherm = True Qobj data = [[-1. 0.] [ 0. -1.]]
es3 = eseries([0.5*sigmaz(), 0.5*sigmaz()], [1j, -1j]) + eseries([-0.5j*sigmax(),
0.5j*sigmax()], [1j, -1j])
es3
ESERIES object: 2 terms Hilbert space dimensions: [[2], [2]] Exponent #0 = (-0-1j) Quantum object: dims = [[2], [2]], shape = (2, 2), type = oper, isherm = False Qobj data = [[ 0.5+0.j 0.0+0.5j] [ 0.0+0.5j -0.5+0.j ]] Exponent #1 = 1j Quantum object: dims = [[2], [2]], shape = (2, 2), type = oper, isherm = False Qobj data = [[ 0.5+0.j 0.0-0.5j] [ 0.0-0.5j -0.5+0.j ]]
es3.value(0.0)
es3.value(pi/2)
rho = fock_dm(2, 1)
es3_expect = expect(rho, es3)
es3_expect
ESERIES object: 2 terms Hilbert space dimensions: [[1, 1]] Exponent #0 = (-0-1j) (-0.5+0j) Exponent #1 = 1j (-0.5+0j)
es3_expect.value([0.0, pi/2])
array([ -1.00000000e+00, -6.12323400e-17])
from qutip.ipynbtools import version_table
version_table()
Software | Version |
---|---|
QuTiP | 4.2.0 |
Numpy | 1.13.1 |
SciPy | 0.19.1 |
matplotlib | 2.0.2 |
Cython | 0.25.2 |
Number of CPUs | 2 |
BLAS Info | INTEL MKL |
IPython | 6.1.0 |
Python | 3.6.1 |Anaconda custom (x86_64)| (default, May 11 2017, 13:04:09) [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] |
OS | posix [darwin] |
Wed Jul 19 22:16:28 2017 MDT |