Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NumPy polydiv, several variables

Tags:

python

numpy

I need to divide a polynomial by a polynomial in NumPy. For this I use numpy.polydiv but in the example of the documentation of polynomials with only one variable. And I need to divide polynomials with three variables. Please tell me how to do it.

For example: x^3 + y^3 + z^3 divided by x^ 2 + z

like image 655
Grigorii Eremeev Avatar asked Apr 21 '26 09:04

Grigorii Eremeev


1 Answers

I suggest you use sympy, which allows for basic symbolic manipulation. In your example x^3 + y^3 + z^3 is not divisible by x^ 2 + z, so nothing will help you there! But, with a simple example like, x**2 - y**2 divided by x - y, we can see sympy in action:

>>> import sympy
>>> x, y = sympy.symbols('x y')
>>> sympy.simplify((x**2 - y**2) / (x - y))
x + y
like image 107
fraxel Avatar answered Apr 22 '26 23:04

fraxel