class_docstr: The DiracDelta function and its derivatives.
  
  Explanation
  ===========
  
  DiracDelta is not an ordinary function. It can be rigorously defined either
  as a distribution or as a measure.
  
  DiracDelta only makes sense in definite integrals, and in particular,
  integrals of the form ``Integral(f(x)*DiracDelta(x - x0), (x, a, b))``,
  where it equals ``f(x0)`` if ``a <= x0 <= b`` and ``0`` otherwise. Formally,
  DiracDelta acts in some ways like a function that is ``0`` everywhere except
  at ``0``, but in many ways it also does not. It can often be useful to treat
  DiracDelta in formal ways, building up and manipulating expressions with
  delta functions (which may eventually be integrated), but care must be taken
  to not treat it as a real function. SymPy's ``oo`` is similar. It only
  truly makes sense formally in certain contexts (such as integration limits),
  but SymPy allows its use everywhere, and it tries to be consistent with
  operations on it (like ``1/oo``), but it is easy to get into trouble and get
  wrong results if ``oo`` is treated too much like a number. Similarly, if
  DiracDelta is treated too much like a function, it is easy to get wrong or
  nonsensical results.
  
  DiracDelta function has the following properties:
  
  1) $\frac{d}{d x} \theta(x) = \delta(x)$
  2) $\int_{-\infty}^\infty \delta(x - a)f(x)\, dx = f(a)$ and $\int_{a-
     \epsilon}^{a+\epsilon} \delta(x - a)f(x)\, dx = f(a)$
  3) $\delta(x) = 0$ for all $x \neq 0$
  4) $\delta(g(x)) = \sum_i \frac{\delta(x - x_i)}{\|g'(x_i)\|}$ where $x_i$
     are the roots of $g$
  5) $\delta(-x) = \delta(x)$
  
  Derivatives of ``k``-th order of DiracDelta have the following properties:
  
  6) $\delta(x, k) = 0$ for all $x \neq 0$
  7) $\delta(-x, k) = -\delta(x, k)$ for odd $k$
  8) $\delta(-x, k) = \delta(x, k)$ for even $k$
  
  Examples
  ========
  
  >>> from sympy import DiracDelta, diff, pi
  >>> from sympy.abc import x, y
  
  >>> DiracDelta(x)
  DiracDelta(x)
  >>> DiracDelta(1)
  0
  >>> DiracDelta(-1)
  0
  >>> DiracDelta(pi)
  0
  >>> DiracDelta(x - 4).subs(x, 4)
  DiracDelta(0)
  >>> diff(DiracDelta(x))
  DiracDelta(x, 1)
  >>> diff(DiracDelta(x - 1), x, 2)
  DiracDelta(x - 1, 2)
  >>> diff(DiracDelta(x**2 - 1), x, 2)
  2*(2*x**2*DiracDelta(x**2 - 1, 2) + DiracDelta(x**2 - 1, 1))
  >>> DiracDelta(3*x).is_simple(x)
  True
  >>> DiracDelta(x**2).is_simple(x)
  False
  >>> DiracDelta((x**2 - 1)*y).expand(diracdelta=True, wrt=x)
  DiracDelta(x - 1)/(2*Abs(y)) + DiracDelta(x + 1)/(2*Abs(y))
  
  See Also
  ========
  
  Heaviside
  sympy.simplify.simplify.simplify, is_simple
  sympy.functions.special.tensor_functions.KroneckerDelta
  
  References
  ==========
  
  .. [1] https://mathworld.wolfram.com/DeltaFunction.html
