Esempio n. 1
0
def test_create_b():
    i, j, n, m = symbols("i,j,n,m")
    o = Bd(i)
    assert isinstance(o, CreateBoson)
    o = o.subs(i, j)
    assert o.atoms(Symbol) == {j}
    o = Bd(0)
    assert o.apply_operator(BKet([n])) == sqrt(n + 1) * BKet([n + 1])
    o = Bd(n)
    assert o.apply_operator(BKet([n])) == o * BKet([n])
Esempio n. 2
0
def test_create():
    i, j, n, m = symbols('i j n m')
    o = Bd(i)
    assert isinstance(o, CreateBoson)
    o = o.subs(i, j)
    assert o.atoms(Symbol) == set([j])
    o = Bd(0)
    assert o.apply_operator(BKet([n])) == sqrt(n+1)*BKet([n+1])
    o = Bd(n)
    assert o.apply_operator(BKet([n])) == o*BKet([n])
Esempio n. 3
0
def test_create():
    i, j, n, m = var('i j n m')
    o = Bd(i)
    assert isinstance(o, CreateBoson)
    o = o.subs(i, j)
    assert o.atoms(Symbol) == set([j])
    o = Bd(0)
    assert o.apply_operator(Ket([n])) == sqrt(n + 1) * Ket([n + 1])
    o = Bd(n)
    assert o.apply_operator(Ket([n])) == o * Ket([n])
Esempio n. 4
0
def test_create():
    i, j, n, m = symbols('i,j,n,m')
    o = Bd(i)
    assert latex(o) == "b^\\dagger_{i}"
    assert isinstance(o, CreateBoson)
    o = o.subs(i, j)
    assert o.atoms(Symbol) == {j}
    o = Bd(0)
    assert o.apply_operator(BKet([n])) == sqrt(n + 1)*BKet([n + 1])
    o = Bd(n)
    assert o.apply_operator(BKet([n])) == o*BKet([n])
Esempio n. 5
0
def test_create():
    i, j, n, m = symbols('i,j,n,m')
    o = Bd(i)
    assert latex(o) == "b^\\dagger_{i}"
    assert isinstance(o, CreateBoson)
    o = o.subs(i, j)
    assert o.atoms(Symbol) == {j}
    o = Bd(0)
    assert o.apply_operator(BKet([n])) == sqrt(n + 1)*BKet([n + 1])
    o = Bd(n)
    assert o.apply_operator(BKet([n])) == o*BKet([n])