MathGroup Archive 1998

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

Search the Archive

Re: Why doesn't this work ?



Andreas Keese wrote:
> 
> Look at this:
> 
> This works:
>   Clear[S1];
>   S1=Sin[x];
>   Plot[S1, {x, 0, 3}]
> 
> But why doesn't it work with more than one functions ?
> 
>   Clear[S2];
>   S2={Sin[x],Cos[x]};
>   Plot[S2, {x, 0, Pi}]
> 
> gives an error - Mathematica complains that S2 is not a machine-size

The reason it doesn't work is due to the process by which mathematica
evaluates its functions.  You need to take manual control of this
process by use of Hold, Evaluate, ReleaseHold etc.  The following
example plots your functions:

Clear[S2];
  S2={Hold[Sin[x]],Hold[Cos[x]]};
  Plot[Evaluate[ReleaseHold[S2]], {x, 0, Pi}]

Check out section 2.5.5 in the mathematica book.  Hope this helps. -- 
Remove the _nospam_ in the return address to respond.



  • Prev by Date: Re: Questions on MultipleListPlot
  • Next by Date: Re: Derivative via mathematica
  • Prev by thread: Why doesn't this work ?
  • Next by thread: RE: Why doesn't this work ?