473,549 Members | 3,065 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Limit Guessing Algorithm

Hello hello,

I'm looking for a piece of code, preferably in Python, that will do
the following. 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, to whatever precision
it can.

For example, if the input is:

[
[1,8],
[2,7.5],
[3,7.25],
[4,7.125]
]

Then the output will be 7. Or at least something close.

Does anyone know anything like that?
Dec 2 '07 #1
10 1392
In article
<65************ *************** *******@b40g200 0prf.googlegrou ps.com>,
"ra********@gma il.com" <ra********@gma il.comwrote:
Hello hello,

I'm looking for a piece of code, preferably in Python, that will do
the following. 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, to whatever precision
it can.

For example, if the input is:

[
[1,8],
[2,7.5],
[3,7.25],
[4,7.125]
]

Then the output will be 7. Or at least something close.

Does anyone know anything like that?
I suggest any introductory calculus or math analysis text. Perhaps even
the one your professor assigned you for the course :-)

Look under "limits" in the table of contents.
Dec 2 '07 #2
On Dec 2, 10:53 pm, Roy Smith <r...@panix.com wrote:
In article
<6527e349-27ba-4de4-bc29-75ff45117...@b4 0g2000prf.googl egroups.com>,

"ram.rac...@gma il.com" <ram.rac...@gma il.comwrote:
Hello hello,
I'm looking for a piece of code, preferably in Python, that will do
the following. 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, to whatever precision
it can.
For example, if the input is:
[
[1,8],
[2,7.5],
[3,7.25],
[4,7.125]
]
Then the output will be 7. Or at least something close.
Does anyone know anything like that?

I suggest any introductory calculus or math analysis text. Perhaps even
the one your professor assigned you for the course :-)

Look under "limits" in the table of contents.
I'm a third year math undergrad. You probably did not understand my
question.
Dec 2 '07 #3
"ra********@gma il.com" <ra********@gma il.comwrites:
Look under "limits" in the table of contents.

I'm a third year math undergrad. You probably did not understand my
question.
I think I understood the question. It sounds like a numerical methods
homework problem. Basically you have f(x0), f(x1), etc. and you want
to extrapolate to x=infinity. Hint: think of a0=1/x0, a1=1/x1, etc.
so your initial data is f(1/a0), f(1/a1), etc. and it should be pretty
obvious what to do next.
Dec 2 '07 #4
On Dec 2, 11:50 pm, Paul Rubin <http://phr...@NOSPAM.i nvalidwrote:
"ram.rac...@gma il.com" <ram.rac...@gma il.comwrites:
Look under "limits" in the table of contents.
I'm a third year math undergrad. You probably did not understand my
question.

I think I understood the question. It sounds like a numerical methods
homework problem. Basically you have f(x0), f(x1), etc. and you want
to extrapolate to x=infinity. Hint: think of a0=1/x0, a1=1/x1, etc.
so your initial data is f(1/a0), f(1/a1), etc. and it should be pretty
obvious what to do next.
Well Paul, it's not obvious to me, so if you could explain it I'll be
grateful.

Also, this is not a homework assignment. This is something I need for
some physical simulations I'm writing.

Thank you,
Ram.
Dec 2 '07 #5
"ra********@gma il.com" <ra********@gma il.comwrites:
I think I understood the question. It sounds like a numerical methods
homework problem. Basically you have f(x0), f(x1), etc. and you want
to extrapolate to x=infinity. Hint: think of a0=1/x0, a1=1/x1, etc.
so your initial data is f(1/a0), f(1/a1), etc. and it should be pretty
obvious what to do next.

Well Paul, it's not obvious to me, so if you could explain it I'll be
grateful.
Basically define g(x) = f(1/x). So you have this g(a0), g(a1), g(a2), ...
and you can fit a curve through them with your favorite extrapolation
formula (see a numerics book for lots of choices). Then compute g(0).
Dec 2 '07 #6
On Dec 3, 12:02 am, Paul Rubin <http://phr...@NOSPAM.i nvalidwrote:
"ram.rac...@gma il.com" <ram.rac...@gma il.comwrites:
I think I understood the question. It sounds like a numerical methods
homework problem. Basically you have f(x0), f(x1), etc. and you want
to extrapolate to x=infinity. Hint: think of a0=1/x0, a1=1/x1, etc.
so your initial data is f(1/a0), f(1/a1), etc. and it should be pretty
obvious what to do next.
Well Paul, it's not obvious to me, so if you could explain it I'll be
grateful.

