{"id":11358,"date":"2021-05-18T09:25:31","date_gmt":"2021-05-18T03:55:31","guid":{"rendered":"http:\/\/www.pythonpool.com\/?p=11358"},"modified":"2021-05-18T09:27:48","modified_gmt":"2021-05-18T03:57:48","slug":"numpy-roots","status":"publish","type":"post","link":"https:\/\/www.pythonpool.com\/numpy-roots\/","title":{"rendered":"Find Roots of the Polynomials Using Numpy in Python"},"content":{"rendered":"\n<p>We often solve polynomial equations in mathematics to find the roots of the equations. Have you ever wondered how to solve those mathematical equations using programming? Well, without using python, it would be a bit stressful to solve those equations. Let me tell you about an amazing library called numpy. In today&#8217;s tutorial, we will explore numPy in python and have some detailed analysis of numpy and its uses.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_74 counter-hierarchy ez-toc-counter ez-toc-transparent ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #990303;color:#990303\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #990303;color:#990303\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 eztoc-toggle-hide-by-default' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.pythonpool.com\/numpy-roots\/#Introduction_of_Numpy_in_python\" >Introduction of Numpy in python<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.pythonpool.com\/numpy-roots\/#Why_to_use_numpy_in_python\" >Why to use numpy in python?<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.pythonpool.com\/numpy-roots\/#What_are_Numpy_roots_in_Python\" >What are Numpy roots in Python?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.pythonpool.com\/numpy-roots\/#Method_1_Using_nproots_function_in_python\" >Method 1: Using np.roots() function in python<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.pythonpool.com\/numpy-roots\/#Syntax\" >Syntax<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.pythonpool.com\/numpy-roots\/#Parameter\" >Parameter<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.pythonpool.com\/numpy-roots\/#Return_Value\" >Return Value<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.pythonpool.com\/numpy-roots\/#Method_2_Using_poly1D_function_in_python\" >Method 2: Using poly1D() function in python<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.pythonpool.com\/numpy-roots\/#Syntax-2\" >Syntax<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/www.pythonpool.com\/numpy-roots\/#Parameter-2\" >Parameter<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/www.pythonpool.com\/numpy-roots\/#Return_value\" >Return value<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/www.pythonpool.com\/numpy-roots\/#How_numpy_solves_the_equation_of_a_Companion_Matrix\" >How numpy solves the equation of a Companion Matrix?<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/www.pythonpool.com\/numpy-roots\/#Syntax-3\" >Syntax:<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/www.pythonpool.com\/numpy-roots\/#Parameter-3\" >Parameter<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/www.pythonpool.com\/numpy-roots\/#Return_Value-2\" >Return Value<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"https:\/\/www.pythonpool.com\/numpy-roots\/#Conclusion\" >Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\" id=\"h-introduction-of-numpy-in-python\"><span class=\"ez-toc-section\" id=\"Introduction_of_Numpy_in_python\"><\/span>Introduction of Numpy in python<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Numpy stands for Numerical Python. It is an open-source scientific computing library for the Python programming language. NumPy is a library of numerical routines that helps in solving scientific problems. Numpy <a href=\"https:\/\/numpy.org\/doc\/stable\/reference\/arrays.ndarray.html\" target=\"_blank\" rel=\"noreferrer noopener\">array<\/a> is a very famous package in the numpy library. It also has functions in the domain of linear algebra, Fourier transformations, and matrices.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-why-to-use-numpy-in-python\"><span class=\"ez-toc-section\" id=\"Why_to_use_numpy_in_python\"><\/span>Why to use numpy in python?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>In our previous tutorial, we have learned about lists. Lists are similar to arrays in python, but it is a slower process. On the other hand, NumPy arrays are stored at one continuous location in memory, so it is straightforward to access and manipulate them very efficiently.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-what-are-numpy-roots-in-python\"><span class=\"ez-toc-section\" id=\"What_are_Numpy_roots_in_Python\"><\/span>What are Numpy roots in Python?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Numpy root helps in finding the roots of a polynomial equation having coefficients in python. It can be found using a couple of methods. Let\u2019s discuss them in detail. A polynomial equation is written as: &#8211;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&nbsp;p&#91;0] * x<sup>n <\/sup>+ p&#91;1] * x<sup>(n-1)<\/sup> + \u2026 + p&#91;n-1]*x + p&#91;n]<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-method-1-using-np-roots-function-in-python\"><span class=\"ez-toc-section\" id=\"Method_1_Using_nproots_function_in_python\"><\/span>Method 1: Using np.roots() function in python<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In this method, we will look at how to use the function of the numpy root and print the given function help of the print function in python. <strong>numpy.roots()<\/strong> function returns the roots of a polynomial with coefficients given in <em><strong>p<\/strong><\/em>. The coefficients of the polynomial are to be put in a numpy array in a sequence.&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-syntax\"><span class=\"ez-toc-section\" id=\"Syntax\"><\/span>Syntax<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>Syntax:<\/strong> numpy.roots(p)<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-parameter\"><span class=\"ez-toc-section\" id=\"Parameter\"><\/span>Parameter<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>It takes the coefficients of an given polynomial.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-return-value\"><span class=\"ez-toc-section\" id=\"Return_Value\"><\/span>Return Value<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>The function will return the roots of the polynomial.<\/p>\n\n\n\n<p>Let&#8217;s do some code to understand. <\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-example-1\"><span style=\"text-decoration: underline\"><span class=\"has-inline-color has-vivid-red-color\">Example 1:<\/span><\/span><\/h4>\n\n\n\n<p>Let us consider an equation: <strong>x<sup>2<\/sup> + 5*x + 6 <\/strong><\/p>\n\n\n\n<p>The coefficients are 1, 5 and 6.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nimport numpy as np\np = &#x5B;1, 5, 6]\nroots = np.roots(p)\nprint(roots)\n<\/pre><\/div>\n\n\n<pre class=\"wp-block-preformatted\"><strong>OUTPUT: <\/strong>- [3.  2.] <\/pre>\n\n\n\n<p><strong><span style=\"text-decoration: underline\">Explanation of the code<\/span><\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>To use the numpy library in python, we need to import it.<\/li><li>np is the alias name of numpy.<\/li><li>p is the list having the coefficients.<\/li><li>To find the roots of the equation, we used np.roots passing the coefficients as the parameter.<\/li><li>Printing the roots.<\/li><\/ol>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-example-2\"><span style=\"text-decoration: underline\"><span class=\"has-inline-color has-vivid-red-color\">Example 2:<\/span><\/span><\/h4>\n\n\n\n<p>Now let us consider the following polynomial for a cubic equation: <strong>&nbsp;x<sup>3<\/sup>&nbsp; &#8211; 6 * x<sup>2<\/sup>&nbsp;+ 11 * x&nbsp;\u2013 6&nbsp;<\/strong><\/p>\n\n\n\n<p>The coefficients are 1, -6 , 11 and -6.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nimport numpy as np \ncoeff = &#x5B;1, -6, 11, -6] \nprint(np.roots(coeff))\n<\/pre><\/div>\n\n\n<pre class=\"wp-block-preformatted\"><strong>OUTPUT:-<\/strong> [3.  2.  1.]<\/pre>\n\n\n\n<p class=\"has-medium-font-size\"><strong><span style=\"text-decoration: underline\">Explanation of the code<\/span><\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>To use the numpy library in python, we need to import it.<\/li><li>np is the alias name of numpy.<\/li><li>coeff has the list of the coefficients.<\/li><li>To find the roots of the equation, we used np.roots passing the coefficients as the parameter and printing it.<\/li><\/ol>\n\n\n\n<p class=\"has-background has-medium-font-size\" style=\"background-color:#81f3c9\"><strong>Also, Read | <\/strong><a href=\"http:\/\/www.pythonpool.com\/numpy-square-root\/\" rel=\"noreferrer noopener\" target=\"_blank\">Numpy Square Root | Usecase Evaluation of Math Toolkit<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-method-2-using-poly1d-function-in-python\"><span class=\"ez-toc-section\" id=\"Method_2_Using_poly1D_function_in_python\"><\/span>Method 2: Using poly1D() function in python<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p><strong>poly1D<\/strong> helps us to define a polynomial function in python. We use this function as it makes it easy to apply the operations on polynomials. The coefficients of the polynomial are to be put in a numpy array in a sequence.\u00a0<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-syntax\"><span class=\"ez-toc-section\" id=\"Syntax-2\"><\/span>Syntax<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">numpy.poly1d(arr, root, var)<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-parameter-1\"><span class=\"ez-toc-section\" id=\"Parameter-2\"><\/span>Parameter<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p><strong>arr:-<\/strong> [array_like]&nbsp; The polynomial coefficients are in the decreasing order of powers. So if the second parameter, i.e., the root, is assigned to the True value, then array values will be the roots of the polynomial equation.<\/p>\n\n\n\n<p><strong>root:<\/strong><em>&nbsp;<\/em>&#8211; [bool, optional] The default value of root is False. True means polynomial roots. <\/p>\n\n\n\n<p><strong>var:<\/strong><em>&nbsp;<\/em>&#8211; variables like x, y, z that we need in polynomial. The default variable is x.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-return-value-1\"><span class=\"ez-toc-section\" id=\"Return_value\"><\/span>Return value<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>poly1D returns the polynomial equation along with the operation applied on it.<\/p>\n\n\n\n<p>for example, let the polynomial be x<sup>2<\/sup> + 5 * x + 6 , then the array will be [1, 5 , 6] respectively.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nimport numpy as np \np = np.poly1d(&#x5B;1, 5, 6]) \nroot = p.r\nprint(p)\nprint(root)\n<\/pre><\/div>\n\n\n<pre class=\"wp-block-preformatted\"><strong>OUTPUT:- <\/strong> x<sup>2<\/sup> + 5x +6\n                    [-3.   -2.]<\/pre>\n\n\n\n<p class=\"has-medium-font-size\"><strong><span style=\"text-decoration: underline\">Explanation of the code<\/span><\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>To use the numpy library, we need to import it.<\/li><li>np is the alias name of numpy.<\/li><li>Entered the coefficients of a polynomial into an array.<\/li><li>Multiplying by <em><strong>r<\/strong><\/em> to get the roots.<\/li><li>Displaying the polynomial equation and the roots of the equation.<\/li><\/ol>\n\n\n\n<p class=\"has-background has-medium-font-size\" style=\"background-color:#81f3c9\"><strong>Also, Read | <a href=\"http:\/\/www.pythonpool.com\/square-root-in-python\/\" rel=\"noreferrer noopener\" target=\"_blank\">How to Calculate Square Root in Python<\/a><\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-how-numpy-solves-the-equation-of-a-companion-matrix\"><span class=\"ez-toc-section\" id=\"How_numpy_solves_the_equation_of_a_Companion_Matrix\"><\/span>How numpy solves the equation of a Companion Matrix?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Python even helps us to solve a <a href=\"https:\/\/en.wikipedia.org\/wiki\/Companion_matrix#:~:text=The%20characteristic%20polynomial%20as%20well,companion%22%20of%20the%20polynomial%20p.&amp;text=Not%20every%20square%20matrix%20is,of%20blocks%20of%20companion%20matrices.\">companion matrix <\/a>as well with the help of numpy. The method which we use to solve this is <strong>np.legcompanion()<\/strong>. The <strong> np.legcompanion()<\/strong> will return the companion matrix .<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-syntax\"><span class=\"ez-toc-section\" id=\"Syntax-3\"><\/span><strong>Syntax:<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">np.legcompanion(c)<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-parameter-2\"><span class=\"ez-toc-section\" id=\"Parameter-3\"><\/span>Parameter<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p><strong>c :<\/strong>[array_like] 1-D arrays of legendre series coefficients which is ordered from low to high.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-return-value-2\"><span class=\"ez-toc-section\" id=\"Return_Value-2\"><\/span>Return Value<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p> It returns  a ndarray Companion matrix of dimensions (degree, degree).<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nimport numpy as np \nimport numpy.polynomial.legendre as npl\ns = (1, 2, 3, 4, 5) \nres = npl.legcompanion(s) \nprint(res) \n<\/pre><\/div>\n\n\n<p class=\"has-medium-font-size\"><strong>OUTPUT:-<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[ [ 0.          0.57735027  0.         -0.30237158]\n  [ 0.57735027  0.          0.51639778 -0.34914862]\n  [ 0.          0.51639778  0.          0.10141851]\n  [ 0.          0.          0.50709255 -0.4571428] ] <\/pre>\n\n\n\n<p class=\"has-medium-font-size\"><strong><span style=\"text-decoration: underline\">Explanation of the code<\/span><\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Importing numpy having alias name as np.&nbsp;&nbsp;<\/li><li>Importing numpy.polynomial.legendre module as npl.<\/li><li>Storing Legendre series coefficients in the variable s.<\/li><li>Using np.legcompanion() method.<\/li><li>Printing the resultant companion matrix.<\/li><\/ol>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-conclusion\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Numpy is an essential library python has. It is used in many applications for data scientists and machine learning engineers. This article has discussed a few of its features, such as root function and polynomial.legendre function. <\/p>\n\n\n\n<p>If you have any doubts please drop a comment in the comment section below.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We often solve polynomial equations in mathematics to find the roots of the equations. Have you ever wondered how to solve those mathematical equations using &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"Find Roots of the Polynomials Using Numpy in Python\" class=\"read-more button\" href=\"https:\/\/www.pythonpool.com\/numpy-roots\/#more-11358\" aria-label=\"More on Find Roots of the Polynomials Using Numpy in Python\">Read more<\/a><\/p>\n","protected":false},"author":19,"featured_media":11712,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[1495],"tags":[3994,3996,3998,3995,3997],"class_list":["post-11358","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-numpy","tag-numpy-polynomial-roots","tag-numpy-real-roots","tag-numpy-roots","tag-numpy-roots-check","tag-numpy-roots-example","infinite-scroll-item"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v20.1 (Yoast SEO v25.0) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Find Roots of the Polynomials Using Numpy in Python - Python Pool<\/title>\n<meta name=\"description\" content=\"Numpy root helps in finding the roots of a polynomial equation having coefficients in python. It can be found using a couple of methods.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.pythonpool.com\/numpy-roots\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Find Roots of the Polynomials Using Numpy in Python\" \/>\n<meta property=\"og:description\" content=\"We often solve polynomial equations in mathematics to find the roots of the equations. Have you ever wondered how to solve those mathematical equations\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.pythonpool.com\/numpy-roots\/\" \/>\n<meta property=\"og:site_name\" content=\"Python Pool\" \/>\n<meta property=\"article:published_time\" content=\"2021-05-18T03:55:31+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-05-18T03:57:48+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/Find-Roots-of-the-Polynomials-Using-Numpy-in-Python.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1350\" \/>\n\t<meta property=\"og:image:height\" content=\"650\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Sagarika Daripa\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@pythonpool\" \/>\n<meta name=\"twitter:site\" content=\"@pythonpool\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sagarika Daripa\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.pythonpool.com\/numpy-roots\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.pythonpool.com\/numpy-roots\/\"},\"author\":{\"name\":\"Sagarika Daripa\",\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/person\/092e9c8a9c793bd19f343d0b8a4009fa\"},\"headline\":\"Find Roots of the Polynomials Using Numpy in Python\",\"datePublished\":\"2021-05-18T03:55:31+00:00\",\"dateModified\":\"2021-05-18T03:57:48+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.pythonpool.com\/numpy-roots\/\"},\"wordCount\":852,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.pythonpool.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.pythonpool.com\/numpy-roots\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/Find-Roots-of-the-Polynomials-Using-Numpy-in-Python.jpg\",\"keywords\":[\"numpy polynomial roots\",\"numpy real roots\",\"numpy roots\",\"numpy roots check\",\"numpy roots example\"],\"articleSection\":[\"Numpy\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.pythonpool.com\/numpy-roots\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.pythonpool.com\/numpy-roots\/\",\"url\":\"https:\/\/www.pythonpool.com\/numpy-roots\/\",\"name\":\"Find Roots of the Polynomials Using Numpy in Python - Python Pool\",\"isPartOf\":{\"@id\":\"https:\/\/www.pythonpool.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.pythonpool.com\/numpy-roots\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.pythonpool.com\/numpy-roots\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/Find-Roots-of-the-Polynomials-Using-Numpy-in-Python.jpg\",\"datePublished\":\"2021-05-18T03:55:31+00:00\",\"dateModified\":\"2021-05-18T03:57:48+00:00\",\"description\":\"Numpy root helps in finding the roots of a polynomial equation having coefficients in python. It can be found using a couple of methods.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.pythonpool.com\/numpy-roots\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.pythonpool.com\/numpy-roots\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.pythonpool.com\/numpy-roots\/#primaryimage\",\"url\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/Find-Roots-of-the-Polynomials-Using-Numpy-in-Python.jpg\",\"contentUrl\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/Find-Roots-of-the-Polynomials-Using-Numpy-in-Python.jpg\",\"width\":1350,\"height\":650,\"caption\":\"numpy roots\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.pythonpool.com\/numpy-roots\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.pythonpool.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Find Roots of the Polynomials Using Numpy in Python\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.pythonpool.com\/#website\",\"url\":\"https:\/\/www.pythonpool.com\/\",\"name\":\"Python Pool\",\"description\":\"Your One-Stop Python Learning Destination\",\"publisher\":{\"@id\":\"https:\/\/www.pythonpool.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.pythonpool.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.pythonpool.com\/#organization\",\"name\":\"Python Pool\",\"url\":\"https:\/\/www.pythonpool.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/logo\/image\/\",\"url\":\"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png\",\"contentUrl\":\"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png\",\"width\":452,\"height\":185,\"caption\":\"Python Pool\"},\"image\":{\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/pythonpool\",\"https:\/\/www.youtube.com\/c\/pythonpool\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/person\/092e9c8a9c793bd19f343d0b8a4009fa\",\"name\":\"Sagarika Daripa\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/b5061d7f84b9ce4980a65ef18a50bba2d1ce8f086e0478fe37bf01423050f927?s=96&d=wavatar&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/b5061d7f84b9ce4980a65ef18a50bba2d1ce8f086e0478fe37bf01423050f927?s=96&d=wavatar&r=g\",\"caption\":\"Sagarika Daripa\"}}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Find Roots of the Polynomials Using Numpy in Python - Python Pool","description":"Numpy root helps in finding the roots of a polynomial equation having coefficients in python. It can be found using a couple of methods.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.pythonpool.com\/numpy-roots\/","og_locale":"en_US","og_type":"article","og_title":"Find Roots of the Polynomials Using Numpy in Python","og_description":"We often solve polynomial equations in mathematics to find the roots of the equations. Have you ever wondered how to solve those mathematical equations","og_url":"https:\/\/www.pythonpool.com\/numpy-roots\/","og_site_name":"Python Pool","article_published_time":"2021-05-18T03:55:31+00:00","article_modified_time":"2021-05-18T03:57:48+00:00","og_image":[{"width":1350,"height":650,"url":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/Find-Roots-of-the-Polynomials-Using-Numpy-in-Python.jpg","type":"image\/jpeg"}],"author":"Sagarika Daripa","twitter_card":"summary_large_image","twitter_creator":"@pythonpool","twitter_site":"@pythonpool","twitter_misc":{"Written by":"Sagarika Daripa","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.pythonpool.com\/numpy-roots\/#article","isPartOf":{"@id":"https:\/\/www.pythonpool.com\/numpy-roots\/"},"author":{"name":"Sagarika Daripa","@id":"https:\/\/www.pythonpool.com\/#\/schema\/person\/092e9c8a9c793bd19f343d0b8a4009fa"},"headline":"Find Roots of the Polynomials Using Numpy in Python","datePublished":"2021-05-18T03:55:31+00:00","dateModified":"2021-05-18T03:57:48+00:00","mainEntityOfPage":{"@id":"https:\/\/www.pythonpool.com\/numpy-roots\/"},"wordCount":852,"commentCount":0,"publisher":{"@id":"https:\/\/www.pythonpool.com\/#organization"},"image":{"@id":"https:\/\/www.pythonpool.com\/numpy-roots\/#primaryimage"},"thumbnailUrl":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/Find-Roots-of-the-Polynomials-Using-Numpy-in-Python.jpg","keywords":["numpy polynomial roots","numpy real roots","numpy roots","numpy roots check","numpy roots example"],"articleSection":["Numpy"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.pythonpool.com\/numpy-roots\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.pythonpool.com\/numpy-roots\/","url":"https:\/\/www.pythonpool.com\/numpy-roots\/","name":"Find Roots of the Polynomials Using Numpy in Python - Python Pool","isPartOf":{"@id":"https:\/\/www.pythonpool.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.pythonpool.com\/numpy-roots\/#primaryimage"},"image":{"@id":"https:\/\/www.pythonpool.com\/numpy-roots\/#primaryimage"},"thumbnailUrl":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/Find-Roots-of-the-Polynomials-Using-Numpy-in-Python.jpg","datePublished":"2021-05-18T03:55:31+00:00","dateModified":"2021-05-18T03:57:48+00:00","description":"Numpy root helps in finding the roots of a polynomial equation having coefficients in python. It can be found using a couple of methods.","breadcrumb":{"@id":"https:\/\/www.pythonpool.com\/numpy-roots\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.pythonpool.com\/numpy-roots\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.pythonpool.com\/numpy-roots\/#primaryimage","url":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/Find-Roots-of-the-Polynomials-Using-Numpy-in-Python.jpg","contentUrl":"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/05\/Find-Roots-of-the-Polynomials-Using-Numpy-in-Python.jpg","width":1350,"height":650,"caption":"numpy roots"},{"@type":"BreadcrumbList","@id":"https:\/\/www.pythonpool.com\/numpy-roots\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.pythonpool.com\/"},{"@type":"ListItem","position":2,"name":"Find Roots of the Polynomials Using Numpy in Python"}]},{"@type":"WebSite","@id":"https:\/\/www.pythonpool.com\/#website","url":"https:\/\/www.pythonpool.com\/","name":"Python Pool","description":"Your One-Stop Python Learning Destination","publisher":{"@id":"https:\/\/www.pythonpool.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.pythonpool.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.pythonpool.com\/#organization","name":"Python Pool","url":"https:\/\/www.pythonpool.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.pythonpool.com\/#\/schema\/logo\/image\/","url":"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png","contentUrl":"http:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png","width":452,"height":185,"caption":"Python Pool"},"image":{"@id":"https:\/\/www.pythonpool.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/pythonpool","https:\/\/www.youtube.com\/c\/pythonpool"]},{"@type":"Person","@id":"https:\/\/www.pythonpool.com\/#\/schema\/person\/092e9c8a9c793bd19f343d0b8a4009fa","name":"Sagarika Daripa","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.pythonpool.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/b5061d7f84b9ce4980a65ef18a50bba2d1ce8f086e0478fe37bf01423050f927?s=96&d=wavatar&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b5061d7f84b9ce4980a65ef18a50bba2d1ce8f086e0478fe37bf01423050f927?s=96&d=wavatar&r=g","caption":"Sagarika Daripa"}}]}},"_links":{"self":[{"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts\/11358","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/users\/19"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/comments?post=11358"}],"version-history":[{"count":41,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts\/11358\/revisions"}],"predecessor-version":[{"id":11715,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts\/11358\/revisions\/11715"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/media\/11712"}],"wp:attachment":[{"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/media?parent=11358"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/categories?post=11358"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/tags?post=11358"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}