Does anyone know an algorithm, or even better yet have code examples, for creating polynomial or Lagrange approximation, given a N number of points, and 1, 2 and 3 variables/dimensions?

I remember taking a course of Numerical Analysis way back in college, and I am pretty dusty on the math.

Much appreciated.

A few years ago, I wrote a Xojo program to fit a polynomial of any degree to experimental data. However, it’s only a one dimensional routine, and would have to be modified to handle extra dimensions. This straightforward in theory (just a few more rows and columns in the matrices), but the implementation might get a bit messy. I could post the code of the original, if it would help.

Nowadays, I tend to use the Nelder-Mead algorithm to fit data. It takes a lot more iterations, but is far more flexible in that it will fit just about any type of function that you can imagine, in as many dimensions as you want.