tabakg / potapov_interpolation

The purpose of this package is to characterize a network of optical components when time delays with feedback are present.

Home Page:http://potapov-interpolation.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

get_roots_rect returns multiple (and sometimes inaccurate) variations of the same root.

petersbingham opened this issue · comments

The issue can be demonstrated using the additional test cases added to the fork here:
https://github.com/petersbingham/potapov_interpolation/blob/Potapov_PolyRootTests/Potapov_Code/tests/tests_Roots.py

eg:

test_Poly_Roots(11, printRoots=True, printPolys=False, printParams=False, doubleOnWarning=False)

When running this example some stats are printed and then a list of roots (in the left column) obtained using numpy.roots and then another list obtained using get_roots_rect. The numbers in the right column (beside the roots) are the results of plugging the root back into the function (so obviously expect to be close to zero).

This is a 10th order polynomial, so expect 10 roots. The numpy in the test code does return the correct number of roots but get_roots_rect returns 22. The roots returned with get_roots_rect all appear clustered around the numpy root values.

I've had a brief look at this and it appears to arise from applying muller to the outliers. This may therefore apply more accurately to the muller function or may be a numerical limitation of the routine,

I believe that I have this fixed. The issue was that the muller verbose parameter was overriding the default tol. I will submit a pull request tomorrow.