#### Previous topic

Model Hamiltonians (qit.hamiltonian)

#### Next topic

Local invariants (qit.invariant)

# Harmonic oscillators (qit.ho)¶

This module simulates harmonic oscillators by truncating the state space dimension to a finite value. Higher truncation limits give more accurate results. All the functions in this module operate in the truncated number basis of the harmonic oscillator, where n is the truncation dimension.

The corresponding truncated annihilation operator can be obtained with qit.utils.boson_ladder.

## Contents¶

 coherent_state(alpha[, n]) Coherent states of a harmonic oscillator. position_state(q[, n]) Position eigenstates of a harmonic oscillator. momentum_state(p[, n]) Momentum eigenstates of a harmonic oscillator. position([n]) Position operator. momentum([n]) Momentum operator. displace(alpha[, n]) Bosonic displacement operator. squeeze(z[, n]) Bosonic squeezing operator. husimi(s[, alpha, z, res, lim]) Husimi probability distribution. wigner(s[, alpha, res, lim]) Wigner quasi-probability distribution.
qit.ho.coherent_state(alpha, n=30)

Coherent states of a harmonic oscillator.

Returns the n-dimensional approximation to the coherent state ,

in the number basis. .

qit.ho.displace(alpha, n=30)

Bosonic displacement operator.

Returns the n-dimensional approximation for the bosonic displacement operator

in the number basis. This yields

and thus the displacement operator displaces the state of a harmonic oscillator in phase space.

qit.ho.squeeze(z, n=30)

Bosonic squeezing operator.

Returns the n-dimensional approximation for the bosonic squeezing operator

in the number basis.

qit.ho.position(n=30)

Position operator.

Returns the n-dimensional approximation of the dimensionless position operator Q in the number basis.

(Equivalently, ). These operators fulfill . The Hamiltonian of the harmonic oscillator is

qit.ho.momentum(n=30)

Momentum operator.

Returns the n-dimensional approximation of the dimensionless momentum operator P in the number basis.

See position.

qit.ho.position_state(q, n=30)

Position eigenstates of a harmonic oscillator.

Returns the n-dimensional approximation of the eigenstate of the dimensionless position operator Q in the number basis.

See position, momentum.

Difference equation:

qit.ho.momentum_state(p, n=30)

Momentum eigenstates of a harmonic oscillator.

Returns the n-dimensional approximation of the eigenstate of the dimensionless momentum operator P in the number basis.

See position, momentum.

Difference equation:

qit.ho.husimi(s, alpha=None, z=0, res=(40, 40), lim=(-2, 2, -2, 2))

Husimi probability distribution.

H       = husimi(s, alpha[, z=])
H, a, b = husimi(s, res=xxx, lim=yyy[, z=])


Returns the Husimi probability distribution corresponding to the harmonic oscillator state s given in the number basis:

z is the optional squeezing parameter for the reference state: . The integral of H is normalized to unity.

qit.ho.wigner(s, alpha=None, res=(20, 20), lim=(-2, 2, -2, 2))

Wigner quasi-probability distribution.

W       = wigner(s, alpha)
W, a, b = wigner(s, res=xxx, lim=yyy)


Returns the Wigner quasi-probability distribution corresponding to the harmonic oscillator state s given in the number basis.

For a normalized state, the integral of W is normalized to unity.

NOTE: The truncation of the number state space to a finite dimension results in spurious circular ripples in the Wigner function outside a given radius. To increase the accuracy, increase the state space dimension.