Ask Your Question

Revision history [back]

A solution is to use the symbolic function unit_step:

sage: L = var('L', domain = 'positive')
sage: f(x) = unit_step(L+x)*unit_step(L-x)*x
sage: diff(f(x), x)
-x*dirac_delta(L - x)*unit_step(L + x) + x*dirac_delta(L + x)*unit_step(L - x) + unit_step(L + x)*unit_step(L - x)
sage: integrate(f(x), (x, 0, 3*L))
1/2*L^2
sage: integrate(f(x), (x, -3*L, 3*L))
0