[Date Index]
[Thread Index]
[Author Index]
Re: a question about plot a list of functions.
*To*: mathgroup at smc.vnet.net
*Subject*: [mg58283] Re: a question about plot a list of functions.
*From*: Bill Rowe <readnewsciv at earthlink.net>
*Date*: Sat, 25 Jun 2005 01:56:58 -0400 (EDT)
*Sender*: owner-wri-mathgroup at wolfram.com
On 6/22/05 at 1:55 AM, jiangzhou_yz at yahoo.com (Zhou Jiang) wrote:
>I defined a function as
>K=(2 r/(1-r^2))^2;
>y=1/(1+K (Sin[x])^2);
>y=y/.{r->{0.2,0.9,0.995}}
>Now the result is a list. I want to plot y vs. x in one figure and
>I did the following
>Plot[y, {x, 0, 10 Pi}];
>But Mathematica gave me an error. I changed it to
>Plot[{y[[1]], y[[2]], y[[3]]}, {x, 0, 10 Pi}];
>Mathematica gave me a correct plot. Can anyone give me some idea
>why the error message is given by Mathematica since y is a list and
>nothing is diffrent from {y[[1]], y[[2]], y[[3]]}?
The difference is due to the way Mathematic evaluates arguments for Plot. For more detail on why this matters read the discussion of Plot in section 1.9.1 in the Mathematica Book. Meanwhile, the issue can be addressed using Evaluate. Specifically,
Plot[Evaluate@y, {x, 0, 10 Pi}];
will do what you want.
--
To reply via email subtract one hundred and four
Prev by Date:
** Re: Asking questions**
Next by Date:
**Re: Re: lists of variables**
Previous by thread:
**Re: a question about plot a list of functions.**
Next by thread:
**Updates to visualization site**
| |