Physics[Simplify] - simplify expressions involving objects and operations related to the Physics package
Calling Sequence
Simplify(A)
Simplify(A, kind1, kind2, ...)
Parameters
A
-
any mathematical expression
kind1, kind2, ...
(optional) any of algebrarules, indices, noncommutativeproducts, sum, int; the kind of simplification to perform
Description
The Simplify command performs simplifications of expressions involving objects and operations related to the Physics package, including taking into account:
- The summation convention for repeated indices, regarding them as dummies, and including the (anti)symmetry properties of the indices of the tensorial objects involved (according to how these objects were defined by the Define command).
- Properties of noncommutative products.
- (Anti)Commutator algebra rules.
- Projectors and KroneckerDelta contracted indices inside sums.
As with the general Maple simplifier, simplify, when you call the Physics[Simplify] command with no extra arguments, all of the simplifications are attempted. When you call it with extra arguments specifying different simplifications, any of algebrarules, bracketrules, indices, noncommutativeproducts, sum, and int, only the specified simplifications are attempted.
You do not need to remember exactly all of the keywords; as with other Physics commands, Simplify will match wrong or partially spelled keywords to the first likely one, and perform the simplification. For example, Simplify(expr, alg) will invoke Simplify(expr, algebrarules).
Examples
with⁡Physics:
Setup⁡mathematicalnotation=true
mathematicalnotation=true
Summation rule for repeated indices
By default, the dimension of the spacetime when you load the Physics package is 4 = 3 + 1, and the signature is `-`.
Setup⁡dimension,signature
dimension=4,signature=- - - +
So the trace of the metric g_ is equal to 4.
g_ν,μ2
gμ,ν⁢g⁢μ,ν⁢μ,ν
Simplify⁡
4
The metric is used to 'raise and lower' indices in other tensors, as shown below.
g_ν,μ⁢g_ν,ρ
gμ,ν⁢δ⁢νρ⁢νρ
gμ,ρ
Define A as an object having tensorial properties; that is, the summation convention for repeated indices in products should be taken into account.
Define⁡A
Defined objects with tensor properties
A,γμ,σμ,∂μ,gμ,ν,εα,β,μ,ν
So the metric can now have indices contracted with A.
g_ν,μ⁢g_ρ,σ⁢Aν,μ,ρ,σ
Aν,μ,ρ,σ⁢g⁢μ,ν⁢μ,ν⁢g⁢ρ,σ⁢ρ,σ
Aννσσννσσ
The metric is totally symmetric with respect to interchange of positions of its indices, while the LeviCivita symbol, in the Maple worksheet displayed as epsilon, is totally antisymmetric. So the contraction of their respective indices is equal to zero.
g_ν,μ⁢LeviCivitaν,μ,σ,ρ
εμ,ν,ρ,σ⁢g⁢μ,ν⁢μ,ν
0
For the same reason, the contraction of any two of the indices of the LeviCivita symbol is also zero.
LeviCivitaν,ν,ρ,σ
As is the product of the LeviCivita symbol, where the same spacetime vector appears two times, contracting different indices of epsilon. To illustrate this case, first Define q to represent this generic tensor.
Define⁡q
q,Aν,μ,ρ,σ,γμ,σμ,∂μ,gμ,ν,εα,β,μ,ν
LeviCivitaν,μ,σ,ρ⁢qμ⁢qν
εμ,ν,ρ,σ⁢q⁢μ⁢μ⁢q⁢ν⁢ν
When defining an object to have tensorial properties, you can define the symmetry properties of the indices of the object as well. The following Defines B and C as totally symmetric and totally antisymmetric, respectively.
Define⁡B,symmetric
B,Aν,μ,ρ,σ,γμ,σμ,∂μ,gμ,ν,q⁢ν⁢ν,εα,β,μ,ν
Define⁡C,antisymmetric
B,C,Aν,μ,ρ,σ,γμ,σμ,∂μ,gμ,ν,q⁢ν⁢ν,εα,β,μ,ν
Bμ,ν⁢LeviCivitaν,μ,σ,ρ
εμ,ν,ρ,σ⁢B⁢μ,ν⁢μ,ν
Define⁡B,query
Totally symmetric tensor, structured as name,indices,variables :
B,2,0,0,0
Cμ,ν⁢g_ν,μ
gμ,ν⁢C⁢μ,ν⁢μ,ν
Define⁡C,query
Totally antisymmetric tensor, structured as name,indices,variables :
C,2,0,0,0
Bμ,ν⁢Cμ,ν
Bμ,ν⁢C⁢μ,ν⁢μ,ν
The number of indices of the LeviCivita symbol depends on the dimension of spacetime. For any dimension and signature, the contracted product of two LeviCivita symbols can be expressed as a sum of products involving the metric g_. Note the use of Check to tell which indices are repeated (contracted) and which are free at any point.
LeviCivitaν,μ,α,β⁢LeviCivitaμ,σ,ρ,τ
εα,β,μ,ν⁢ε⁢μρ,σ,τ⁢μρ,σ,τ
Check⁡,indices,all
The repeated indices per term are: ...,...,..., the free indices are: ...
μ,α,β,ν,ρ,σ,τ
−gα,ρ⁢gβ,σ+gα,σ⁢gβ,ρ⁢gν,τ−gα,σ⁢gβ,τ⁢gν,ρ+gα,τ⁢gβ,σ⁢gν,ρ−gα,τ⁢gβ,ρ⁢gν,σ+gα,ρ⁢gβ,τ⁢gν,σ
LeviCivitaν,μ,σ,ρ⁢LeviCivitaν,μ,α,β
−εα,β,μ,ν⁢ε⁢μ,νρ,σ⁢μ,νρ,σ
μ,ν,α,β,ρ,σ
2⁢gα,ρ⁢gβ,σ−2⁢gα,σ⁢gβ,ρ
LeviCivitaν,μ,α,σ⁢LeviCivitaν,μ,α,β
εα,μ,ν,σ⁢ε⁢αβμ,ν⁢αβμ,ν
α,μ,ν,β,σ
−6⁢gβ,σ
LeviCivitaν,μ,α,β2
εα,β,μ,ν⁢ε⁢α,β,μ,ν⁢α,β,μ,ν
α,β,μ,ν,∅
−24
Note that the results above are different if the dimension or signature of spacetime are different from 4 and `-`, respectively.
During normal computations, a frequent occurrence is when two products have tensors with the same contracted indices, but in each product the contracted indices are represented by different letters, thus obscuring the fact that the two products are mathematically equal.
Define⁡F,quiet
F,Aν,μ,ρ,σ,B⁢μ,ν⁢μ,ν,Cμ,ν,γμ,σμ,∂μ,gμ,ν,q⁢ν⁢ν,εα,β,μ,ν
Fμ,ν⁢Cν,ρ+Fμ,α⁢Cα,ρ
Cα,ρ⁢Fμαμα+Cν,ρ⁢Fμνμν
α,ν,μ,ρ
2⁢Cα,ρ⁢Fμαμα
The following example would be a little trickier to tell.
Define⁡Aμ,Cμ,redo,quiet
Aμ,B⁢μ,ν⁢μ,ν,Cμ,γμ,Fμαμα,σμ,∂μ,gμ,ν,q⁢ν⁢ν,εα,β,μ,ν
Define⁡query,A,C
Tensors structured as name,indices,variables:
A,1,0,0,0,C,1,0,0,0
LeviCivitaν,μ,α,σ⁢LeviCivitaν,μ,α,β⁢Aβ⁢Cσ−Aσ⁢Cβ
Aβ⁢Cσ−Aσ⁢Cβ⁢εα,μ,νσα,μ,νσ⁢ε⁢α,β,μ,ν⁢α,β,μ,ν
Sums, KroneckerDelta, and Projectors
Expressions involving sums with KroneckerDelta indices contracted or with Projectors in the summand, and integrals involving Dirac functions, are simplifiable by using Simplify.
Consider a basis, labeled A, whose dimension is M+1.
Setup⁡basisdim=A=0..M
* Partial match of 'basisdim' against keyword 'quantumbasisdimension'
_______________________________________________________
quantumbasisdimension=A=0..M
The projector onto this basis is:
Projector⁡Ket⁡A,j
∑j=0M⁡Aj⁢Aj
So this expression,
Sum⁡Bracket⁡Bra⁡Ψ,n,Ket⁡A,j⁢Bracket⁡Bra⁡A,j,Ket⁡Ψ,m,j=0..M
∑j=0M⁡Ψn|Aj⁢Aj|Ψm
where you see the projector inserted in the Bracket, can be simplified to:
δm,n
Expressions involving Sums with KroneckerDelta in the summand, provided that the indices in KroneckerDelta are inside the summation range (you can use assuming to enforce that), are also simplifiable.
Sum⁡Sum⁡Sum⁡Sum⁡conjugate⁡an,i⁢ai,m⁢KroneckerDeltai,j⁢KroneckerDeltam,n,j=0..M,i=0..M,n=0..M,m=0..M
∑m=0M⁡∑n=0M⁡∑i=0M⁡∑j=0M⁡an,i&conjugate0;⁢ai,m⁢δi,j⁢δm,n
∑m=0M⁡∑i=0M⁡am,i&conjugate0;⁢ai,m
In the following example, both simplifications are used together.
Sum⁡Sum⁡Sum⁡Sum⁡conjugate⁡an,i⁢ai,m⁢Bracket⁡Bra⁡Ψ,n,Ket⁡A,j⁢Bracket⁡Bra⁡A,j,Ket⁡Ψ,m,j=0..M,i=0..M,n=0..M,m=0..M
∑m=0M⁡∑n=0M⁡∑i=0M⁡∑j=0M⁡an,i&conjugate0;⁢ai,m⁢Ψn|Aj⁢Aj|Ψm
Noncommutative products and (Anti)Commutator algebras
Two different kinds of simplifications are available: a normalization of products involving noncommutative operands some of which commute between themselves (that have Commutator equal to zero), and a simplification taking into account (Anti)Commutator rules (that have (Anti)Commutator not equal to zero). These simplifications are frequently required, for example, when deriving the Commutator algebra of problems involving angular momentum or Annihilation/Creation operators.
1. Consider the angular momentum operators |L|, Lx,Ly, and Lz in quantum mechanics. Verify that the Commutator of |L|^2 with any of the components of L is equal to zero (see for instance Chapter VI of the reference, below). For that purpose, a 3-D vector-quantum-operator representation of L is constructed with the Vectors package (vectorpostfix identifier is '_'), setting L, Lx,Ly,Lz, r, and p, as well as their components, as quantum operators.
with⁡Physics:-Vectors
&x,`+`,`.`,Assume,ChangeBasis,ChangeCoordinates,CompactDisplay,Component,Curl,DirectionalDiff,Divergence,Gradient,Identify,Laplacian,∇,Norm,ParametrizeCurve,ParametrizeSurface,ParametrizeVolume,Setup,Simplify,`^`,diff,int
Setup⁡quantumoperators=L_,Lx,Ly,Lz,p_,px,py,pz,r_,x,y,z
quantumoperators=L→,Lx,Ly,Lz,p→,px,py,pz,r→,x,y,z
So for |L|^2 and L itself in terms of the vector operators r and p, you have:
LL≔L_·L_
LL≔L→·L→
L_≔r_&xp_
L→≔r→×p→
where
r_≔x⁢_i+y⁢_j+z⁢_k
r→≔i∧⁢x+j∧⁢y+k∧⁢z
p_≔px⁢_i+py⁢_j+pz⁢_k
p→≔i∧⁢px+j∧⁢py+k∧⁢pz
The Commutator rules for the components Li are a consequence of the Commutator rules for the components of r and p. These rules can be set by using the Setup command, entering all of the commutators between any two of {x,y,z,px,py,pz}, as in Setup⁡algebrarules={%Commutator⁡x,px=I,%Commutator⁡x,py=0,%Commutator⁡x,y=0,...}. A convenient alternative for situations such as this is to create an indexing procedure for a Matrix. For example,
C≔a,i,b,j↦%Commutator⁡Component⁡a,i,Component⁡b,j
C≔a,i,b,j↦ai,bj−
algebra≔i,j↦C⁡r_,i,p_,j=I⋅KroneckerDeltai,j,C⁡r_,i,r_,j=0,C⁡p_,i,p_,j=0
algebra≔i,j↦C⁡r→,i,p→,j=I⁢δi,j,C⁡r→,i,r→,j=0,C⁡p→,i,p→,j=0
The commutators are then generated by the Matrix constructor, and the whole Matrix can be passed to Setup.
Matrix⁡3,3,algebra
Setup⁡
algebrarules=px,py−=0,px,pz−=0,py,pz−=0,x,px−=I,x,py−=0,x,pz−=0,x,y−=0,x,z−=0,y,px−=0,y,py−=I,y,pz−=0,y,z−=0,z,px−=0,z,py−=0,z,pz−=I
The components of L are:
Lx≔Component⁡L_,1
Lx≔y⁢pz−z⁢py
Ly≔Component⁡L_,2
Ly≔z⁢px−x⁢pz
Lz≔Component⁡L_,3
Lz≔x⁢py−y⁢px
To verify that |L|^2=LL commutes with each Li,
%Commutator⁡LL,Lx
y⁢pz−z⁢py2+z⁢px−x⁢pz2+x⁢py−y⁢px2,y⁢pz−z⁢py−
value⁡
Commutator⁡LL,Ly
Commutator⁡LL,Lz
Depending on the case, an expansion of the Commutator is sometimes necessary to verify its value is 0, or to take the commutator rules into account in all subexpressions use Simplify.
2. Using a quantum-operator-tensor notation for the components of L, show that [Li,Lj]=I⁢epsilon[i,j,k]⁢Lk (see the exercises of Chap VI in Cohen-Tannoudji). For this purpose, set the dimension of spacetime to 3, and its signature to Euclidean. To follow textbook notation, also use lowercaselatin letters for space tensor indices (see Setup).
Setup⁡dimension=3,signature=`+`,spacetimeindices=lowercaselatin_is,spaceindices=none,quiet
dimension=3,signature=+ + +,spaceindices=none,spacetimeindices=lowercaselatin_is
Define r and p as tensors in this 3-D Euclidean space to be able to Simplify the result by using Einstein's summation convention for repeated (tensor) indices.
Define⁡r,p
p,r,γi,σi,∂i,gi,j,εi,j,k
Now set the related Commutator rules defining the algebra in tensor notation; in doing so, erase also previous settings (by using the redo option of Setup) for quantum operators and algebra rules (not necessary here, but sometimes desired).
Setup⁡redo,quantumoperators=L,p,r,algebrarules=%Commutator⁡pi,pj=0,%Commutator⁡ri,pj=I⁢kd_i,j,%Commutator⁡ri,rj=0
algebrarules=pi,pj−=0,ri,pj−=I⁢δi,j,ri,rj−=0,quantumoperators=L,p,r
Verify how this algebra of Commutators works.
%Commutator⁡rj,pk
rj,pk−
I⁢δj,k
Commutator⁡rj⁢pk,rm⁢pm
−I⁢δk,m⁢rj⁢pm+I⁢δj,m⁢rm⁢pk
Enter expressions for the tensor components of L that enter the commutator Li,Lj, to verify that it is equal to I⁢epsilon[i,j,k]⁢Lk. In doing so, use the default abbreviation ε for the LeviCivita pseudo-tensor.
Li≔ep_i,m,n⁢rm⁢pn
Li≔εi,m,n⁢rm⁢pn
Lj≔subs⁡i=j,Li
Lj≔εj,m,n⁢rm⁢pn
Compute the Commutator.
ans≔Commutator⁡Li,Lj
ans≔εi,m,n⁢εj,k,l⁢−I⁢δk,n⁢rm⁢pl+I⁢δl,m⁢rk⁢pn
The above is indeed Lk, but is missing some simplification of the contracted indices of the LeviCivita and KroneckerDelta tensors, and the indices of the quantum operators r,p involved in the noncommutative products.
Simplify⁡ans
−I⁢rj⁢pi−ri⁢pj
See Also
&x, Bra, Bracket, Check, Component, Define, g_, Ket, KroneckerDelta, LeviCivita, Physics, Physics conventions, Physics examples, Physics Updates, Tensors - a complete guide, Mini-Course Computer Algebra for Physicists, Projector, Setup, Vectors
References
Cohen-Tannoudji, C.; Diu, B.; and Laloe, F. Quantum Mechanics. Paris, France: Hermann, 1977.
Download Help Document