Interpolation exercise of coordinates

129 Views Asked by At

The next problem of interpolation I do not know how to approach it. The problem says:

A way to interpolate in two dimensions the values ​​of $f (x, y)$ in the vertices $(x_1, y_1)$, $(x_1, y_2)$, $(x_2, y_1), (x_2, y_2)$ of a rectangle, where we seek to approximate $f (x$ *$, y$ * $)$, is:

--Interpolate linearly between $f (x_1, y_1)$ and $f(x_2, y_1)$ giving $f_1$*$(x $ *$, y_1)$

--Interpolate linearly between $f (x_1, y_2)$ and $f(x_2, y_2)$ giving $f_2$*$(x $ *$, y_2)$

--Interpolate linearly between $f (x$* $, y_1)$ and $f(x$* $, y_2)$ giving $f$*$(x $ *$, y$ * $)$

This process can be done in reverse order, interpolating first in $y$ and then in $x$.

the questions are:

$a)$ Does the order in which the variables are considered refer? (If so, the method is at least suspect.)

$b)$ What does it correspond to, in terms of the multivariate polynomial used to interpolate?

Hint: Algebra is heavy, use a symbolic algebra package (like SymPy for Python).

-

in what way and with what arguments can I answer the request?

2

There are 2 best solutions below

1
On BEST ANSWER

The processes you describe at not neutral with respect to the order in which you do the linear interpolations.

You will find here the description of the "normal" process for bilinear interpolation.

You could easily notice that this is equivalent to a Taylor expansion for a function of two variables for which the derivatives are obtained by differences.

To summarize, what you should use is $$(x_2-x_1)(y_2-y_1)f(x,y)=$$

$$ f(x_1,y_1)(x_2-x)(y_2-y) + f(x_2,y_1)(x-x_1)(y_2-y)+$$ $$ f(x_1,y_2)(x_2-x)(y-y_1) + f(x_2,y_2)(x-x_1)(y-y_1)$$

Edit

Suppose that you have data points $(x_i,y_i,z_i)$ and what you notice is that for a fixed value of $x$, $z$ is linear with respect to $y$. So, for each given value of $x$ you have $$z=a+ b y$$ But, now, plotting the values of $a$ and $b$ a functions of $x$, you notice again that $a$ and $b$ are linear with respect to $c$, that is to say $$a=a_0+a_1 x \qquad \text{and} \qquad b=b_0+b_1x$$ Then $$z=(a_0+a_1 x)+(b_0+b_1x)y$$ Develop and get $$z=\alpha+\beta x+\gamma y+\delta x y$$ Same story !

0
On

For single-variable linear interpolation, given a function $g(\theta)$ whose values we know at $\theta = \theta_1$ and $\theta = \theta_2,$ the value interpolated at $\theta = \theta^*$ is \begin{align} g^*(\theta^*) &= g(\theta_1) + \frac{\theta - \theta_1} {\theta_2 - \theta_1} (g(\theta_2) - g(\theta_1)) \\ &= \frac{\theta_2 - \theta} {\theta_2 - \theta_1} g(\theta_1) + \frac{\theta - \theta_1} {\theta_2 - \theta_1} g(\theta_2). \end{align}

So let's try applying this as described in the question. We begin:

Interpolate linearly between $f(x_1, y_1)$ and $f(x_2, y_1)$ giving $f_1^*(x^*, y_1)$

This implies that $$ f_1^*(x^*, y_1) = \frac{x_2 - x^*}{x_2 - x_1} f(x_1, y_1) + \frac{x^* - x_1}{x_2 - x_1} f(x_2, y_1). $$

Interpolate linearly between $f(x_1, y_2)$ and $f(x_2, y_2)$ giving $f_2^*(x^*, y_2)$

This implies that $$ f_2^*(x^*, y_2) = \frac{x_2 - x^*}{x_2 - x_1} f(x_1, y_2) + \frac{x^* - x_1}{x_2 - x_1} f(x_2, y_2). $$

