Inner Product

Symbolic inner product.

class sympy.physics.quantum.innerproduct.InnerProduct(bra, ket)[source]

An unevaluated inner product between a Bra and a Ket [1].

Parameters

bra : BraBase or subclass

The bra on the left side of the inner product.

ket : KetBase or subclass

The ket on the right side of the inner product.

References

R436

http://en.wikipedia.org/wiki/Inner_product

Examples

Create an InnerProduct and check its properties:

>>> from sympy.physics.quantum import Bra, Ket, InnerProduct
>>> b = Bra('b')
>>> k = Ket('k')
>>> ip = b*k
>>> ip
<b|k>
>>> ip.bra
<b|
>>> ip.ket
|k>

In simple products of kets and bras inner products will be automatically identified and created:

>>> b*k
<b|k>

But in more complex expressions, there is ambiguity in whether inner or outer products should be created:

>>> k*b*k*b
|k><b|*|k>*<b|

A user can force the creation of a inner products in a complex expression by using parentheses to group the bra and ket:

>>> k*(b*k)*b
<b|k>*|k>*<b|

Notice how the inner product <b|k> moved to the left of the expression because inner products are commutative complex numbers.

doit(**hints)[source]

Evaluate objects that are not evaluated by default like limits, integrals, sums and products. All objects of this kind will be evaluated recursively, unless some species were excluded via ‘hints’ or unless the ‘deep’ hint was set to ‘False’.

>>> from sympy import Integral
>>> from sympy.abc import x
>>> 2*Integral(x, x)
2*Integral(x, x)
>>> (2*Integral(x, x)).doit()
x**2
>>> (2*Integral(x, x)).doit(deep=False)
2*Integral(x, x)