Re: RowBox-es
- To: mathgroup at smc.vnet.net
- Subject: [mg21345] Re: RowBox-es
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Mon, 27 Dec 1999 01:37:53 -0500 (EST)
- References: <844clm$jpv@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Drago,
I don't have any answers, I think that you r second example is a bug, but
here are some observations
YOUR FIRST QUESTION
This works:
ToExpression["?N"]
"N[expr] gives the numerical value of expr. N[expr, n] attempts to give a \
result with n-digit precision."
YOUR SECOND QUESTION
It looks as if "\[IndentingNewLine]" does have something to do with it.
Cell expression
Cell[BoxData[
RowBox[{"A", "[",
RowBox[{"x", "\[IndentingNewLine]", "y"}],
"]"}]], "Input",
CellLabel->"In[50]:="]
Formatted form and output
A[x
y]
A[y]
Cell expression
Cell[BoxData[
RowBox[{"A", "[",
RowBox[{"x", "\n", "y"}],
"]"}]], "Input",
CellLabel->"In[50]:="]
Formatted form and output
A[x
y]
A[x y]
Actually, I have cheated - when I paste the full cell containing the second
cell expression into OutlookExpress I ge the formatted form.
Allan
---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565
"Drago Ganic" <drago.ganic at in2.hr> wrote in message
news:844clm$jpv at smc.vnet.net...
> Hi,
>
> I've got two questions concerning RowBoxes.
>
> FIRST QUESTION
> ==============
>
> Try (Mathematica 4)
>
> FullForm[?N]
>
> and you get an error message.
>
> Show at the internel representation (using Format | Show Expression)
>
> Cell[BoxData[
> RowBox[{"FullForm", "[",
> RowBox[{"?", "N]"}]}]], "Input",
> CellLabel->"In[1]:="]
>
> and changing it (deleting the internal RowBox) into
>
> Cell[BoxData[
> RowBox[{"FullForm", "[", "?", "N]"}]], "Input",
> CellLabel->"In[1]:="]
>
> we get the right answer.
>
> or (better) moving the outer bracket outside the inner RowBox we get
>
> Cell[BoxData[
> RowBox[{"FullForm", "[",
> RowBox[{"?", "N"}], "]"}]], "Input",
> CellLabel->"In[1]:="]
>
> I believe Mathematica has problems in correctly interpretating the
expression. Any comments ?
>
>
> SECOND QUESTION
> ==================
>
> In the Book David B. Wagner: "Power Programming with Mathematica THE
KERNEL" on page
> 46 ther is an exercise 2.
>
> The question is "What will happen with this Input" - notice the missing
2'nd comma
>
> {2 + 3,
> 4 + 5
> 6 + 7
> } // Trace
>
> Evaluating the expression with MathKernel 3 or 4 we get the expected
answer
>
> {{2 + 3, 5}, {{5 6, 30}, 4 + 30 + 7, 41}, {5, 41}}
>
> BUT, evaluating the expression with the notebook (especcially v4.0) I get
an
> unexpected anser (wrong ??)
>
>
> Output in Notebook v3.0
> Syntax::"tsntxi": "2+3, 4+5" is incomplete; more input is needed."
>
> Output in Notebook v4.0
> {{2 + 3, 5}, {4 + 6 + 7, 17}, {5, 17}} (* !!????!! *)
>
> Of course the Notebook v4.0 gives the expected answer for the input in ONE
line
> In {2 + 3, 4 + 5 6 + 7} // Trace
> Out {{2 + 3, 5}, {{5 6, 30}, 4 + 30 + 7, 41}, {5, 41}}
>
>
> I believe that the wrong behaiviour is not because of the new symbol
"\[IndentingNewLine]"
> (in v3.0: "\n", "\t" was used instead). It's because of the wrong use of
RowBox-es.
>
> Cell[BoxData[
> RowBox[{"{",
> RowBox[{
> RowBox[{"2", "+", "3"}], ",", "\[IndentingNewLine]",
> RowBox[{"4", "+",
> RowBox[{"5", "\[IndentingNewLine]", "6"}], "+",
> "7"}]}], "\[IndentingNewLine]", "}"}]], "Input",
> CellLabel->"In[6]:="]
>
>
> But I wasn' able to change it to get the same bahaviour like v3.0.
> Am I right ?
>
>
> Greeting from Croatia,
> Drago Ganic
>
>