[Feature] Add definite integration#214
Merged
matthew-mccall merged 10 commits intoApr 28, 2026
Merged
Conversation
Only a test for equal bounds is written for now. # Conflicts: # src/Integral.cpp # Conflicts: # src/Integral.cpp
Issues were arising from the + C that comes from indefinite integration. That issue is fixed now, so definite integration is working as intended.
Test cases for swapped bounds, integrating 0, etc. were added. Comments clarifying the definite integration method were also added.
…nused includes Changed variables in snake case to camel case to match the rest of the project. Improved comment wording in Integral.cpp and added comments in DefiniteIntegralTests.cpp, to explain what is being tested and the expected outcome. Removed unused include statements that were left over from initial testing and are not needed.
… description for IntegrateWithBounds() Added a test case to ensure that non-integrable functions successfully return out with a nullptr (to catch situtations where the function can not be integrated for definite integration), also updated the comment for the function in Expression.hpp to more accurately describe the function's current implementation.
Some formatting was slightly off from the rest of the project. Ran clang-format so that the formatting is consistent with the rest of the project.
matthew-mccall
requested changes
Apr 21, 2026
Collaborator
There was a problem hiding this comment.
Thank you for contributions, in addition to the specific changes requested. In general, if a function takes a const&, you don't need to create a std::unique_ptr only to Copy() and deference it, you should be able to get away with instantiated and passing the const& like any other variable.
…ded calls to Copy(), removed outdated include statements Change IntegrateWithBounds() to no longer take in a variable, with the function instead using the Integral's GetLeastSigOp(). Removed extra unneeded calls to Copy() when testing in DefiniteIntegralTests.cpp for better clarity. Removed an old include statement in MultiplyTests.cpp and SubtractTests.cpp that caused issues with compilation.
Contributor
Author
|
I apologize for the late reply. I have made those edits and committed to the fork just now. Please let me know if I should make any other changes, thank you. |
matthew-mccall
approved these changes
Apr 28, 2026
matthew-mccall
left a comment
Collaborator
There was a problem hiding this comment.
attempt no. 2 because GitHub is still blocked on my old review
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.
Add an implementation of definite integration to the Integral class.
The implementation requires the given expression to have an antiderivative, so definite integrals without antiderivatives that require other tricks to solve are not supported (e.g., the Gaussian Integral).