Limit Guessing Algorithm
Roberto Bonvallet
rbonvall at gmail.com
Sun Dec 2 18:33:49 EST 2007
On Dec 2, 5:27 pm, "ram.rac... at gmail.com" <ram.rac... at gmail.com>
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
More information about the Python-list
mailing list