Message Boards Message Boards

0
|
1021 Views
|
3 Replies
|
0 Total Likes
View groups...
Share
Share this post:

GridBox doesn't return the same form when its inputs are the same value

Posted 7 months ago
b1={{1},{2},{3}} 
    b2={{Range[1,1]},{Range[2,2]},{Range[3,3]}}

"b1" and "b2" are set as above mentioned.
As "b1" and "b2" return the same value "{{1},{2},{3}}", "GridBox[b1]" and "GridBox[b2]" return the same "GridBox[{{1},{2},{3}}]" .
But "GridBox[b1]//DisplayForm" and "GridBox[b2]//DisplayForm" return different forms respectively as below:
GridBox[b1]//DisplayForm
    1
    2
    3

GridBox[b2]//DisplayForm
GridBox[{{1}, {2}, {3}}]

If "b2" is changed to "ToExpression[b2]", then "GridBox[b2]//DisplayForm" returns
    1
    2
    3
I don't understand why the "ToExpression" is to be applyed to "b2" when "b1" is same to "b2". A same parameter would not be necessary to be applied by "ToExpression",I think.
The version of Mathematica is 4.1. The below is the notebook atached but becomes a little different from original. But functions and their responses are correct.
Thanks.

POSTED BY: Ichione Ichiro
3 Replies
Posted 7 months ago

Mr.Eric Rimbey
I have noticed my mistake in the expression of b2={{Range[1,1]},{Range[2,2]},{Range[3,3]}}.
The correct is b2={Range[1,1],Range[2,2],Range[3,3]}:

b1 = {{1}, {2}, {3}}
b2 = {Range[1, 1], Range[2, 2], Range[3, 3]}

I beg your pardon for my mistake.
Thank you for your pointing out.

Mr.Gianluca Gorni
I can not have got hints for "Grid" from the helpDocs. Now, I have found that "Grid" can be used in my old Mathematica. For a long time,when I used boxes, I almost have used them with DisplayForm to show forms. Troubles in such low level commands of old version that bother me may unavoidable as you say.
Thank you for advice to the point.

POSTED BY: Ichione Ichiro
Posted 7 months ago

As "b1" and "b2" return the same value

No, they don't return the same value. I didn't try to debug the rest of your situation, because I stopped when I read that comment. For clarity:

b1 = {{1}, {2}, {3}}
b2 = {{Range[1, 1]}, {Range[2, 2]}, {Range[3, 3]}}
(* b2 is now {{{1}},{{2}},{{3}}}, which has an extra level of lists. *)
POSTED BY: Eric Rimbey

Your result is very strange and I cannot reproduce it. I get the same outputs for b1 and b2. I see that you are using a very old version of Mathematica FrontEndVersion->"4.1 for Microsoft Windows", which may be involved with the probem.

Why are you not using TableForm[b1] or Grid[b1], which do not need DisplayForm?

POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract