The 
Mathematica Journal
Volume 9, Issue 1

Search

In This Issue
Tricks of the Trade
In and Out
Trott's Corner
New Products
New Publications
Calendar
News Bulletins
New Resources
Classifieds

Download This Issue 

About the journal
Editorial Policy
Staff
Submissions
Subscriptions
Advertising
Back Issues
Contact Information

Tricks of the Trade
Edited by Paul Abbott

TraditionalForm versus StandardForm

The default input and output FormatType is StandardForm, which provides good readable two-dimensional typeset input and output and is mathematically unambiguous because it uses Mathematica syntax. TraditionalForm is an enhanced format corresponding to mathematical syntax, as far as this is consistently possible. Nevertheless, most Mathematica users cling stubbornly to StandardForm.

Since I find TraditionalForm to be the most attractive input and output format—and I use it in my columns—I would like to convince readers of the advantages of using TraditionalForm. These advantages include:

1. Matrices can be entered and are displayed in two-dimensional form without requiring MatrixForm.

2. Derivatives can be entered in their familiar two-dimensional form.

3. Standard notation is available for limits and directional limits.

4. Mathematical expressions are easier to read.

5. Where it is not ambiguous, special functions are interpreted automatically. For example, here is the derivative of the Bessel function .

6. Special function names and syntax correspond to those found in standard tables.

7. Complicated functions are easier to digest.

TraditionalForm can be selected as the default input and output format using Cell ⊳ Default Input FormatType and Cell ⊳ Default Output FormatType.

There are, of course, issues involved in using TraditionalForm.

1. Because a space is (correctly) interpreted as multiplication, entering a space where it is not required leads to the following type of mistake.

2. It may not always be obvious how to input typeset expressions in TraditionalForm. Probably the easiest way is to type the expression using normal syntax, for example,

and then use Convert To ⊳TraditionalForm (under the Cell menu) on the cell to yield

Note that this expression is not just a with a subscript and superscript . Unformatting the expression (using Show Expression under the Format menu) reveals LegendreP in a Tagbox at its heart.

Cell[BoxData[
    FormBox[
      RowBox[{
        SubsuperscriptBox[
          TagBox["P",
            LegendreP], "l", "m"], "(", "x", ")"}], TraditionalForm]], "InputOnly"]

Finally, it is possible to include a palette that automatically switches all input and output cells in a notebook from StandardForm to TraditionalForm and vice versa.

ConverttoStandardForm
ConverttoTraditionalForm

To produce a palette, select the above cell and then use Generate Palette from Selection (under the File menu).

Notation Package

It is also worthwhile to highlight the excellent Utilities`Notation` package (the latest version of which is available from library.wolfram.com/packages/notation). This package allows you to define arbitary input and output syntaxes for functions of your choosing.

Consider defining a notation for mappings. For example, the function may be written as the mapping . The mapping notation corresponds directly to Function in Mathematica.

Load the Notation package.

Use the Notation palette to define a two-way notation (indicated by ) for mappings.

To make it easier to enter mappings, use the Notation palette to add an input alias for mappings to the current notebook.

Now enter “map” templates by simply typing map.

Using the  key you can cycle through the placeholders in this template. Mappings can now be entered using ordinary mathematical notation. For example, here is the function .

Also, because we have used a two-way notation, conversion to and from ordinary mathematical notation and Mathematica notation is possible. For example, define the function using Function.

Then use Convert To ⊳ TraditionalForm (under the Cell menu) on the cell.

You can recover the original Function form using Convert To ⊳ StandardForm.



     
About Mathematica  Download Mathematica Player
Copyright © Wolfram Media, Inc. All rights reserved.