Jump to content
  • Advertisement
Sign in to follow this  
helloworld123

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

This topic is 3027 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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)

Share this post


Link to post
Share on other sites
Advertisement

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! :)

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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).

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!