The Mathematica Journal
Feature Articles
New Products
New Publications
News Bulletins
Write Us
About the Journal
Staff and Contributors
Back Issues
Download this Issue

Formatted Tables

To summarize a set of results, it is useful to display them in a table. Consider the following set of values.


When displaying tabular output, we often need to pad all numeric values in each column to the same length. PaddedForm controls the number of displayed digits and ToString converts all numbers to strings. We project out the nth column of data as a (column) matrix using [Graphics:../Images/index_gr_5.gif], e.g.,


and specify a different number of displayed digits for each column.


Using GridBox and StyleBox allows fine control of the display of tabular data to produce a more distinctive table.


FilterOptions passes valid options from opts to GridBox and StyleBox respectively. For example,



It is easy to add other descriptive columns to tables. Defining


converts strings to vertical GridBoxes.


We now display the following data,


in a tabular format.



The final example is taken from group theory. The Euclidean Lie algebra [Graphics:../Images/index_gr_20.gif] has the Lie subalgebras [Graphics:../Images/index_gr_21.gif] and [Graphics:../Images/index_gr_22.gif] known as [Graphics:../Images/index_gr_23.gif] and [Graphics:../Images/index_gr_24.gif] which generate rotations and translations respectively. In terms of infinitesimal generators, we have




Mathematica implementation of these differential operators is straightforward.


Note that we associate the rotation operators with R and the translation operators with P (see Section 2.4.10 of The Mathematica Book). This way we can clear all translation operators using Clear[P].

Introducing the commutator operator [Graphics:../Images/index_gr_37.gif] as


the following routine equates the commutator of two differential operators, [Graphics:../Images/index_gr_39.gif], to an arbitrary linear combination of all the operators in an algebra and then determines the coefficients (c) using SolveAlways.


For example, in the Euclidean Lie algebra [Graphics:../Images/index_gr_41.gif] (keeping the operators in unevaluated form using HoldForm and Unevaluated),


we find that [Graphics:../Images/index_gr_44.gif].


Here is the table of commutators in an easily readable format.



It is apparent from this table that translation operators commute but rotation operators do not.

Converted by Mathematica      May 8, 2000

[Tricks of the Trade Index] [Prev Page][Next Page]