VOOZH about

URL: https://www.geeksforgeeks.org/python/numpy-roots-function-python/

⇱ numpy.roots() function - Python - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

numpy.roots() function - Python

Last Updated : 11 Jun, 2020
numpy.roots() function return the roots of a polynomial with coefficients given in p. The values in the rank-1 array p are coefficients of a polynomial. If the length of p is n+1 then the polynomial is described by: p[0] * x**n + p[1] * x**(n-1) + ... + p[n-1]*x + p[n]
Syntax : numpy.roots(p) Parameters : p : [array_like] Rank-1 array of polynomial coefficients. Return : [ndarray] An array containing the roots of the polynomial.
Code #1 : Output :
[-1.+1.41421356j -1.-1.41421356j]
  Code #2 :
Output :
[-0.3125+0.46351241j -0.3125-0.46351241j]
Comment
Article Tags:
Article Tags: