[Date Index]
[Thread Index]
[Author Index]
Re: Do Plot
*To*: mathgroup at smc.vnet.net
*Subject*: [mg129132] Re: Do Plot
*From*: Andrzej Kozlowski <akozlowski at gmail.com>
*Date*: Mon, 17 Dec 2012 02:57:59 -0500 (EST)
*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com
*Delivered-to*: l-mathgroup@wolfram.com
*Delivered-to*: mathgroup-newout@smc.vnet.net
*Delivered-to*: mathgroup-newsend@smc.vnet.net
*References*: <20121216100503.A648D692C@smc.vnet.net>
It will work in versions before 6 but not later. Do only "does" but
produces no output. In versions of Mathematica before 6, the actual
picture produced by Plot was a "side-effect", but since version 6 the
picture is actually output and since Do returns no output you get no
picture.
There are two solutions.
1. The bad solution. Make it work just as before version 6. Print works
by "side-effect" so just insert print into your code like this:
Do[Print[Plot[x^2 + c, {x, -2, 2}]], {c, -1, 1, 0.2}]
The reason why this is bad is because since your pictures are not output
you can't do anything with them.
2. The second approach is to forget Do and use something that produces
output, like Table. Thus
graphs = Table[Plot[x^2 + c, {x, -2, 2}], {c, -1, 1, 0.2}];
will make a list containing your pictures as Mathematica objects. You
can now use them in all sorts of ways,e.g
graphs[[5]]
GraphicsGrid[{graphs[[1 ;; 5]]}]
GraphicsGrid[Transpose[{graphs[[1 ;; 5]]}]]
and so on.
Andrzej Kozlowski
On 16 Dec 2012, at 11:05, dwarnold45 at suddenlink.net wrote:
> Should this command work in Mathematica 9?
>
> Do[Plot[x^2 + c, {x, -2, 2}], {c, -1, 1, 0.2}]
>
> Not working on my Macbook Pro, Snow Leopard 10.6.8.
>
> David.
>
**References**:
**Do Plot**
*From:* dwarnold45@suddenlink.net
Prev by Date:
** Re: Do Plot**
Next by Date:
**How to use FindMaximum with a parameter passed to NDSolve??**
Previous by thread:
**Re: Do Plot**
Next by thread:
**Re: Do Plot**
| |