Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(21)  |  Call(14)  |  Derive(0)  |  Import(7)
An abstract Hilbert space for quantum mechanics.

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

Examples
========

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

src/s/y/sympy-HEAD/sympy/physics/quantum/qexpr.py   sympy(Download)
    def _eval_hilbert_space(cls, args):
        """Compute the Hilbert space instance from the args.
        """
        from sympy.physics.quantum.hilbert import HilbertSpace
        return HilbertSpace()

src/s/y/sympy-HEAD/sympy/core/tests/test_args.py   sympy(Download)
def test_sympy__physics__quantum__hilbert__HilbertSpace():
    from sympy.physics.quantum.hilbert import HilbertSpace
    assert _test_args(HilbertSpace())
 
 

src/s/y/sympy-HEAD/sympy/physics/quantum/tests/test_hilbert.py   sympy(Download)
from sympy.physics.quantum.hilbert import (
    HilbertSpace, ComplexSpace, L2, FockSpace, TensorProductHilbertSpace,
    DirectSumHilbertSpace, TensorPowerHilbertSpace
)
 
from sympy import Interval, oo, Symbol, sstr, srepr
 
 
def test_hilbert_space():
    hs = HilbertSpace()

src/s/y/sympy-HEAD/sympy/physics/quantum/tests/test_state.py   sympy(Download)
    KetBase, BraBase, StateBase, Wavefunction
)
from sympy.physics.quantum.hilbert import HilbertSpace
 
x, y, t = symbols('x,y,t')
 
    assert k.label == (Symbol('0'),)
    assert k.hilbert_space == HilbertSpace()
    assert k.is_commutative is False
 
    k = Ket(x, y)
    assert k.label == (x, y)
    assert k.hilbert_space == HilbertSpace()
    assert k.is_commutative is False
 
 
    assert b.label == (Symbol('0'),)
    assert b.hilbert_space == HilbertSpace()
    assert b.is_commutative is False
 
    b = Bra(x, y)
    assert b.label == (x, y)
    assert b.hilbert_space == HilbertSpace()
    assert b.is_commutative is False
 

src/s/y/sympy-HEAD/sympy/physics/quantum/tests/test_qexpr.py   sympy(Download)
from sympy import Symbol, Integer
from sympy.physics.quantum.qexpr import QExpr, _qsympify_sequence
from sympy.physics.quantum.hilbert import HilbertSpace
from sympy.core.containers import Tuple
 
def test_qexpr_new():
    q = QExpr(0)
    assert q.label == (0,)
    assert q.hilbert_space == HilbertSpace()
    assert q.is_commutative is False
 
    q = QExpr(0, 1)
    assert q.label == (Integer(0), Integer(1))
 
    q = QExpr._new_rawargs(HilbertSpace(), Integer(0), Integer(1))
    q = QExpr._new_rawargs(HilbertSpace(), Integer(0), Integer(1))
    assert q.label == (Integer(0), Integer(1))
    assert q.hilbert_space == HilbertSpace()
 
 
    assert q1*q2 != q2*q1
 
    q = QExpr._new_rawargs(0, 1, HilbertSpace())
    assert q.is_commutative is False
 

src/s/y/sympy-HEAD/sympy/physics/quantum/tests/test_printing.py   sympy(Download)
from sympy.physics.quantum.dagger import Dagger
from sympy.physics.quantum.gate import CGate, CNotGate, IdentityGate, UGate, XGate
from sympy.physics.quantum.hilbert import ComplexSpace, FockSpace, HilbertSpace, L2
from sympy.physics.quantum.innerproduct import InnerProduct
from sympy.physics.quantum.operator import Operator, OuterProduct, DifferentialOperator
def test_hilbert():
    h1 = HilbertSpace()
    h2 = ComplexSpace(2)
    h3 = FockSpace()
    h4 = L2(Interval(0, oo))
    e3 = Wigner3j(1, 2, 3, 4, 5, 6)*TensorProduct(Commutator(Operator('A') + Dagger(Operator('B')), Operator('C') + Operator('D')), Jz - J2)*Dagger(OuterProduct(Dagger(JzBra(1, 1)), JzBra(1, 0)))*TensorProduct(JzKetCoupled(1, 1, (1, 1)) + JzKetCoupled(1, 0, (1, 1)), JzKetCoupled(1, -1, (1, 1)))
    e4 = (ComplexSpace(1)*ComplexSpace(2) + FockSpace()**2)*(L2(Interval(
        0, oo)) + HilbertSpace())
    assert str(e1) == '(Jz**2)x(Dagger(A) + Dagger(B))*{Dagger(DifferentialOperator(Derivative(f(x), x),f(x)))**3,Dagger(A) + Dagger(B)}*(<1,0| + <1,1|)*(|0,0> + |1,-1>)'
    ascii_str = \

src/s/y/sympy-HEAD/sympy/physics/quantum/tests/test_operator.py   sympy(Download)
from sympy import (Derivative, diff, Function, Integer, Mul, pi, sin, Symbol,
                   symbols)
from sympy.physics.quantum.qexpr import QExpr
from sympy.physics.quantum.dagger import Dagger
from sympy.physics.quantum.hilbert import HilbertSpace
    assert A.label == (Symbol('A'),)
    assert A.is_commutative is False
    assert A.hilbert_space == HilbertSpace()
 
    assert A*B != B*A