Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: Do Plot
Replies: 3   Last Post: Dec 17, 2012 2:54 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Andrzej Kozlowski

Posts: 226
Registered: 1/29/05
Re: Do Plot
Posted: Dec 17, 2012 2:54 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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@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.
>





Date Subject Author
12/17/12
Read Re: Do Plot
Murray Eisenberg
12/17/12
Read Re: Do Plot
Bob Hanlon
12/17/12
Read Re: Do Plot
Andrzej Kozlowski

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.