0
$\begingroup$

I need to approximate a function $y=f(x)$ using a small set of constants $a_0…a_n$, ideally where the number of constants can be arbitrarily increased to improve accuracy. $x$ and $y$ are both real and >0. The function I am fitting approaches some linear relationship as x and y become large, and all the ‘interesting’ features of the x-y relation (the features that would justify using a higher n for better approximation) tend to occur at smaller x and y. I would like to be able to invert the approximation function to get a $x=f(y)$ function once the $a_i$ constants for the original $y=f(x)$ have been found. This need not be the same kind of function, but it would be neat if it was and only the constants needed recalculating, or equivalently if there was another function to compute $x=f(y)$ that relied on the same constants $a_i$ used for the $y=f(x)$ function.

Simple polynomials are a bad choice here as they are not generally invertible for n>3, and are prone to oscillation and unnatural (and certainly nonlinear) behaviour when extrapolated. So-called rational functions (ratio of two polynomials) work very well for the approximation, especially as the order of the top and bottom polynomials can be chosen to give the desired behaviour at large x. However, as far as I’m aware, they’re generally impossible to invert. One way to get invertibility would be to make a function by repeatedly applying some simple invertible function $x\mapsto(x+a_i)^p$ as many times as required to get $y=f(x)$, which could then be ‘unwrapped’ to get another function using the same $a_i$ constants to give $x=f(y)$. However the final function created by that example does not appear to be useful as a general approximant. The invertibility requirement makes me feel I might be grappling for some class of polynomials that forms a group.

For the curious, I’m trying to analytically fit the calibration function for some mechanical apparatus that applies a force to a material sample and measures the resulting deformation. We want to determine the deformation in the sample, but the measured deformation includes some elastic deformation in the rig itself. Hence if we can determine the deformation in the rig as a function of force, we can subtract it from the total measured deformation to get the required sample deformation. But it’s just as common to want to convert the other way.

Is there a general class of polynomials or other functions that seems applicable here?

EDIT: $y=f(x)$ can be assumed monotonically increasing, so inverse will be unique.

$\endgroup$
2
  • $\begingroup$ If the function approaches linearity as $x$ increases, a polynomial that is not purely $a+bx$ must fail to capture this. $\endgroup$
    – user619894
    Commented Jun 10, 2020 at 6:17
  • $\begingroup$ Yes, 'polynomial' is likely the wrong word for what I'm after here. Is there a word for 'function of x characterised by set of constants $a_0...a_n$ that can approximate a wide range of other functions by changing the constants'? Like rational functions? I'll edit if that makes it clearer. $\endgroup$ Commented Jun 10, 2020 at 10:41

2 Answers 2

1
$\begingroup$

Start with the function

$$f_i(x)=a_i x \frac{x+b_i}{x+c_i}$$.

This approaches linearity at large x and is invertible by solving a quadratic equation also well behaved if c_i is positive. Also with this constraint there is only one positive inverse for value of y.

Of course this function is forced to pass through (0,0) if you require a non-zero intercept you can take the slight generalization

$$f_i(x)=a_i x \frac{x+b_i}{x+c_i}+d_i$$.

To get a function with more free parameters take

$$y=f_1\circ f_2\circ\dots\circ f_n(x)$$

(i.e. concatenate n functions of this form)

This will still approach linearity and be invertible since each function in the chain is invertible with an analytic expression.

If you want the function and the inverse to be of the same form as the forwards function, define

$$g_{ij}=f_i^{-1}(f_j(x))$$

This function approaches linearity and the inverse is of the same type

$$g_{ij}^{-1}=g_{ji}$$

Again if you want more degrees of freedom consider

$$ y=g_{12}\circ g_{34}\circ \dots \circ g_{2n-1\ 2n} (x)$$

The analytics of expanding this out might get a bit ugly but each $f$ and $f^{-1}$ is an analytic expression which has at worst a square root.

$\endgroup$
0
$\begingroup$

A shot in the dark (I don't follow your application):

What about $f(x) = \frac 1 {(x+1)^{n-1}} \sum_i^n a_i x^i$ ?

Reasoning: The degree of the numerator is $n,$ provided $a_n \neq 0,$ while the denominator has degree $n-1,$ so the long run behavior is linear.

It has a pole at $x=-1,$ but you mention both $x,y$ being positive. So for nice values of $a_n$ this should be monotonically increasing/decreasing for positive $x.$

You can solve the equation $f(x) = y$ by multiplying across the denominator. Ie, you'll instead be solving: $$\sum_i a_i x^i = y (x+1)^{n-1}$$ $$ \sum_i a_i x^i - y (x+1)^{n-1} = 0$$

ie, the roots of a degree $n$ polynomial in $x.$ We've got numerical techniques for this, if nothing else.

Further, if you have fixed data points $(x_i, y_i),$ then the above gives you a linear constraint on the $a_i.$ You can literally fit a function of this type of degree $n$ using $n$ data points (though it may not be invertible, see below).

Interesting behavior near $0:$ we get this as most of the coefficients ($a_i$) have diminishing impact away from $x=-1.$ I suppose if you want a larger impact you could replace $x+1$ in the denominator with $x+\epsilon$ for some small $\epsilon,$ though that will make for more constraints on the $a_i.$

So this answer includes some math, I'll include the requirement that for $a_i$ to give an invertible function for positive $x,$ we need:

$$f'(x) = \frac 1 {(x+1)^{n-1}} \sum_i i a_i x^{i-1} - (n-1) \frac 1 {(x+1)^n} \sum_i a_i x^i \neq 0 (\text{for } x > 0)$$

clearing denominators, we need that all the roots of the polynomial

$$(x+1) \sum_i i a_i x^{i-1} - (n-1) \sum_i a_i x^i$$

are negative. Cool thing, apparently this is exactly provided by Descartes' rule of signs (here). So we need just that the coefficients

$$i a_i + (i+1)a_{i+1} - (n-1) a_i$$ are all either positive or negative (with $0$'s allowed in either case).

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .