Skip to content

dq.momentum

momentum(dim: int) -> Array

Returns the momentum operator \(p = i (a^\dag - a) / 2\).

Parameters

  • dim

    Dimension of the Hilbert space.

Returns

(array of shape (dim, dim)) Momentum operator.

Examples

>>> dq.momentum(3)
Array([[0.+0.j   , 0.-0.5j  , 0.+0.j   ],
       [0.+0.5j  , 0.+0.j   , 0.-0.707j],
       [0.+0.j   , 0.+0.707j, 0.+0.j   ]], dtype=complex64)