Basically define g(x) = f(1/x). So you have this g(a0), g(a1), g(a2), ...
and you can fit a curve through them with your favorite extrapolation
formula (see a numerics book for lots of choices). Then compute g(0).
Thank you Paul. This seems to make sense :)
I'll try to implement it.

Best Wishes,
Ram.
Dec 2 '07 #7
On Dec 2, 5:27 pm, "ram.rac...@gma il.com" <ram.rac...@gma il.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(poi nts):
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
Dec 2 '07 #8
On Dec 3, 1:33 am, Roberto Bonvallet <rbonv...@gmail .comwrote:
On Dec 2, 5:27 pm, "ram.rac...@gma il.com" <ram.rac...@gma il.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(poi nts):
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 :)
Dec 3 '07 #9
Hi,
>
I'm looking for a piece of code, preferably in Python, that will do
the following. 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, to whatever precision
it can.

For example, if the input is:

[
[1,8],
[2,7.5],
[3,7.25],
[4,7.125]
]

Then the output will be 7. Or at least something close.

Does anyone know anything like that?
It is obvious that in general this is an unsolvable problem. But if you
know for some reason that your series/functions are "well behaved" in
some sense it still might be possible to do something reasonable and
there has some work been done on these things. You might e.g. google for
Wynns epsilon method which gives some examples and references for
related stuff.

hth,

albert
Dec 3 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
5329
by: CajunCoiler \(http://www.cajuncoiler.tk\) | last post by:
I've seen no reference to this in the MSDN library, so I ask here... what is the known upper limit for the RichTextbox control? And when this limit is exceeded, what error is generated?
3
9809
by: Cengiz Dincoglu | last post by:
When I insert a long value as key and the object to a hashtable. it fails at about 600,000 data points. ht.add(long, long) We are developing a real time application that is required to keep about 2.5 million objects in a hashtable and the object should be readly available to the app very fast at any time. Is it better to come up with an...
3
4812
by: Colleyville Alan | last post by:
From the MS Access help I have seen the limits on number of fields in an index, objects in a db, etc. But I have seen no mention on a limit of rows. I am considering an application that would have a table that would have 3.5 million rows. Is there a limit on the number of rows specifically or is there merely a limit on the size of the total...
9
1717
by: James Macbell | last post by:
I think I have pushed ASP.NET to the limit, I am not sure if I have done anything wrong in the code because I am trying to make 2 pieces of code (C# vs PHP) using the same algorithm. Anyways, here is the my test. How: Create a HTML page with 2 hyper links to these files (posted below). Right click, Save target As. Tested: On my P4 1.6 GHz...
4
8457
by: sathyashrayan | last post by:
(This is not a home work question) Dear group, I want a program to find one number between a set of natural number.A program to guess a number in between a Natural number set.This should be a simple task but my mind suddenly got stuck. I am trying to implement a square root function as a practice. I am able to code for the perfect square
4
2079
by: Gerino | last post by:
I am looking for an algorithm, function or something else, that would find limit of a sequence, while given formula i.e. a = n/(n+1) (or any other). Is such thing even possible? I can calculate any number of points, a, a...a, but is there any method to find limit of a sequence in general case?
81
4509
by: Peter Olcott | last post by:
It looks like System::Collections::Generic.List throws and OUT_OF_MEMORY exception whenever memory allocated exceeds 256 MB. I have 1024 MB on my system so I am not even out of physical RAM, much less virtual memory. Are other people experiencing this same problem?
16
1455
by: Nad | last post by:
I have a very large site with valuable information. Is there any way to prevent downloading a large number of articles. Some people want to download the entire site. Any hints or pointers would be appreciated.
10
23719
by: orsula | last post by:
Hi Guys, I have a class A composed of several string and int members. I would like to manage a huge amount (several thousands) of A objects in a dictionary where each object has its unique key. Is there any known limitation or best practice that you think I should consider? Thanks,
0
7446
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7715
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7956
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7469
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7808
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6040
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5368
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
1
1935
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1057
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.