Status: New
Owner: ----
Labels: Type-Defect Priority-Medium
New issue 3869 by [email protected]: integrate the derivative of
DiracDelta multipled by some function
http://code.google.com/p/sympy/issues/detail?id=3869
I'm tyring to do integrals of the following form:
integrate(f(x)*DiracDelta(x-a, n), (x, -oo, oo))
When n = 0, i.e. DiracDelta has not been differentiated, then I get the
correct answer of:
f(a)
When n>0, i.e. DiracDelta had been differentiated n times, then the
integral is not calculated, i.e. the input:
integrate(f(x)*DiracDelta(x-a, n), (x, -oo, oo))
is returned.
If I look in sympy.functions.special.delta_functions then the docstring
directs me to http://mathworld.wolfram.com/DeltaFunction.html for more
info. This webpage indicates that :
integrate(f(x)*DiracDelta(x-a, n), (x, -oo, oo))
should give:
(-1)**n * diff(f(x),x , n).subs(x=a)
I can hack the source code to get what I want. In
sympy.integrals.deltafunctions I make two alterations. Firstly in the
change_mul function remove the restriction of n only being 0 or ommited. I
replace:
if arg.func == DiracDelta and arg.is_simple(x) \
and (len(arg.args) <= 1 or arg.args[1]==0):
with the following:
if arg.func == DiracDelta and arg.is_simple(x):
Secondly, in the deltaintegrate function I replace:
return (rest_mult.subs(x, point)*Heaviside(x - point))
with the following:
try:
n = dg.args[1]
except:
n = 0
return ((-1)**n*sympy.diff(rest_mult, x, n).subs(x, point)*Heaviside(x
- point))
It's probably easiest to check:
integrate(sin(x)*DiracDelta(x-a, 0), (x, -oo, oo))
integrate(sin(x)*DiracDelta(x-a, 1), (x, -oo, oo))
integrate(sin(x)*DiracDelta(x-a, 2), (x, -oo, oo))
integrate(sin(x)*DiracDelta(x-a, 3), (x, -oo, oo))
integrate(sin(x)*DiracDelta(x-a, 4), (x, -oo, oo))
should give:
sin(a)
cos(a)
-sin(a)
-cos(a)
sin(a)
Is this OK? (does it break anything else?) Can someone add it to future
releases of sympy? I have no idea how to do so. This and resolution of
heaviside integrations issue 1696 would be great.
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
--
You received this message because you are subscribed to the Google Groups
"sympy-issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy-issues?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.