# Revision history [back]

It is possible to integrate these special functions in Sage as follows:

Dirac: using the algorithm keyword:

sage: var('x,a')
sage: integral(x^2*dirac_delta(-a + x), x, -infinity, +infinity, algorithm='sympy')
a^2
sage: integral(x^2*dirac_delta(-a + x), x, -infinity, +infinity, algorithm='giac')  # >= v.8.0.beta5
a^2


Heaviside: in this case the Maxima interface returns the expected result but using unit_step instead:

sage: var('x,x1,x2')
sage: assume(x1<x2)
sage: k(x,x1,x2) = unit_step(x-x1) * unit_step(x2-x)
sage: integrate(k(x,x1,x2), x, -infinity, infinity)
-x1 + x2


cf. #22850

(update) It is possible to integrate these special functions in Sage as follows:

Dirac: using the algorithm keyword:

sage: var('x,a')
sage: integral(x^2*dirac_delta(-a + x), x, -infinity, +infinity, algorithm='sympy')
a^2
sage: integral(x^2*dirac_delta(-a + x), x, -infinity, +infinity, algorithm='giac')  # >= v.8.0.beta5
a^2


Heaviside: in this case the Maxima interface returns the expected result but using unit_step instead:

sage: var('x,x1,x2')
sage: assume(x1<x2)
sage: k(x,x1,x2) = unit_step(x-x1) * unit_step(x2-x)
sage: integrate(k(x,x1,x2), x, -infinity, infinity)
-x1 + x2


cf. #22850

It is (updatenow) It is possible to integrate these special functions in Sage as follows:

Dirac: using the algorithm keyword:

sage: var('x,a')
sage: integral(x^2*dirac_delta(-a + x), x, -infinity, +infinity, algorithm='sympy')
a^2
sage: integral(x^2*dirac_delta(-a + x), x, -infinity, +infinity, algorithm='giac')  # >= v.8.0.beta5
a^2


Heaviside: in this case the Maxima interface returns the expected result but using unit_step instead:

sage: var('x,x1,x2')
sage: assume(x1<x2)
sage: k(x,x1,x2) = unit_step(x-x1) * unit_step(x2-x)
sage: integrate(k(x,x1,x2), x, -infinity, infinity)
-x1 + x2


cf. #22850