MathGroup Archive 2008

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

Search the Archive

Re: When is a List not a List?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg91054] Re: When is a List not a List?
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Mon, 4 Aug 2008 03:27:17 -0400 (EDT)
  • Organization: Uni Leipzig
  • References: <g6rntk$7kj$1@smc.vnet.net>
  • Reply-to: kuska at informatik.uni-leipzig.de

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?