Re: Repeated function evaluation?
- To: mathgroup at smc.vnet.net
- Subject: [mg24239] Re: Repeated function evaluation?
- From: "Kevin J. McCann" <kevinmccann at home.com>
- Date: Tue, 4 Jul 2000 15:22:04 -0400 (EDT)
- References: <8jrcda$du2@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Try,
f[x_,y_] := f[x,y]=Module[{ }, . . .]
This stores previous evaluations. Note that it is costing you memory when
you do this; so, you could run into trouble.
Kevin
"AES" <siegman at stanford.edu> wrote in message
news:8jrcda$du2 at smc.vnet.net...
> 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
>