 Creating New Notations in Mathematica
Jason Harris
Introduction
Mathematica 3.0 and 4.0 understand most standard mathematical notations such as integrals, sums, products, etc. But in many mathematical fields, particularly pure mathematics, a variety of additional specific notations are used. The programmability of input and output in Mathematica makes it possible to introduce these kinds of notations, and to integrate them into your work.
The Notation package provides a variety of utilities allowing you to flexibly and extensively create and add your own notations to a Mathematica session. The full documentation for the package can be found here. Without the Notation package creating and defining your own notations can be laborious and problematic.
In[1]:=
A Simple Example
In[2]:=
In[3]:=
Out[3]=
In[4]:=
Out[4]=
Notation for the Wigner 3j Symbol
The Wigner 3j Symbol is used in the coupling of angular momenta in quantum mechanics. The 3j symbol is a more symmetric form of a corresponding Clebsch-Gordon coefficient. This section creates a notation for 3j symbols and illustrates the use of this notation with a few simple examples.
In[5]:=
This notation consists of a 3 2 GridBox with round braces subscripted by 3j. There are many other notational forms that could have been chosen including ones with hidden TagBoxes.
In[6]:=
Out[6]=
In[7]:=
Out[7]=
This notation for the Wigner 3j symbol can now be freely used in calculations, greatly increasing readability in certain cases. Furthermore, for ease of input we can add an input-alias for the Wigner 3j symbol to the current notebook.
In[8]:=
A blank template of a Wigner 3j symbol can now be created by typing 3j in any input cell.
The following is a short example illustrating an identity involving the Wigner 3j symbol.
In[9]:=
In[12]:=
Out[12]=
There are many ways to represent spherical tensors. The following is a simple, though not general approach.
In[13]:=
In[16]:=
In[17]:=
Out[17]=
Bras, Kets and Operators in Quantum Mechanics
The following illustrates a notational system for the Dirac bra-ket notation used in quantum mechanics.
Modify Parenthesize and FullForm
The following code is used to fix the formatting of tag boxes and full form. This correction is not central to the points being illustrated in this notebook, but is necessary for correct formatting.
In[18]:=
In[23]:=
Declare the notation for Operators, Bras and Kets
In[26]:=
In[27]:=
The following notations for bras, kets, and brakets depend on specific styles that have been added to the style sheet of this notebook. These styles are necessary to give the bras, kets and brakets the correct visual and structural properties.
In[28]:=
In[31]:=
Out[31]=
In[32]:=Bra[ ]
Out[32]=
In[33]:=
Out[33]=
Entering Bras and Kets
To enter complex templates consisting of tag boxes and other underlying structures it is desirable to add input aliases to the current notebook. Creating input aliases for bras and kets is a perfect illustration of this.
In[34]:=
In[37]:=
Out[37]=
Toy Calculations
What follows are some toy definitions and calculations to illustrate the functionality of the notation defined for Bras and Kets.
In[38]:=
In[39]:=
In[40]:=
In[43]:=
Out[43]=
In[44]:=
Out[44]=
In[45]:=
Out[45]=
In[46]:=
Out[46]=
In[47]:=
Out[47]=
In[48]:=
Out[48]=
In[49]:=
Out[49]=
In[50]:=
Out[50]=
Angular Momentum
This subsection contains some simple definitions and calculations to illustrate angular momentum and raising and lowering operators in quantum mechanics.
In[51]:=
In[52]:=
In[53]:=
In[56]:=
Out[56]=
To progress further we must add some basic properties to our NonCommutativeTimes. The following is a crude implementation of multiple linearity over addition and multiple linearity over constants, however it is sufficient for the purpose of illustration. The following rules state that constants can be factored out of a NonCommutativeTimes expression, and that NonCommutativeTimes distributes over addition.
In[57]:=
In[59]:=
In[65]:=
Out[65]=
In angular momentum theory the operator has the eigenvalue on eigenstates of angular momentum. It is usually a textbook calculation to show that the operator can be decomposed into operators involving , and . Let us verify that this is the case.
In[66]:=
Out[66]=
In[67]:=
Out[67]=
For those that know enough about quantized angular momentum it is evident that the calculation above shows that is equivalent to .
Let us extend our implementation of angular momentum a little further and note that the eigenstates of angular momentum are orthogonal.
In[68]:=
We can now evaluate the decomposition of between different eigenstates of angular momentum.
In[69]:=
Out[69]=
Finally, for illustration let us calculate an expression involving products of operators between eigenstates.
In[70]:=
Out[70]=
Category Theory Diagrams
Some of the most complicated notation found anywhere occurs in category theory. This section gives some simple examples of how category theory diagrams can be set up as notations in Mathematica. The following example comes from the section on natural transformations in Birkhoff and MacLane's Algebra.
In[71]:=
In[72]:=
In[73]:=
Out[73]=
In[74]:=
Out[74]=
A look at the rules
In[75]:=
|