MathGroup Archive 2010

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

Search the Archive

Re: Automatic update of variables

  • To: mathgroup at
  • Subject: [mg110314] Re: Automatic update of variables
  • From: "Sjoerd C. de Vries" <sjoerd.c.devries at>
  • Date: Sun, 13 Jun 2010 04:09:41 -0400 (EDT)
  • References: <huvk4q$rq0$>

Are you kidding us? Using SetDelayed (:=) in the definition of b means
the most current value of a are used anytime b is used.

Check this:

b := a
a = 2;
a = 4;

yields 2, then 4.

Or try
b := a

and the assign various values to a and see the dynamically displayed
value of b changing immediately.

By the way: b:=3 a +1 is not a delayed rule. That would be b:>3 a +1

Cheers -- Sjoerd

On Jun 12, 11:31 am, Antonio De Ju=E1rez <adejua... at> wrote:
> Sometimes, I would find useful a method to update variables
> automatically. For example, given the delayed rule
> b:=3 a+1;
> it would be useful to have b updated whenever a is assigned a new
> value, like a=37. Is there any method to do this in Mathematica?
> Thanks,
>    Antonio.

  • Prev by Date: Re: Apply a function to parts of a list
  • Next by Date: Re: Lists: Row Vectors vs. Column Vectors. (feels like such a silly
  • Previous by thread: Re: Automatic update of variables
  • Next by thread: Re: Automatic update of variables