Re: Plot[], Show[] and ; in Version 6

*To*: mathgroup at smc.vnet.net*Subject*: [mg76534] Re: Plot[], Show[] and ; in Version 6*From*: Szabolcs <szhorvat at gmail.com>*Date*: Wed, 23 May 2007 05:39:12 -0400 (EDT)*Organization*: University of Bergen*References*: <f2u4am$jnp$1@smc.vnet.net>

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 Hi Victor, Try to avoid procedural approaches like this. You almost never need to use Print[] in Mathematica (I only use it for debugging). Instead of using explicit output functions, just return the results. This is now possible with graphics in v6. In 5.2 you did Do[Plot[Sin[k x], {x, 0, 2 Pi}], {k, 1, 5}]. Now change that to Table[Plot[Sin[k x], {x, 0, 2 Pi}], {k, 1, 5}]. Or instead of the example you gave with Block, use something like With[{a=1, b=2}, { Plot[a*x, {x,0,1}], Sqrt[y], Plot[b*x^2, {x,0,1}] } ] If you really really want explicit output functions, you can use Print with graphics. But I strongly suggest you avoid this. If you don't like the layout of graphics when output as elements of a list, use GraphicsColumn, GraphicsRow, GraphicsGrid, Grid etc. Szabolcs