The Numpy polynomial related function discussed in recent posts can now be downloaded from:

The download file includes Python code and a sample spreadsheet. Required installed software is Python, Numba and pyxll to call the code from Excel. Some of the functions in the default file require the just-in-time compiler, Numba. For those without Numba installed the file pyNumpy-noJIT.py can be used.

Note that the Quadratic, Cubic and Quartic functions (which are not included in Numpy) are based on C code from the following sources:

- http://numerical.recipes/book/book.html
- https://github.com/LuaDist/gsl/blob/master/poly/solve_cubic.c
- https://www.gnu.org/software/gsl/doc/html/poly.html

The screenshots below show examples of the spreadsheet functions: (click on any image for full-size view).

The py_PolyRoots function calls the general purpose Numpy function, that will work for any degree polynomial. The alternative functions have very much better performance for degrees up to quartic.

Py_PolyFromRoots finds polynomial factors from its roots. Py_PolyVal returns the function value for any value of x, allowing array input.

Py_PolyFit fits a polynomial to input data:

Other Numpy polynomial functions are shown below:

The py_flip functions reverses a Numpy array along a specified axis:

Finally functions are provided to form a Numpy array of complex numbers from an Excel list of pairs of floats: