# Ticket #12047(closed defect: fixed)

Opened 18 months ago

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

Reported by: Owned by: jdemeyer burcin major sage-4.8 calculus karsten.naert@…, zimmerma, mjo N/A Michael Orlitzky Jeroen Demeyer sage-4.8.alpha3

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.

## Change History

### comment:1 Changed 18 months ago by jdemeyer

• Description modified (diff)

### comment:2 Changed 18 months ago by jdemeyer

• Description modified (diff)

### comment:3 Changed 18 months ago by jdemeyer

• Status changed from new to needs_review
• Authors set to Jeroen Demeyer

### comment:4 follow-up: ↓ 5 Changed 18 months ago by kcrisman

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 18 months ago by jdemeyer

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 18 months ago by mjo

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

### comment:8 follow-up: ↓ 9 Changed 18 months ago by mjo

• Status changed from needs_review to 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 18 months ago by jdemeyer

• Status changed from needs_work to needs_review

### comment:11 follow-up: ↓ 13 Changed 18 months ago by mjo

• Status changed from needs_review to positive_review

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

### comment:12 Changed 18 months ago by kcrisman

• Reviewers set to Michael Orlitzky

### comment:13 in reply to: ↑ 11 Changed 18 months ago by jdemeyer

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 18 months ago by kcrisman

@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 18 months ago by jdemeyer

• Status changed from positive_review to closed
• Resolution set to fixed
• Merged in set to sage-4.8.alpha3
Note: See TracTickets for help on using tickets.