Jump to content

Multidimensional interpolation: Difference between revisions

From Wikibase
fix undefined polynomial name f → p when marking the query point; AI-assisted (RonzzWikiCowriter) (via update-page on MediaWiki MCP Server)
 
(11 intermediate revisions by 2 users not shown)
Line 44: Line 44:
! latitude $\downarrow$ / longitude $\rightarrow$ !! $0^\circ$E !! $1^\circ$E !! $2^\circ$E !! $3^\circ$E
! latitude $\downarrow$ / longitude $\rightarrow$ !! $0^\circ$E !! $1^\circ$E !! $2^\circ$E !! $3^\circ$E
|-
|-
! $53^\circ$N
! $50^\circ$N
| 18.4 || 19.1 || 20.6 || 21.8
| 22.8 || 23.6 || 24.9 || 26.1
|-
! $51^\circ$N
| 21.7 || 22.5 || 23.9 || 25.0
|-
|-
! $52^\circ$N
! $52^\circ$N
| 20.1 || 20.9 || 22.3 || 23.5
| 20.1 || 20.9 || 22.3 || 23.5
|-
|-
! $51^\circ$N
! $53^\circ$N
| 21.7 || 22.5 || 23.9 || 25.0
| 18.4 || 19.1 || 20.6 || 21.8
|-
! $50^\circ$N
| 22.8 || 23.6 || 24.9 || 26.1
|}
|}


Line 71: Line 71:


$$
$$
L^{(x_1)}_{1}(x_1)=-\frac{(x_1-51)(x_1-52)(x_1-53)}{6}=-\frac{1}{6}x_1^3+26x_1^2-\frac{8111}{6}x_1+23426,\\  
L^{(x_1)}_{1}(x_1)=\frac{(x_1-51)(x_1-52)(x_1-53)}{(50-51)(50-52)(50-53)}=-\frac{1}{6}x_1^3+26x_1^2-\frac{8111}{6}x_1+23426,\\  
L^{(x_1)}_{2}(x_1)=\frac{(x_1-50)(x_1-52)(x_1-53)}{2}=\frac{1}{2}x_1^3-\frac{155}{2}x_1^2+4003x_1-68900
L^{(x_1)}_{2}(x_1)=\frac{(x_1-50)(x_1-52)(x_1-53)}{(51-50)(51-52)(51-53)}=\frac{1}{2}x_1^3-\frac{155}{2}x_1^2+4003x_1-68900
$$
$$


$$
$$
L^{(x_1)}_{3}(x_1)=-\frac{(x_1-50)(x_1-51)(x_1-53)}{2}=-\frac{1}{2}x_1^3+77x_1^2-\frac{7903}{2}x_1+67575,\\
L^{(x_1)}_{3}(x_1)=\frac{(x_1-50)(x_1-51)(x_1-53)}{(52-50)(52-51)(52-53)}=-\frac{1}{2}x_1^3+77x_1^2-\frac{7903}{2}x_1+67575,\\
L^{(x_1)}_{4}(x_1)=\frac{(x_1-50)(x_1-51)(x_1-52)}{6}=\frac{1}{6}x_1^3-\frac{51}{2}x_1^2+\frac{3901}{3}x_1-22100
L^{(x_1)}_{4}(x_1)=\frac{(x_1-50)(x_1-51)(x_1-52)}{(53-50)(53-51)(53-52)}=\frac{1}{6}x_1^3-\frac{51}{2}x_1^2+\frac{3901}{3}x_1-22100
$$
$$


$$
$$
L^{(x_2)}_{1}(x_2)=-\frac{(x_2-1)(x_2-2)(x_2-3)}{6}=-\frac{1}{6}x_2^3+x_2^2-\frac{11}{6}x_2+1,\qquad L^{(x_2)}_{2}(x_2)=\frac{x_2(x_2-2)(x_2-3)}{2}=\frac{1}{2}x_2^3-\frac{5}{2}x_2^2+3x_2
L^{(x_2)}_{1}(x_2)=\frac{(x_2-1)(x_2-2)(x_2-3)}{(0-1)(0-2)(0-3)}=-\frac{1}{6}x_2^3+x_2^2-\frac{11}{6}x_2+1,\qquad L^{(x_2)}_{2}(x_2)=\frac{x_2(x_2-2)(x_2-3)}{(1-0)(1-2)(1-3)}=\frac{1}{2}x_2^3-\frac{5}{2}x_2^2+3x_2
$$
$$


