Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #5657

Re: Plot function with two arguments

From "Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Plot function with two arguments
Date 2011-10-15 10:03 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <j7blpd$32t$1@smc.vnet.net> (permalink)
References <j79109$i3b$1@smc.vnet.net>

Show all headers | View raw


On Fri, 14 Oct 2011 10:56:25 +0100, Alexei Boulbitch  
<Alexei.Boulbitch@iee.lu> wrote:

> "Remove Evaluate, and all the curves will be the same color."
>
> Why actually it behaves this way?
>
> This:
>
> f[x_, k_] := (k*x^2 - x)/(x - k);
> Plot[Table[f[x, k], {k, -3, 3}], {x, -20, 20}]
>
> indeed yields all lines of the same colour.  However, this:
>
> lst=Table[f[x, k], {k, -3, 3}];
> Plot[lst, {x, -20, 20}]
>
> returns the lines with different colours. I would appreciate, if one  
> explains the reason For such a behaviour.
>
> Thank you, Alexei

Plot has HoldAll. By the looks of it, a check is done to see if the first  
argument has head List; if so, Plot understands that it is being given a  
list of functions and colours them accordingly. If the Head is not List,  
though (for example, in this case it would be Table), Plot treats it as a  
single, vector-valued function, with all branches plotted using the same  
style.

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Re: Plot function with two arguments Alexei Boulbitch <Alexei.Boulbitch@iee.lu> - 2011-10-14 09:56 +0000
  Re: Plot function with two arguments "Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com> - 2011-10-15 10:03 +0000

csiph-web