Opened 11 years ago

Closed 11 years ago

# numerical_integral(f, a, a) should always be zero

Reported by: Owned by: Jeroen Demeyer Burcin Erocal major sage-4.8 calculus karsten.naert@…, Paul Zimmermann, Michael Orlitzky sage-4.8.alpha3 Jeroen Demeyer Michael Orlitzky N/A

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.

Also: remove various unused things from the file `sage/gsl/integration.pyx` and clean up the documentation.

### comment:1 Changed 11 years ago by Jeroen Demeyer

Description: modified (diff)

### comment:2 Changed 11 years ago by Jeroen Demeyer

Description: modified (diff)

### comment:3 Changed 11 years ago by Jeroen Demeyer

Authors: → Jeroen Demeyer new → needs_review

### comment:4 follow-up:  5 Changed 11 years ago by Karl-Dieter Crisman

Was that Fourier stuff ever going to be used? Or is it elsewhere? I didn't really look at it.

Considering that

```sage: integral(1/x,x,0,0)
0
```

already, I guess we should do this. Are there any symbolic integrals on a point that Maxima doesn't give 0 for?

I'll review this more formally - especially the doc stuff, which seems good at a quick glance - if I get a chance, otherwise someone else feel free to do so!

### comment:5 in reply to:  4 Changed 11 years ago by Jeroen Demeyer

Was that Fourier stuff ever going to be used? Or is it elsewhere?

Probably "no" to both questions. That commented-out code has been there since 2007, the day that file was created. It does not look very developed, so I think it's okay to remove it.

### Changed 11 years ago by Michael Orlitzky

A one-off script I used to throw random functions at the numerical integration

### comment:8 follow-up:  9 Changed 11 years ago by Michael Orlitzky

Cc: Michael Orlitzky added needs_review → needs_work

You should add the ticket number to the new doctests, and maybe add yourself as author/copyright. Other than that, it looks good.

Done that.

### comment:10 Changed 11 years ago by Jeroen Demeyer

Status: needs_work → needs_review

### comment:11 follow-up:  13 Changed 11 years ago by Michael Orlitzky

Status: needs_review → positive_review

Positive review from me, then, although this is my first review so you may want a second opinion.

### comment:12 Changed 11 years ago by Karl-Dieter Crisman

Reviewers: → Michael Orlitzky

### comment:13 in reply to:  11 Changed 11 years ago by Jeroen Demeyer

Positive review from me, then, although this is my first review so you may want a second opinion.

First time for everything, right? I guess this patch is pretty safe, it makes only a small functional change to Sage. If all doctests pass and the documentation builds and looks okay (which is the case), then this patch should be merged.

Thanks for the review!

### comment:14 Changed 11 years ago by Karl-Dieter Crisman

@mjo:

Given the author and his current role, I'm sure this isn't an issue, but one thing to make sure to do with things that change the reference manual is to do

```sage -docbuild reference html
```

or the like, just to check that links look right and there isn't a misplaced colon or something.

Looking forward to seeing many more reviews - and other contributions? - from you! Thanks for helping.

### comment:15 Changed 11 years ago by Jeroen Demeyer

Merged in: → sage-4.8.alpha3 → fixed positive_review → closed
Note: See TracTickets for help on using tickets.