I am looking for a simple method/function to calculate polynomial coefficients given the polynomial roots in C#. For example, given the roots: roots = [-3+j, -3-j, -5, -1] calculate a polynomial in the form x^4 + ax^3 + bx^2 + cx + d = 0, with the result being given as coefficients = [a, b, c, d]. In Python, numpy.poly(roots) can simply be used for this. I've looked for an equivalent C# function, but haven't found anything. Does anyone know of something like this?
C# function to calculate polynomial coefficients from roots
949 views Asked by Tony At
1
The following method extracts coefficients of a polynomial that has the specified roots:
You can use it in the following way: