Grigorii Eremeev
Grigorii Eremeev

Reputation: 31

NumPy polydiv, several variables

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

Upvotes: 3

Views: 368

Answers (1)

fraxel
fraxel

Reputation: 35309

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

Upvotes: 5

Related Questions