Approximate/Find Function

59 Views Asked by At

I have got values $x_{i}$ and targets $z_{i}$.
Now I want to find a function $f(x)=z$, which approximates the mapping of my value $x_{i}$ to its targetvalue $z_{i}$ as good as possible for every $x_{i}$. I do not no any connection or physical background of these values. I hope at least there is something like a correlation between them.

Can anybody help me (eg with a catchword to google, hint)?

2

There are 2 best solutions below

2
On

Your question is too vague. There exists an infinite number of functions that fit the requirements you listed so far.

For example, one such function is:

$$f(x) = \begin{cases}z_1; & x=x_1\\ z_2; & x=x_2\\ \vdots\\ z_n; & x=x_n\\ 0; &\text{else} \end{cases}$$

This function perfectly maps all values $x_i$ to ther targets. It is probably not the function you are looking for. You need more restrictions before you can hope to get a good answer to your question.


You may think that requiring a continuous function would be enough, but it is not. There are still infinitely many functions that satisfy your conditions. One of them is defined as $$f(x) = z_i + \frac{(x-x_i}{x_{i+1}-x_i} (z_{i+1}-z_i)$$ on the interval $[x_i, x_{i+1}]$ (assuming $x_1<x_2<\dots<x_n$), but it is far from the only one.


You may want analytic functions, but even THAT is not enough. There exists infinitely many polynomials $p$ that satisfy the requirement $\forall i: p(x_i) = z_i$.

And not only polynomials, for any collection $\lambda_1,\dots, \lambda_n$ for which no two $\lambda_i$ are equal, you can find a set of constants $A_1,\dots A_n$ such that $f(x) = A_1e^{\lambda_1 x}+\cdots+A_ne^{\lambda_n}$ will satisfy the requirement $\forall i: f(x_i)=z_i$.

0
On

There are many interpolation and approximation methods available, depending on your requirements (in terms of smoothness, robustness to noise, computational cost...). Most of them are base on polynomials or piecewise polynomial functions.

Interpolation makes sure that $f(x_i)=z_i$, while approximation realizes $f(x_i)\approx z_i$.

https://en.wikipedia.org/wiki/List_of_numerical_analysis_topics#Polynomial_interpolation https://en.wikipedia.org/wiki/List_of_numerical_analysis_topics#Spline_interpolation

Without knowing anything of your case, I would consider cubic spline interpolation.