QuTiP: The Quantum Toolbox in Python

5.2.3 · active · verified Thu Apr 16

QuTiP is an open-source Python library for simulating the dynamics of closed and open quantum systems. It provides user-friendly and efficient numerical simulations for a wide range of quantum mechanical problems, including those with arbitrary time-dependence, commonly found in quantum optics, trapped ions, superconducting circuits, and quantum nanomechanical resonators. The library, currently at version 5.2.3, is built upon NumPy, SciPy, and Cython for numerical backends and Matplotlib for graphical output, with regular minor and patch releases, and significant major updates.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates creating basic quantum objects (ket states and operators) and performing fundamental operations like applying an operator to a state and calculating an expectation value.

import qutip as qt

# Create a basis state |0> for a two-level system
ket0 = qt.basis(2, 0)
print(f"Ket |0>:\n{ket0}")

# Create a Pauli sigma-x operator
sigmax = qt.sigmax()
print(f"Sigma-x operator:\n{sigmax}")

# Apply the operator to the state
ket1 = sigmax * ket0
print(f"Sigma-x applied to |0> (gives |1>):\n{ket1}")

# Calculate expectation value
exp_val = qt.expect(sigmax, ket0)
print(f"Expectation value of sigma-x in |0>: {exp_val}")

view raw JSON →