コード例 #1
0
ファイル: test_qexpr.py プロジェクト: msgoff/sympy
def test_qexpr_commutative():
    q1 = QExpr(x)
    q2 = QExpr(y)
    assert q1.is_commutative is False
    assert q2.is_commutative is False
    assert q1 * q2 != q2 * q1

    q = QExpr._new_rawargs(0, 1, HilbertSpace())
    assert q.is_commutative is False
コード例 #2
0
ファイル: test_qexpr.py プロジェクト: msgoff/sympy
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))
    assert q.label == (Integer(0), Integer(1))
    assert q.hilbert_space == HilbertSpace()
コード例 #3
0
def test_qexpr():
    q = QExpr('q')
    assert str(q) == 'q'
    assert pretty(q) == 'q'
    assert upretty(q) == u'q'
    assert latex(q) == r'q'
    sT(q, "QExpr(Symbol('q'))")
コード例 #4
0
def test_qexpr():
    q = QExpr("q")
    assert str(q) == "q"
    assert pretty(q) == "q"
    assert upretty(q) == u"q"
    assert latex(q) == r"q"
    sT(q, "QExpr(Symbol('q'))")
コード例 #5
0
ファイル: test_qexpr.py プロジェクト: A-turing-machine/sympy
def test_qexpr_commutative():
    q1 = QExpr(x)
    q2 = QExpr(y)
    assert q1.is_commutative is False
    assert q2.is_commutative is False
    assert q1*q2 != q2*q1

    q = QExpr._new_rawargs(0, 1, HilbertSpace())
    assert q.is_commutative is False
コード例 #6
0
ファイル: test_qexpr.py プロジェクト: A-turing-machine/sympy
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))
    assert q.label == (Integer(0), Integer(1))
    assert q.hilbert_space == HilbertSpace()
コード例 #7
0
ファイル: spin.py プロジェクト: devs1991/test_edx_docmode
 def _eval_args(cls, args):
     args = QExpr._eval_args(args)
     if len(args) != 3:
         raise ValueError('3 Euler angles required, got: %r' % args)
     return args
コード例 #8
0
ファイル: sho1d.py プロジェクト: ChaliZhg/sympy
 def _eval_args(cls, args):
     args = QExpr._eval_args(args)
     if len(args) == 1:
         return args
     else:
         raise ValueError("Too many arguments")
コード例 #9
0
ファイル: spin.py プロジェクト: hitej/meta-core
 def _eval_args(cls, args):
     args = QExpr._eval_args(args)
     if len(args) != 3:
         raise ValueError("3 Euler angles required, got: %r" % args)
     return args
コード例 #10
0
ファイル: test_args.py プロジェクト: Visheshk/sympy
def test_sympy__physics__quantum__qexpr__QExpr():
    from sympy.physics.quantum.qexpr import QExpr
    assert _test_args(QExpr(0))
コード例 #11
0
ファイル: qft.py プロジェクト: Aang/sympy
 def _eval_args(cls, args):
     # Fall back to this, because Gate._eval_args assumes that args is
     # all targets and can't contain duplicates.
     return QExpr._eval_args(args)
コード例 #12
0
ファイル: qft.py プロジェクト: ness01/sympy
 def _eval_args(cls, args):
     # Fall back to this, because Gate._eval_args assumes that args is
     # all targets and can't contain duplicates.
     return QExpr._eval_args(args)
コード例 #13
0
 def _eval_args(cls, args):
     args = QExpr._eval_args(args)
     if len(args) == 1:
         return args
     else:
         raise ValueError("Too many arguments")
コード例 #14
0
ファイル: test_qexpr.py プロジェクト: msgoff/sympy
def test_qexpr_subs():
    q1 = QExpr(x, y)
    assert q1.subs(x, y) == QExpr(y, y)
    assert q1.subs({x: 1, y: 2}) == QExpr(1, 2)
コード例 #15
0
ファイル: test_qexpr.py プロジェクト: msgoff/sympy
def test_qexpr_commutative_free_symbols():
    q1 = QExpr(x)
    assert q1.free_symbols.pop().is_commutative is False

    q2 = QExpr("q2")
    assert q2.free_symbols.pop().is_commutative is False
コード例 #16
0
ファイル: test_qexpr.py プロジェクト: A-turing-machine/sympy
def test_qexpr_subs():
    q1 = QExpr(x, y)
    assert q1.subs(x, y) == QExpr(y, y)
    assert q1.subs({x: 1, y: 2}) == QExpr(1, 2)