# Revision history [back]

### How can I Integrate the dirac_delta and heaviside functions in sage?

Is it possible to integrate the dirac_delta and the heaviside function in sage. I can't seem to do it. For the dirac_delta I've tried the following code:

reset()
var('x,a')
integral(x^2*dirac_delta(-a + x), x, -infinity, +infinity)


from which, after evaluating, I get:

integrate(x^2*dirac_delta(-a + x), x, -Infinity, +Infinity)


i.e. the integration is not performed. I am expecting a^2.

For the heaviside fucntion I've tried:

reset()
var('x,x1,x2')
k(x,x1,x2)=heaviside(x-x1)*heaviside(x2-x)
integrate(k(x,x1,x2),x,-infinity,infinity)


from which, after evaluating, I get:

integrate(heaviside(-x + x2)*heaviside(x - x1), x, -Infinity, +Infinity)


I am expecting x2-x1. Am I doing something wrong or is it just not possible to do these integrations in sage?

 2 retagged Kelvin Li 503 ●5 ●12 ●17

### How can I Integrate the dirac_delta and heaviside functions in sage?

Is it possible to integrate the dirac_delta and the heaviside function in sage. I can't seem to do it. For the dirac_delta I've tried the following code:

reset()
var('x,a')
integral(x^2*dirac_delta(-a + x), x, -infinity, +infinity)


from which, after evaluating, I get:

integrate(x^2*dirac_delta(-a + x), x, -Infinity, +Infinity)


i.e. the integration is not performed. I am expecting a^2.

For the heaviside fucntion I've tried:

reset()
var('x,x1,x2')
k(x,x1,x2)=heaviside(x-x1)*heaviside(x2-x)
integrate(k(x,x1,x2),x,-infinity,infinity)


from which, after evaluating, I get:

integrate(heaviside(-x + x2)*heaviside(x - x1), x, -Infinity, +Infinity)


I am expecting x2-x1. Am I doing something wrong or is it just not possible to do these integrations in sage?