# Manipulation of Polynomials and Goodness-of-Fit

This question is directly connected with my problem in Python section HERE. Basically I've programmed a method with mathematical and physical background that forms a polynomial of selected degree whose coefficients are calculated by the measured data.

The final result is a graph that has a correlation between time to rapture and stress at different temperatures. The measurements (measured points) are done at specific temperatures, but with this method you can, after determination of polynomial coefficients, extrapolate a curve for any desired temperature.

You can check out the graphs with the use of 2nd, 3rd, 4th and 5th degree polynomials HERE (to get a better feeling).

2 problems seem to appear:

### 1. Waving/fluctuation

It is especially noticeable in the mid section of 4th and 5th degree polynomial and in case of higher order polynomials it may be even worse.

### 2. Physical incorrectness of polynomial derivative

This appears in 4th degree polynomial where the curve at the bottom section changes its path from left to right - the derivative goes from negative to positive which is physically impossible. It should go in the same direction and manner like 5th degree. Same goes for 3rd degree.

## 1. QUESTION: How to fix the waving and derivative problem

I would like some general mathematical or numerical advice on how this problems are normally solved (with some extra conditions?). For smoothing of the waves I was thinking of an averaging algorithm (similar to Savitzky–Golay filter).

## 2. QUESTION: What is the best/normal way of determining the Goodness-of-fit for non-linear regression

For linear models it's very easy (R squared), but in non-linear cases I'm not familiar with the procedure. Basically I need to determine the Goodness-of-fit for n-th degree polynomial (for any of the shown polynomials)

Any given advice is highly appreciable!

• What are you even trying to do? It is not very easy to understand the plots. Question 2. depends completely on application. What are you going to use your polynomial for? What properties will be of interest / importance? If you get two much waving you may want to consider some type of regularization. – mathreadler Jul 12 '16 at 10:57
• I'm trying to form a model that forms correlation between stress and time to rapture (like shown in the graphs) at different temperature levels. Basically it's an algorithm that generates polynomial coefficients of the chosen polynomial (with specified degree) in regards to measured points, which are obtained from testing. It is a type of approximation and extrapolation at the same time and what I'm trying to solve is how more precisely can this behavior be covered with higher order polynomials (for example 4th, 5th,.. degree), rather than 2nd degree. I don't need specific help, just general.. – mcluka Jul 12 '16 at 11:04

Question 1 can be helped at least a bit if you apply some $$\min_{x}\left\{\sum_{\forall k}{\bf W_k}\left\|\frac{\partial^k}{\partial x^k} \left\{P(x)\right\}\right\|\right\}$$ for a set of diagonal weight matrices $$\bf W_k$$ and a set of some $$k\in\{1,\cdots\}$$ and where $$P(x)$$ is the coefficient vector of the polynomial in various points of interest and $$\bf W_k$$ depends on some function of $$x$$ so that it is large for values in between samples that should be fit, and the differential is a representation matrix compatible with the chosen vectorization of polynomial coefficients.