On Dec 3, 1:33 am, Roberto Bonvallet <[EMAIL PROTECTED]> wrote: > On Dec 2, 5:27 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > wrote: > > > It will accept a few data points (x,f(x)) of a function > > that converges to some finite value when x converges to infinity. I > > need the algorithm to guess what that limit is. > > Since there are an infinity of ways to estimate the limit, I suggest > sticking to the simplest one: > > def guess_limit(points): > x, y = max(points) > return y > > > [ > > [1,8], > > [2,7.5], > > [3,7.25], > > [4,7.125] > > ] > > Then the output will be 7. Or at least something close. > > For this data set, my function will return 7.125. Is it close enough? > Finding a better estimation is more a math problem than a Python one. > > Best regards, > -- > Roberto Bonvallet
Roberto, your Zen-Python wisdom is irresistible :) -- http://mail.python.org/mailman/listinfo/python-list