# Table data interpolation JavaScript library

This small page was developed to test an algorithm that will be included in other programs, it allows you to perform a linear interpolation from bi-dimensional arrays (tables).

To explain the concept and usage, nothing better than an example: Suppose we have a table with the calories (Z) from the food based in the percentage of sugar (rows=X) and fat (columns=Y) as indicated in the table. We might want to know the calories from intermediate points, not listed. The interpolation for the table above would give the following results for the amounts of fat and sugar entered:
• X (Sugar)=20%, Y (Fat)=30% => Z (Calories) = 500. This was a tabulated data.
• X=20%, Y=45% => Z = 800. Exact match for X and the Y was interpolated from 20% and 60%.
• X=25%, Y=45% => Z = 850. Double interpolation for X and Y.
• X=45%, Y=10% => Z = 500. Double interpolation for X and Y.
• X=10%, Y=0% => Z = Error. No tabulated data for this region.
• X=60%, Y=60% => Z = Error. Outside of the tabulated data range.

You can try the interpolation by generating a table and entering the data in the interface below. You can use any non-numeric symbol to express the non-tabulated data, for example: "null".

This application does 100% of the calculations in the user browser by using JavaScript. The library code can be found here: interpolizer.js and the example of usage in the source of this page.

Please visit my website for more resources: www.danbp.org. I am Daniel Brooke Peig.

Blue row = Y Values
Yellow column = X Values
White cells = Z Values