MathGroup Archive 2005

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

Search the Archive

Re: Plotting lists of functions


On 1/22/05 at 3:51 AM, dbae at maths.warwick.ac.uk (David Epstein)
wrote:

>Try this in Mathematica:

>Plot[{1, 2}, {x, 0, 1}]
>listOfFunctions = Table[i, {i, 1, 2}] (*now listOfFunctions equals
>{1,2}*)
>Plot[listOfFunctions, {x, 0, 1}]

>Can anyone tell me a) WHY the first Plot instruction works and the
>second doesn't and b) How I can MAKE this kind of construction
>work.

This occurs because of the way Mathematica evaluates expressions in Plot. See section 1.9.1 of the Mathematica Book for an explanation. The "cure" is to force evaluation of the expression before Plot sees it. That is

Plot[Evaluate@listOfFunctions, {x,0,1}]

will do what you want
--
To reply via email subtract one hundred and four


  • Prev by Date: Re: PlotLegend not an option for PLot? 5.1
  • Next by Date: Re: PlotLegend not an option for PLot? 5.1
  • Previous by thread: Re: Plotting lists of functions
  • Next by thread: Re: Plotting lists of functions