MathGroup Archive 2010

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

Search the Archive

Variables in Iterator limits?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg109608] Variables in Iterator limits?
  • From: AES <siegman at stanford.edu>
  • Date: Sat, 8 May 2010 07:05:49 -0400 (EDT)
  • Organization: Stanford University

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: PlotLegend Bug?
  • Next by Date: Re: Easy question, please help to run a function n times
  • Previous by thread: PlotLegend Bug?
  • Next by thread: Re: Variables in Iterator limits?