Comment #6 on issue 3716 by mrock...@gmail.com: Integrals over non-interval
sets
http://code.google.com/p/sympy/issues/detail?id=3716
Are sets able to rewrite themselves as a union of intervals?
I don't believe so, no. I think Interval(a, a) is actually transformed
into FiniteSet(a).
One way to do this is an explicit branch on the type
if isinstance(xab[1], Union):
return Add(*[Integral(...) for ... in xab[1].args])
if isinstance(xab[1], FiniteSet):
return 0
Also, I'm not sure what the mathematically correct thing do to with a
delta function over a finite set is.
Currently we just return 0
In [12]: integrate(DiracDelta(x), (x, 0, 0))
Out[12]: 0
Also, care is needed. Integral(f(x), (x, Union(Interval(a, b),
Interval(c, d))) is not the same as Integral(f(x), (x, a, b)) +
Integral(f(x), (x, c, d)) if c < b.
In some cases this is handled by Union
In [18]: Union(Interval(1, 5), Interval(3, 8))
Out[18]: [1, 8]
However, if we're unable to infer that c < b or c > b then yes, we do run
into an ambiguity problem. Union._measure does the whole addition and
subtraction of nested intersections thing. We could generalize it to this
problem. It's currently handling this problem correctly when the integrand
is 1.
Really though I wouldn't mind just assuming that if we can't infer anything
about c and b then the intervals don't overlap. Or maybe we just raise a
NotImplementedError when this is the case.
--
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 sympy-issues+unsubscr...@googlegroups.com.
To post to this group, send email to sympy-issues@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy-issues?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.