braketrule

◼ braketrule[bra[i], ket[j]] defines the value of the braket ⟨i|j⟩.

◼ Wheneven a bra and a ket are juxtaposed within a nc expression and they are compatible (in the sense described in the documentation for bra), the braket is evaluated by calling braketrule.

◼ The default braketrule returns the product of KroneckerDelta symbols for each pair of compatible indexes from bra and ket.

◼ See also: nc, bra, ket.

Further examples

Load Package sneg

<< sneg`sneg`;

Default definition

?? braketrule

The kets form an orthonormal basis

k = Array[ket, 5]
b = conj[k]
Outer[nc, b, k] // MatrixForm

Define a different rule for computing brakets

Clear[braketrule];
braketrule[bra[i_Integer], ket[j_Integer]] := 
        Exp[-Abs[i - j]];
Outer[nc, b, k] // MatrixForm