$$
$$
L^{(x_2)}_{3}(x_2)=-\frac{x_2(x_2-1)(x_2-3)}{2}=-\frac{1}{2}x_2^3+2x_2^2-\frac{3}{2}x_2,\qquad L^{(x_2)}_{4}(x_2)=\frac{x_2(x_2-1)(x_2-2)}{6}=\frac{1}{6}x_2^3-\frac{1}{2}x_2^2+\frac{1}{3}x_2
L^{(x_2)}_{3}(x_2)=\frac{x_2(x_2-1)(x_2-3)}{(2-0)(2-1)(2-3)}=-\frac{1}{2}x_2^3+2x_2^2-\frac{3}{2}x_2,\qquad L^{(x_2)}_{4}(x_2)=\frac{x_2(x_2-1)(x_2-2)}{(3-0)(3-1)(3-2)}=\frac{1}{6}x_2^3-\frac{1}{2}x_2^2+\frac{1}{3}x_2
$$
$$


Line 119: Line 119:


$$
$$
P(51.6,1.4)=-\tfrac{1}{45}(51.6)^3(1.4)^3+\tfrac{11}{120}(51.6)^3(1.4)^2-\tfrac{31}{360}(51.6)^3(1.4)+\tfrac{1}{15}(51.6)^3
y(51.6,1.4)=P(51.6,1.4)=-\tfrac{1}{45}(51.6)^3(1.4)^3+\tfrac{11}{120}(51.6)^3(1.4)^2-\tfrac{31}{360}(51.6)^3(1.4)+\tfrac{1}{15}(51.6)^3
$$
$$


Line 262: Line 262:


{{Hidden example}}
{{Hidden example}}
'''Surface temperature over a square of weather stations, by successive 1D interpolation.'''
'''Surface temperature over a grid of weather stations (particular value by successive 1D interpolations)'''


Take the same sixteen weather stations as above.
Retake the same example as in [[#Grid interpolation]]:
 
Sixteen weather stations sitting in a $4^\circ \times 4^\circ$ grid measure surface temperature at various latitudes and longitudes.
 
{| class="wikitable"
|+ Temperature ($^\circ$C) at each station
! latitude $\downarrow$ / longitude $\rightarrow$ !! $0^\circ$E !! $1^\circ$E !! $2^\circ$E !! $3^\circ$E
|-
! $50^\circ$N
| 22.8 || 23.6 || 24.9 || 26.1
|-
! $51^\circ$N
| 21.7 || 22.5 || 23.9 || 25.0
|-
! $52^\circ$N
| 20.1 || 20.9 || 22.3 || 23.5
|-
! $53^\circ$N
| 18.4 || 19.1 || 20.6 || 21.8
|}


What is the interpolated temperature at $51.6^\circ \textbf{N}, 1.4^\circ \textbf{E}$?
What is the interpolated temperature at $51.6^\circ \textbf{N}, 1.4^\circ \textbf{E}$?
Line 270: Line 289:
'''Algebraic solution''':
'''Algebraic solution''':


'''Step 1: interpolate in $x_1$ (latitude).''' Fix the longitude at each of its four known values, and interpolate the four readings along latitude with the one-dimensional Lagrange polynomial, evaluated at $x_1^*=51.6$:
'''Step 1: interpolate in $x_1$ (latitude).''' Interpolate the four readings of different latitudes with the one-dimensional Lagrange polynomial at each of the four known longitudes, then evaluate the interpolating functions at $x_1^*=51.6$.
 
$$
L^{(x_1)}_{1}(x_1)=\frac{(x_1-51)(x_1-52)(x_1-53)}{(50-51)(50-52)(50-53)},\qquad L^{(x_1)}_{2}(x_1)=\frac{(x_1-50)(x_1-52)(x_1-53)}{(51-50)(51-52)(51-53)}
$$
 
$$
L^{(x_1)}_{3}(x_1)=\frac{(x_1-50)(x_1-51)(x_1-53)}{(52-50)(52-51)(52-53)},\qquad L^{(x_1)}_{4}(x_1)=\frac{(x_1-50)(x_1-51)(x_1-52)}{(53-50)(53-51)(53-52)}
$$
 
<blockquote>
The four Lagrange basis polynomials in $x_1$, built on the latitude nodes $50,51,52,53^\circ \textbf{N}$, are the same at every longitude.
</blockquote>
 
At $x_1^*=51.6$,


$$
$$
Line 280: Line 313:
$$
$$
y_{x_1^*,i_2}=\sum_{i_1=1}^{4}y_{i_1,i_2}\,L^{(x_1)}_{i_1}(51.6),\qquad i_2=1,2,3,4
y_{x_1^*,i_2}=\sum_{i_1=1}^{4}y_{i_1,i_2}\,L^{(x_1)}_{i_1}(51.6),\qquad i_2=1,2,3,4
$$
$$
y_{x_1^*,1}=-0.056(22.8)+0.448(21.7)+0.672(20.1)-0.064(18.4)=20.7744,\\
y_{x_1^*,2}=-0.056(23.6)+0.448(22.5)+0.672(20.9)-0.064(19.1)=21.5808,\\
y_{x_1^*,3}=-0.056(24.9)+0.448(23.9)+0.672(22.3)-0.064(20.6)=22.9800,\\
y_{x_1^*,4}=-0.056(26.1)+0.448(25.0)+0.672(23.5)-0.064(21.8)=24.1352
$$
$$


Line 290: Line 330:
|}
|}


