Skip to content

[Feature] Add definite integration#214

Merged
matthew-mccall merged 10 commits into
open-algebra:masterfrom
JooseMann:feature-definite-integration
Apr 28, 2026
Merged

[Feature] Add definite integration#214
matthew-mccall merged 10 commits into
open-algebra:masterfrom
JooseMann:feature-definite-integration

Conversation

@JooseMann

Copy link
Copy Markdown
Contributor

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).

JooseMann and others added 9 commits April 17, 2026 17:42
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 matthew-mccall self-requested a review April 21, 2026 21:13
@matthew-mccall matthew-mccall added core Related to the OASIS library itself labels Apr 21, 2026

@matthew-mccall matthew-mccall left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread tests/DefiniteIntegralTests.cpp Outdated
Comment thread include/Oasis/Integral.hpp Outdated
…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.
@JooseMann

Copy link
Copy Markdown
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 matthew-mccall left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@matthew-mccall matthew-mccall self-requested a review April 28, 2026 17:18

@matthew-mccall matthew-mccall left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

attempt no. 2 because GitHub is still blocked on my old review

@matthew-mccall matthew-mccall merged commit cb3063b into open-algebra:master Apr 28, 2026
9 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in OASIS Core Feature Development Apr 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Related to the OASIS library itself

Projects

Development

Successfully merging this pull request may close these issues.

2 participants