NumPy | Python Methods and Functions

** numpy.polysub () **: This function helps you find the difference between two polynomials and then return the result as a polynomial. Each input polynomial must be a sequence of polynomial coefficients, from highest to lowest degree.

Parameters:p1:Input polynomial 1: 1x + 2.p2:Input polynomial 2: 9x^{ 2 }+ 5x + 4

** Return :**

Difference of polynomials: (0-9) x^{ 2 }+ (1-5) x + (2-4)

` `

` ` ` # Code Python explaining `

` # numpy.polysub () `

` # importing libraries `

` import `

` numpy as np `

` p1 `

` = `

` np.poly1d ([`

` 1 `

`, `

` 2 `

`]) `

` p2 `

` = `

` np.poly1d ([`

` 9 `

`, `

` 5 `

`, `

` 4 `

`]) `

` print `

` (`

` "P1:" `

`, p1) `

` print `

` (`

` "P2:" `

`, p2) `

` a `` = `

` np.polysub (p1, p2) `

` `

` print `

` (`

` "P1 - P2: "`

`, a) `

** Output: **

P1: 1 x + 2 P2: 2 9 x + 5 x + 4 P1 - P2: 2 -9 x - 4 x - 2

Coding for Kids: Python - Learn to Code with 50 Awesome Games and Activities. Learning to code isn't as difficult as it sounds, you just have to get started! Coding for Kids: Python gets kids start...

31/08/2021

Pandas for Everyone: Python Data Analysis (Addison-Wesley Data & Analytics Series), 1st Edition. Pandas for Everyone brings together the practical knowledge and insights you need to solve real-worl...

05/09/2021

Systems programming provides the basis for global calculation. Developing performance-sensitive code requires a programming language that allows programmers to control the use of memory, processor tim...

23/09/2021

ig Data applications are growing very rapidly around the globe. This new approach to decision making takes into account data gathered from multiple sources. Here my goal is to show how these diverse s...

10/07/2020

X
# Submit new EBook