Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
sagemathgh-39362: Add doctest that integral of 0 function is 0
    
Fixes sagemath#33034.

Issue sagemath#33034 pointed out that integrating a function that is identically
zero can produce a nonzero value. However, this was a maxima bug that
was fixed in sage 10.1.  So we just add a doctest.

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->

- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [x] I have created tests covering the changes.
- [x] I have updated the documentation and checked the documentation
preview.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on. For example,
-->
<!-- - sagemath#12345: short description why this is a dependency -->
<!-- - sagemath#34567: ... -->
    
URL: sagemath#39362
Reported by: DaveWitteMorris
Reviewer(s):
  • Loading branch information
Release Manager committed Jan 29, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents f80efdb + e1e4071 commit 7dfec67
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/sage/misc/functional.py
Original file line number Diff line number Diff line change
@@ -777,6 +777,13 @@ def integral(x, *args, **kwds):
...
sage: result # needs sage.symbolic
-1/4
Verify that :issue:`33034` is fixed::
sage: f(x) = (x + sin(3*x)) * exp(-3*x*I)
sage: h(x) = f(x) - f(x).expand()
sage: integral(h(x), (x, 0, 2*pi))
0
"""
if hasattr(x, 'integral'):
return x.integral(*args, **kwds)

0 comments on commit 7dfec67

Please sign in to comment.