I need to come up with a formula for a personal project to fit 7 data points that are, most definitely...

I need to come up with a formula for a personal project to fit 7 data points that are, most definitely, not in the same quadratic. Is there a reliable method or formula to solve for an equasion where n points is greater than 3? I've looked for a few days, but haven't found anything.

Other urls found in this thread:

desmos.com/calculator/qtwugsygr9
en.wikipedia.org/wiki/Newton_polynomial
twitter.com/SFWRedditGifs

Create a system like you normally would in the form Ax=b where A is your matrix with rows (0,0,1), (1,1,1), (4,2,1),...,(36,6,1), x=(a_2,a_1,a_0) where your desired quadratic is f(x)=a_2x^2+a_1x+a_0 and b=(pi,pi,...,384). However, clearly you're system is overdetermined. Compute the least square quadratic via solving x=(A*A)^(-1)A*b where A* is the transpose matrix. If this does not work, try x=(A*A+eId)^(-1)A*b where e>0 and Id is the identity matrix. Choose an e sufficiently small and you should get something reasonably close to an actual solution. Look up Tikhonov approximation if you're interested. Need functional analysis though.

Y = 1.366exp(0.800X)

R^2 = 0.875

It's an ok fit but not great

Why not just use a 5th degree polynomial if you want a perfect fit?

I'm the same guy here . I just reread your question. What I responded with was what you should do if you only want a degree 2 approximation of those data points. If you're fine with any degree then just look up Lagrange interpolation method.

The post about the Lagrange interlopation method seems like something I'll need to look into, so thank you.

I plan on using an nth degree polynomial, but I'm having problems on solving for what the equation would actually be. Hopefully # helps.

you can find a polynomial of the form

[math]c_1x^7+c_2x^6+c_3x^5+c_4x^4+c_5x^3+c_6x^2+c_7x+c_8[/math]

which is guaranteed to fit all those points

#
How would I go about solving for c? I'm somewhat new to solving for polynomials.

I'm the same guy. Polynomial interpolation is pretty simple. All methods will lead to the exact same polynomial, however some representations are more useful than others. If you just look at the wiki I'm sure it will lay out the foundations for you.

Many thanks. I'll look into it and be sure to post what I come up with. It's a decently cool project (in theory).

construct a 7x7 system of equations, using each point. plug in the x value into "x" and y value into "y" for example your first equation would be
[math]c_1\pi^7+c_2\pi^6+c_3\pi^5+c_4\pi^4+c_5\pi^3+c_6\pi^2+c_7\pi+c_8=0[/math]

this is pretty tedious and if all you need is a reasnoble approximation w/ decimals and not closed form you can do a polynomial regression on something like desmos

Hey boss, I think you mixed up your pi and zero.

oh yeah i read it backwards my bad. anyway op is this what you're looking for?

desmos.com/calculator/qtwugsygr9

As great as it is having the exact decimal answer, I need to solve in terms of pi as my formula needs to fit exactly. I appreciate the help, but it's gonna be a lot of longhand to get it done.

Looking at the actual data, I think op would do better with taking the log of each y and getting a linear best fit. That polynomial is not attractive. What's the project's purpose OP?

I'm working on a formula to go between certain multi dimensional objects. Call me paranoid, but I'd rather not get any more specific than that in case it actually turns out to be a good equation. I've got most of it done. I just have to account for this set of data.

have you used any psychoactive substances within recent times? or ever?

Lol its more sane than it sounds. I'll post the formula and its use when I'm done. I just want to be able to say I did it.

How about the carbon monoxide detectors in your house? How are their battery levels?

Its for use on paper only. Practically useless but theoretically neat.

Lol, I thought that the data looked kind of weird to be related with anything practical (though that is not to say uninteresting). If I had to conjecture, I say it has got something to do with circles and the x-coordinates are dimensions. However I can't make out why the Pi's disappear for higher dimensions. Good luck with your project OP.

You're pretty much on point if I get what you're saying. Believe it or not, it took a few tricks to get pi to appear. Made this part harder, but every other part easier. Thank you for the good wishes.

here you go. the function that maps to those points will have the form

y=bx^6+cx^5+dx^4+ex^3+fx^2+gx+h

Dude. Thank you. Do you have any kind of contact you'd post on here?

uh sure, i guess. you can email me at [email protected]

take the unique polynomial of degree 6 that fits these point.

Jesus christ this isn't magic.

If you read the thread you'd see that's what he settled on. Further, in his OP, it seemed like he wanted a least squares quadratic. That is not the case however.

There's an easier way of doing that.

you have equally spaced points. And the spacing is 1! Use the Newton polynomial.


en.wikipedia.org/wiki/Newton_polynomial

Very little calculation is needed.

en.wikipedia.org/wiki/Newton_polynomial

Oh yeah I wrote some code for that a little while ago. Of course with so few points it hardly makes a difference.

And have an unbounded error on the interpolated points

It can be large but it is bounded.

Though I guess maybe that's only when the original assumption that the points are from function is true?

Anyway here's an interesting example showing where the error concentrates depending on the clustering of the points.

start with a linear equation, integrate and set your constant to be the next data point and repeat 6 times?