The Mathematica Frontend:
We're on the Road (again)

Mr. Theodore W. Gray
Dr. Neil M. Soiffer, Esq
Wolfram Research, Inc

Successes of Version 3

Symbolic document format

The fact that notebook documents are ordinary Mathematica expressions was a controversial decision.  However, experience over the last two years has shown that the ability to seamlessly process notebook documents in the kernel is genuinely useful in real-world situations.

Some things that can be done include:
	Automatic index generation
	Automatic table of contents/references
	Maintenance of hyperlinks (dead links checking)

Calculus and Mathematica

Conversion process proved usefulness of symbolic representation.
	Removing unnecessary option settings using patterns.
	Complex program read inconsistent, messed up title blocks from all 184 files and replaced them intelligently with correct versions.

Look at the difference between 2.2 and 3.0...
	Old
	New

Beginner's Guide

Processing to adapt to new possibilities offered by style mechanism.  For example, the following code rewrites all bold, Courier text as being in Input style instead:

StyleBox[e_, l___, FontFamily -> "Courier", c___, 
        FontWeight -> "Bold", r___] -> 
      StyleBox[e, "Input", l, c, r]

Physica

Alternative front end, completely replaces menus, methods of input, syntax.
Presents a limited, physics-problems only environment, built using front end programming commands.
	Physica menus
Normal menus

Books

Before V3 came out, we told you about how it would be possible to create books that integrate into Mathematica.

It actually works!

Books really do integrate into the help browser, and master index.

New Features in 3.1

Spell checker

Off[General::spell]Off[General::spell1]

Notice how there are no speling mistakes in this talk.  How is this possible?

Includes Proximity spelling system, and we bundle a math/science dictionary at no charge.
But, it's not just a generic spell checker.

5000 word supplementary dictionary built from Mathematica books and packages, using a "Dictionary harvester" program.  (If you want words from your book included, please give us your files to scan.)

You can add your own dictionary in either Mathematica list format, or one-word-per-line format (e.g., taken from a unix spell dictionary, etc).

Spell checker knows about conventions used in computerese: Checks internally capitalized words as separate entities (e.g. RationalApproximation) will pass, unlike in any other program.  Also understands _ (underscore) as word separator (e.g. count_Integer will pass).

Hyphenation

Proximity system also provides sophisticated automatic hyphenation.

But, there's a problem!  Hyphenating Mathematica function names can be very confusing, because the hyphen may be misinterpreted as a minus sign in math.

Solution: You can specify any character to be used as the hyphen character, and the default style sheet uses the Mathematica continuation character () in Input style.  Example, in the following paragraph english words are hyphenated with - while function names are hyphenated with

When pig farming collectives switch to using Mathematica based semi-quantitative methods, functions such as the powerful yet easy to use FractionalPorcineQuantification are very useful.

As with spell checking, internally capitalized words are split so the hybrid table/algorithmic hyphenator has the best chance of picking correct hyphenation points.

Inline cells

Completed implementation of inline cells.  Now Text and graphics cells can be embedded in
Math cells and vice-versa to any depth.

makePlot[i_, j_] := 
      Plot[i Sin[j x], {x, 0, 2  π}, PlotRange -> {-5, 5}, 
        Ticks -> None, DisplayFunction -> DisplayString]

makeCell[s_, size_] := 
      Cell[GraphicsData["PostScript", s], "Text", 
        ImageSize -> N[{size, (size/GoldenRatio)}], 
        CellMargins -> {{0, 0}, {0, 0}}];

\(CellPrint[
      Cell[BoxData[
          GridBox[
	Table[makeCell[makePlot[i, j], 60], {i, 5}, {j, 5}]]], 
        "Text"]]\)

Pig farming example

({{Unit, Status, Productivity, Photo}, {Mir, This unit has been showing consistantly climbing productivity. Analysis indicates a curve approximating (e^x)., , }, {Stephen, This unit has been showing consistantly climbing productivity. Analysis indicates a curve approximating (1/(e^x))., , }, {Theo, We have high hopes for the future of this unit.  There is no reason to believe the productivity is following a curve similar to this bell curve: )., , }, {Neil, Inconsistancy is the name of the game with this unit.  We are attempting the use of medical grade chocolate., , }})

Double buffering

All screen drawing is done first into an off screen buffer then copied on-screen when complete.
A common technique to eliminate flicker, but at the cost of being slower and using more memory.
Double buffering—a doubled edged sward.
(So, of course, we give you an option to control it.)

Improved line breaking

Fixed some bugs in globally-optimal linebreaking.

Locally-optimal linebreaking for input reduces cursor jumping

We now give you The Incredible Shrinking Blob™

(1/5) (Sqrt[(1/2) (5 + (Sqrt[5]))]) 
        ArcTan[2 (Sqrt[(2/(5 + (Sqrt[5])))]) ((1/4) (1 - (Sqrt[5])) + x)] + 
      (1/5) (Sqrt[(1/2) (5 - (Sqrt[5]))]) 
        ArcTan[2 (Sqrt[(2/(5 - (Sqrt[5])))]) ((1/4) (1 + (Sqrt[5])) + x)] - 
      (1/5) Log[-1 + x] + 
      (1/20) (1 - (Sqrt[5])) Log[1 + (1/2) (1 - (Sqrt[5])) x + (x^2)] + 
      (1/20) (1 + (Sqrt[5])) Log[1 + (1/2) (1 + (Sqrt[5])) x + (x^2)]

General Placeholders

Placeholders can be any expression: Anything you put in "Placeholder" or "PrimaryPlaceholder" style will act as a placeholder.

(Sqrt[(num/denom)])

This allows us to improve the function template feature greatly.

Implementation

MakeBoxes[PrimaryPlaceholder[expr_], form_] := 
      StyleBox[FrameBox[MakeBoxes[expr, form], 
          BoxMargins -> {{ .2,  .2}, { .25,  .25}}], 
        "PrimaryPlaceholder"]

MakeBoxes[Placeholder[expr_], form_] := 
      StyleBox[FrameBox[MakeBoxes[expr, form], 
          BoxMargins -> {{ .2,  .2}, { .25,  .25}}], "Placeholder"]

