mdbtxt1
mdbtxt2
Proceed to Safety

# Inverse Interpolation

Robert P. Munafo, 2023 Feb 19

This is the inverse of the calculation of linear interpolation, a common type of calculation generally taught in secondary school.

In ordinary linear interpolation, there are two variables (x and y, sometimes called the independent variable and the dependent variable) that are taken to be related by a linear equation y=ax+b. However, the coefficients a and b are unknown, and instead we are given two x values x1 and x2 and the corresponding y values y1 and y2; and we are asked to determine the y for some other x that is between x1 and x2.

Without loss of generality the values x1 and x2 can be 0 and 1, and for simplicity the values y1 and y2 can be given distinct letters a and b, and the "intermediate value" can be p. Then the value of the dependent variable is given by

v = a(1-p) + b p

For inverse interpolation, we are given the values of a, b, and v and we wish to find p. The answer is

p = (v-a)/(b-a)

In Two Dimensions

Of particular interest for the Mandelbrot set specifically is the problem of inverse interpolation with two degrees of freedom — finding the two parameters p and q that specify the relative position of a point within a quadrilateral (treated as a rectangle with rotation and some non-affine distortion). For that algorithm see the article Inverse Interpolation for a Quadrilateral.

Program

The following program sets up an example and prints the calculations as it goes; you can use the example values to verify that your implementation is working.

// Perform inverse interpolation: given the interpolation formula // v = a(1-p) + bp // solve for p interms of the other three variables.    // Example values for the equations: -3x+2y=33 ; x+y=34 a = 7 b = 27 v = 21    // Solve for p p = (v-a)/(b-a) print p // should print 0.7

revisions: 20230219 initial description; 20230221 add reference to Inverse Interpolation for a Quadrilateral

From the Mandelbrot Set Glossary and Encyclopedia, by Robert Munafo, (c) 1987-2024.

This page was written in the "embarrassingly readable" markup language RHTF, and was last updated on 2023 Jun 20. s.27