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].


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.


Create an InnerProduct and check its properties:

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

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

>>> b*k

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

>>> 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

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