Interpolate linearly between $f(x^*, y_1)$ and $f(x^*, y_2)$ giving $f^*(x^*, y^*)$

I assume this actually means we interpolate linearly between $f_1^*(x^*, y_1)$ and $f_2^*(x^*, y_2).$ This implies that \begin{align} f^*(x^*, y^*) &= \frac{y_2 - y^*}{y_2 - y_1} f_1^*(x^*, y_1) + \frac{y^* - y_1}{y_2 - y_1} f_2^*(x^*, y_2) \\ &= \frac{y_2 - y^*}{y_2 - y_1} \left(\frac{x_2 - x^*}{x_2 - x_1} f(x_1, y_1) + \frac{x^* - x_1}{x_2 - x_1} f(x_2, y_1)\right)\\ & \qquad + \frac{y^* - y_1}{y_2 - y_1} \left(\frac{x_2 - x^*}{x_2 - x_1} f(x_1, y_2) + \frac{x^* - x_1}{x_2 - x_1} f(x_2, y_2)\right)\\ &= \frac{(x_2 - x^*)(y_2 - y^*)}{(x_2 - x_1)(y_2 - y_1)} f(x_1, y_1) + \frac{(x^* - x_1)(y_2 - y^*)}{(x_2 - x_1)(y_2 - y_1)} f(x_2, y_1) \\ & \qquad + \frac{(x_2 - x^*)(y^* - y_1)}{(x_2 - x_1)(y_2 - y_1)} f(x_1, y_2) + \frac{(x^* - x_1)(y^* - y_1)}{(x_2 - x_1)(y_2 - y_1)} f(x_2, y_2). \end{align}

Now let's try interpolating between $y_1$ and $y_2$ first. That is, we interpolate $$ f_1^{**}(x_1, y^*) = \frac{y_2 - y^*}{y_2 - y_1} f(x_1, y_1) + \frac{y^* - y_1}{y_2 - y_1} f(x_1, y_2) $$ and $$ f_2^{**}(x_2, y^*) = \frac{y_2 - y^*}{y_2 - y_1} f(x_2, y_1) + \frac{y^* - y_1}{y_2 - y_1} f(x_2, y_2). $$ (The double asterisk (**) on each function is meant to denote that these are not the same functions as the single-asterisk functions in the previous interpolation.)

Then the final interpolation (between $x_1$ and $x_2$) is

\begin{align} f^{**}(x^*, y^*) &= \frac{x_2 - x^*}{x_2 - x_1} f_1^{**}(x_1, y^*) + \frac{x^* - x_1}{x_2 - x_1} f_2^{**}(x_2, y^*) \\ &= \frac{x_2 - x^*}{x_2 - x_1} \left(\frac{y_2 - y^*}{y_2 - y_1} f(x_1, y_1) + \frac{y^* - y_1}{y_2 - y_1} f(x_1, y_2)\right)\\ & \qquad + \frac{x^* - x_1}{x_2 - x_1} \left(\frac{y_2 - y^*}{y_2 - y_1} f(x_2, y_1) + \frac{y^* - y_1}{y_2 - y_1} f(x_2, y_2)\right)\\ &= \frac{(x_2 - x^*)(y_2 - y^*)}{(x_2 - x_1)(y_2 - y_1)} f(x_1, y_1) + \frac{(x_2 - x^*)(y^* - y_1)}{(x_2 - x_1)(y_2 - y_1)} f(x_1, y_2) \\ & \qquad + \frac{(x^* - x_1)(y_2 - y^*)}{(x_2 - x_1)(y_2 - y_1)} f(x_2, y_1) + \frac{(x^* - x_1)(y^* - y_1)}{(x_2 - x_1)(y_2 - y_1)} f(x_2, y_2). \end{align}

You can confirm that this is equal to the fully developed formula of $f^*(x^*,y^*).$ That is, the result does not depend on which variable you interpolate first. This result is also equivalent to the formula given in this other answer and the formula given in Wikipedia.