Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

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

Search the Archive

Re: Variables in Iterator limits?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg109629] Re: Variables in Iterator limits?
  • From: "Kurt TeKolste" <tekolste at fastmail.net>
  • Date: Sun, 9 May 2010 07:49:01 -0400 (EDT)

It would appear that in evaluating

Show[lines]/.testValues

you are first evaluating Show[lines] with no assigned value for kmax,
getting the error message and the full form of Show[lines] and then
evaluating that with kmax assigned, resulting in the graph

For comparison try Show[lines/.testValues]

ekt



On Sat, 08 May 2010 07:05 -0400, "AES" <siegman at stanford.edu> wrote:
> If I execute the following lines, I get the graphic that I want:
> 
>    x; Remove["Global`*"];
> 
>     lines := Graphics[ Table[ Line[{{k 10/kmax,-1},
>                                      {k  10/kmax,1}}], {k,1,kmax}]]
> 
>    km = 30; Show[lines]
> 
> If I execute the following lines, I get exactly the same graphic, all OK,
> 
>    x; Remove["Global`*"];
> 
>    lines := Graphics[ Table[ Line[{{k 10/kmax,-1},
>                                      {k  10/kmax,1}}], {k,1,kmax}]]
> 
>    testValues = {kmax->30};  Show[lines] /. testValues
> 
> -- except that I also get a beep, and an error msg in the Messages 
> window:
> 
>      "Iterator {k,1,kmax} does not have appropriate bounds"
> 
> (but no little red square in the graphics output cell).
> 
> Same thing happens in the /. case if I do the two tests in reverse order.
> 
> Seems like another annoying little Mathematica "gotcha" to me . . . ?
> 
> 


  • Prev by Date: Re: How to Explain This Behavior of Simple Procedures?
  • Next by Date: Re: Variables in Iterator limits?
  • Previous by thread: Re: Variables in Iterator limits?
  • Next by thread: Re: Variables in Iterator limits?