Bracket - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim

Physics[Bracket] - compute the scalar product between Bras, Kets, and quantum operators in Dirac's notation

Calling Sequence


Bracket(B, K)

Bracket(B, H, K)

Bracket(a, b, c, ...)




an algebraic expression, typically a linear quantum operator, defined as such by the Setup, Annihilation, Creation, or Projector commands



a Bra state vector of a space of quantum states



a Ket state vector of a space of quantum states

a, b, c, ...


shortcut notation: algebraic expressions representing labels and quantum numbers of a Bra and a Ket, possibly including a quantum operator between them when there is an odd number of arguments



A Ket state vector represents the quantum state of a physical system. A Bra is also a vector in a space of quantum states and corresponds to a Ket vector in that one is obtained from the other through Hermitian conjugation.


The Bracket(B, K) command (note the 'c' between Bra and Ket) performs the scalar product, also called the inner product, between a Bra B and a Ket K. The Bracket(B, H, K) command, where H represents a linear quantum operator, defined as such by the Setup command, or returned by one of the Annihilation, Creation, or Projector commands, returns the scalar product between the Bra B and the Ket resulting from the action of H on the Ket K. When H is not an operator, Bracket(B, H, K) transforms into H*Bracket(B, K).


The %Bracket command is the inert form of Bracket; that is, it represents the same mathematical operation while displaying the operation unevaluated. To evaluate the operation, use the value command.


A shortcut notation for Bracket consists of the following:


- if an even number of arguments N are passed, and the first and (N/2 + 1)th are names (so they can represent labels for spaces of states), and the rest of the arguments are not quantum operators, then for example, Bracket(B, n1,n2, K, m1,m2) is transformed into Bracket(Bra(B, n1,n2), Ket(K, m1,m2)).


- if an odd number of arguments N are passed, where the (N+1)/2th argument is H, then for example, Bracket(B, n1,n2, H, K, m1,m2) is transformed into Bracket(Bra(B, n1,n2), H, Ket(K, m1,m2)).


The scalar product between B and K (or H and K) is computed also by using B·K (or H·K), where `.` is the Physics[`.`] scalar (inner) product operator.


The Bracket between a Bra and a Ket is expressed in terms of KroneckerDeltas, when the state vectors belong to a discrete space of states, or by using Dirac functions, when the state vectors belong to a continuous space of states. To make the label (first argument) of a Bra or Ket be associated with a continuous space of states, use the Setup command, as in Setupcontinuousbasis=A; otherwise, it is assumed that the Bra or Ket corresponds to a discrete space of states.


To set bracket rules involving Bra and Ket state vectors, use the Setup command; see the examples below.


When the Bracket cannot be resolved, the operation is returned unevaluated; see details in Physics[`.`].


Consider two Kets belonging to the same basis, labeled with the letter ψ (psi).


Setup(mathematicalnotation = true);



K1 := Ket(psi, n, m);



K2 := Ket(psi, r, s);



To construct the corresponding Bras, you can enter them directly by using the Bra command (as in BK1), or take the Hermitian conjugate by using the Dagger command (as in BK2).

BK1 := Bra(psi, n, m);



BK2 := Dagger(K2);



To perform the scalar product, use the Bracket command.

Bracket(BK1, K2);



You can also use the scalar product operator, Physics[`.`]

BK1 . K2;



Notice that the above is the product of two Kronecker deltas. This is so because these Kets are assumed to be part of the same discrete basis. To indicate that they belong to a continuous space of states, use the Setup command.

Setup(continuousbasis = psi);

* Partial match of 'continuousbasis' against keyword 'quantumcontinuousbasis'




Bracket(BK1, K2);



In the above, you see a 2-dimensional Dirac function. To expand this Dirac function into a product of two 1-dimensional Dirac functions, use the expand command. When taking the Bracket between state vectors with different labels, unless a bracket rule for them is known to the system, the result is returned unevaluated.

Bracket(Bra(psi, x), Ket(phi, y));



To set a rule for the evaluation of these brackets, see Setup and the example below.

You can also set the label ψ (formerly set to represent a continuous space of states) to represent a discrete space of states by using the Setup command again. When resetting a label from a continuous to a discrete space of states, you first need to clear the previous setting (a two step operation), or directly redo the setting in one step, as shown below.

Setup(discretebasis = psi, redo);

* Partial match of 'discretebasis' against keyword 'quantumdiscretebasis'




For discrete bases, it is possible to define creation and annihilation operators acting on Kets belonging to this space of states (that is, to the basis labeled by the Ket's first argument). For these purposes, use the Annihilation and Creation operators.

am1 := Annihilation(psi, 1);



ap2 := Creation(psi, 2);



In the above, am1 and ap2 represent the annihilation (with respect to the first quantum number) and creation (with respect to the second quantum number) operators, respectively; their actions over the Ket K1 are shown below.

am1 . K1;



ap2 . K1;



where `.` is the scalar product operator in the Physics package.

The following are the related Bracket operations, expressed in the inert form %Bracket; inert computations are evaluated by using the value command.

%Bracket(Dagger(K1), am1, K2);






%Bracket(Dagger(K1), ap2, K2);






Let |R,x,y,z> and |P,px,py,pz> represent "position" and "momentum" state vectors; their scalar product is unknown to the system.

Bracket(Bra(R, x, y, z), Ket(P, p[x], p[y], p[z]));



Let their scalar product be the corresponding normalized plane wave (see References below).

(20) = 1/(2*Pi)^(3/2)*exp(I*(x*p[x] + y*p[y]+z*p[z]));



To set the above as a rule when computing brackets between the vectors R and P, use the Setup command.



Now this rule is used automatically. Note the use of shortcut notation in the example below.

%Bracket(R, a,b,c, P, d,e,f);






Construct the Projector onto the basis P.

Setup(continuousbasis = {P,R});

* Partial match of 'continuousbasis' against keyword 'quantumcontinuousbasis'




Projector(Ket(P, p[1], p[2], p[3]));



Consider the representation R of this Projector: it is directly computable from the bracket rule already set (use delay evaluation quotes and perform the operation in the next line by using the ditto operator, %).

'Bracket'(R, x[1],x[2],x[3] , (26), R,y[1],y[2],y[3]);






See Also

Annihilation, Bra, Creation, Dagger, Ket, KroneckerDelta, Physics, Physics conventions, Physics examples, Physics Updates, Tensors - a complete guide, Mini-Course Computer Algebra for Physicists, Physics/`.`, Physics[`*`], Projector, Setup, value



Cohen-Tannoudji, C.; Diu, B.; and Laloe, F. Quantum Mechanics. Chapter II. Paris, France: Hermann, 1977.