I have f(x) and g(x), what is f(g)

I have two polynomial interpolations of raw data:

1. Wind speed as a function of turbine rotation => v(r)
2. Power as a function of turbine rotation => p(r)

I would like to map these functions to a function describing the relationship between wind speed and power, specifically, p(v)

To provide more information, we are trying to compare the performance of two types of machines. The parameter rotation (r) has little to do with the performance, we are more-so interested in the relationship between v and p.

These are the relationships concerned:

Power vs RPM

RPM vs Wind speed

-
 To straighten things out: you have a parametric equation for the curve relating wind speed and power, with turbine rotation as parameter, and you want the explicit relationship between wind speed and power. Right? Now... why BTW did you use polynomials? Did the physics of the situation necessarily dictate that you use interpolating polynomials? – J. M. Oct 6 '11 at 7:33 @J.M. I have edited the question to provide more info. There is no strict dependence on polynomials, I find however on small intervals the interpolations can made quite accurate. – klonq Oct 6 '11 at 7:50 Do you have the polynomials v(r) and p(r) strictly by interpolation of the empirical data or do you have some additional theoretical/mathematical background for them? If they are simple polynomial regressions from the pairs of measures of (r and v) and of (r and p), and if the regressions are moreover based on the same set of data in r, then why not simply regress (polynomially) p on v ? Or is there some aspect why this would not be meaningful? – Gottfried Helms Oct 6 '11 at 7:51 Huh. I would hope that there's a firm theoretical foundation behind your use of polynomials. You have noisy data; I will presume that you merely erroneously referred to your polynomial fits as "interpolations"... but seriously, have you tried looking for theoretical models? (In short, I fear your problem is more physical than mathematical.) – J. M. Oct 6 '11 at 7:54 @J.M. I do not use the entirety of the data set, outliers are ignored and the average is taken, the interpolation is calculated based on that in MATLAB – klonq Oct 6 '11 at 7:58

The other answers are certainly interesting from a mathematical point of view, but I think J.M.'s comment is way more practical: you don't have the analytic definition of the functions, just two data sets given as $v(r)$ and $p(r)$. By doing a parametric plot where $r$ is the parameter, you can obtain a visualisation of $p(v)$.

If you are working with Matlab, that can be easily done if your data are stored in vectors, you just plot both vectors against each other, provided that the indices of the vectors match so that they correspond to the same $r$-values. From there you can try any fitting method you wish.

-

Hmm, I played a bit with my MatMate-calculator which allows matrix-expressions for statistical evaluation, to give a concrete example for one possible interpretation of your problem.

I generate correlated randomdata in the vectors rpm, veloc, pow ; by construction veloc -data are composed of veloc-specific component and of rpm via a quadratic polynomial (including a constant term!) and pow data analoguously but via a cubic polynomial. It is likely important, that after that compositions pow and veloc are not recentered because having a model involving quadratics means to have ratio-scales.

First I show some code to show how the polynomial regression is expressed in MatMate (hopefully this is explanatory enough to see how this can be done generally/in Matlab), then I show two alternative solutions how to express pow by veloc in that same framework, which -being in the framework of regression only- avoids your intended inverting and composing of polynomials.

1.)
The following MatMate-code reproduced very well the composition-parameters for veloc and pow. The data vectors are arranged as rowvectors for each variable; I chose a cubic regression-model for rpm -> veloc including the constant term.

// comments:   m *'   means: multiply m with its transpose
//             an operator followed by # means: do the operator elementwise
//             1..4 in indexes means the range 1 to 4, * means the full range
//               the ´ means concatenation of ranges
//             original data of rpm veloc and pow were made win n=200 cases
//             data-vectors are organized rowwise

