Source code for naginterfaces.library.examples.zeros.poly_complex_fpml_ex

#!/usr/bin/env python3
"``naginterfaces.library.zeros.poly_complex_fpml`` Python Example."

# NAG Copyright 2019.

# pylint: disable=invalid-name

from naginterfaces.library import zeros

[docs]def main(): """ Example for :func:`naginterfaces.library.zeros.poly_complex_fpml`. Find all the roots of a complex polynomial equation. >>> main() naginterfaces.library.zeros.poly_complex_fpml Python Example Results. Roots of a complex polynomial equation. Computed roots: 0.007 + 0.007j -0.007 + -0.007j -24.328 + -4.855j 14.653 + -16.569j 5.249 + 22.736j """ print( 'naginterfaces.library.zeros.poly_complex_fpml ' 'Python Example Results.' ) print('Roots of a complex polynomial equation.') coefs = [ 5.0 + 6.0j, 30.0 + 20.0j, -0.2 + -6.0j, 50.0 + 100000.0j, -2.0 + 40.0j, 10.0 + 1.0j, ] print('Computed roots:') for z_val in zeros.poly_complex_fpml(coefs).z: print('{0.real:7.3f} + {0.imag:7.3f}j'.format(z_val))
if __name__ == '__main__': import doctest import sys sys.exit( doctest.testmod( None, verbose=True, report=False, optionflags=doctest.REPORT_NDIFF, ).failed )