Re: new behavior of Plot
- To: mathgroup at smc.vnet.net
- Subject: [mg78560] Re: new behavior of Plot
- From: Bill Rowe <readnewsciv at sbcglobal.net>
- Date: Wed, 4 Jul 2007 05:36:21 -0400 (EDT)
On 7/3/07 at 5:40 AM, sh2.7183 at earthlink.net (Selwyn Hollis) wrote: >Apologies if this has been mentioned here before and I missed it, >but I just accidently discovered that Mathematica 6 has squashed one >of the top three FAQs of all time. >This now works without using Evaluate: >fns = Table[Cos[x - c], {c, -1, 1, .2}]; Plot[fns, {x, -5, 5}] >So does this, but all the curves are drawn with the same color: >Plot[Table[Cos[x - c], {c, -1, 1, .2}], {x, -5, 5}] >This is all rather mysterious, since Plot still has the attribute >HoldAll. >Can anyone explain? In your first case, fns has the head List. So, Plot recognizes it as a list of functions and colors each curve appropriately. In the second case, Plot simply sees Table[...] as a single multi-valued function and the result gets plotted in a single color. Inserting Evaluate before Table gets the same result as your first example since it forces the Table to be evaluated before Plot samples the functions. Here again, Plot sees its argument as a list of functions to be plotted. -- To reply via email subtract one hundred and four