def __truediv__(self, other):
        """\
Implements some simple forms of division.  See
http://en.wikipedia.org/wiki/Synthetic_division
for details.

>>> str(SimplePolynomial() / 2)
'0.5*X'
>>> x = SimplePolynomial()
>>> quotient, remainder  = (x**3 - 12*x**2 - 42) / (x - 3)
>>> str(quotient), str(remainder)
('X**2 - 9*X - 27', '-123')
"""
        if isinstance(other, Number):
            return SimplePolynomial([c / other for c in self.terms])
        if len(other.terms) == 1:
            return self/other.terms[0]
        assert len(other.terms) == 2
        dividend = self.terms[:]
        divisor = other.terms[:]
        assert divisor[-1] == 1
        xi = 0
        result = []
        for i in xrange(-1, -len(dividend) - 1, -1):
            xi = dividend[i] - xi * divisor[0]
            result.insert(0, xi)
        return SimplePolynomial(result[1:]), result[0]
        raise NotImplementedError('synthetic division')
Implements some simple forms of division.  See
http://en.wikipedia.org/wiki/Synthetic_division
for details.

>>> str(SimplePolynomial() / 2)
'0.5*X'
>>> x = SimplePolynomial()
>>> quotient, remainder  = (x**3 - 12*x**2 - 42) / (x - 3)
>>> str(quotient), str(remainder)
('X**2 - 9*X - 27', '-123')

recipes/Python/576953_Simple_polynomial_class/recipe-576953.py