Inverse Interpolation
Source Code:
Write a program in C to find the value of 𝒙 for 𝒚 = 𝟗 using Inverse Interpolation from the data:
x: 1, 2, 4
y: 1, 4, 16
#include <stdio.h>
#include <conio.h>
int main(){
clrscr();
double x[3]={1,2,4}, y[3]={1,4,16}, yq=9, xq=0, L;
for(int i=0;i<3;i++){
L=1;
for(int j=0;j<3;j++)
if(j!=i) L *= (yq - y[j])/(y[i] - y[j]);
xq += L * x[i];
}
printf("\n\n\tFor y=%.1f, x=%.2f\n", yq, xq);
getch();
return 0;
}
Output

