MathGroup Archive 2000

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

Search the Archive

Repeated function evaluation?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg24240] Repeated function evaluation?
  • From: AES <siegman at stanford.edu>
  • Date: Mon, 3 Jul 2000 20:39:21 -0400 (EDT)
  • Organization: Stanford University
  • Sender: owner-wri-mathgroup at wolfram.com

Suppose I have a function  f[x_,y_] := Module[{ }, . . .]  where the 
module is fairly time-consuming to evaluate.

If I call this function a second time in a given notebook using 
identical values of the arguments  x  and  y , is Mathematica smart 
enough the second time around to recognize that it's already evaluated 
the function once for those arguments, and use a stored value?

Or, if I want to use the values of this function for a given range of 
arguments multiple times (e.g., replotting the values in different 
ways), do I need to do something like

   Do[ ff[x,y] = f[x,y], {x, x1, x2}, {y, y1, y2} ]

and use the values  ff[x,y]  instead?

Thanks   AES


  • Prev by Date: Programming+Goto
  • Next by Date: HELP: personal package
  • Previous by thread: Re: Programming+Goto
  • Next by thread: Re: Repeated function evaluation?