I am trying to fit a polynomial through 340 points in a 3D space, i.e.

$$f(x,y,z) = k$$

I asked previously about the theory behind polynomial interpolation here -> Polynomial interpolation

Few interesting points came out from the discussion, but I would like to understand how to correctly implement them in Python.

I am writing a script in Python to compute the Vandermonde matrix for a polynomial of a generic order $p$. Now the implementation problem arises.

First method

I have 340 points $(x,y,z)$. Supposing I have a polynomial of 6th order I have

(order+1) ^ number_of_dimensions

degrees of freedom for my polynomial. Therefore, it means that I have 343 degrees of freedom. Since I have 340 points I cannot use such order because otherwise the problem is underdetermined.

If I use a 5th order polynomial I have 216 degrees of freedom, and in this case the problem is overdetermined and the polynomial is an approximating polynomial. In a preliminary phase I do not need the exact interpolation, since I can solve the problem with a complementary solution, but do you think it is feasible the solution given?

Second method

As suggested by the user who helped me in the previous question, actually a polynomial of 6th order has 84 degrees of freedom. This is related to the constraint given by $$a+b+c<p$$ with $a,b,c$ the exponents in each term $x^a y^b z^c$.

The question which arises is if it more feasible to create a Vandermonde matrix which respects this constraint. Does it give an improved approximated solution compared to a full Vandermonde matrix?

  • $\begingroup$ Please, don't sign your posts. It is not needed since your username appears below each post. $\endgroup$
    – nicoguaro
    Jun 16 '17 at 17:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.