MathGroup Archive 2003

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

Search the Archive

Re: Recovering f[z] values?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg42700] Re: Recovering f[z] values?
  • From: bobhanlon at aol.com (Bob Hanlon)
  • Date: Tue, 22 Jul 2003 04:40:37 -0400 (EDT)
  • References: <bfgb8a$8g4$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Clear[f, z];

Include memory in the definition of f

f[z_] := f[z] = Sin[z/10];

Use f

Do[f[Random[Integer,{0,20}]], {5}];

Recall use of f

{#[[1,1,1]],#[[2]]}& /@ Drop[DownValues[f],-1]

{{0, 0}, {6, Sin[3/5]}, {18, Sin[9/5]}, {20, Sin[2]}}

Reset f without losing definition

DownValues[f]=Last[DownValues[f]];

Reuse f

Do[f[Random[Integer,{0,20}]], {5}];

Recall use of f since reset

{#[[1,1,1]],#[[2]]}& /@ Drop[DownValues[f],-1]

{{2, Sin[1/5]}, {3, Sin[3/10]}, {7, Sin[7/10]}, {13, Sin[13/10]}}


Bob Hanlon

In article <bfgb8a$8g4$1 at smc.vnet.net>, AES/newspost <siegman at stanford.edu>
wrote:

<< During the course of a long notebook evaluation a certain function

    f[z] = some function of z

gets executed multiple times for various values of z which are no longer 
remembered.  Near the end of the calculation it's desired to recover all 
these values, perhaps in a list

    {{z1,f[z1]}, {z2,f[z2}, . . . }

Is there a simple way to do this?


  • Prev by Date: Re: Recovering f[z] values?
  • Next by Date: Re: Eulerian angles
  • Previous by thread: Re: Recovering f[z] values?
  • Next by thread: Re: Re: Recovering f[z] values?