MathGroup Archive 1999

[Date Index] [Thread Index] [Author Index]

Search the Archive

BadAlgebra

  • To: mathgroup at smc.vnet.net
  • Subject: [mg20557] BadAlgebra
  • From: William Fairchild <fairchiw at union.edu>
  • Date: Sat, 30 Oct 1999 00:14:06 -0400
  • Sender: owner-wri-mathgroup at wolfram.com

Must we apply Evaluate[    ] to everything?  Here is an example which
shows that it's a good idea; the following command yields 2(x)+1 in an
input cell:

CellPrint[Cell[BoxData[RowBox[

        {"2", RowBox[{RowBox[{"(", "x", ")"}], "+", "1"}]}

        ]], "Input"]]

but this 2(x)+1 is not the same as one which is typed in, because when it
is entered the output is 2(1+x).  In other words we have an example of
session with

In[1]:=CellPrint[Cell[BoxData[RowBox[

        {"2", RowBox[{RowBox[{"(", "x", ")"}], "+", "1"}]}

        ]], "Input"]]

In[2]:= 2(x)+1

Out[2]:= 2(1+x)

and today is not April 1st.  This example arose in the course of normal
typing and editing of Mathematica expressions, although in a more
complicated situation; the above example is a distillation.

Notice that if the aberrant 2(x)+1 is wrapped in Evaluate[] the
preprocessor does the right thing and the output is correct. Evidently one
must coax the preprocessor to transform the list

{"2", RowBox[{RowBox[{"(", "x", ")"}], "+", "1"}]}

into 

{RowBox[{"2", RowBox[{"(", "x", ")"}]}], "+", "1"} 

so that the kernel gets the right input.  Almost any other minor
perturbation also causes the preprocessor to kick in and "do the right
thing".  The question is:  What other Front End glitches will cause wrong
output?  And can they all be prevented by use of Evaluate[] or other
wrappings?

Bill Fairchild <fairchiw at union.edu>
Math. Dept.
Union College,
Schenectady, NY
518-388-6164



  • Prev by Date: difference equations
  • Next by Date: Zeta Function
  • Previous by thread: difference equations
  • Next by thread: Zeta Function