Opened 5 years ago

Last modified 5 years ago

## #21667 new task

# Redundant integrate() & integral() in functional.py and integral.py

Reported by: | mafra | Owned by: | |
---|---|---|---|

Priority: | major | Milestone: | sage-7.4 |

Component: | symbolics | Keywords: | |

Cc: | Merged in: | ||

Authors: | Reviewers: | ||

Report Upstream: | N/A | Work issues: | |

Branch: | Commit: | ||

Dependencies: | Stopgaps: |

### Description

The motivation for this ticket is that the documentation for

integral?

didn't mention very explicitly the different algorithms (it omits 'fricas', for example). The documentation that appears above is from the file misc/functional.py.

However, grep'ing around I found out that there is a much better documentation in the integral() definition in sage/symbolic/integration/integral.py
but it simply never appears upon eitheir `integral?`

or `integrate?`

Looking more closely, having the integrate() functions in both files seems redundant. One does `integrate = integral`

and the other does `integral = integrate`

at the end of their definitions.

My first reaction was to kill the definition from misc/functional.py but I get a compilation error related to the docbuild(!) which I could not understand where it is coming from (yet).

So before going on with killing integral() from misc/functional.py (and obtaining the much better documentation from integral.py as a result) I would like to ask more experienced Sage developers what they think about this. Is this unification recommended or is it a stupid thing to try?

But again, the underlying motivation was about the poorer documentation from functional.py

### Attachments (1)

**Note:**See TracTickets for help on using tickets.

I have prepared a preliminary patch (not to be applied) just to give an idea about what I meant above.

With the patch applied I get the (more helpful) documentation from integral.py upon

`integral?`

. Of course I could have just moved the text from integral.py to functional.py, but I thought that a bit of cleanup could be interesting.So this patch also implies that

`integrate`

is no longer valid, and one should use`integral`

only. That of course will break many tests (which could be fixed by`sed 's/integrate/integral/'`

), but the point I want to raise is whether it is desirable to have two names for the same thing (for what it's worth, Mathematica admits only`Integrate`

). IMHO, I think that Sage should allow only one name (my preferred choice would be`integrate`

).Of course, this patch is very preliminary. For example, I used the lazy_import() in all.py because I didn't know how to do it properly. This should be fixed I guess.

In any case, I realize that deprecating

`integral`

is a major decision. But the current situation with duplicated functions is not optimal (again imho). After my patch here I tested many integrals from examples in the sage source and they all worked the same way (provided integrate -> integral). So I guess that proves that there is some redundancy in the current code, and the documentation suffers from it.