MathGroup Archive 2009

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

Search the Archive

Re: Combined Set, SetDelayed

  • To: mathgroup at
  • Subject: [mg100805] Re: Combined Set, SetDelayed
  • From: Simon <simonjtyler at>
  • Date: Sun, 14 Jun 2009 05:41:47 -0400 (EDT)
  • References: <h0vteh$6v2$>

Hi Sid,

if you check the grouping of the expression it is

f[x_,y_] := ( f[x, y] = ... )

thus if f[x,y] is not in the downvalues of f for the particular x and
y it will do the calculation.  If it is in the downvalues, it simply
returns the value it knows.
( NB this is dangerous if you change your definition of f, but do not
clear all the previously calculated specific values )

it can be used whenever the calculation of f[x,y] is computationally
expensive (and memory isn't too much of a problem)...
the famous example (I think given in the documentation centre) is that
of the Fibonacci numbers - a naive recursive definition


becomes unusable for relatively small values of n.


  • Prev by Date: Re: differentiation operator
  • Next by Date: Re: Inverse / Laplace Transform Halved
  • Previous by thread: Re: Combined Set, SetDelayed
  • Next by thread: Re: Combined Set, SetDelayed