I was wondering if there is anything on root you can use to get the equation of a polynomial fit for a graph? I made a TGraph with a google sheet of data points and then did a pol 3 fit and I was just wondering if there is a way to get the equation of the fit line it made.

So if you have the result of the pol3 fit (the parameters: a b c d) you get the equation… by definition axˆ3+bxˆ2+cx+d

Thank you for the feedback. I tried that in desmos to see if it graphed the line and it didn’t seem to be working. My parameters are:

p0: 3.415 ± 0.1558

p1: -8.64e-08 ± 5.951e-09

p2: 7.62e-16 ± 7.084e-17

p3: -2.272e-24 ± 2.658e-25

I made my equation:

3.415x^3 - 8.64e-08x^2 + 7.62e-16x - 2.272e-24

Can you help tell me what is wrong?

`pol3 = p0 + p1*x + p2*x*x + p3*x*x*x`

Oh ok thank you. Just a conceptual question, why exactly does that work? Why do the parameters convert into the equation like that?

That’s canonic form of a degree 3 equation. The fitting operation allows to determine a b c and d

So if you replace a b c and d by the computed value you get the specific equation.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.