Re: Plotting lists of functions
- To: mathgroup at smc.vnet.net
- Subject: [mg53672] Re: Plotting lists of functions
- From: highegg at centrum.cz (highegg)
- Date: Sat, 22 Jan 2005 03:51:57 -0500 (EST)
- References: <1r4ncfh6m2m8@legacy>
- Sender: owner-wri-mathgroup at wolfram.com
Hi, this is because Plot possesses the HoldAll attribute. (I can't tell why from the top of my head, but I'm sure there's a reason for that) To make it work, simply tell Mathematica to Evaluate the supplied argument first: Plot[Evaluate[listOfFunctions], {x,0,1}]; regards, highegg On 21 Jan 05 05:38:27 -0500 (EST), 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. I need the >construction in a much more general context than this---this is the >simplest example where the "obvious" code screws up. > >I tried the archives of the mailing lists, but they all refer to >EFFICIENCY questions. I can't even get Mathematica to parse the above >3 lines of code. > >Please copy any responses to dbae at maths.warwick.ac.uk, because I don't >read the Mathematica mailing list. > >Thanks a lot >David