Physics[`.`] - scalar product between Bras, Kets, and quantum operators, and simplification of contracted indices in spacetime tensors
Calling Sequence
Bra(A, ...) . Ket(B, ...)
Q . Ket(B, ...)
Bra(A, ...) . Q
A[mu, ...] . B[mu,...]
Parameters
Ket(B, ...)
-
a Ket vector; represents the quantum state of a system in Dirac's notation
Bra(A, ...)
a Bra vector; represents the quantum state of a system in Dirac's notation
Q
a quantum operator, set to be so by the Setup command, assumed to be a linear functional operator regarding Bras and Kets
A, B
both A and B a spacetime tensors defined as such with the Define command of the Physics package; to perform a simplification of the contracted (repeated) indices.
Description
The Physics[`.`] command is a computational representation for the scalar product operation between Bras, Kets, and quantum operators set to be so by the Setup command, or returned by the Annihilation, Creation, and Projector commands.
Independent of that, Physics[`.`] is also a handy shortcut for performing simplification of contracted indices in tensor products; for instance if A[mu] is Defined as a tensor, g_[mu, nu] . A[nu] returns A[mu], equivalent to performing Simplify(g_[mu, nu] * A[nu], indices) (see Simplify and the end of the Examples section).
When taking the scalar product between Bras, Kets, or quantum operator, generally speaking, two situations can happen: 1) there is not enough information to perform the operation (for example, A|B for two generic unknown Kets), in which case it is returned unevaluated; or 2) the information available permits performing the operation.
In the following situations, the scalar product is returned unevaluated:
The scalar product between a Bra and a Ket, with or without a quantum operator in between, is returned in terms of the Bracket function.
A product involving only a quantum operator and either a Ket or a Bra is returned as entered, in terms of Physics[`.`].
A product with two or more Kets only (or two or more Bras only) is returned in terms of Physics[*], and represents a state vector of the tensor product of the respective spaces.
In the following situations, the scalar product can be performed:
The Kets belong to the same basis: if the basis, represented by the Ket's first argument, is discrete, then the result involves KroneckerDelta; if the basis is continuous, then it involves the Dirac function. To indicate that a basis is continuous, use the Setup command. Remark: when the discrete or continuous character of the basis has not been set, it is assumed that the basis is discrete.
The label A, entered as the first argument of the Ket, has also been set as a quantum operator by the Setup command; for example, a Ket Ket⁡A,n,m is an eigenvector of A1 with eigenvalue n and of A2 with eigenvalue m.
The quantum operator is an annihilation or creation operator, and the Ket (or the Bra) belongs to the basis on which the operator acts.
A bracket rule, for example, for A|B or A|H|B, where H represents a generic quantum operator, has been previously set by Setup, and so determines the result.
Examples
with⁡Physics:
Setup⁡mathematicalnotation=true
mathematicalnotation=true
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.
Bra⁡A,n·Ket⁡B,m
An|Bm
Setup⁡op=H
* Partial match of 'op' against keyword 'quantumoperators'
_______________________________________________________
quantumoperators=H
Bra⁡A,n·H·Ket⁡B,m
An|H|Bm
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.
Bra⁡A,n·Ket⁡A,m
δm,n
Setup⁡continuousbasis=C
* Partial match of 'continuousbasis' against keyword 'quantumcontinuousbasis'
quantumcontinuousbasis=C
Bra⁡C,x·Ket⁡C,y
δ⁡−y+x
In the output above, you see a Dirac delta function. If, in Q·Cy, the symbol Q does not represent a quantum operator, the operation is transformed into a commutative or noncommutative product, according to whether or not Q is commutative. If Q has been set to represent a quantum operator, or was returned as such by the Annihilation or Creation commands, then Q is applied to the Ket as follows:
Q·Ket⁡C,y
Q⁢Cy
Setup⁡quantumop=Q
* Partial match of 'quantumop' against keyword 'quantumoperators'
quantumoperators=H,Q
Q·Cy
Kets using Q as a label (first argument) are eigenvectors of the operator Q; to identify the quantum number entered as an eigenvalue, indicate its position as an index to the operator Q.
Q1·Ket⁡Q,m,n
m⁢Qm,n
Q2·Ket⁡Q,m,n
n⁢Qm,n
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.
`%.`⁡Q1,Ket⁡Q,m,n
Q1·Qm,n
value⁡
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.
%Bracket⁡Bra⁡Q,m,n,Ket⁡A,r,s=A⁡q⁢kd_m,r⁢kd_n,s
Qm,n|Ar,s=A⁡q⁢δm,r⁢δn,s
Setup⁡
bracketrules=Qm,n|Ar,s=A⁡q⁢δm,r⁢δn,s
%Bracket⁡Bra⁡Q,i,j,Ket⁡A,k,l
Qi,j|Ak,l
A⁡q⁢δi,k⁢δj,l
Bra⁡Q,r,s·Ket⁡A,t,s
A⁡q⁢δr,t
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.
with⁡VectorCalculus:
with⁡Physics:-Vectors:
Try performing the operations between Bra and Ket vectors belonging to spaces of quantum states: everything continues working.
Now the symbols A_ and B_ 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:
AB≔A_·B_
AB≔A→·B→
Algebraic sum:
A_,B_≔_i+2⁢_j+3⁢_k,4⁢_i+5⁢_j+6⁢_k
A→,B→≔i∧+2⁢j∧+3⁢k∧,4⁢i∧+5⁢j∧+6⁢k∧
lprint⁡A_
_i+2*_j+3*_k
type⁡A_,algebraic
true
AB
32
In the next example, A and B are Matrix representation of vectors because you loaded the VectorCalculus package. This operation is automatically forwarded to be performed by that package's subroutines.
A_ is not an algebraic object:
A_,B_≔1|2|3,4|5|6
Vector[row](3,{1 = 1, 2 = 2, 3 = 3},datatype = anything,storage = rectangular, order = Fortran_order,attributes = [coords = cartesian],shape = [])
false
A_·B_
The Physics[`.`] operator is also a handy shortcut for performing simplification of contracted indices in tensor products. Define first some spacetime tensors.
Define⁡A,B
Defined objects with tensor properties
A,B,γμ,σμ,∂μ,gμ,ν,εα,β,μ,ν
Compare the difference between `*` and `.`
g_α,μ⁢Aμ
Aμ⁢δαμαμ
g_α,μ·Aμ
Aα
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
g_α,μ⁢Aμ⁢g_α,ν⁢Bν
Aμ⁢Bν⁢δαμαμ⁢g⁢α,ν⁢α,ν
You can always Simplify the whole product, as in
Simplify⁡,indices
Aν⁢B⁢ν⁢ν
Using Physics[`.`], however, you can achieve either the same, or any more selective simplification. Replacing the first `*` by `.`,
g_α,μ·Aμ⁢g_α,ν⁢Bν
Aα⁢Bν⁢g⁢α,ν⁢α,ν
Likely (note the parenthesis to indicate the desired order of precedence between `.` and `*`)
g_α,μ⁢Aμ⁢g_α,ν·Bν
Bα⁢Aμ⁢g⁢α,μ⁢α,μ
and replacing `*` and `.` in the middle of the expression,
g_α,μ⁢Aμ·g_α,ν⁢Bν
When one of the sides of `.` is a nested expression, the simplification of contracted indices is performed recursively, compare for instance
g_α,μ⁢Aμ+Bμ
Aμ+Bμ⁢δαμαμ
g_α,μ·Aμ+Bμ
Aα+Bα
Set the spacetime metric to be the Schwarzschild metric and consider the contraction of all the indices of the Riemann tensor
g_sc
⁢_______________________________________________________
⁢Systems of spacetime coordinates are:⁢X=r,θ,φ,t
⁢Default differentiation variables for d_, D_ and dAlembertian are:⁢X=r,θ,φ,t
Setting lowercaselatin_is letters to represent space indices
⁢The Schwarzschild metric in coordinates ⁢r,θ,φ,t
Parameters: m
Signature: - - - +
gμ,ν=
Riemannα,β,μ,ν⁢Riemannα,β,μ,ν
Rα,β,μ,ν⁢R⁢α,β,μ,ν⁢α,β,μ,ν
Riemannα,β,μ,ν·Riemannα,β,μ,ν
48⁢m2r6
See Also
`*`, Bra, Bracket, Define, g_, Ket, lprint, Physics, Physics conventions, Physics examples, Physics Updates, Tensors - a complete guide, Mini-Course Computer Algebra for Physicists, Physics[Vectors], Riemann, Setup, Simplify, VectorCalculus
References
Cohen-Tannoudji, C.; Diu, B.; and Laloe, F. Quantum Mechanics. Chapter II. Paris, France: Hermann, 1977.
Download Help Document