When there is not enough information to perform the scalar product, the result is returned unevaluated, depending on the case, in terms of the Bracket function.
When the Bra and Ket belong to the same basis, unless this basis is specified as a continuous basis by the Setup command, it is assumed that the basis is discrete, and the scalar product is returned in terms of KroneckerDelta.
In the output above, you see a Dirac delta function. If, in , the symbol does not represent a quantum operator, the operation is transformed into a commutative or noncommutative product, according to whether or not is commutative. If has been set to represent a quantum operator, or was returned as such by the Annihilation or Creation commands, then is applied to the Ket as follows:
Kets using as a label (first argument) are eigenvectors of the operator ; to identify the quantum number entered as an eigenvalue, indicate its position as an index to the operator .
Note that there is an inert form for the scalar product operation, represented, as in the case of the other Physics commands, by the operator preceded by %. The inert form is activated by using the value command.
By setting the bracket rules, you can also control the result of the corresponding scalar products; note the use of the default abbreviation for KroneckerDelta.
Note that the implementation of Physics[`.`] is that of an overloaded procedure. Thus if the arguments are not of type algebraic, for example, if they are of type Matrix, and other related packages are loaded, then the operation is automatically forwarded to these other packages. The same happens if you load the Vectors subpackage of Physics, which has its own scalar product operator, which is also implemented as an overloaded procedure. So provided that Physics or Physics[Vectors] is loaded last, these packages can be loaded together with everything working as expected.
For example, load the VectorCalculus and Physics[Vectors] packages to work with Matrix and algebraic representations of vectors, respectively.
Try performing the operations between Bra and Ket vectors belonging to spaces of quantum states: everything continues working.
Now the symbols and are algebraic representations for vectors because you loaded the Vectors package, so the following operation is automatically forwarded to be performed by that package.
Scalar product between 3-D non-projected vectors:
Algebraic sum:
In the next example, and are Matrix representation of vectors because you loaded the VectorCalculus package. This operation is automatically forwarded to be performed by that package's subroutines.
is not an algebraic object:
Vector[row](3,{1 = 1, 2 = 2, 3 = 3},datatype = anything,storage = rectangular,
order = Fortran_order,attributes = [coords = cartesian],shape = [])
| |
The Physics[`.`] operator is also a handy shortcut for performing simplification of contracted indices in tensor products. Define first some spacetime tensors.
Compare the difference between `*` and `.`
So is g_[alpha, mu] . A[mu] equivalent to Simplify(g_[alpha, mu] * A[mu], indices). This functionality is particularly useful when handling larger expressions where you want contraction to be simplified only in some places. Consider the following product
You can always Simplify the whole product, as in
Using Physics[`.`], however, you can achieve either the same, or any more selective simplification. Replacing the first `*` by `.`,
Likely (note the parenthesis to indicate the desired order of precedence between `.` and `*`)
and replacing `*` and `.` in the middle of the expression,
When one of the sides of `.` is a nested expression, the simplification of contracted indices is performed recursively, compare for instance
Set the spacetime metric to be the Schwarzschild metric and consider the contraction of all the indices of the Riemann tensor