Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #7465
| From | Bill Rowe <readnews@sbcglobal.net> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Plot in a Module |
| Date | 2011-12-29 07:54 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <jdh6be$kkj$1@smc.vnet.net> (permalink) |
On 12/28/11 at 5:16 AM, sam.takoy@yahoo.com (Sam Takoy) wrote:
>How does one use the Plot command inside a Module? I find that if
>one places a semi-colon after the command, then the output is
>suppressed. But it also seems illegal to skip the semi-colon? So how
>does one do it?
No, it is not illegal to skip a semicolon. Either of the
following constructs will create a plot
Module[{x = 2},
Plot[y^2, {y, 0, x}]]
or
Module[{x, p},
x = 2;
p = Plot[y^2, {y, 0, x}];
Sqrt[x];
p]
All a semicolon does is create a compound expression. The last
element of a compound expression determines what is displayed.
When you do say
x=2;
You actually create the compound expression x = 2;Null. Since
the last element is Null which does nothing, nothing is displayed.
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
Re: Plot in a Module Bill Rowe <readnews@sbcglobal.net> - 2011-12-29 07:54 +0000
csiph-web