0

Given some coordinates in 3D (x-, y- and z-axes), what I would like to do is to get a polynomial (fifth order). I know how to do it in 2D (for example just in x- and y-direction) via numpy. So my question is: Is it possible to do it also with the third (z-) axes? Sorry if I missed a question somewhere.

Thank you.

David Zwicker
  • 23,581
  • 6
  • 62
  • 77
DomDom
  • 1
  • http://stackoverflow.com/q/382186/1461210 http://stackoverflow.com/q/10988082/1461210 http://stackoverflow.com/q/11856206/1461210 – ali_m Jan 04 '16 at 21:15

1 Answers1

0

Numpy has functions for multi-variable polynomial evaluation in the polynomial package -- polyval2d, polyval3d -- the problem is getting the coefficients. For fitting, you need the polyvander2d, polyvander3d functions that create the design matrices for the least squares fit. The multi-variable polynomial coefficients thus determined can then be reshaped and used in the corresponding evaluation functions. See the documentation for those functions for more details.

Charles Harris
  • 934
  • 6
  • 4