// make data-matrix for model of veloc
modelv = {const, rpm , rpm ^# 2, rpm ^# 3, veloc}
covv = modelv *' /n
// based on the first four components (const,rpm,rmp^2,rmp^3)
betav =  betav  || ladv[*,5]                  // append the veloc-specific coeff

// do the same with the data of pow
modelp = {const, rpm , rpm ^# 2, rpm ^# 3, pow}
covp = modelp *' /n


These regressions reproduce the coefficients, with which the data were created, very closely approximated (using an n=200 and basically uniformly randomdata for rpm and the item-specific randomvalues).
We find them in the last row of betav resp betap . I think it is not too difficult to translate this into Matlab-code.

2.)
Now you want the explanation of pow by veloc (or vice versa). Here we have to do two decisions:

1. Do we want to explain one by the other by partialling out the rpm?
2. Do we want to explain by another polynomial model of order >1 ?

I've made examples for both options. The first one regresses pow on veloc and rpm, where I propose a quadratic and cubic influence also by veloc

  modelvp = {const, rpm, rpm^#2, rpm^#3, veloc, veloc^#2, veloc^#3, pow}
covvp = modelvp *'  / n
betavp = betavp || ladvp[*, 8]


Here we get 7 coefficients, with the one for the constant component included.

Next is a model, where the influence of rpm is partialled out of each of pow and veloc. The partialling assumes a cubic polynomial model for each of them. The final model is again cubic, we search for the coefficients of $\small pow.r = \beta_0 + \beta_1 veloc.r + \beta_2 veloc.r^2 + \beta_3 veloc.r^3 + pow\_specific.r$ where the .r indicates that rpm was partialled out.

 ladvp_r = ladvp[1´5..8,1´5..8]    // this removes the 2..4 rows and columns from ladvp,
// which means to remove the influcence of rpm, rmp^2 and rpm^3
// remaining variance
betavp_r = betavp_r  || ladvp_r [*,5]


Again in the last row of betavp.r we get some coefficients for the cubic model (however they are meaningsless here because the data were created with a simpler model).

I hope this is helpful although it has nothing to do with composition of polynomials and or their inversion. If for some theoretical reason you need an algebraic solution for the handling with your polynomials anyway we have to attack this differently.

-

If the functions describing wind speed and power are $v = f(r)$ and $p=g(r)$, and the function $f$ is invertible, then you can write

$$r = f^{-1}(v)$$

and then

$$p = g(r) = g(f^{-1}(v))$$

which is the relationship you are after. You may or may not be able to get an analytic form for this, depending on how complicated your functions $f$ and $g$ are.

It can be confusing to use the same letter for a function and the output of a function, as you did when you wrote $p(r)$ and $v(r)$, which is why I introduced the letters $f$ and $g$ to stand for the functions, and reserved $p$, $v$ and $r$ to be real numbers, i.e. the inputs and outputs of the functions.

-

You must somehow invert v, that is, find a function w such that v(r)=x if and only if r=w(x). Then the power corresponding to a given wind speed x is p(w(x)).

Note that I did not confuse the functions p, v and w with their arguments r and x. In such contexts it might help to remember that a function is really defined as a functional relationship AND a source set AND a target set. For example v:R→V takes any element r in R and produces an element x of V, which we denote by v(r)=x. Likewise p:R→P takes any element r in R and produces an element y of P, which we denote by p(r)=y. And you look for a function V→P taking any x in V and producing an element in P. The only way is to take the v arrow backwards, which is what w:V→R is supposed to do, and then to use the path V→R→P thanks to the arrows w and p.

-
 thanks for the tips, I have provided more info in the question. Can you point to any methods for finding w(x) for polynomials of the form v(r) = a_0 + a_1*x1 + a_2*x2^2 ... – klonq Oct 6 '11 at 7:55 @klonq: you might be interested on my answer in math.stackexchange.com/questions/66991/… (the "accepted" answer). It is much text, but gives an impression how to invert and compose powerseries(which can be seen as extensions of polynomials) using the concept of Carlemanmatrices. However, if you have a_0<>0 in the definition in your comment then things complicate and one should add more explanation. If this is really what you want, then please say so in your question and I (and probably others) likely shall focus on this. – Gottfried Helms Oct 6 '11 at 11:23 @klonq, I have provided more info in the question... meaning that you completely changed its focus. Oh well. – Did Oct 6 '11 at 17:08