MathGroup Archive 2010

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

Search the Archive

Re: Variables in Iterator limits?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg109645] Re: Variables in Iterator limits?
  • From: AES <siegman at stanford.edu>
  • Date: Mon, 10 May 2010 06:37:39 -0400 (EDT)
  • Organization: Stanford University
  • References: <hs67fk$2rh$1@smc.vnet.net>

To make this query a bit more generic, suppose you're typing in at the 
beginning of a notebook a series of expressions that you're going to use 
later on 

expr1  :=  . . . 
expr2  :=  . . . 
expr3  :=  . . . 
  . . . 

where each of these expressions contains some subset of a fairly lengthy 
set of global variables a, b, c, . . . to which no values have yet been 
assigned.

Suppose further that as you're typing in these expressions, you may to 
test whether one or another of them (let's say expr2) works properly,  
without having any persistent side effects on that expression, or any of 
the previous or subsequent expression definitions, or any of the global 
variables, after the test is carried out, the test line deleted, and the 
expression definitions all reevaluated.

One way to do this might reasonably seem to be to define a typical set 
of _numerical_ test values  a1, b1, . . .   and apply them as follows:

testValues = {a->a1, b->b1, . . . }

expr1 := . . . 
expr2 := . . . 
expr2  /.  testValues
expr3 := . . . 
  . . . 

after which you remove the test line and re-evaluate all the 
definitions.  But this approach apparently can encounter problems 
arising from the order of evaluations.  So, how about

testValues = {a=a1, b=b1, . . . }

expr1 := . . . 
expr2 := . . . 
With[ testValues, expr2 ]
expr3 := . . . 
  . . . 

Is that a safe approach to this objective?


  • Prev by Date: Re: Number of ways of permutations to form a certain pattern of
  • Next by Date: Re: help with DictionaryLookup[] and a type of regular
  • Previous by thread: Re: Variables in Iterator limits?
  • Next by thread: Re: Variables in Iterator limits?