On Tue, Nov 8, 2011 at 5:24 AM, Jeroen Demeyer <jdeme...@cage.ugent.be> wrote: > Currently, in sage-4.7.2: > > sage: integral_numerical(log(x), 0, 0) > (nan, nan) > > Mathematically, the integral should certainly be zero: there is a > primitive function which is continuous and defined at 0. Symbolically, > we can compute the integral correctly: > > sage: integral(log(x), (x,0,0)) > 0 > > So I would like to add a special-case check for integral_numerical(): if > the interval of integration is a point, then always return 0. > > I realize that this means that also the integral of 1/x from 0 to 0 > would be 0, even though 1/x has no continuous primitive at 0. But > according to the Lebesgue theory of integration, I think this is not > even a problem.
Quick remark: I hope you don't do this for everything, e.g., for dirac_delta, since sage: integral_numerical(dirac_delta, 0,0) 0 would suck. In this case, dirac_delta is actually a distribution. It is defined as the distribution with the property that integral(dirac_delta, a, b) is 0 if the interval [a,b] does not contain 0, and is 1 if the interval [a,b] does contain 0. Right now we get a TypeError when trying to evaluate the above, which is unfortunate too, but at least it's an error rather than a totally wrong answer. With your patch, probably Sage would silently produce a wrong answer. -- William > > -- > To post to this group, send an email to sage-devel@googlegroups.com > To unsubscribe from this group, send an email to > sage-devel+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/sage-devel > URL: http://www.sagemath.org > -- William Stein Professor of Mathematics University of Washington http://wstein.org -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org