By the way, this is what Maple does:

> quo(5*x**3, 3*x, x);
                                    5  2
                                    - x 
                                    3   
> rem(5*x**3, 3*x, x);
                                      0

Now I realize that things might be different there because those are user level 
functions, but actually our user level functions do the same as Poly:

In [10]: div(-5*x**3, 3*x)
Out[10]: 
⎛       3⎞
⎝0, -5⋅x ⎠

Aaron Meurer

On Aug 5, 2010, at 5:09 PM, Aaron S. Meurer wrote:

> I didn't want to open an issue before asking here, because for all I know 
> there could be a very good reason for this.
> 
> In [1]: Poly(-5*x**3, x).div(Poly(3*x, x))
> Out[1]: (Poly(0, x, domain='ZZ'), Poly(-5*x**3, x, domain='ZZ'))
> 
> In [2]: Poly(-5*x**3, x, field=True).div(Poly(3*x, x, field=True))
> Out[2]: (Poly(-5/3*x**2, x, domain='QQ'), Poly(0, x, domain='QQ'))
> 
> I understand that it doesn't want to create field coefficients, but I thought 
> that the definition of polynomial division and remainder was that a.div(b) 
> returns q and r such that a == b*q + r and **either r == 0 or deg(r) < 
> deg(b)**.  [1] obviously does not satisfy this second condition.  So what 
> definition does it use?  
> 
> This is causing problems in the Risch algorithm.  It seems like I need to be 
> using field=True every time I create a Poly, or else I will get wrong 
> results. But then that gives things like gcd() problems.  
> 
> By the way, I know about pdiv.  But I think regular div() should be returning 
> results with field coefficients if it must to satisfy the definition, unless 
> I am seriously missing something.
> 
> Aaron Meurer

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to sy...@googlegroups.com.
To unsubscribe from this group, send email to 
sympy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to