# Contribution to a ploynomial

1. Dec 5, 2007

### Budbus

Hello All,

I'll outline what i'm trying to do: I've written a program which will fit a polynomial to a set of data. The data represents a spectra. I want to be able to fit a ploynomial to an experimental data set and then also fit several reference data sets(which i've been able to do. So i have a polynomial for the experimental data and several for the reference sets.

What i want to do now is find out what combination of the reference polynomials wil best fit the experimental data set and therefore find the contribution of each reference to the final measured data. The problem is that the degree of each of the polynomials is not nesessarly the same.

Any ideas? do i make myself clear?

Thanks

2. Dec 5, 2007

### CompuChip

If I understand the problem correctly, it comes down to the following

E.g. if you have
$$a_1(x^2 + 3x + 3) + a_2(2 x^2 - x ) + a_3 (4 x - 1)$$
and you want to match it to
$$5 x^2 + 6 x - 3$$
Then you want to choose the coefficients such that ideally
$$a_1 + 2 a_2 = 5, 3a_1 - a_2 + 4a_3 = 6, 3a_1 - a_3 = -3$$
or at least as close as possible.

E.g. you can reduce your problem to solving a system of linear equations, or finding a best fit. There are probably tons of methods for them, though I must admit I know none.

3. Dec 5, 2007

### Budbus

now why didn't i think of that!

You understood correctly and i think it's going to work.
Thanks a lot

4. Dec 5, 2007

### leon1127

I think you want the idea of orthogonal (orthonormal) polynomials and projections.

5. Dec 6, 2007

### CompuChip

Yeah, I was also thinking in terms of defining an inner product $$\langle \cdot, \cdot \rangle$$, and then decomposing as
$$\sum \langle p_n, f \rangle p_n(x)$$
but I'm not sure if this would work if the set of reference polynomials wasn't orthogonal (probably it will be either incomplete or over complete at the very least, which means that the decomposition might not exist or not be unique) and not even which inner product to take for polynomials (the usual definition
$$\langle f, g \rangle = \int_{-\infty}^\infty f(x) g(x) \, \mathrm dx$$
will certainly not work as the polynomials are not square integrable --- unless the domain is finite hmm, if the data represents a spectrum, it probably is bounded... so this might work? Still leaves the problem to determine how good a basis the set of reference polynomials is though[/edit]).

I also have no idea how accurate the coefficient matching thing is, and how to get the best match if there is no exact solution for the system (e.g. there are more reference polynomials than the degree of the input function)