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 , 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  has the Lie subalgebras  and  known as  and  which generate rotations and translations respectively. In terms of infinitesimal generators, we have

and

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  as

the following routine equates the commutator of two differential operators, , 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  (keeping the operators in unevaluated form using HoldForm and Unevaluated),

we find that .

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]