Re: Plot curiousities ...
- To: mathgroup at christensen.Cybernetics.NET
- Subject: [mg324] Re: [mg314] Plot curiousities ...
- From: ianc (Ian Collier)
- Date: Mon, 12 Dec 1994 14:58:35 -0600
At 11:32 PM 12/11/94, Dave Shreiner wrote:
>Hi,
>
> Plot[] seems to be a little contrary at the moment. Perhaps, its too late,
>and I'm missing something, but Plot[] seems to be very picky about which lists
>its willing to execute. For example, consider the following session,
>
>> Mathematica 2.2 for SGI
>> Copyright 1988-93 Wolfram Research, Inc.
>> -- Motif graphics initialized --
>>
>> In[1]:= $Version
>>
>> Out[1]= SGI 2.2 (December 22, 1993)
>>
>> In[2]:= Plot[ { x, x^2, x^3 }, { x, 0, 3 }]
>>
>> Out[2]= -Graphics-
>
> Here, I actually get a window with the plots in it.
>
>> In[3]:= Plot[ Power[ x, Range[ 3 ]] // Flatten, { x, 0, 3 }]
<<<Error messages deleted >>>
> Here, I get an empty plot window, as expected from the messages.
>
>> In[4]:= Power[ x, Range[ 3 ]] // Flatten
>>
>> 2 3
>> Out[4]= {x, x , x }
>
> However, this list seems to be identical to the one that I hand entered.
>An undocumented feature, perhaps? This certainly isn't a critical problem, but
>I would like to know if I'm the cause of the problem.
>
> Thanks for any assistance.
Dave,
Try:
Plot[ Evaluate[Power[ x, Range[ 3 ]] // Flatten], { x, 0, 3 }]
The Evaluate is necessary because Plot has the attribute HoldAll.
--Ian
----------------------------------------------------------------
Ian Collier
Technical Sales Support
Wolfram Research, Inc.
----------------------------------------------------------------
Tel (217) 398-0700 Fax (217) 398-0747 ianc at wri.com
----------------------------------------------------------------