[Feature] Add Approximations of Zeros#216
Merged
matthew-mccall merged 10 commits intoJun 6, 2026
Merged
Conversation
No tests added for this yet. A few header files were also changed to fix small include errors.
Added checks to make sure that the approximation does not get "stuck". It is possible for the approximation to get stuck in a cycle of repeating one or more values, in which case the algorithm fails. Also added a preliminary test case for one of these cases.
Fixed a small logical mistake when calculating the approximation, added a test case to make sure that the general case works.
Tested more general approximation cases with polynomials. Also updated some edge cases in the approximation method.
…camel case. Updated some comments for better clarity with the ApproximateZeros() function. Also changed the variable naming scheme from snake case to camel case, in order to match the rest of the code.
Changed the formatting to be easier to read, also added some comments to clarify test cases
… match preexisting functions Some variable (especially in testing files) had unclear names and/or unnecessary calls to Copy(), these were changed to more direct variable types (mainly Oasis::Real) and changed to have clearer names. Previously, ApproximateZeros() had returned nullptr if it could not find an approximation, so it was changed to return the original function on error to match other functions in the codebase.
Discovered warnings from mistakes that I had previously made. Small mistakes were fixed to remove these warnings
…in `Expression.hpp`.
404Naz
approved these changes
Jun 6, 2026
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 approximating an Expression's zeros. In particular, approximate zeros through Netwon's Method.
This implementation is added to the Expression class, so that any Expression can attempt to have its zeros approximated (especially in the case that zeros can not be found directly).