(self, x)
return self
simplify(self, x)

           Compute a simplified representation of the function using
           property number 4.

           x can be:

           - a symbol

           Examples
           ========

           >>> from sympy import DiracDelta
           >>> from sympy.abc import x, y

           >>> DiracDelta(x*y).simplify(x)
           DiracDelta(x)/Abs(y)
           >>> DiracDelta(x*y).simplify(y)
           DiracDelta(y)/Abs(x)

           >>> DiracDelta(x**2 + x - 2).simplify(x)
           DiracDelta(x - 1)/3 + DiracDelta(x + 2)/3

           See Also
           ========

           is_simple, Directdelta
simplify(self, x)
simplify ( self x )
def simplify(self, x):
        """simplify(self, x)

           Compute a simplified representation of the function using
           property number 4.

           x can be:

           - a symbol

           Examples
           ========

           >>> from sympy import DiracDelta
           >>> from sympy.abc import x, y

           >>> DiracDelta(x*y).simplify(x)
           DiracDelta(x)/Abs(y)
           >>> DiracDelta(x*y).simplify(y)
           DiracDelta(y)/Abs(x)

           >>> DiracDelta(x**2 + x - 2).simplify(x)
           DiracDelta(x - 1)/3 + DiracDelta(x + 2)/3

           See Also
           ========

           is_simple, Directdelta

        """
        from sympy.polys.polyroots import roots

        if not self.args[0].has(x) or (len(self.args) > 1 and self.args[1] != 0 ):
            return self
        try:
            argroots = roots(self.args[0], x, multiple=True)
            result = 0
            valid = True
            darg = diff(self.args[0], x)
            for r in argroots:
                #should I care about multiplicities of roots?
                if r.is_real is not False and not darg.subs(x, r).is_zero:
                    result += self.func(x - r)/abs(darg.subs(x, r))
                else:
                    valid = False
                    break
            if valid:
                return result
        except PolynomialError:
            pass
        return self
def simplify ( self , x ) : from sympy . polys . polyroots import roots if not self . args [ 0 ] . has ( x ) or ( len ( self . args ) > 1 and self . args [ 1 ] != 0 ) : return self try : argroots = roots ( self . args [ 0 ] , x , multiple = True ) result = 0 valid = True darg = diff ( self . args [ 0 ] , x ) for r in argroots : #should I care about multiplicities of roots? if r . is_real is not False and not darg . subs ( x , r ) . is_zero : result += self . func ( x - r ) / abs ( darg . subs ( x , r ) ) else : valid = False break if valid : return result except PolynomialError : pass return self