sympy/sympy — pull request #2436 by asmeurer (2013-09-04 03:39:34+00:00)
Title: Make degree(0) == -oo in the polys

Previously, degree(0) was -1. This makes sense for the dense representation,
because then one can use degree in place of len(f) - 1, but outside of that,
it makes little sense. In particular, the very important formula regarding
degree, deg(f*g) == deg(f) + deg(g), does not hold unless deg(0) == -oo.
Therefore, any code that does arithmetic on a degree and then makes a
comparison against it (like "if degree(f) - 1 > 0"), such as some code in the
Risch algorithm) was previously for 0 but generally correct now.

Fixing this just means being more careful about when you mean degree(f) and
when you mean len(f) - 1 in the dense representation algorithms. Another
argument for this is that the change in the sparse code required no additional
changes anywhere; apparently the degree does not correspond to any natural
quantity in the sparse representation.

@mattpap

@cheatiiit, you might try merging this with your branch and see if it fixes
anything. I know that a few of your bugs were caused by the fact that
degree(0) == -1 instead of -oo.