MathGroup Archive 2008

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

Search the Archive

Re: When is a List not a List?


Hi,

try

g[x_, n_] := x^n
FullForm[Table[g[x, n], {n, 1, 2}]]
FullForm[{g[x, 1], g[x, 2]}]
Plot[{g[x, 1], g[x, 2]}, {x, 0, 1}, PlotStyle -> {Red, Blue}]
Plot[Evaluate[Table[g[x, n], {n, 1, 2}]], {x, 0, 1},
  PlotStyle -> {Red, Blue}]

because Plot[] has the attribute HoldAll, it find not out that
the evaluate version of Table[g[x, n], {n, 1, 2}] is a list.

Regards
   Jens

AES wrote:
>    g[x_, n_] := x^n
>    FullForm[Table[g[x, n], {n, 1, 2}]]
>    FullForm[{g[x, 1], g[x, 2]}]
>    Plot[{g[x, 1], g[x, 2]}, {x, 0, 1}, PlotStyle -> {Red, Blue}]
>    Plot[Table[g[x, n], {n, 1, 2}], {x, 0, 1}, PlotStyle -> {Red, Blue}]
> 
> The FullForm[]s are identical.  One Plot[] has red and blue curves; the 
> other has two blue curves.
> 
> Quirky!
> 


  • Prev by Date: Re: Colors in Plot[]
  • Next by Date: Re: Constructing vector using table
  • Previous by thread: Re: Re: When is a List not a List?
  • Next by thread: Re: When is a List not a List?