Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1998

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Why doesn't this work ?

Hi Andreas

Plot has the attribute HoldAll. So:
> Look at this:
> This works:
>   Clear[S1];
>   S1=Sin[x];
>   Plot[S1, {x, 0, 3}]

Matheamtica see one single symbol S1 and assumes it has to plot one
function. S1 gets evaluated and evaluates to Sin[x] -- all works fine.

> But why doesn't it work with more than one functions ?
>   Clear[S2];
>   S2={Sin[x],Cos[x]};
>   Plot[S2, {x, 0, Pi}]

Again Mathematica see one single symbol and assumes S2 will return one
value. Now S2 gets evaluated and evaluates to a pair of functions --
but now it is to late to fall back from the assumption of one single
argument and You get an error message.

To Help You out -- Just put a Evaluate[S1] to Your first
Plot[]-argument. Than  S2 is evaluated first 




and Mathematica can reconize that more than one function is to be
plotted. Hope that helps

  • Prev by Date: RE: Re: Easy question: Infinite Series, Infinite Sequences
  • Next by Date: Re: Why doesn't this work ?
  • Prev by thread: Re: Why doesn't this work ?
  • Next by thread: Re: Why doesn't this work ?