How do I solve a 4th-order polynomial?

Here’s the situation: For temperatures less than 0 °C an industrial platinum resistance thermometer can be characterized as follows:

AT[sup]4[/sup] + BT[sup]3[/sup] + CT[sup]2[/sup] + DT + E = R

Where T is the temperature (°C) and R is the resistance (ohms). A, B, C, D, and E are known coefficients.

This equation is (obviously) wonderful for computing R if you already know T. But it’s useless when you measure R and try to compute T (which is what we do).

Up until now I have relied on Excel’s “solver” tool, but I find it annoying and risky because the user has to manually invoke it. I would really like to derive an inverse equation so Excel can do it “on the fly.”

Any help would be appreciated. Thanks.

Here’s a hint.

Sorry about the lack of subscript formatting, I’ll do in Excel language

log(X^t) = t* log(x)
AT^4 = A^(-3) * [A*T]^(4)

From there you should be able to linearise the equation.

It’s on pages 9-12 of my 25th edition CRC. I’ll type it in if you don’t have a CRC. It’s not a simple thing.

Oh and that log[AT] = log [A] + log [T]

Should be dead easy to factorise out the log[T] terms now.

There’s good news, bad news, and bad news. The good news is that there does, indeed, exist an analytic solution to a general quartic (but you’d be out of luck if it were a quintic). The bad news is that that general solution is about fifty pages long, and I’m not even going to try to invert it here. And the bad news is that a general quartic has four solutions, and no matter what method you use, you’re not certain of getting the right one.

Were I in your shoes, I would just construct a big table or graph of R as a function of T, and then look at it sideways.

Thanks Chronos.

I just did a google search on quartic" and found this:

Not sure if it will help me…

What are the values for the coefficients and what is the temperature range? I suspect that will limit the solutions down considerably. Would it be possible to create a series solution, such as a Taylor series, that would get reasonably close enough?

Imagine T®=sum with i from 0 to n of a(i)*R**i
with a(i) being your made up (fitted?) inverse-o-matic coefficients

Most numerical methods will behave well for polynomials. That’s really your best bet.

Use this. There’s code on that site too.

If your use LabView or something like that for DAQ - it has inbuilt functions too

The Taylor series expansion of a polynomial will just get you the original polynomial. Not terribly helpful.

You could try using Newton’s method:

If you have a differentiable function f(x), Newton’s method allows you to create a sequence converging to a solution of f(x)=0.

First, make a “guess” as to what the solution is. Plug this value into

x - (f(x)/f’(x))

(f’(x)=the derivative of f(x)). This your second guess. Plug this into the above formula to get your third guess. Plug that value in to get your fourth guess. And so on.

Some bizarre things can happen with Newton’s method, but generally it converges fairly quickly to the value you’re looking for. If you’re not comfortable with calculus, I’m sure we can help you with the details to get it set up.

Hmm…Newton’s method can do strange things, but it should handle a low-order polynomial pretty well. I assume you know basic differential calculus, Crafter_Man, but just in case, the derivative of At[sup]4[/sup] + Bt[sup]3[/sup] + Ct[sup]2[/sup] + Dt + E is 4At[sup]3[/sup] + 3Bt[sup]2[/sup] + 2Ct + D.

Hey Crafter_Man, I have some numerical root-finding routines in some of my code. It should be relatively easy for me to modify them to solve your equation and tack on a simple console interface.

I guess you wouldn’t be able to call it from excell (unless somebody else here knows how that’s done), but if you are interested let me know and email me a couple of test solutions for comparisons.

I have Newton’s method routines from Numerical Recipes as well as a Muller’s method which has some liberal borrowing from some algorithms I found on the net.

What are the values for the coefficients and what is the temperature range?

I’d be interested to know too. For instance, knowing which terms dominate, you might be able to speed things up with a hybrid method: a first pass to get a good approximation using available functions within Excel, then a couple of Newton’s iterations to refine it.

There’s no magical formula here.

The thermocouple has been calibrated a 5 points, and a 4th order polynomial has been fitted.

There’s a few things you can do:

  1. Test a lower order polynomial over the temperature range you’re interested in. If that gives acceptable errors, use the lower order approximation.

  2. Populate a table with values from the 4th order polynomial (as Chronos suggested), then use linear, quadratic or cubic spline interpolation to look up the value you need.

  3. If (1) doesn’t work, and you don’t want to use (2), then break the operating range up into smaller segments where several different lower order approximations give acceptable results.