# Hilbert Space¶

Hilbert spaces for quantum mechanics.

Authors: * Brian Granger * Matt Curry

class sympy.physics.quantum.hilbert.HilbertSpace[source]

An abstract Hilbert space for quantum mechanics.

In short, a Hilbert space is an abstract vector space that is complete with inner products defined [R73].

References

Examples

>>> from sympy.physics.quantum.hilbert import HilbertSpace
>>> hs = HilbertSpace()
>>> hs
H

dimension[source]

Return the Hilbert dimension of the space.

class sympy.physics.quantum.hilbert.ComplexSpace[source]

Finite dimensional Hilbert space of complex vectors.

The elements of this Hilbert space are n-dimensional complex valued vectors with the usual inner product that takes the complex conjugate of the vector on the right.

A classic example of this type of Hilbert space is spin-1/2, which is ComplexSpace(2). Generalizing to spin-s, the space is ComplexSpace(2*s+1). Quantum computing with N qubits is done with the direct product space ComplexSpace(2)**N.

Examples

>>> from sympy import symbols
>>> from sympy.physics.quantum.hilbert import ComplexSpace
>>> c1 = ComplexSpace(2)
>>> c1
C(2)
>>> c1.dimension
2

>>> n = symbols('n')
>>> c2 = ComplexSpace(n)
>>> c2
C(n)
>>> c2.dimension
n

class sympy.physics.quantum.hilbert.L2[source]

The Hilbert space of square integrable functions on an interval.

An L2 object takes in a single sympy Interval argument which represents the interval its functions (vectors) are defined on.

Examples

>>> from sympy import Interval, oo
>>> from sympy.physics.quantum.hilbert import L2
>>> hs = L2(Interval(0,oo))
>>> hs
L2([0, oo))
>>> hs.dimension
oo
>>> hs.interval
[0, oo)

class sympy.physics.quantum.hilbert.FockSpace[source]

The Hilbert space for second quantization.

Technically, this Hilbert space is a infinite direct sum of direct products of single particle Hilbert spaces [R74]. This is a mess, so we have a class to represent it directly.

References

Examples

>>> from sympy.physics.quantum.hilbert import FockSpace
>>> hs = FockSpace()
>>> hs
F
>>> hs.dimension
oo


#### Previous topic

Cartesian Operators and States

Operator