The Mathematica Journal
Departments
Feature Articles
Columns
New Products
New Publications
Classifieds
Calendar
News Bulletins
Mailbox
Letters
Write Us
About the Journal
Staff and Contributors
Submissions
Subscriptions
Advertising
Back Issues
Home
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.

[Graphics:../Images/index_gr_3.gif]
[Graphics:../Images/index_gr_4.gif]

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.,

[Graphics:../Images/index_gr_6.gif]
[Graphics:../Images/index_gr_7.gif]

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

[Graphics:../Images/index_gr_8.gif]

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

[Graphics:../Images/index_gr_9.gif]
[Graphics:../Images/index_gr_10.gif]

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

[Graphics:../Images/index_gr_11.gif]

[Graphics:../Images/index_gr_12.gif]

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

[Graphics:../Images/index_gr_13.gif]

converts strings to vertical GridBoxes.

[Graphics:../Images/index_gr_14.gif]
[Graphics:../Images/index_gr_15.gif]

We now display the following data,

[Graphics:../Images/index_gr_16.gif]
[Graphics:../Images/index_gr_17.gif]

in a tabular format.

[Graphics:../Images/index_gr_18.gif]

[Graphics:../Images/index_gr_19.gif]

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

[Graphics:../Images/index_gr_25.gif]
[Graphics:../Images/index_gr_26.gif]
[Graphics:../Images/index_gr_27.gif]

and

[Graphics:../Images/index_gr_28.gif]
[Graphics:../Images/index_gr_29.gif]
[Graphics:../Images/index_gr_30.gif]

Mathematica implementation of these differential operators is straightforward.

[Graphics:../Images/index_gr_31.gif]
[Graphics:../Images/index_gr_32.gif]
[Graphics:../Images/index_gr_33.gif]
[Graphics:../Images/index_gr_34.gif]
[Graphics:../Images/index_gr_35.gif]
[Graphics:../Images/index_gr_36.gif]

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

[Graphics:../Images/index_gr_38.gif]

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.

[Graphics:../Images/index_gr_40.gif]

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

[Graphics:../Images/index_gr_42.gif]
[Graphics:../Images/index_gr_43.gif]

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

[Graphics:../Images/index_gr_45.gif]
[Graphics:../Images/index_gr_46.gif]

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

[Graphics:../Images/index_gr_47.gif]
[Graphics:../Images/index_gr_48.gif]

[Graphics:../Images/index_gr_49.gif]

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]