How to get equation given many (x,y) points?

Started by
18 comments, last by Medium9 14 years, 2 months ago
Let's say you have a thousand (x,y) points. You want to get an equation, such that: f(x) = y How to get f(x)? (Assuming value of x is always unique)
Advertisement
What you are looking for is probably Curve Fitting. Hope this helps.
Best regards, Omid

Hi Omid, thanks for the link!

I looked into it, if i use that, then if I have a thousand (x,y) points, my final equation would have a degree of 999 right? (a long equation, but it'll work)

Is there another method, where it does the same thing, but gives a shorter equation?

or is there a way to make an equation of degree 999 into something shorter that people can write?

thanks! :)
Quote:Original post by helloworld123
Is there another method, where it does the same thing, but gives a shorter equation?

or is there a way to make an equation of degree 999 into something shorter that people can write?
Are your points random, or do you have some information/educated intuition about the type of curve they form?

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

Quote:Original post by swiftcoder
Quote:Original post by helloworld123
Is there another method, where it does the same thing, but gives a shorter equation?

or is there a way to make an equation of degree 999 into something shorter that people can write?
Are your points random, or do you have some information/educated intuition about the type of curve they form?



Hi,

yes the points are random, and all x-values in all (x,y) are non-repeating (unique).

I'm not really interested with the curve, or the interpolation/extrapolation data that could be derived, i'm only interested in getting y, given x, using an equation.

is there a way to simplify an equation of degree 999?

If I understood you correctly and your points are randomly distributed then you can't find a function f(x)=y. But of course you could use a lookup-table. But maybe you could give some more information about your points.
Quote:Original post by __MosteM__
If I understood you correctly and your points are randomly distributed then you can't find a function f(x)=y. But of course you could use a lookup-table. But maybe you could give some more information about your points.



actually you can, the points are random and are unique (let's say x-values are guaranteed to be unique).

i looked into lagrange interpolation, which does exactly this, it takes many control points (unique points), and give you an equation too.

but problem is, what about for 1000 control points, it'll give a polynomial of degree 999.

i'm just wondering if there is an alternative that gives another equation or some sort, something shorter than an equation of degree 999.

(or is there a way to represent an equation of degree 999 into something shorter? by shorter i mean something you could even write down on a small piece of paper)

thanks!
Fundamentally that is not a useful thing to be doing.

Whilst it is true that for an arbitrary number of points you can find an equation which will satisfy all points it isn't going to be useful for anything.

The point of an equation is that you can put in an input and get an output.

Making up an arbitrary number of random points and finding an equation to fit them is only going to give you more random points.

Summary:
random input -> random output
Subdivide the entire domain in N equal intervals. Build an approximation curve for each of the intervals. If your 1000 points are uniformly distributed, each of the curves will have the degree (1000 / N - 1).
The way of fitting many points to a much smaller equation is known as least-squares regression.

However, I think there may be confusion about your statement "They are random points."
If the x values are "random" then we are talking, and you may be able to fit an equation...
BUT if the y values are ALSO "random" then you are saying there is NO implicit structure to the point distribution, and thus no equation can fit that structure.

It would be very helpful if you could post an example "plot"of some of the points you want to fit.

This topic is closed to new replies.

Advertisement