Re: Plot[], Show[] and ; in Version 6
- To: mathgroup at smc.vnet.net
- Subject: [mg76495] Re: [mg76433] Plot[], Show[] and ; in Version 6
- From: Murray Eisenberg <murray at math.umass.edu>
- Date: Wed, 23 May 2007 05:18:58 -0400 (EDT)
- Organization: Mathematics & Statistics, Univ. of Mass./Amherst
- References: <200705220648.CAA19859@smc.vnet.net>
- Reply-to: murray at math.umass.edu
Simple solution: enclose the first Plot with Print!
Some words of explanation: A block (or Module) should NOT display any
result other than the final one: the old behavior, in 5.2, resulted only
from the fact that the display of a graphic was a side-effect and not
the result. In 6.0, the display IS the result.
Now the second argument of a Block is a CompoundExpression (with the
special input form using semicolons to separate the arguments of the
CompoundExpression). So, as you've discovered, any Plot expression
before the final one in the CompoundExpression produces no result.
yasdfer at yahoo.com wrote:
> Since version 6.0 suppresses Plot/Show outputs with ; (semicolon), how
> do you plot and then do additional numerical (or graphical) outputs? I
> have a lot of existing notebooks that follow such pattern and I am
> hoping that there are some quick fixes.
>
> For example, the following would work in older version and not in 6:
>
> Block[{x=1,y=2},
> Plot[x,{x,0,1}];
> Print[Sqrt[y]];
> Plot[x^2,{x,0,1}]
> ]
>
> Thanks,
>
> -Victor
>
>
--
Murray Eisenberg murray at math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower phone 413 549-1020 (H)
University of Massachusetts 413 545-2859 (W)
710 North Pleasant Street fax 413 545-1801
Amherst, MA 01003-9305
- References:
- Plot[], Show[] and ; in Version 6
- From: yasdfer@yahoo.com
- Plot[], Show[] and ; in Version 6