MathGroup Archive 2007

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

Search the Archive

Re: neat way to program minimum of sum

  • To: mathgroup at smc.vnet.net
  • Subject: [mg75222] Re: neat way to program minimum of sum
  • From: CoolGenie <CGenie at gmail.com>
  • Date: Sat, 21 Apr 2007 23:05:07 -0400 (EDT)
  • References: <f01360$889$1@smc.vnet.net><f07agh$4gm$1@smc.vnet.net>

This just came to my mind:

x[t_]:=x[t]=Random[]
f[t_]:=Length[NestWhileList[# + x[#] &, 0, # <= t &]]

But this is quite crazy!! It generates the list but not indexed by
integers but by some real numbers (increasing, if only we don't get a
'0'...).

To Norbert Marxer:
What if I want to plot this function? Saving the values of x for later
is mandatory.

Thanks to everybody for answers,
P. Kaminski



  • Prev by Date: Re: Assign delayed but fixed value
  • Next by Date: how to make myVec[v,3] to return {v_1, v_2, v_3} ?
  • Previous by thread: Re: neat way to program minimum of sum
  • Next by thread: minmum of a function