For an explanation of polynomials take a look at Polynomial - Wikipedia .

Your three data sets can be approximated by low order polynomials and the coefficients of these polynomials are dependent on the approximation criteria used. If one minimizes the mean squared error one will get one set of coefficients and if one minimizes the mean modulus error one will get another set of coefficients. I minimized the mean square error to produce

temp = -4.000000000000e+01 * n^2 + 1.000000000000e+00 * n + 0.000000000000e+00

r22 = -2.481298946362e-03 * n^3 + 4.497414533268e-01 * n^2 + 2.797375277604e-03 * n + 2.846855202869e-05

r410 a = 9.665115991248e+00 * n^4 + 7.746002147311e-01 * n^3 + 2.846743410771e-03 * b^2 + 5.633949163074e-05 * n + -2.953171222656e-08

These coefficients were calculated using Java double and have more precision that can be exploited on the Arduino but it does not hurt to keep the precision at this stage. The compiler will round them as appropriate.

A simple way of using these is to create a Polynomial class that is constructed with these coefficients and has a method to evaluate them for a particular ‘n’. As a starting point see

```
class Polynomial
{
public:
Polynomial(double* poly, uint8_t order): poly_(poly), order_(order)
{
}
const double evaluate(const double x) const
{
double r = poly_[order_];
for (int i = order_ - 1; i >= 0; i--)
{
r = r * x + poly_[i];
}
return r;
}
private:
uint8_t order_;
double* poly_;
};
static double tempPolyCoefs[] =
{
-4.000000000000e+01,
1.000000000000e+00,
0.000000000000e+00
};
static Polynomial tempPoly(tempPolyCoefs, 2);
static double r22PolyCoefs[] =
{
-2.481298946362e-03,
4.497414533268e-01,
2.797375277604e-03,
2.846855202869e-05
};
static Polynomial r22Poly(r22PolyCoefs, 3);
static double r410aPolyCoefs[] =
{
9.665115991248e+00,
7.746002147311e-01,
2.846743410771e-03,
5.633949163074e-05,
-2.953171222656e-08
};
static Polynomial r410aPoly(r410aPolyCoefs, 4);
void setup() {
Serial.begin(115200);
for (int i = 0; i < 200; i++)
{
char tempStr[20];
dtostrf(tempPoly.evaluate(i), 1, 1, tempStr);
char r22Str[20];
dtostrf(r22Poly.evaluate(i), 1, 1, r22Str);
char r410aStr[20];
dtostrf(r410aPoly.evaluate(i), 1, 1, r410aStr);
char buffer[80];
sprintf(buffer, "%d %s %s %s\n", i, tempStr, r22Str, r410aStr);
Serial.print(buffer);
}
}
void loop() {
}
```

Obviously this implementation takes fewer resources than your implementation.

You have not said how you intend to use the data but I am betting that what you want is to actually compute ‘r22’ and ‘r410a’ for a given temperature. One could do this with the polynomials I have provided BUT it would be much better to create polynomials for ‘r22’ and ‘r410a’ with the independent variable being temperature. I will let you do this if you decide you need it; as I did you might want to make the use of http://www.arachnoid.com/polysolve/ .

Whether or not these approximations are accurate enough for your application depends on the application.