'''Step 2: interpolate in $x_2$ (longitude).''' Interpolate these four readings along longitude with the one-dimensional Lagrange polynomial in $x_2$, evaluated at $x_2^*=1.4$:
'''Step 2: interpolate in $x_2$ (longitude).''' Interpolate the four interpolated readings $y_{51.6^\circ \textbf{N},i_2}$ with a one-dimensional Lagrange polynomial in $x_2$ (longitude$) to obtain the interpolating function $f^{(x_2)}(x_2)$. Evaluate $f$ at $x_2^*=1.4$ for $y(51.6,1.4)$.
 
Four Lagrange basis polynomials, built on the longitude nodes $0,1,2,3^\circ \textbf{E}$:
 
$$
L^{(x_2)}_{1}(x_2)=\frac{(x_2-1)(x_2-2)(x_2-3)}{(0-1)(0-2)(0-3)},\qquad L^{(x_2)}_{2}(x_2)=\frac{x_2(x_2-2)(x_2-3)}{(1-0)(1-2)(1-3)}
$$
 
$$
L^{(x_2)}_{3}(x_2)=\frac{x_2(x_2-1)(x_2-3)}{(2-0)(2-1)(2-3)},\qquad L^{(x_2)}_{4}(x_2)=\frac{x_2(x_2-1)(x_2-2)}{(3-0)(3-1)(3-2)}
$$
 
At $x_2^*=1.4$,


$$
$$
Line 297: Line 349:


$$
$$
P(51.6,1.4)=\sum_{i_2=1}^{4}y_{x_1^*,i_2}\,L^{(x_2)}_{i_2}(1.4)=-0.064(20.7744)+0.672(21.5808)+0.448(22.9800)-0.056(24.1352)
y(51.6,1.4)=f^{(x_2)}(1.4)=\sum_{i_2=1}^{4}y_{x_1^*,i_2}\,L^{(x_2)}_{i_2}(1.4)=-0.064(20.7744)+0.672(21.5808)+0.448(22.9800)-0.056(24.1352)
$$
$$


Line 304: Line 356:
$$
$$


