Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

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

Search the Archive

Show and 6.0

  • To: mathgroup at smc.vnet.net
  • Subject: [mg89425] Show and 6.0
  • From: AES <siegman at stanford.edu>
  • Date: Mon, 9 Jun 2008 02:28:55 -0400 (EDT)
  • Organization: Stanford University

I believe I've more or less fully grasped the explanation of what Show[] 
now does in 6.0 that's been repeatedly restated in all the recent and 
earlier responses to all the repeated plaintive posts about ""Why 
doesn't my plot appear?!?"  --- and this explanation actually make 
reasonable sense to me. 

[It's less obvious, however, how someone is suppose to know that 
Print[]; _will_ print something on screen, but Show[]; _won't_ show 
anything on screen.  Read the Helps for these two commands and see the 
help pages make this obvious to you)

I'm less sure that these expert respondents -- and also WRI -- have 
grasped _why_ these recurrent queries keep recurring; so led me add a 
few (5 actually) responses myself on that point (though it will make for 
a long post):

1)  I suggest the primary problem is a deeper, long-standing, and quite 
understandable misunderstanding of compound expressions, and especially 
the role of semicolons in compound expressions.  

To quote, for example, from one of the recent "Plot and Show[]" 
responses, posted by someone who's often on this group:

> In general, a semi-colon is used to separate the parts of a compound 
> expression

Well, the correct response to that response is "NOT!", right?  Or at 
least, "not entirely".  

That is to say, is the primary function of a semicolon to separate the 
parts of compound expressions? -- or is it to suppress output from an 
expression?  And is it always necessary between two expressions?

I've thought for all my years with Mathematica that you _had_ to put 
semicolons between two successive expressions on the same line or in the 
same cell, except for the very last line in the cell.  And, I guess I 
deduced that this made sense and was necessary because logically you 
always needed to be clear where one expression ended and the next one 
began.

Given this, I would never have believed that giving as input, on a 
single line and in a single cell, the following

   a = Plot[x, {x, 0, 1}];  b = Plot[x^2, {x, 0, 1}];  a  b

would be a legal input -- until I tried it a couple of minutes ago.

But wait a minute!  Aren't a and b now expressions (separately)?  So, 
don't they require a semicolon between them, to separate them?

[In fact, I just tried the above input with  a + b  and then  a * b at 
the end of the line -- and they all worked exactly the same as just 
a b . WOW!!!]

Semicolons need explaining and understanding!

2)  So, where would an innocent but intelligent Mathematica user go to 
unravel these mysteries.  I'd issue a small challenge:  Don't explain 
compound expressions and semicolons to me.  Show us -- show me -- in 
detail how a novice could learn the at least the essential elementary 
rules of compound expressions and semicolons FROM THE CURRENTLY 
AVAILABLE MATHEMATICA 6.0 DOCUMENTATION.

[And, see if the Help for ";" comports with the results I just 
experienced in the preceding.]

3)  And then think a little deeper:  Ask yourself, WHY do these 
recurrent queries about Show[]keep recurring so recurrently?  

Could it just be because the _documentation_ provided for 6.0's 
introduction, and for the massive changes it introduced, has not been 
adequate in explaining or warning about these sizable changes for a 
large class of users???

Let's just leave that thought to simmer for a while . . . 

4)  OK, now having understood the new character of Show[], what should 
users do if they want to really show some graphics -- have them appear 
on screen -- in the middle of a long compound expression.  

Respondents keep suggesting that one should Print[] the graphics.  OK, 
that works, of course -- but it's a poor solution, among other things 
because Print[] messes with the sizes at which the graphics are 
displayed, in a way that doesn't always match with what's expected.  
Something better is needed.

5) Finally, to respond on a quite different aspect of Show[] that's also 
been the subject of a thread recently:

Go to the Help for Show[], where you'll read:

      Show[g1,g2]  . . . concatenates the graphics primitives in the
      gi, effectively overlaying the graphics.

and then try

      a = Plot3D[x y, {x, 0, 1}, {y, 0, 1}]; 
      b = Graphics3D[{Red, Thickness[0.01],
             Line[{{1/2, 1/2, 0}, {1/2, 1/2, 2}}]}];

followed by Show[a, b]  and then  Show[b, a].  Evidently, 
Show[a,b] =|= Show[b,a].

I guess I grasp what happens here, don't need an explanation, and can 
sort of understand, yeah, that's what "concatenate" gives you.  But it's 
a lesson on how careful you have to be with these things.

That's it for the 5.


  • Prev by Date: Re: Selecting Element from List via Pattern Matching
  • Next by Date: Re: Show and 6.0
  • Previous by thread: Re: where is "Mathematica in education and research"?
  • Next by thread: Re: Show and 6.0