\(Unprotect[FE`FT]; 

    FE`FT["Plot"]\  := \ 
\ \ \ \ 
      NotebookWrite[SelectedNotebook[], \ 
        MakeBoxes[
          Plot[PrimaryPlaceholder[function], {Placeholder[var], 
              Placeholder[min], Placeholder[max]}]], Placeholder]\)

\(\(Unprotect[FE`FT]; 

    FE`FT["Sum"]\  := \ 
\ \ \ \ 
      NotebookWrite[SelectedNotebook[], 
\ \ \ \ 
        RowBox[{
\ \ \ \ \ \ 
            UnderoverscriptBox["∑", \ 
\ \ \ \ \ \ \ \ 
              RowBox[{
\ \ \ \ \ \ \ \ \ \ 
                  StyleBox[
                    FrameBox["i", 
                      BoxMargins -> {{ .2,  .2}, { .25,  .25}}], 

                    \ \ \ \ \ \ \ \ \ \ \ \ "PrimaryPlaceholder"], \ 
                  "=", \ 
\ \ \ \ \ \ \ \ \ \ 
                  StyleBox[
                    FrameBox["imin", 
                      BoxMargins -> {{ .2,  .2}, { .25,  .25}}], 

                    \ \ \ \ \ \ \ \ \ \ \ \ "Placeholder"]}], \ 

              \ \ \ \ \ \ \ \ 
              StyleBox[
                FrameBox["imax", 
                  BoxMargins -> {{ .2,  .2}, { .25,  .25}}], 

                \ \ \ \ \ \ \ \ \ \ "Placeholder"]], \ 
\ \ \ \ \ \ 
            StyleBox[
              FrameBox["expr", 
                BoxMargins -> {{ .2,  .2}, { .25,  .25}}], 

              \ \ \ \ \ \ \ \ "Placeholder"]}], Placeholder]\ \)\)

Examples

AutoIndent

Option AutoIndent now supports Automatic, which does what you've always wanted it to do.

\(If[Porky ≤ 1, 
	fixPorky[], 
	unfixPorky[]
]\)

\(If[Porky ≤ 1, 
	fixPorky[], 
	unfixPorky[]
]\)

If[Porky ≤ 1, 
fixPorky[], 
      
unfixPorky[]
];

Improvements to keyboard editing/selection/motion commands

Improvements to up/down arrow:  they now move up/down using the physical position, not the logical character count.  Also, gridboxes, fractions, and under/over scripts act as lines.

(({{(1/5) (Sqrt[(1/2) (5 + (Sqrt[5]))]), {1, 2}}, {{2, 1}, {2, 2}}}))"second line""third line"

Select/deselect to begin/end of line
Select/delete previous/next line

Keyboard short names

Esc generalized to expand to any box

SetOptions[SelectedNotebook[], 
      ShortNames 
        -> {
          "intt" -> 
            MakeBoxes[
              ∫\[SelectionPlaceholder] 
                  \[DifferentialD]\[Placeholder]], 
          "dintt" -> 
            MakeBoxes[
              (∫_\[Placeholder]^\[Placeholder]) 
                  \[SelectionPlaceholder] \[DifferentialD]\[Placeholder]]}];

SetOptions[SelectedNotebook[], 
      ShortNames -> 
        Union[ShortNames /. Options[SelectedNotebook[], ShortNames], 
          Flatten[Table[
              StringJoin[ToString[i], ToString[j], "k", ToString[k], 
                  ToString[l]] -> 
                RowBox[{
                    SubsuperscriptBox["",  
                      i,  j], SubsuperscriptBox["K", k, l]}], {i, 3}, {
                j, 3}, {k, 3}, {l, 3}]]]];

SetOptions[SelectedNotebook[], ShortNames -> {}];

If you are developing a package, you might want to consider adding some short name equivalents for any palettes or notation that you develop.

AutoReplace

By default, a very small number of common sequences now auto-convert.  For example -> turns into -> automatically.  The number is kept small to avoid annoyance.

The characters to be converted must be a Mathematica token. (So 12k34 as above would not work.)

The conversion happens on the next character.

Let's write a simple package:

\(\(CreateSubscriptedVariables[basesP_, subscriptsP_] := 

      Module[{bases, subscripts}, 
        
bases = Map[ToString, Flatten[{basesP}]]; 
        
subscripts = 
          Map[ToString, Flatten[{subscriptsP}]]; 
        

SetOptions[SelectedNotebook[], 
          InputAutoReplace -> 
            Union[InputAutoReplace /. 
                Options[SelectedNotebook[], InputAutoReplace], 
              Flatten[Outer[
                  StringJoin[#1, #2] -> SubscriptBox[#1, #2] &, bases, 
                  subscripts]]]]; 
]; \)\)

CreateSubscriptedVariables[{a, b, x, y}, Range[5]]

Safe file save

Makes sure that there is enough disk space.
Makes sure that you don't run out of memory while saving.

Remote file system support

The front end now supports a set of MathLink packets that mirror the low level file system functions in the kernel.
This allows you to write programs in the kernel that open, read, write, etc, files on the front end's file system.

Clearly, this is most useful when the front end and kernel are running on different file systems.

Experimental Features in 3.1

Popup palettes

Here are some (quick and dirty) examples.  Note the use of graphics in buttons.

({{Arithmetic({{\[SelectionPlaceholder] + \[Placeholder], \[SelectionPlaceholder] - \[Placeholder], \[SelectionPlaceholder]×\[Placeholder], (\[SelectionPlaceholder]/\[Placeholder])}, {-\[SelectionPlaceholder], (\[SelectionPlaceholder]^\[Placeholder]), (Sqrt[\[SelectionPlaceholder]]), (\[SelectionPlaceholder]^(1/\[Placeholder]))}})}, {Algebra({{\[SelectionPlaceholder] == \[Placeholder]}, {Solve[\[SelectionPlaceholder] == \[Placeholder], 
                      \[Placeholder]]}, {\(Solve[{\[SelectionPlaceholder] == \[Placeholder], 
                        \[Placeholder] == \[Placeholder]}, 

                      	\ \ \ \ \ \ \ \ \ \ \ \ \ {\[Placeholder], 
                        \[Placeholder]}]\)}, {NSolve[\[SelectionPlaceholder] == \[Placeholder], 
                      \[Placeholder]]}, {Expand[\[SelectionPlaceholder]]}, {Factor[\[SelectionPlaceholder]]}, {Together[\[SelectionPlaceholder]]}, {Apart[\[SelectionPlaceholder]]}, {Cancel[\[SelectionPlaceholder]]}, {Simplify[\[SelectionPlaceholder]]}, {FullSimplify[\[SelectionPlaceholder]]}})}, {Complex Numbers({{\[SelectionPlaceholder] + \[Placeholder]  I}, {({{Re[\[SelectionPlaceholder]], Im[\[SelectionPlaceholder]]}, {Abs[\[SelectionPlaceholder]], Arg[\[SelectionPlaceholder]]}})}, {Conjugate[\[SelectionPlaceholder]]}, {PowerExpand[\[SelectionPlaceholder]]}, {ComplexExpand[\[SelectionPlaceholder]]}})}, {Lists({{({{(({{\[Placeholder]}, {\[Placeholder]}})), (({{\[Placeholder], \[Placeholder]}})), , (({{\[Placeholder], \[Placeholder]}, {\[Placeholder], \[Placeholder]}}))}})}, {({{Table[
                            \[SelectionPlaceholder], {\[Placeholder], 
                              \[Placeholder], \[Placeholder]}]}, {Table[
                            \[SelectionPlaceholder], {\[Placeholder], 
                              \[Placeholder], \[Placeholder], \[Placeholder]}]
                            }, {\(Table[
                            \[SelectionPlaceholder], {\[Placeholder], 
                              \[Placeholder], \[Placeholder]}, 

                            	\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {
                              \[Placeholder], \[Placeholder], \[Placeholder]}]
                            \)}})}})}, {Matrix Operations({{\[SelectionPlaceholder] . \[Placeholder]}, {Cross[\[SelectionPlaceholder], \[Placeholder]]}, {Outer[\[SelectionPlaceholder], \[Placeholder], 
                      \[Placeholder]]}, {Det[\[SelectionPlaceholder]]}, {Inverse[\[SelectionPlaceholder]]}, {Transpose[\[SelectionPlaceholder]]}, {Eigenvalues[\[SelectionPlaceholder]]}, {Eigenvectors[\[SelectionPlaceholder]]}, {LinearSolve[\[SelectionPlaceholder], \[Placeholder]]
                      }, {RowReduce[\[SelectionPlaceholder]]}})}, {Trig and Exp({{({{Sin[\[SelectionPlaceholder]], ArcSin[\[SelectionPlaceholder]]}, {Cos[\[SelectionPlaceholder]], ArcCos[\[SelectionPlaceholder]]}, {Tan[\[SelectionPlaceholder]], ArcTan[\[SelectionPlaceholder]]}})}, {({{TrigExpand[\[SelectionPlaceholder]]}, {TrigFactor[\[SelectionPlaceholder]]}, {TrigReduce[\[SelectionPlaceholder]]}, {ExpToTrig[\[SelectionPlaceholder]]}, {TrigToExp[\[SelectionPlaceholder]]}, {({{Log[\[SelectionPlaceholder]], Log[10,  \[SelectionPlaceholder]], Exp[\[SelectionPlaceholder]]}})}, {({{Sinh[\[SelectionPlaceholder]], ArcSinh[\[SelectionPlaceholder]]}, {Cosh[\[SelectionPlaceholder]], ArcCosh[\[SelectionPlaceholder]]}, {Tanh[\[SelectionPlaceholder]], ArcTanh[\[SelectionPlaceholder]]}})}})}})}, {Calculus({{({{∫\[SelectionPlaceholder] \[DifferentialD]\[Placeholder], (∂_\[Placeholder]) 
                            \[SelectionPlaceholder]}, {(∫_\[Placeholder]^\[Placeholder])\[SelectionPlaceholder] \[DifferentialD]\[Placeholder], (∂_(\[Placeholder], 
                              \[Placeholder]))\[SelectionPlaceholder]}, {(∑_(\[Placeholder] = 
                                    \[Placeholder])^\[Placeholder]) \[SelectionPlaceholder], (∏_(\[Placeholder] = 
                                    \[Placeholder])^\[Placeholder]) \[SelectionPlaceholder]}})}, {({{Limit[\[SelectionPlaceholder], 
                            \[Placeholder] -> \[Placeholder]]}, {Series[
                            \[SelectionPlaceholder], {\[Placeholder],  
                              \[Placeholder],  \[Placeholder]}]}, {DSolve[
                            \[SelectionPlaceholder]  ==  
                              \[Placeholder],  \[Placeholder],  
                            \[Placeholder]]}, {\(DSolve[{
                              \[SelectionPlaceholder]\  == \ 
                                \[Placeholder], \ 
                              \[Placeholder]\  == \ \[Placeholder]}, 

                            	\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 
                            \[Placeholder], \ \[Placeholder]]\)}, {\(DSolve[{
                              \[SelectionPlaceholder]\  == \ 
                                \[Placeholder], \ 
                              \[Placeholder]\  == \ \[Placeholder]}, 

                            	\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {
                              \[Placeholder], \ \[Placeholder]}, \ 
                            \[Placeholder]]\)}, {\(NDSolve[{
                              \[SelectionPlaceholder]\  == \ 
                                \[Placeholder], \ 
                              \[Placeholder]\  == \ \[Placeholder]}, 

                            	\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 
                            \[Placeholder], 
                            \ {\[Placeholder], \ \[Placeholder], \ 
                              \[Placeholder]}]\)}})}})}, {Root Finding({{FindRoot[
                      \[SelectionPlaceholder] == \[Placeholder], 
                       {\[Placeholder],  \[Placeholder]}]}, {\(FindRoot[
                      \[SelectionPlaceholder] == \[Placeholder], 

                      	\ \ \ \ \ \ \ \ \ {\[Placeholder], 
                        \ {\[Placeholder], \ \[Placeholder]}}]\)}, {\(FindRoot[{
                        \[SelectionPlaceholder] == \[Placeholder], \ 
                        \[Placeholder] == \[Placeholder]}, 

                      	\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {
                        \[Placeholder], \ \[Placeholder]}, 
                      \ {\[Placeholder], \ \[Placeholder]}]\)}, {Floor[\[SelectionPlaceholder]]}, {Ceiling[\[SelectionPlaceholder]]}, {Round[\[SelectionPlaceholder]]}, {Chop[\[SelectionPlaceholder]]}, {Mod[\[SelectionPlaceholder], \[Placeholder]]}, {Quotient[\[SelectionPlaceholder], \[Placeholder]]}, {GCD[\[SelectionPlaceholder], \[Placeholder]]}, {LCM[\[SelectionPlaceholder], \[Placeholder]]}, {FactorInteger[\[SelectionPlaceholder]]}, {Rationalize[\[SelectionPlaceholder]]}})}, {Special Functions({{\[SelectionPlaceholder]!}, {BesselI[\[Placeholder], \[SelectionPlaceholder]]}, {BesselJ[\[Placeholder], \[SelectionPlaceholder]]}, {BesselK[\[Placeholder], \[SelectionPlaceholder]]}, {BesselY[\[Placeholder], \[SelectionPlaceholder]]}, {Erf[\[SelectionPlaceholder]]}, {Gamma[\[SelectionPlaceholder]]}, {Zeta[\[SelectionPlaceholder]]}})}, {Graphics({{Plot[\[SelectionPlaceholder], {\[Placeholder], 
                        \[Placeholder], \[Placeholder]}]}, {Plot[{\[SelectionPlaceholder], \[Placeholder]}, {
                        \[Placeholder], \[Placeholder], \[Placeholder]}]}, {\(ParametricPlot[{\[SelectionPlaceholder], 
                        \[Placeholder]}, 

                      	\ \ \ \ \ \ \ \ \ \ \ \ \ {\[Placeholder], 
                        \[Placeholder], \[Placeholder]}]\)}, {\(Plot3D[\[SelectionPlaceholder], 

                      	\ \ {\[Placeholder], \[Placeholder], 
                        \[Placeholder]}, {\[Placeholder], \[Placeholder], 
                        \[Placeholder]}]\)}, {\(ParametricPlot3D[

                      	\ \ \ \ \ \ \ {\[SelectionPlaceholder], 
                        \[Placeholder], \[Placeholder]}, 

                      \ \ \ \ \ \ \ 	{\[Placeholder], \[Placeholder], 
                        \[Placeholder]}]\)}, {\(ParametricPlot3D[

                      	\ \ \ \ {\[SelectionPlaceholder], \[Placeholder], 
                        \[Placeholder]}, 

                      	\ \ \ \ {\[Placeholder], \[Placeholder], 
                        \[Placeholder]}, {\[Placeholder], \[Placeholder], 
                        \[Placeholder]}]\)}, {\(ContourPlot[\[SelectionPlaceholder], 

                      	\ \ \ {\[Placeholder], \[Placeholder], 
                        \[Placeholder]}, {\[Placeholder], \[Placeholder], 
                        \[Placeholder]}]\)}, {\(DensityPlot[\[SelectionPlaceholder], 

                      	\ \ \ {\[Placeholder], \[Placeholder], 
                        \[Placeholder]}, {\[Placeholder], \[Placeholder], 
                        \[Placeholder]}]\)}, {ListPlot[\[SelectionPlaceholder]]}, {\(ListPlot[\[SelectionPlaceholder], 
	
                      PlotJoined -> True]\)}, {ListPlot3D[\[SelectionPlaceholder]]}})}})

({{2 + 2({{\[SelectionPlaceholder] + \[Placeholder], \[SelectionPlaceholder] - \[Placeholder], \[SelectionPlaceholder]×\[Placeholder], (\[SelectionPlaceholder]/\[Placeholder])}, {-\[SelectionPlaceholder], (\[SelectionPlaceholder]^\[Placeholder]), (Sqrt[\[SelectionPlaceholder]]), (\[SelectionPlaceholder]^(1/\[Placeholder]))}}), x + y({{\[SelectionPlaceholder] == \[Placeholder]}, {Solve[
                        \[SelectionPlaceholder] == \[Placeholder], 
                        \[Placeholder]]}, {\(Solve[{
                          \[SelectionPlaceholder] == \[Placeholder], 
                          \[Placeholder] == \[Placeholder]}, 

                        	\ \ \ \ \ \ \ \ \ \ \ \ \ {\[Placeholder], 
                          \[Placeholder]}]\)}, {NSolve[
                        \[SelectionPlaceholder] == \[Placeholder], 
                        \[Placeholder]]}, {Expand[\[SelectionPlaceholder]]}, {Factor[\[SelectionPlaceholder]]}, {Together[\[SelectionPlaceholder]]}, {Apart[\[SelectionPlaceholder]]}, {Cancel[\[SelectionPlaceholder]]}, {Simplify[\[SelectionPlaceholder]]}, {FullSimplify[\[SelectionPlaceholder]]}}), 1 + I({{\[SelectionPlaceholder] + \[Placeholder]  I}, {({{Re[\[SelectionPlaceholder]], Im[\[SelectionPlaceholder]]}, {Abs[\[SelectionPlaceholder]], Arg[\[SelectionPlaceholder]]}})}, {Conjugate[\[SelectionPlaceholder]]}, {PowerExpand[\[SelectionPlaceholder]]}, {ComplexExpand[\[SelectionPlaceholder]]}}), {}({{({{(({{\[Placeholder]}, {\[Placeholder]}})), (({{\[Placeholder], \[Placeholder]}})), , (({{\[Placeholder], \[Placeholder]}, {\[Placeholder], \[Placeholder]}}))}})}, {({{Table[
                              \[SelectionPlaceholder], {\[Placeholder], 
                                \[Placeholder], \[Placeholder]}]}, {Table[
                              \[SelectionPlaceholder], {\[Placeholder], 
                                \[Placeholder], \[Placeholder], 
                                \[Placeholder]}]}, {\(Table[
                              \[SelectionPlaceholder], {\[Placeholder], 
                                \[Placeholder], \[Placeholder]}, 

                              	\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {
                                \[Placeholder], \[Placeholder], 
                                \[Placeholder]}]\)}})}}), (({{a, b}, {c, d}}))({{\[SelectionPlaceholder] . \[Placeholder]}, {Cross[\[SelectionPlaceholder], \[Placeholder]]}, {Outer[\[SelectionPlaceholder], \[Placeholder], 
                        \[Placeholder]]}, {Det[\[SelectionPlaceholder]]}, {Inverse[\[SelectionPlaceholder]]}, {Transpose[\[SelectionPlaceholder]]}, {Eigenvalues[\[SelectionPlaceholder]]}, {Eigenvectors[\[SelectionPlaceholder]]}, {LinearSolve[\[SelectionPlaceholder], \[Placeholder]]
                        }, {RowReduce[\[SelectionPlaceholder]]}}), ({{({{Sin[\[SelectionPlaceholder]], ArcSin[\[SelectionPlaceholder]]}, {Cos[\[SelectionPlaceholder]], ArcCos[\[SelectionPlaceholder]]}, {Tan[\[SelectionPlaceholder]], ArcTan[\[SelectionPlaceholder]]}})}, {({{TrigExpand[\[SelectionPlaceholder]]}, {TrigFactor[\[SelectionPlaceholder]]}, {TrigReduce[\[SelectionPlaceholder]]}, {ExpToTrig[\[SelectionPlaceholder]]}, {TrigToExp[\[SelectionPlaceholder]]}, {({{Log[\[SelectionPlaceholder]], Log[10,  \[SelectionPlaceholder]], Exp[\[SelectionPlaceholder]]}})}, {({{Sinh[\[SelectionPlaceholder]], ArcSinh[\[SelectionPlaceholder]]}, {Cosh[\[SelectionPlaceholder]], ArcCosh[\[SelectionPlaceholder]]}, {Tanh[\[SelectionPlaceholder]], ArcTanh[\[SelectionPlaceholder]]}})}})}}), ∫∂({{({{∫\[SelectionPlaceholder] \[DifferentialD]\[Placeholder], (∂_\[Placeholder]) 
                              \[SelectionPlaceholder]}, {(∫_\[Placeholder]^\[Placeholder])\[SelectionPlaceholder] \[DifferentialD]\[Placeholder], (∂_(\[Placeholder], 
                                \[Placeholder]))\[SelectionPlaceholder]}, {(∑_(\[Placeholder] = 
                                      \[Placeholder])^\[Placeholder]) \[SelectionPlaceholder], (∏_(\[Placeholder] = 
                                      \[Placeholder])^\[Placeholder]) \[SelectionPlaceholder]}})}, {({{Limit[\[SelectionPlaceholder], 
                              \[Placeholder] -> \[Placeholder]]}, {Series[
                              \[SelectionPlaceholder], {\[Placeholder],  
                                \[Placeholder],  \[Placeholder]}]}, {DSolve[
                              \[SelectionPlaceholder]  ==  
                                \[Placeholder],  \[Placeholder],  
                              \[Placeholder]]}, {\(DSolve[{
                                \[SelectionPlaceholder]\  == \ 
                                  \[Placeholder], \ 
                                \[Placeholder]\  == \ \[Placeholder]}, 
                              
	\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 
                              \[Placeholder], \ \[Placeholder]]\)}, {\(DSolve[{
                                \[SelectionPlaceholder]\  == \ 
                                  \[Placeholder], \ 
                                \[Placeholder]\  == \ \[Placeholder]}, 
                              
	\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {
                                \[Placeholder], \ \[Placeholder]}, \ 
                              \[Placeholder]]\)}, {\(NDSolve[{
                                \[SelectionPlaceholder]\  == \ 
                                  \[Placeholder], \ 
                                \[Placeholder]\  == \ \[Placeholder]}, 
                              
	\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 
                              \[Placeholder], 
                              \ {\[Placeholder], \ \[Placeholder], \ 
                                \[Placeholder]}]\)}})}}), (Sqrt[find])({{FindRoot[
                        \[SelectionPlaceholder] == \[Placeholder], 
                         {\[Placeholder],  \[Placeholder]}]}, {\(FindRoot[
                        \[SelectionPlaceholder] == \[Placeholder], 

                        	\ \ \ \ \ \ \ \ \ {\[Placeholder], 
                          \ {\[Placeholder], \ \[Placeholder]}}]\)}, {\(FindRoot[{
                          \[SelectionPlaceholder] == \[Placeholder], \ 
                          \[Placeholder] == \[Placeholder]}, 

                        	\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {
                          \[Placeholder], \ \[Placeholder]}, 
                        \ {\[Placeholder], \ \[Placeholder]}]\)}, {Floor[\[SelectionPlaceholder]]}, {Ceiling[\[SelectionPlaceholder]]}, {Round[\[SelectionPlaceholder]]}, {Chop[\[SelectionPlaceholder]]}, {Mod[\[SelectionPlaceholder], \[Placeholder]]}, {Quotient[\[SelectionPlaceholder], \[Placeholder]]
                        }, {GCD[\[SelectionPlaceholder], \[Placeholder]]}, {LCM[\[SelectionPlaceholder], \[Placeholder]]}, {FactorInteger[\[SelectionPlaceholder]]}, {Rationalize[\[SelectionPlaceholder]]}}), Γζ({{\[SelectionPlaceholder]!}, {BesselI[\[Placeholder], \[SelectionPlaceholder]]}, {BesselJ[\[Placeholder], \[SelectionPlaceholder]]}, {BesselK[\[Placeholder], \[SelectionPlaceholder]]}, {BesselY[\[Placeholder], \[SelectionPlaceholder]]}, {Erf[\[SelectionPlaceholder]]}, {Gamma[\[SelectionPlaceholder]]}, {Zeta[\[SelectionPlaceholder]]}}), ({{Plot[\[SelectionPlaceholder], {\[Placeholder], 
                          \[Placeholder], \[Placeholder]}]}, {Plot[{\[SelectionPlaceholder], \[Placeholder]}, {
                          \[Placeholder], \[Placeholder], \[Placeholder]}]
                        }, {\(ParametricPlot[{\[SelectionPlaceholder], 
                          \[Placeholder]}, 

                        	\ \ \ \ \ \ \ \ \ \ \ \ \ {\[Placeholder], 
                          \[Placeholder], \[Placeholder]}]\)}, {\(Plot3D[\[SelectionPlaceholder], 

                        	\ \ {\[Placeholder], \[Placeholder], 
                          \[Placeholder]}, {\[Placeholder], \[Placeholder], 
                          \[Placeholder]}]\)}, {\(ParametricPlot3D[

                        	\ \ \ \ \ \ \ {\[SelectionPlaceholder], 
                          \[Placeholder], \[Placeholder]}, 

                        \ \ \ \ \ \ \ 	{\[Placeholder], \[Placeholder], 
                          \[Placeholder]}]\)}, {\(ParametricPlot3D[

                        	\ \ \ \ {\[SelectionPlaceholder], \[Placeholder], 
                          \[Placeholder]}, 

                        	\ \ \ \ {\[Placeholder], \[Placeholder], 
                          \[Placeholder]}, {\[Placeholder], \[Placeholder], 
                          \[Placeholder]}]\)}, {\(ContourPlot[\[SelectionPlaceholder], 

                        	\ \ \ {\[Placeholder], \[Placeholder], 
                          \[Placeholder]}, {\[Placeholder], \[Placeholder], 
                          \[Placeholder]}]\)}, {\(DensityPlot[\[SelectionPlaceholder], 

                        	\ \ \ {\[Placeholder], \[Placeholder], 
                          \[Placeholder]}, {\[Placeholder], \[Placeholder], 
                          \[Placeholder]}]\)}, {ListPlot[\[SelectionPlaceholder]]}, {\(ListPlot[\[SelectionPlaceholder], 
	
                        PlotJoined -> True]\)}, {ListPlot3D[\[SelectionPlaceholder]]}})}})

Symbol Value Tracker

Constantly updates value of symbols.

An important part of a debugger—not entirely clear what it's good for in other contexts.

Implementation

GlobalStatusWindow =. ;

GlobalStatusSymbols  = {};

createGlobalStatusWindow[] := 
      If[Head[GlobalStatusWindow] === Symbol, 
        GlobalStatusWindow = 
          NotebookCreate[WindowSize -> {300, Automatic}, 
            WindowMargins -> {{Automatic, 4}, {4, 10}}, 
            ShowCellBracket -> False, ShowSelection -> False]]

Developer`SetSymbolTest[s_] := (UpdateValue[s]; True)

Developer`SetSymbolTest[s_,  val_] := 
      (UpdateValue[s, val]; True)

\(Attributes[valueCell] = {HoldAll}; 

    valueCell[s_] := valueCell[s, Null, False]; 

    valueCell[s_, \ s_] := valueCell[s, Null, False]; 
    valueCell[s_, val_] := valueCell[s, val, True]; \)

valueCell[s_, val_, set_] := 
      Cell[BoxData[
          If[set, ToBoxes[val], 
            StyleBox["Cleared", FontColor -> RGBColor[0, 0, 1]]]], 
        "Output", CellTags -> ToString[HoldForm[s]], 
        CellLabel -> StringJoin[ToString[HoldForm[s]], " ="], 
        CellMargins -> {{100, 0}, {2, 2}}];

\(Attributes[AddToGlobalStatus] = {HoldAll}; 

    AddToGlobalStatus[s_] := 
      Module[{}, 
If[\(! FreeQ[GlobalStatusSymbols, s]\), Return[]]; 


        Developer`SpecializeSymbol[s]; 

        Experimental`ValueFunction[s] = UpdateValue; 

        AppendTo[GlobalStatusSymbols, \ s]; 
createGlobalStatusWindow[]; 

        SelectionMove[GlobalStatusWindow, \ After, \ Notebook]; 

        NotebookWrite[GlobalStatusWindow, valueCell[s, s]]
]\)

\(Attributes[UpdateValue] = {HoldAll}; 

    UpdateValue[s_] := 
      FrontEndExecute[{

          FrontEnd`NotebookFind[GlobalStatusWindow, 
            ToString[HoldForm[s]], {CellTags}], 

          FrontEnd`NotebookWrite[GlobalStatusWindow, 
valueCell[s]]
}]; 

    UpdateValue[s_, val_] := 
      FrontEndExecute[{

          FrontEnd`NotebookFind[GlobalStatusWindow, 
            ToString[HoldForm[s]], {CellTags}], 

          FrontEnd`NotebookWrite[GlobalStatusWindow, valueCell[s, val]]
}]; 
    \)

$NewSymbol = (AddToGlobalStatus[Evaluate[ToExpression[#1]]] &);

Examples

Do[i, {i, 30}];

FindRoot[(x^2) == Sin[x], {x, 100}]

step[n_?EvenQ] := (n/2); 
step[n_?OddQ] := 3  n + 1;

NestWhile[step, 51, (nn = #; # ≠ 1) &];

Future Features

Real time 3D Graphics

Stephen showed this earlier.

Graphics

Interactive graphics, integrated as tightly with the kernel as typeset expressions are now.

Programmability and symbolic foundation will make this another revolutionary feature in Mathematica.

Stephen showed it earlier, but this is a better example.

Implementation

Setup

Off[General::"spell"];

Off[General::"spell1"];

ExpressionToGraphics[]

ClearAll[ExpressionToGraphics];

\(\(ExpressionToGraphics[a_?AtomQ]\  := 
	
      Graphics[{
	RGBColor[ .8, \  .8, \ 1], 

          	 (*\ Order\ of\ points\ is\ crucial\ to\ proper\ parsing\ *) 
	
          Polygon[{{\(-1\), \(-0.5\)}, {\(-0.5\), \(-1\)}, {0, \(-0.5\)}, {
                \(-0.5\), \ 0}}], 
	GrayLevel[0], 
			
          Text[StyleForm[a, FontSize -> 18], \ {\(-0.5\), \(-0.5\)}]

          		}, \ PlotRange -> {{\(-1\), 0}, {\(-1\), 0}}]; \)\)

\(\(ExpressionToGraphics[f_[e___]]\  := 
	
      Module[{inputGraphics, xMin, \ xMax, \ yMin, \ yMax, width, \ height, 
          nInputs, 
		hSpacing\  = \ 1.5, 
		vSpacing\  = \ 0.5, 
		
          stubLength\  = \ 0.25, 
		stubSpacing\  = \ 0.5, 
		
          boxMargin\  = \ 0.6, 
		boxUnitsPerChar\  = \ 0.2
		}, 

        		{inputGraphics, \ {{xMin, xMax}, {yMin, \ yMax}}}\  = 
			\ 
          arrangeInputs[ExpressionToGraphics\ /@\ {e}, \ vSpacing]; 
		
        nInputs\  = \ Length[{e}]; 
		
        width\  = \ 
          Max[1, \ boxMargin\  + \ 
              boxUnitsPerChar\ *\ StringLength[ToString[f]]]; 
		
        height\  = \ \((Max[nInputs, \ 1]\  + \ 1)\)\ stubSpacing; 
		
        xMinHead\  = \ xMax\  + \ hSpacing; 
		
        xMaxHead\  = \ xMinHead\  + \ width; 
		
        yMaxHead\  = \ yMax\  - \ \((\((yMax\  - \ yMin)\) - height)\)/2; 

        		yMinHead\  = \ yMaxHead\  - \ height; 
		
        Graphics[{
				First\ /@\ inputGraphics, 
				
            Table[Line[{
							
                    \({xMax, \ Plus\ @@\ #[\([2]\)]/2} &\)[\ 
                      PlotRange\  /. \ Options[inputGraphics[\([i]\)]]\ ], 

                    							{xMinHead, \ yMaxHead\  - \ i\ stubSpacing}
                      
					}], \ {i, \ 1, nInputs}]\  /. 
              \ {
						
                Line[{{x1_, \ y1_}, {x2_, y2_}}]\  :> \ 
                  Line[{{x1, y1}, {x1\  + \ stubLength, \ y1}, {
                        x2\  - \ stubLength, \ y2}, {x2, y2}}]

                						}, 
				
            translateGraphics[{
						RGBColor[ .7, 1,  .7], 

                						 (*\ 
                  Order\ of\ points\ is\ crucial\ to\ proper\ parsing\ *) 

                						
                Polygon[{{\(-width\), \ \(-height\)}, {\(-width\), \ 0}, {0, 
                      0}, {0, \(-height\)}, {\(-width\), \ \(-height\)}}], 

                						GrayLevel[0], 
						
                Text[StyleForm[f, FontSize -> 18], 
                  \ {\(-width\)/2, \(-height\)/2}]
					}, 
              \ {width\  + \ hSpacing, \ 
                \(-\((yMax\  - \ yMin\  - \ height)\)\)/2}]
			}, 
			
          PlotRange -> {{xMin, \ width\  + \ hSpacing}, 
              \ {Min[yMin, \ \((yMin\  - \ yMax\  - height)\)/2], \ yMax}}

          		]
	]; \)\)

arrangeInputs[]

Positions the elements of a list of Graphics[] so that the rhs of their bounding boxes are at x=0, the top of the first is at y=0, and the rest descend downward with vSpacing units inbetween each.  Returns a doublet containing a list of the arranged graphics and the bounding box of the graphics.

ClearAll[arrangeInputs];

\(\(arrangeInputs[g : {_Graphics ... }, \ vSpacing_]\  := 
	
      arrangeInputs[g, \ vSpacing, \ {}, \ {{0, 0}, {0, 0}}]; \)\)

arrangeInputs[{},   _,  g_,  bbox_]  :=  {g,  bbox};

\(\(arrangeInputs[gIn : {__}, \ \ vSpacing_, \ gOut_List, 

        	{{xMinBBox_, \ xMaxBBox_}, {yMinBBox_, yMaxBBox_}}
]\  := 
	
      Module[{xMin, \ xMax, yMin, yMax, \ g, \ dy}, 
		
        dy\  = \ If[gOut\  == \ {}, \ 0, \ vSpacing]; 

        		{{xMin, \ xMax}, {yMin, yMax}}\  = \ 
          PlotRange\  /. \ Options[First[gIn]]; 
		
        g\  = \ \ 
          translateGraphics[First[gIn], 
            \ {\(-xMax\), \ \(-yMax\)\  + yMinBBox - dy}]; 

        		{{xMin, \ xMax}, {yMin, yMax}}\  = \ PlotRange\  /. \ Options[g]; 
        
		arrangeInputs[Rest[gIn], \ vSpacing, 
			
          Append[gOut, 
            g], {{Min[xMin, \ xMinBBox], xMaxBBox}, {\ yMin, \ yMaxBBox}}

          		]
	]; \)\)

\(\(translateGraphics[g_, \ d_]\  := 
	
      g\  /. {
			Point[pt_]\  :> \ Point[pt + d], 
			
          Line[pts_]\  :> \ Line[\(\((#\  + \ d)\) &\)\ /@\ pts], 
			
          Polygon[pts_]\  :> \ Polygon[\(\((#\  + \ d)\) &\)\ /@\ pts], 

          			Text[t_, pt_]\  :> \ Text[t, \ pt\  + \ d], 
			
          Rectangle[pt1_, \ pt2_]\  :> \ 
            Rectangle[pt1\  + \ d, \ pt2\  + \ d], 
			
          Circle[pt_, \ r_]\  :> \ Circle[pt\  + \ d, \ r], 
			
          HoldPattern[PlotRange -> r_] :> \(PlotRange -> r + d\)
		}; 
    \)\)

GraphicsToExpression

ClearAll[GraphicsToExpression];

\(\(GraphicsToExpression[g : Graphics[___]]\  := 
	
      Module[{text, \ nFunctionRects, \ labeledRects, \ lines, \ 
          parentChildArcs, \ parentChildMultiArcs}, 
		

        		 (*\ Make\ a\ list\ of\ labeled\ bounding\ box\ rectangles\ *) 

        		 (*\ Processing\ of\ text\ is\ a\ hack\ that\ makes\ a\ shaky\ 
            assumption\ about
		\ \ \ the\ form\ of\ the\ first\ 
            \(argument . \)\ *) 
		
        text\  = \ 
          Cases[g, \ 
            Text[DisplayForm[e_], \ pt_] :> 
              Text[ToExpression[e], \ pt], \ {1, \ ∞}]; 
		
        labeledRects\  = 
          labelRects[text, \ 
				
            Cases[g, \ 
              Polygon[{{x1_, y1_}, {x2_, y2_}, \ {x3_, \ y3_}, 
                    \ {x4_, \ y4_}, \ {x5_, \ y5_}}] :> {Interval[{x1, x3}], 
                  Interval[{y1, y3}]}, \ {1, \ ∞}]]; 
		
        nFunctionRects\  = \ Length[labeledRects]; 
		
        labeledRects\  = \ 
          Join[labeledRects, \ 
            labelRects[text, \ 
              Cases[g, \ 
                Polygon[{{x1_, y1_}, {x2_, y2_}, \ {x3_, \ y3_}, 
                      \ {x4_, \ y4_}}] :> {Interval[{x1, x3}], 
                    Interval[{y2, y4}]}, \ \ {1, ∞}]]]; 


        		 (*\ Find\ out\ which\ rects\ are\ joined\ by\ which\ lines\ *) 

        		lines\  = \ 
          Cases[g, \ 
            Line[{{x1_, y1_}, ___, {xn_, yn_}}] -> {{x1, y1}, {xn, yn}}, 
            \ {1, \ ∞}]; 
		
        parentChildArcs\  = \ 
          findParentChildArcs[lines, \ labeledRects, \ 0.01]; 
		
        parentChildMultiArcs\  = \ findParentChildMultiArcs[parentChildArcs]; 
        

		 (*\ 
          Build\ the\ expression\ from\ the\ arcs\ and\ text\ information\ *) 
          
		buildExpression[parentChildMultiArcs, \ 
          findMultiArcsRoot[parentChildMultiArcs], \ 
          \(\((#[\([3]\)])\) &\)\ /@\ labeledRects, \ nFunctionRects]
	]; 
    \)\)

\(\(labelRects[text_, \ rects_]\  := 
      \(Module[

            		{xInterval\  = \ #[\([1]\)], \ yInterval\  = \ #[\([2]\)]}, 

            		Append[#, 
			
              \(Select[text, \ 
				
                  \((IntervalMemberQ[xInterval, \ #[\([2, 1]\)]]\  && \ 

                        					IntervalMemberQ[yInterval, \ #[\([2, 2]\)]])
                      \) &, \ 1]\)[\([1, 1]\)]
			]
	] &\)\ /@\ rects; 
    \)\)

\(\(findParentChildArcs[lines_, \ rects_, \ slop_]\  := \ 
      \(Module[

            		{x1\  = \ #[\([1, 1]\)], \ y1\  = \ #[\([1, 2]\)], \ 
              x2\  = \ #[\([2, 1]\)], \ y2\  = \ #[\([2, 2]\)]}, 

            		{
			
              \(Position[rects, \ 

                  				_?
                    \((\((IntervalMemberQ[#[\([2]\)], \ y2]\  && \ 
                            IntervalMemberQ[#[\([1]\)], \ 
                              \((x2\  + \ slop)\)])\) &)\), \ 
				{1}, 
                  \ 1, \ Heads -> False]\)[\([1, 1]\)], 
			
              \(Position[rects, \ 

                  				_?
                    \((\((IntervalMemberQ[#[\([2]\)], \ y1]\  && \ 
                            IntervalMemberQ[#[\([1]\)], \ 
                              \((x1\  - \ slop)\)])\) &)\), \ 
				{1}, 
                  \ 1, \ Heads -> False]\)[\([1, 1]\)], 
				y2
		}

            		] &\)\ /@\ lines; \)\)

\(\(findParentChildMultiArcs[arcs_]\  := \ 
      Module[{sortedArcs, \ maxIndex}, 
		
        sortedArcs\  = \ 
			
          Sort[arcs, \ 
            \((First[#1] < First[#2]\  || \ 
                  \((First[#1] == First[#2]\  && \ Last[#1] > Last[#2])\))
                \) &]; 
		
        maxIndex\  = \ Max\ @@\ Flatten[\(Drop[#, \(-1\)] &\)\ /@\ arcs]; 

        		Fold[Insert[#1, \ #2[\([2]\)], \ {#2[\([1]\)], \(-1\)}] &, \ 
          Table[{}, \ {maxIndex}], \ sortedArcs]
	]; \)\)

\(\(findMultiArcsRoot[arcs_]\  := \ 
	
      First[Complement[Range[Length[arcs]], \ Sequence\ @@\ arcs]]; \)\)

\(\(buildExpression[multiArcs_, \ rootIndex_, \ text_, \ nFunctions_] := 
      \ 
	If[rootIndex\  > \ nFunctions, 
		text[\([rootIndex]\)], 
		
        text[\([rootIndex]\)]\ @@
			
          \((\(buildExpression[multiArcs, \ #, \ text, \ nFunctions] &\)\ /@\ 
              multiArcs[\([rootIndex]\)])\)
	]; \)\)

MakeBoxes[] and MakeExpression[]

Needs["GraphEditGraphics`"];

\(\(MakeBoxes[DiagramForm[e_], \ form_]\  := 
	
      \(MakeBoxes[DisplayForm[#], \ form] &\)\ @@\ {ExpressionToGraphics[e]}; 
    \)\)

Unprotect[Graphics];

\(\( (*\ This\ is\ wrong, \ 
      since\ the\ args\ get\ evaluated . \ But\ it' s\ good\ enough\ for\ 
        \(now . \)\ *) 

    \(Graphics\  /: 
MakeExpression[g : Graphics[__], \ form_]\  := \ 
      HoldComplete\ @@\ {GraphicsToExpression[g]}; \)\)\)

Protect[Graphics];

setGraphics["Graphics"];

Example

NestList[f,  x,  2] // DiagramForm

{1, 2, 3} // DiagramForm

xxfxffList/.{x -> 123List}//DiagramForm

Dialog Boxes

We plan to implement a full dialog box language.  We've seen people put in super-human effort to make something that sort of works given the limitations of the current frontend.  Life is just too short — we're working on it.

That's all Folks