Physics
Maple provides a state-of-the-art environment for algebraic computations in Physics, with emphasis on ensuring that the computational experience is as natural as possible. The theme of the Physics project for Maple 2019 has been the consolidation of the functionality introduced in previous releases, together with significant enhancements to further strengthen the functionality mainly in three areas:
Quantum Mechanics: coherent states, tensor products of states, taylor series of expressions involving anticommutative variables and functions, and several improvements in the normalization and simplification of Commutator and AntiCommutator algebra rules.
Tensor computations in general, making Maple 2019 unmatched in the field, covering classical and quantum mechanics, and special and general relativity, using natural tensor input notation and textbook-like display of results. The functionality for tensors is tightly integrated with the full Maple computation system and extensively documented in "A Complete Guide for performing tensor computations using Physics".
Documentation: besides the new guide for tensor computations, two other new pages, linked in all the help pages of Physics commands, are
Physics Updates organizes and presents in one place all formerly scattered links to updates and presentations with examples on the use of Physics.
Mini-Course: Computer Algebra for Physicists, is a course that can be used as a tutorial, with 10 sections to be covered in 5 hands-on guided experiences of 2 hours each. The first part, 5 sections, is about Maple 101, while the remaining 5 sections is all about using the Physics package.
Overall, the enhancements throughout the entire package increase robustness, versatility and functionality, extending furthermore the range of Physics-related algebraic computations that can be done naturally in a worksheet. The presentation below illustrates both the novelties and the kind of mathematical formulations that can now be performed.
As part of its commitment to providing the best possible environment for algebraic computations in Physics, Maplesoft launched a Maple Physics: Research and Development website with Maple 18, which enabled users to download research versions, ask questions, and provide feedback. The results from this accelerated exchange with people around the world have been incorporated into the Physics package in Maple 2019.
Tensor product of Quantum States using Dirac's Bra-Ket Notation
Coherent States in Quantum Mechanics
The Zassenhaus formula and the algebra of the Pauli matrices
Multivariable Taylor series of expressions involving anticommutative (Grassmannian) variables
New SortProducts command
Documentation: "Physics updates", "A complete guide for performing tensor computations" and the "Mini-Course: Computer Algebra for Physicists"
Simplification of tensors, Pauli and Dirac matrices and KroneckerDelta
See Also
Tensor products of Hilbert spaces and related quantum states are relevant in a myriad of situations in quantum mechanics, and in particular regarding quantum information. Tensor products are key in the mathematical formulation of entanglement. Below is a presentation of the design and implementation introduced in Maple 2019, with input/output and examples, organized in four sections:
The basic ideas and design
Tensor product notation and the hideketlabel option
Entangled States and the Bell basis
Entangled States, Operators and Projectors
References
[1] Cohen-Tannoudji, C.; Diu, B.; and Laloe,F. Quantum Mechanics, Chapter 2, section F.
[2] Griffiths, Robert B. Hilbert Space Quantum Mechanics. Quantum Computation and Quantum Information Theory Course, Physics Department, Carnegie Mellon University, 2014.
The basic ideas and design implemented in Maple 2019
Suppose A and B are quantum operators and Aα,Bβ are, respectively, their eigenkets. The following works since the introduction of the Physics package in Maple
withPhysics:
Setupop=A,B
* Partial match of 'op' against keyword 'quantumoperators'
_______________________________________________________
quantumoperators=A,B
A ⋅ KetA,alpha = A . KetA,alpha
A⁢Aα=α⁢Aα
B ⋅ KetB,beta = B . KetB,beta
B⁢Bβ=β⁢Bβ
In previous Maple releases, all quantum operators are supposed to act on the same Hilbert space. New in Maple 2019: suppose that A and B act on different, disjointed, Hilbert spaces.
1) To represent that situation, a new keyword in Setup, hilbertspaces, is introduced. With it you can indicate the quantum operators that act on a Hilbert space, say as in hilbertspaces=A,B with the meaning that the operator A acts on one Hilbert space while B acts on another one.
The Hilbert space thus has no particular name (as in 1, 2, 3 ...) and is instead identified by the operators that act on it. There can be one or more, and operators acting on one space can act on other spaces too. The disjointedspaces keyword is a synonym for hilbertspaces and hereafter all Hilbert spaces are assumed to be disjointed.
NOTE: noncommutative quantum operators acting on disjointed spaces commute between themselves, so after setting - for instance - hilbertspaces=A,B, automatically, A,B become quantum operators satisfying (see comment (ii) on page 156 of ref.[1])
A,B−=0
2) Product of Kets and Bras that belong to different Hilbert spaces are understood as tensor products satisfying (see footnote on page 154 of ref.[1]):
Aα⊗⁢Bβ=Bβ⊗⁢Aα
Aα⊗⁢Bβ=Bβ⁢⊗Aα
while
Aα⁢Aβ≠Aβ⁢Aα
3) All the operators of one Hilbert space act transparently over operators, Bras, and Kets of other Hilbert spaces. For example
A⁢Bn=Bn⁢A
and the same for the Dagger of this equation, that is
Bn⁢A†=A†⁢Bn
Hence, when we write the left-hand sides of the two equations above and press enter, they are automatically rewritten (returned) as the right-hand sides.
4) Every other quantum operator, set as such using Setup, and not indicated as acting on any particular Hilbert space, is assumed to act on all spaces.
5) Notation:
Tensor products formed with operators, or Bras and Kets belonging to different Hilbert spaces (set as such using Setup and the keyword hilbertspaces), are now displayed with the symbol ⊗ in between, as in An⊗⁢Bn instead of An⁢Bn, and A⁢⊗B instead of A⁢B. The product of an operator A of one space and a Ket of another space Bn however, is displayed ⁢ BnA, without ⊗.
A new Setup option hideketlabel , makes all the labels in Kets and Bras to be hidden when displaying Kets, Bras, and Bracket, so when you set it entering Setup⁡hideketlabel=true,
Am,n,l
is displayed as
m,n,l
This is the notation frequently used when working with angular momentum or in quantum information, where tensor products of Hilbert spaces are used.
Design details
The commutativity of the eigenkets of A and B is consistent with A,B−=0, see footnote on page 154 of ref. [1].
Taking advantage of this commutativity of Bras and Kets belonging to disjointed spaces, during the computer algebra session (on the worksheet) the ordering of their products in the output happens automatically and systematically, it is always the same, and according to the following rules: suppose there are two Hilbert subspaces, then:
Within a product, contiguous Kets are grouped per Hilbert subspace
The Hilbert subspaces are ordered by sorting, alphabetically, the operators that act on that subspace.
Example: if one Hilbert subspace has operators A,E acting on it and the other has operators B,C then a product of contiguous eigenkets of these operators is sorted as
A⊗E⊗B⊗C
Where the first pair of Kets belong to the first Hilbert subspace and the other pair to the second subspace, and where the first subspace is the one whose operands are alphabetically sorted first than the operands of the second subspace (in this example A is sorted before B) and within a subspace, the Kets are also sorted alphabetically (so A before E, then in the second subspace B before C).
Regarding the notation for the Dagger of a tensor product of states, say Aα⊗Bβ† the standard convention for tensor products is to preserve the order, as in Aα⊗Bβ†=Aα⊗Bβ representing an exception to the “reverse the order” rule of the Dagger operation. This is conventional, in that Kets and Bras belonging to disjointed spaces actually commute. This convention, however is notationally important for two reasons
1. Frequently, tensor product of states are written not as a product of Kets but as a single ket with many quantum numbers (multidimensional Hilbert space), for example as Cα,β, and Cα,β†as Cα,β, that is, preserving the order of the quantum numbers, the first index refers to the first Hilbert subspace and the second index to the other one, in both the Ket and the Bra (its Dagger). So, when these multi-index Kets can be expressed as tensor products, the ordering of the Hilbert subspaces is preserved.
2. This preservation of the ordering of the Hilbert subspaces in a tensor product of Kets is also relevant in connection with the new Setup keyword hideketlabel, which requires the ordering of subspaces to be preserved in order to have non-ambiguous notation when the quantum numbers of Kets belonging to identical subspaces (e.g. qubits) are the same.
Example: we know that
A0⊗B1≠B0⊗A1
In the left-hand and right-hand sides of the expression above, the ordering of the Hilbert subspaces is not the same. If we now omit the labels A and B, we would have
0⊗1≠0⊗1
which would be misleading. Likewise,
A0⊗B1=B1⊗A0
and removing the labels we would get the misleading
0⊗1= 1 ⊗ 0
From all this we see that, in order to make sense of the notation without labels, it is necessary to preserve the ordering of the Hilbert subspaces present in a tensor product, and also when taking the Dagger of a Ket. Accordingly, within tensor products, for instance in these examples, the system will always write Kets of the subspace A before Kets of the subspace B.
According to the design section, set now two disjointed Hilbert spaces with operators A,C acting on one of them and B,C on the other one (you can think of C=A⊗B)
Setup⁡hilbertspaces=A,C,B,C
disjointedspaces=A,C,B,C
Consider a tensor product of Kets, each of which belongs to one of these different spaces, note the new notation using⊗
KetA,1 KetB,0
A1⊗B0
As explained in the Details of the design section, the ordering of the Hilbert spaces in tensor products is now preserved: Bras (Kets) of the first space always appear before Bras (Kets) of the second space. For example, construct a projector into the state (5)
⋅ Dagger
A1⊗B0⊗A1⊗B0
You see that in the product of Bras, and also in the product of Kets, A comes first, then B.
Remark: some textbooks prefer a dyadic style for sorting the operands in products of Bras and Kets that belong to different spaces, for example, (A1A1)⊗(B0B0) instead of the projector sorting style of (6). Both reorderings of Kets and Bras are mathematically equal.
Because that ordering is preserved, one can now hide the label of Bras and Kets without ambiguity, as it is usual in textbooks (e.g. in Quantum Information). For that purpose use the new keyword option hideketlabel
Setuphide=true
* Partial match of 'hide' against keyword 'hideketlabel'
hideketlabel=true
The display for (6) is now
1⊗0⊗1⊗0
Important: this new option only hides the label while displaying the Bra or Ket. The label, however, is still there, both in the input and in the output. One can "see" what is behind this new display using show, that works the same way as it does in the context of CompactDisplay. The actual contents being displayed in (8) is thus (6)
show
Operators of each of these spaces act on their eigenkets as usual. Here we distribute over both sides of an equation, using `*` on the left-hand side, to see the product uncomputed, and `.` on the right-hand side to see it computed:
`*` = `.`A, KetA,1;
A⁢1=1
`*` = `.`A, KetA,0;
A⁢0=0
The tensor product of operators belonging to different Hilbert spaces is also displayed using ⊗
A B
A⊗B
As mentioned in the preceding design section, using the commutativity between operators, Bras and Kets that belong to different Hilbert spaces, within a product, operators are placed contiguous to the Kets and Bras belonging to the space where the operator acts. For example, consider the delayed product represented using the start `*` operator
' ⋅ '
A⊗B⁢1⊗0⊗1⊗0
Release the product
%
A⁢1⁢B⁢0⊗1⊗0
The same operation but now using the dot product `.` operator. Start by delaying the operation
' . '
A⊗B·1⊗0⊗1⊗0
Recalling that this product is mathematically the same as (14), and that
B·B0
0
by releasing the delayed product (15) we have
Reset hideketlabel
Setuphideketlabel = false
hideketlabel=false
Implementation details
When defining a disjointed Hilbert space that contains operators belonging to one of the previously defined disjointed spaces, if the previously defined space is a subset of the one being defined, the former definition is removed and only the latter is kept.
There are three new routines related to operators acting on disjointed spaces
Library:-BelongToDifferentDisjointedSpacesA,B
true
and, in connection with the possibility of indicating that two operators act on the same disjointed space, there is a new routine to tell when the operators belong to (act on) the same space
Library:-BelongToTheSameDisjointedSpaceA,B
false
Library:-BelongToTheSameDisjointedSpaceA,C
Finally, there is a routine to tell whether a sequence of objects belong (all of them) to (the same or different) disjointed spaces, i.e. were set as such using Setup and the hilbertpaces keyword
Library:-BelongToDisjointedSpacesA,B,C
Setupop = E
quantumoperators=A,B,C,E
Library:-BelongToDisjointedSpacesE
Library:-BelongToDisjointedSpacesA,B,E
These three Physics:-Library routines, are the ones used internally by the Physics package to make decisions.
Coordinates of a coordinate system defined using the Coordinates, or equivalently the Setup, command, when they are also set to as quantum operators, are automatically assumed to act on disjointed spaces. For example,
Setupdimension = 3, signature = `+`, coordinates=cartesian, quantumoperators=X,quiet
coordinatesystems=X,dimension=3,quantumoperators=A,B,C,E,x,y,z,signature=+ + +
Library:-BelongToDifferentDisjointedSpacesx,y
Remove the coordinates from the quantum operators set
Setupclear, op = X
The following swapped products on the left-hand and right-hand sides (with their evaluation delayed due to enclosing the equation between ' ' ) are automatically reordered in one and the same way when we remove the delay, as explained in the details of the design section.
Example
Setuphide = false
' KetA,n⋅ KetB,m = KetB,m KetA,n '
An⊗Bm=Bm⊗An
Remove now the evaluation delay and the ordering on the right-hand side is automatically rearranged as in the left-hand side.
An⊗Bm=An⊗Bm
The same using the dot operator `.`
' KetA,n. KetB,m = KetB,m. KetA,n '
An·Bm=Bm·An
NOTE: the dot product operator, `.`, is used to perform contractions or attachments in the space of quantum states. Therefore, in the case of tensor products, it returns using the star product operator `*`, in that there is no meaning for the contraction of tensors of different (disjointed) Hilbert spaces.
Regarding the product of a Bra and a Ket belonging to disjointed spaces, we also have, automatically,
' BraA, n KetB,n = KetB,n BraA, n '
An⊗Bn=Bn⊗An
Bn⊗An=Bn⊗An
So the left-hand side is rewritten as the right-hand side, and An⊗Bnis not a "scalar product", but an operator in the tensor product of spaces, since A and B belong to different disjointed spaces.
Enclose again the input with ' ' to delay its evaluation
' A ⋅ KetB, n = KetB, n ⋅ A '
Release the evaluation
Bn⁢A=Bn⁢A
In the output above we see that A·Bn is not interpreted as contraction between an operator and Ket, but as the product of A=A⁢𝕀B acting on Bn where 𝕀B is the identity (projector) onto the B space. That is, an operator of one disjointed space acts transparently over a Bra or a Ket of a different disjointed space. The same happens with A† just that, while A moves to the right, jumping over a Bra or Ket (see (37)), A† moves to the left:
' DaggerA ⋅ BraB, n = BraB, n ⋅ DaggerA '
A†⁢Bn=Bn⁢A†
A†⁢Bn=A†⁢Bn
NOTE: Although determining "who is the Dagger of who" is arbitrary, this implementation follows what we do with paper and pencil: operators act to their right while those having an explicit Dagger act to their left.
Finally, the notation used for tensor products of operators is the same one used for tensor products of Bras and Kets:
A ⋅ B
As explained in the Details of the design section, the ordering of the Hilbert spaces in tensor products is now preserved, so taking the Dagger does not swap the operands in this product:
Dagger
A†⊗B†
With the introduction of disjointed Hilbert spaces in Maple 2019 it is possible to represent entangled quantum states in a simple way, basically as done with paper and pencil.
Recalling the Hilbert spaces set at this point are,
Setuphilbert
* Partial match of 'hilbert' against keyword 'hilbertspaces'
where C acts on the tensor product of the spaces where A and B act. An eigenstate of C can then always be written as
KetC,m,n = SumSumMj,p KetA,j KetB,p,j, p
Cm,n=∑p⁡∑j⁡Mj,p⁢Aj⊗Bp
where Mj,p is a matrix of complex coefficients. Bra states of C are formed as usual taking the Dagger
Cm,n=∑p⁡∑j⁡Mj,p&conjugate0;⁢Aj⊗Bp
By definition, all states Cm,n that can be written exactly as Am⊗Bn, that is, the product of an arbitrary state of the subspace A and another of the subspace B, are product states, and all the other ones are entangled states. Entanglement is a property that is independent of the basis Aj⊗Bpused in (43). The physical interpretation is the standard one: when the state of a system constituted by two subsystems A and B is represented by a product state, the properties of the subsystem A are well defined and all given by Aj,while those for the subsystem B by Bp. When the system is in an entangled state one typically cannot assign definite properties to the individual subsystems A or B, each subsystem has no independent reality. To determine whether a state Cn,m is entangled it then suffices to check the rank R of the matrix Mj,p (see LinearAlgebra:-Rank): when R=1 the state is a product state, otherwise it is an entangled state. When the state being analyzed belongs to the tensor product of two subspaces, R=1 is equivalent to having the determinant of Mj,p equal to 0. The condition R=1, however, is more general, and suffices to determine whether a state is a product state also on a Hilbert space that is the tensor product of three or more subspaces: ℋ=ℋ1⊗ℋ2⊗ℋ3... ℋn, in which case the matrix M will have more rows and columns and a determinant equal to 0 would only warrant the possibility of factorizing one Ket.
Example: the Bell basis for a system of two qubits
Consider a 2-dimensional space of states acted upon by the operator A, and let B act upon another, disjointed, Hilbert space that is a replica of the Hilbert space on which A acts. Set the dimensions of A, B and C respectively equal to 2, 2 and 2x2 (see Setup)
Setupquantumbasisdimension = A = 2, B = 2, C1 = 2, C2 = 2
quantumbasisdimension=A=2,B=2,C1=2,C2=2
The system C with the two subsystems A and B represents a two qubits system. The standard basis for C can be constructed in a natural way from the basis of Kets of A and B, A0,A1,B0,B1, by taking their tensor products:
seqseqKetA,j⋅KetB,k,k=0..1,j=0..1
A0⊗B0,A0⊗B1,A1⊗B0,A1⊗B1
Set a more mathematical display for the imaginary unit
interfaceimaginaryunit = i:
The four entangled Bell states also form a basis of C and are given by
Setupop = ℬ
quantumoperators=ℬ,A,B,C,E
Ketℬ,0 = 1'sqrt'2KetA,0 KetB,0 + KetA,1 KetB,1
ℬ0=A0⊗B0+A1⊗B12
Ketℬ,1 = 1'sqrt'2KetA,0 KetB,1 + KetA,1 KetB,0
ℬ1=A0⊗B1+A1⊗B02
Ketℬ,2 = i'sqrt'2KetA,0 KetB,1 − KetA,1 KetB,0
ℬ2=ⅈ⁢A0⊗B1−A1⊗B02
Ketℬ,3 = 1'sqrt'2KetA,0 KetB,0 − KetA,1 KetB,1
ℬ3=A0⊗B0−A1⊗B12
There is no standard convention for the four linear combinations of the right-hand sides above defining the Bell states. The convention used here relates to the definition of these states using the Pauli matrices as shown further below. Regardless of the convention used, the Bell basis is orthonormal. That can be verified by taking dot products, for example:
Dagger .
1=1
In steps, perform the same operation but using the star (`*`) operator, so that the contraction is represented but not performed
Dagger ⋅
ℬ0⁢ℬ0=A0⊗B0+A1⊗B1⁢A0⊗B0+A1⊗B12
Evaluate now the result at `*` = `.`, that is transforming the star product into a dot product
eval, `*` = `.`
ℬ0⁢ℬ1=A0⊗B0+A1⊗B1⁢A0⊗B1+A1⊗B02
0=0
The Bell basis and its relation with the Pauli matrices
The Bell basis can be constructed departing from ℬ0 using the Pauli matrices σj. For that purpose, using a Vector representation for Bj,
KetB,0 = Vector1,0, KetB,1 = Vector0,1
B0=10,B1=01
Multiplying B0by each of the σj Pauli matrices and performing the matrix operations we have
seqPsigmaj ⋅ 1, j=1..3
σ1⁢B0=σ1⁢10,σ2⁢B0=σ2⁢10,σ3⁢B0=σ3⁢10
Library:-PerformMatrixOperations,only=righthandsides
σ1⁢B0=01,σ2⁢B0=0ⅈ,σ3⁢B0=10
In this result we see that σ1 and σ2 flip the state, transforming B0 into B1, σ2 also multiplies by the imaginary unit ⅈ, while σ3 leaves the state B0unchanged.
We can express all that by removing from (59) the Vector representations shown in (57). For that purpose, create a list of substitution equations
maprhs = lhs,, i ⋅~
10=B0,01=B1,ⅈ0=ⅈ⁢B0,0ⅈ=ⅈ⁢B1
The action of σj in B0is then given by
Library:-SubstituteMatrix,
σ1⁢B0=B1,σ2⁢B0=ⅈ⁢B1,σ3⁢B0=B0
For B1, performing the same steps, the action of the Pauli matrices on it is
seqPsigmaj ⋅ 2, j=1..3
σ1⁢B1=σ1⁢01,σ2⁢B1=σ2⁢01,σ3⁢B1=σ3⁢01
σ1⁢B1=10,σ2⁢B1=−ⅈ0,σ3⁢B1=0−1
σ1⁢B1=B0,σ2⁢B1=−ⅈ⁢B0,σ3⁢B1=−B1
To obtain the other three Bell states using the results (61) and (64), indicate to the system that the Pauli matrices operate in the subspace where B operates
Setuphilbert = B,C,Psigma
disjointedspaces=A,C,B,C,σ
Multiplying ℬ0 given in (48) by each of the three σj we get the other three Bell states
ℬ0=2⁢A0⊗B0+A1⊗B12
Psigma1 ⋅
σ1⁢ℬ0=2⁢σ1⁢A0⊗B0+A1⊗B12
Substitute in this result the first equations of (61) and (64)
1, 1
σ1⁢B0=B1,σ1⁢B1=B0
maprhs=lhs,
B1=σ1⁢B0,B0=σ1⁢B1
subs,
σ1⁢ℬ0=2⁢σ1⁢A0⁢σ1⁢B1+A1⁢σ1⁢B02
factorSimplify
σ1⁢ℬ0=2⁢A0⊗B1+A1⊗B02
This is ℬ1 defined in (49)
ℬ1=2⁢A0⊗B1+A1⊗B02
−
σ1⁢ℬ0−ℬ1=0
Multiplying now by σ2 and substituting Bj using the 2nd equations of (61) and (64) we get ℬ2
Psigma2 ⋅
σ2⁢ℬ0=2⁢σ2⁢A0⊗B0+A1⊗B12
2, 2
σ2⁢B0=ⅈ⁢B1,σ2⁢B1=−ⅈ⁢B0
zipisolate,,KetB,1,KetB,0
B1=−ⅈ⁢σ2⁢B0,B0=ⅈ⁢σ2⁢B1
factorSimplifysubs,
σ2⁢ℬ0=ⅈ2⁢2⁢A0⊗B1−A1⊗B0
The above is ℬ 2 defined in (50)
ℬ2=ⅈ2⁢2⁢A0⊗B1−A1⊗B0
Expand−
σ2⁢ℬ0−ℬ2=0
Finally, multiplying ℬ0 by σ3
Psigma3 ⋅
σ3⁢ℬ0=2⁢σ3⁢A0⊗B0+A1⊗B12
Substituting
3, 3
σ3⁢B0=B0,σ3⁢B1=−B1
rhs=lhs 1, rhs = lhs−2
B0=σ3⁢B0,B1=−σ3⁢B1
We get
σ3⁢ℬ0=2⁢A0⊗B0−A1⊗B12
which is ℬ3
ℬ3=2⁢A0⊗B0−A1⊗B12
σ3⁢ℬ0−ℬ3=0
Reset the symbol representing imaginary unit to use i as an index in the next section
interfaceimaginaryunit = I:
Consider a fourth operator, H, that is Hermitian and acts on the same space of C, has the same dimension, and ℋ,ℍ are its mean values in an entangled and product states respectively.
Setupadditionally, hermitian = H, basisdimension = H1 = 2, H2=2, hilbertspaces = A,C,H,B,C,H,realobjects = ℋ,ℍ
* Partial match of 'hermitian' against keyword 'hermitianoperators'
* Partial match of 'basisdimension' against keyword 'quantumbasisdimension'
disjointedspaces=A,C,H,B,C,H,B,C,σ,hermitianoperators=H,quantumbasisdimension=A=2,B=2,C1=2,C2=2,H1=2,H2=2,realobjects=ℍ,ℋ,x,y,z
To operate in a practical way with these operators, Bras and Kets, bracket rules reflecting their relationship are necessary. From the definition of C as acting on the tensor product of spaces where A and B act (see (43)) and taking into account the dimensions specified for A, B and C we have
KetC,a, b = SumSumMa,j,b,p KetA,j KetB,p,j=0..1, p=0..1
Ca,b=∑p=01⁡∑j=01⁡Ma,j,b,p⁢Aj⊗Bp
Ak·
Ak|Ca,b=∑p=01⁡Ma,k,b,p⁢Bp
Bk·
Bk|Ca,b=∑j=01⁡Ma,j,b,k⁢Aj
Ak·Bl·
Ak⁢Bl|Ca,b=Ma,k,b,l
The bracket rules for A, B and C are the first two of these; Set these rules, so that the system can take them into account
Setup,
bracketrules=Ak|Ca,b=∑p=01⁡Ma,k,b,p⁢Bp,Bk|Ca,b=∑j=01⁡Ma,j,b,k⁢Aj
If we now recompute (90), the left-hand side is also computed
Ma,k,b,l=Ma,k,b,l
Suppose now that you want to compute with the Hermitian operator H, that operates on the same space as C, both using C and the operators A and B, as in
Cⅈ,j|H|Ck,l=ℋi,j,k,l
Aⅈ⊗Bj⁢H⁢Ak⊗Bl=⁢ℍⅈ,j,k,l
where ℋi,j,k,l = ℍⅈ,j,k,l when Ci,j is a product (not entangled) state.
To compute taking into account Cⅈ,j|H|Ck,l=ℋⅈ,j,k,l it suffices to set a bracket rule
Setup%BracketBraC,a,b,H,KetC,c,d = ℋa,b,c,d, real=ℋ
* Partial match of 'real' against keyword 'realobjects'
bracketrules=Ak|Ca,b=∑p=01⁡Ma,k,b,p⁢Bp,Bk|Ca,b=∑j=01⁡Ma,j,b,k⁢Aj,Ca,b|H|Cc,d=ℋa,b,c,d,realobjects=ℍ,ℋ,x,y,z
After that,
Cj,k·H·Cm,n
ℋj,k,m,n
Regarding Aⅈ⊗Bj⁢H⁢Ak⊗Bl=ℍⅈ,j,k,l, since H belongs to the tensor product of spaces A and B, it can be an entangled operator, one that you cannot represent just as a product of one operator acting on A times another one acting on B. A computational representation for the operator Bj⁢H⁢Ak (that is not just itself or as abstract) is not possible in the general case. For that you can use a different feature: define the action of the operator H on Kets of A and B.
Basically, we want:
H·Ak→ Hk
Hk· Al→Hk,l ...Hi,j,k·Al→ ℍi,j,k,l
A program sketch for that would be:
if H is applied to a Ket of A or B and it still has not 4 indices then
if H itself is indexed then return H with its indices followed by the index of the Ket else
return H indexed by the index of the Ket; otherwise return the dot product operation uncomputed, unevaluated
In the Maple language (see sec. 1.4) that program-sketch becomes
H ≔ K → if procname∷Notindexed or nopsprocname < 4 and K∷Ket and op1, K∷'identicalA,B' then if procname∷'indexed' then if nopsprocname = 3 then ℍopprocname, op2, K # no more indices to be accumulated, scalar result else Hopprocname, op2, K # accumulate indices, operator result fi else Hop2, K fi else 'procname . K' fi:
Let's see it in action. Start by erasing the Physics performance remember tables, which remember results computed before the definition of H
Library:-Forget
H·Ak
Hk
Recalling that H is Hermitian,
Bj·H
Hj
Bj·H·Ak
Hj,k
Bj·H·Ak·Bl
Hj,k,l
Ai·Bj·H·Ak·Bl
ℍi,j,k,l
Note that the definition of H as a procedure does not interfere with the setting of a bracket rule for it with Ca,b, that is still working
Ci,j·H·Ck,l
ℋi,j,k,l
where H = H when Ck,l is a product state. The definition of H takes precedence, so if in that definition you indicate what to do with a C Ket, that will be taken into account before the bracket rule.
You can set the projectors for all these operators / spaces. For example,
𝕀__A ≔ ProjectorKetA,i;𝕀__B ≔ ProjectorKetB,i;𝕀__C ≔ ProjectorKetC,a,b
𝕀__A≔∑i=01⁡Ai⁢Ai
𝕀__B≔∑i=01⁡Bi⁢Bi
𝕀__C≔∑b=01⁡∑a=01⁡Ca,b⁢Ca,b
Since the algebra rules for computing with eigenkets of A, B and C were already set in (91), from the projectors above you can construct any subspace projector, for example
BraA,m . 𝕀__C
∑b=01⁡∑a=01⁡∑p=01⁡Ma,m,b,p⁢Bp⁢Ca,b
𝕀__C . KetA, m
∑b=01⁡∑a=01⁡∑p=01⁡Ma,m,b,p&conjugate0;⁢Ca,b⁢Bp
The conjugate of Ma,m,b,p is due to the contraction or attachment from the right of (102), that is with
Ca,b=∑p=01⁡∑j=01⁡Ma,j,b,p&conjugate0;⁢Aj⊗Bp
The coefficients Ma,m,b,p satisfy constraints due to the normalization of Kets of A and B. One can derive these constraints by inserting the unit operator 𝕀__C in the identity
Am·Bn·𝕀__C·Ar·Bs=Am·Bn·Ar·Bs
∑b=01⁡∑a=01⁡Ma,r,b,s&conjugate0;⁢Ma,m,b,n=δm,r⁢δn,s
Transform this result into a function P to explore the identity further
P ≔ unapplysubsSum=sum,,m,n,r,s
P≔m,n,r,s↦∑b=01⁡∑a=01⁡Ma,r,b,s&conjugate0;⁢Ma,m,b,n=δm,r⁢δn,s
The first and third indices refer to the quantum numbers of A, the second and fourth to B, so the right-hand sides in the following are respectively 1 and 0
P1,0,1,0
M0,1,0,0&conjugate0;⁢M0,1,0,0+M1,1,0,0&conjugate0;⁢M1,1,0,0+M0,1,1,0&conjugate0;⁢M0,1,1,0+M1,1,1,0&conjugate0;⁢M1,1,1,0=1
P1,0,0,0
M0,0,0,0&conjugate0;⁢M0,1,0,0+M1,0,0,0&conjugate0;⁢M1,1,0,0+M0,0,1,0&conjugate0;⁢M0,1,1,0+M1,0,1,0&conjugate0;⁢M1,1,1,0=0
To get the whole system of equations satisfied by the coefficients Ma,m,b,n