which agrees with the value obtained above from the full two-variable polynomial, without ever forming that polynomial: $4$ one-dimensional interpolations in latitude, followed by $1$ in longitude, sufficed.
which agrees with the value obtained in [[#Grid interpolation]].
{{End hidden}}
{{End hidden}}



Latest revision as of 13:27, 28 October 2026

Languages: English · français · Esperanto

Multidimensional interpolation is the process of finding a multivariable function $f(x_1,\cdots,x_m)$ that for a definite set of datapoints $\{(x_{1,i},\cdots,x_{m,i},y_i)\mid i\in [0,n], i \in \mathbb{N}\}$ satisfies $f(x_{1,i},\cdots,x_{m,i})=y_i$.

Grid interpolation

via Lagrange polynomial in multiple variables

If a "grid" of $n^m$ datapoints, i.e., values of $y$ at all possible combinations of $n$ particular values in each of the $m$ variables

$$ \{(x_{1,i_1},\cdots,x_{m,i_m},y_{i_1,\cdots,i_m})\mid i_1,\cdots,i_m \in [0,n-1],\, i_1,\cdots,i_m \in \mathbb{N}\} $$

is known, then a multivariable-version of the Lagrange polynomial can be used to interpolate for $y$.

$$ P(x_1,\cdots,x_m)=\sum_{i_1=0}^{n-1}\cdots\sum_{i_m=0}^{n-1}y_{i_1,\cdots,i_m}\prod_{j=1}^{m}L^{(x_j)}_{i_j}(x_j),\qquad L^{(x_j)}_{i_j}(x_j)=\prod_{\substack{k=0\\k\neq i_j}}^{n-1}\frac{x_j-x_{j,k}}{x_{j,i_j}-x_{j,k}} $$

which is a multi-variable polynomial of degree at most $n-1$ in each variable unique for each set of datapoints.

Similar to the one-dimensional Lagrange polynomials,

$$ L^{(x_j)}_{i_j}(x_j)= \begin{cases} 1, & x_j=x_{j,i_j},\\ 0, & x_j=x_{j,i_k},\, i_k \in [0,n-1],\, i_k \neq i_j,\, i_k \in \mathbb{N} \end{cases} $$

which guarantees that $P(x_1,\cdots,x_m)=y(x_1,\cdots,x_m)$ at all datapoints.[1]

$P(x_1,\cdots,x_m)$ is also known as the tensor product Lagrange interpolant.

Pointwise interpolation

Pointwise interpolation estimates the value of $y$ at one particular point, $y(x_1^*,\cdots,x_m^*)$, without constructing a general interpolating function.

via successive 1D interpolation in each variable

If a "grid" of $n^m$ datapoints, i.e., values of $y$ at all possible combinations of $n$ particular values in each of the $m$ variables

$$ \{(x_{1,i_1},\cdots,x_{m,i_m},y_{i_1,\cdots,i_m})\mid i_1,\cdots,i_m \in [0,n-1],\, i_1,\cdots,i_m \in \mathbb{N}\} $$

is known, then first perform $n^{m-1}$ 1D interpolations in $x_1$, fixing $x_2,\cdots,x_m$ at all known values, obtaining $n^{m-1}$ interpolating functions $f^{(x_1)}_{i_2,i_3,\cdots,i_m}(x_1)$

Now evaluate each $f^{(x_1)}$ at $x_1=x_1^*$ to obtain $n^{m-1}$ interpolated datapoints

$$ \{(x_1^*,x_{2,i_2},\cdots,x_{m,i_m},y_{x_1^*,i_2,\cdots,i_m})\mid i_2,\cdots,i_m \in [0,n-1],\, i_2,\cdots,i_m \in \mathbb{N}\} $$

Then perform $n^{m-2}$ 1D interpolations in $x_2$, fixing $x_3,\cdots,x_m$ at all known values, obtaining $n^{m-2}$ interpolating functions $f^{(x_2)}_{i_3,\cdots,i_m}(x_2)$

Now evaluate each $f^{(x_2)}$ at $x_2=x_2^*$ to obtain $n^{m-2}$ interpolated datapoints

$$ \{(x_1^*,x_2^*,x_{3,i_3}, \cdots,x_{m,i_m},y_{x_1^*,x_2^*,i_3,\cdots,i_m})\mid i_3,\cdots,i_m \in [0,n-1],\, i_3,\cdots,i_m \in \mathbb{N}\} $$

Then perform $n^{m-3}$ 1D interpolations in $x_3$, $n^{m-4}$ 1D interpolations in $x_4$, $\ldots$, $n$ 1D interpolations in $x_{m-1}$, and finally $1$ 1D interpolation in $x_m$ to obtain one interpolating function $f^{(x_m)}$.

Then the estimate of $y$ at $(x_1^*,\cdots,x_m^*)$ is $f^{(x_m)}(x_m^*)$.[2]

References