class_docstr_tok: ["The","DiracDelta","function","and","its","derivatives",".","Explanation","===========","DiracDelta","is","not","an","ordinary","function",".","It","can","be","rigorously","defined","either","as","a","distribution","or","as","a","measure",".","DiracDelta","only","makes","sense","in","definite","integrals",",","and","in","particular",",","integrals","of","the","form","``","Integral","(","f","(","x",")","*","DiracDelta","(","x","-","x0",")",",","(","x",",","a",",","b",")",")","``",",","where","it","equals","``","f","(","x0",")","``","if","``","a","<","=","x0","<","=","b","``","and","``","0","``","otherwise",".","Formally",",","DiracDelta","acts","in","some","ways","like","a","function","that","is","``","0","``","everywhere","except","at","``","0","``",",","but","in","many","ways","it","also","does","not",".","It","can","often","be","useful","to","treat","DiracDelta","in","formal","ways",",","building","up","and","manipulating","expressions","with","delta","functions","(","which","may","eventually","be","integrated",")",",","but","care","must","be","taken","to","not","treat","it","as","a","real","function",".","SymPy","'s","``","oo","``","is","similar",".","It","only","truly","makes","sense","formally","in","certain","contexts","(","such","as","integration","limits",")",",","but","SymPy","allows","its","use","everywhere",",","and","it","tries","to","be","consistent","with","operations","on","it","(","like","``","1\/oo","``",")",",","but","it","is","easy","to","get","into","trouble","and","get","wrong","results","if","``","oo","``","is","treated","too","much","like","a","number",".","Similarly",",","if","DiracDelta","is","treated","too","much","like","a","function",",","it","is","easy","to","get","wrong","or","nonsensical","results",".","DiracDelta","function","has","the","following","properties",":","1",")","$","\\frac","{","d","}","{","d","x","}","\\theta","(","x",")","=","\\delta","(","x",")","$","2",")","$","\\int_","{","-\\infty","}","^\\infty","\\delta","(","x","-","a",")","f","(","x",")","\\",",","dx","=","f","(","a",")","$","and","$","\\int_","{","a-","\\epsilon","}","^","{","a+\\epsilon","}","\\delta","(","x","-","a",")","f","(","x",")","\\",",","dx","=","f","(","a",")","$","3",")","$","\\delta","(","x",")","=","0","$","for","all","$","x","\\neq","0","$","4",")","$","\\delta","(","g","(","x",")",")","=","\\sum_i","\\frac","{","\\delta","(","x","-","x_i",")","}","{","\\|g","'","(","x_i",")","\\|","}","$","where","$","x_i","$","are","the","roots","of","$","g","$","5",")","$","\\delta","(","-x",")","=","\\delta","(","x",")","$","Derivatives","of","``","k","``","-th","order","of","DiracDelta","have","the","following","properties",":","6",")","$","\\delta","(","x",",","k",")","=","0","$","for","all","$","x","\\neq","0","$","7",")","$","\\delta","(","-x",",","k",")","=","-\\delta","(","x",",","k",")","$","for","odd","$","k","$","8",")","$","\\delta","(","-x",",","k",")","=","\\delta","(","x",",","k",")","$","for","even","$","k","$","Examples","========",">",">",">","from","sympy","import","DiracDelta",",","diff",",","pi",">",">",">","from","sympy.abc","import","x",",","y",">",">",">","DiracDelta","(","x",")","DiracDelta","(","x",")",">",">",">","DiracDelta","(","1",")","0",">",">",">","DiracDelta","(","-1",")","0",">",">",">","DiracDelta","(","pi",")","0",">",">",">","DiracDelta","(","x","-","4",")",".subs","(","x",",","4",")","DiracDelta","(","0",")",">",">",">","diff","(","DiracDelta","(","x",")",")","DiracDelta","(","x",",","1",")",">",">",">","diff","(","DiracDelta","(","x","-","1",")",",","x",",","2",")","DiracDelta","(","x","-","1",",","2",")",">",">",">","diff","(","DiracDelta","(","x","*","*","2","-","1",")",",","x",",","2",")","2","*","(","2","*","x","*","*","2","*","DiracDelta","(","x","*","*","2","-","1",",","2",")","+","DiracDelta","(","x","*","*","2","-","1",",","1",")",")",">",">",">","DiracDelta","(","3","*","x",")",".is_simple","(","x",")","True",">",">",">","DiracDelta","(","x","*","*","2",")",".is_simple","(","x",")","False",">",">",">","DiracDelta","(","(","x","*","*","2","-","1",")","*","y",")",".expand","(","diracdelta=True",",","wrt=x",")","DiracDelta","(","x","-","1",")","\/","(","2","*","Abs","(","y",")",")","+","DiracDelta","(","x","+","1",")","\/","(","2","*","Abs","(","y",")",")","See","Also","========","Heaviside","sympy.simplify.simplify.simplify",",","is_simple","sympy.functions.special.tensor_functions.KroneckerDelta","References","==========","..","[","1","]","https",":","\/\/mathworld.wolfram.com\/DeltaFunction.html"]
docstr: Returns the DiracDelta expression written in the form of Singularity
  Functions.
docstr_tok: ["Returns","the","DiracDelta","expression","written","in","the","form","of","Singularity","Functions","."]
code: def _eval_rewrite_as_SingularityFunction(self, *args, **kwargs):
      """
      Returns the DiracDelta expression written in the form of Singularity
      Functions.
  
      """
      from sympy.solvers import solve
      from sympy.functions.special.singularity_functions import (
          SingularityFunction,
      )
  
      if self == DiracDelta(0):
          return SingularityFunction(0, 0, -1)
      if self == DiracDelta(0, 1):
          return SingularityFunction(0, 0, -2)
      free = self.free_symbols
      if len(free) == 1:
          x = free.pop()
          if len(args) == 1:
              return SingularityFunction(x, solve(args[0], x)[0], -1)
          return SingularityFunction(
              x, solve(args[0], x)[0], -args[1] - 1
          )
      else:
          # I don't know how to handle the case for DiracDelta expressions
          # having arguments with more than one variable.
          raise TypeError(
              filldedent(
                  """
                  rewrite(SingularityFunction) does not support
                  arguments with more that one variable."""
              )
          )
  
imports: from sympy.core import S, diff
  from sympy.core.function import Function, ArgumentIndexError
  from sympy.core.logic import fuzzy_not
  from sympy.core.relational import Eq, Ne
  from sympy.functions.elementary.complexes import im, sign
  from sympy.functions.elementary.piecewise import Piecewise
  from sympy.polys.polyerrors import PolynomialError
  from sympy.polys.polyroots import roots
  from sympy.utilities.misc import filldedent
label_desc: Use image node_id 6 for calling the DiracDelta obj's underlying member method code with example usage: obj._eval_rewrite_as_SingularityFunction() and returns: SingularityFunction, SingularityFunction, SingularityFunction, SingularityFunction