Repository navigation
Split a definite integral at an equation's solutions and at exact points (#2654) - #2657
Open
Rafael-SOWNet wants to merge 1 commit into
Open
Rafael-SOWNet wants to merge 1 commit into
Rafael-SOWNet wants to merge 1 commit into
Conversation
…nts (#2654) A definite integral of a piecewise or a provided expression is split at the boundaries of its conditions. Only a comparison of the variable with a number was read as a boundary. (x^3 - x)/(x^2 - 1) simplifies to x provided not x^2 - 1 = 0, so its integral over [-2, 2] was left unevaluated, although the condition fails only at -1 and 1 and the integral is 0. A range with an infinite bound was not split at all. The boundaries also went into the pieces as decimals, so a split at sqrt(2) gave 3 - 1.41421... where the integral is 3 - sqrt(2). An equation's solutions are now listed as boundaries, by the zero lister the antiderivative breaks use, including periodic families such as cos(x) = 0. A range with an infinite bound is split like a finite one, taking its outer pieces' sample points one unit inside. Each boundary is kept as written, so the pieces end at exact points. A condition that fails on an interval still leaves no value there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2657 +/- ##
==========================================
- Coverage 86.71% 86.71% -0.01%
==========================================
Files 346 346
Lines 75660 75736 +76
Branches 22118 22149 +31
==========================================
+ Hits 65608 65671 +63
- Misses 5420 5423 +3
- Partials 4632 4642 +10
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes how a definite integral of a piecewise or provided expression is split at the boundaries of its conditions. Three things were wrong:
(x^3 - x)/(x^2 - 1)simplifies tox provided not x^2 - 1 = 0, so its integral over[-2, 2]was left unevaluated, even though the condition fails only at ±1 and the integral is 0.sqrt(2)gave3 - 1.41421….The fix:
AntiderivativeBreaks.ZerosOf, the lister the antiderivative breaks already use. It handles periodic families such ascos(x) = 0.integral((x^3 - x)/(x^2 - 1), x, -2, 2)0integral(sin(x) cos(x)^0, x, 0, pi)2integral(sin(x)^4 cos(x)^0, x, 0, pi)3/8 * piintegral((-x - 1)/(x^3 + 3x^2 + x - 1), x, -oo, -3)integral(piecewise(x provided x < sqrt(2), 1), x, 0, 2)3 - 1.41421…(a 100-digit decimal)3 - sqrt(2)integral(x provided x > 1/2, x, 0, 1)Checks
sin^m cos^nwith odd and even exponents, and definite integrals with a symbolic parameter checked at three values. Run alongside the earlier exp/ln/radical and rational sets, 622 cases in all: 0 wrong.Still left unevaluated, and not addressed here: the parametric integrals
exp(-a x) sin(x)andexp(-a x) cos(2x)over[0, +oo), which needa > 0, and1/(a + cos(x))over[0, pi], which needsa > 1. Also unaddressed:1/(a + sin(x))over[0, 2 pi]times out.Closes #2654.
🤖 Generated with Claude Code