Function Repository Resource:

TransfiniteInterpolation

Source Notebook

Transfinite interpolation of functions representing boundary curves of a surface

Contributed by: Jan Mangaldan

ResourceFunction["TransfiniteInterpolation"][{fs,fn},{fw,fe},{x,xmin,xmax},{y,ymin,ymax}]

gives the transfinite interpolation of the functions fw and fe over x and the functions fs and fn over y.

Details

In two-dimensional transfinite interpolation, an interpolating function f[x,y] is constructed such that the boundary conditions f[x,ymin]=fs[x], f[x,ymax]=fn[x], f[xmin,y]=fw[y] and f[xmax,y]=fe[y] are satisfied. In effect the result fills in the surface from specified boundary curves.

Examples

Basic Examples (2) 

Build the transfinite interpolant of a given set of slice functions:

In[1]:=
tf[x_, y_] = ResourceFunction[
  "TransfiniteInterpolation"][{Sin[x], Sin[2 x]}, {Haversine[2 y], Haversine[4 y]}, {x, -\[Pi], \[Pi]}, {y, -\[Pi], \[Pi]}]
Out[1]=

Plot the transfinite interpolant:

In[2]:=
Plot3D[tf[x, y], {x, -\[Pi], \[Pi]}, {y, -\[Pi], \[Pi]}]
Out[2]=

Properties and Relations (4) 

Construct a transfinite interpolant:

In[3]:=
tf[x_, y_] = ResourceFunction[
  "TransfiniteInterpolation"][{Sin[x], Sin[2 x]}, {Haversine[2 y], Haversine[4 y]}, {x, -\[Pi], \[Pi]}, {y, -\[Pi], \[Pi]}]
Out[3]=

Construct another interpolant by solving a Laplace equation:

In[4]:=
lapSol = NDSolveValue[{\!\(
\*SubsuperscriptBox[\(\[Del]\), \({x, y}\), \(2\)]\(f[x, y]\)\) == 0, f[x, -\[Pi]] == Sin[x], f[x, \[Pi]] == Sin[2 x], f[-\[Pi], y] == Haversine[2 y], f[\[Pi], y] == Haversine[4 y]}, f, {x, -\[Pi], \[Pi]}, {y, -\[Pi], \[Pi]}]
Out[4]=

Compare the two interpolating functions:

In[5]:=
{Plot3D[tf[x, y], {x, -\[Pi], \[Pi]}, {y, -\[Pi], \[Pi]}], Plot3D[lapSol[x, y], {x, -\[Pi], \[Pi]}, {y, -\[Pi], \[Pi]}, PlotRange -> All]} // GraphicsRow
Out[5]=

The two functions agree at the boundaries, but behave differently within them:

In[6]:=
Plot3D[tf[x, y] - lapSol[x, y], {x, -\[Pi], \[Pi]}, {y, -\[Pi], \[Pi]}]
Out[6]=

Version History

  • 1.0.0 – 27 May 2022

Source Metadata

Author Notes

This currently implements only the linear case of two-dimensional transfinite interpolation. An extension to an arbitrary number of slices and arbitrary dimensions is left for a future update.

License Information