Skip to content

[Feature] Add Approximations of Zeros#216

Merged
matthew-mccall merged 10 commits into
open-algebra:masterfrom
JooseMann:feature-newton's-method
Jun 6, 2026
Merged

[Feature] Add Approximations of Zeros#216
matthew-mccall merged 10 commits into
open-algebra:masterfrom
JooseMann:feature-newton's-method

Conversation

@JooseMann

Copy link
Copy Markdown
Contributor

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

JooseMann and others added 10 commits April 28, 2026 13:37
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
@matthew-mccall matthew-mccall requested a review from 404Naz June 6, 2026 20:24
@matthew-mccall matthew-mccall self-assigned this Jun 6, 2026
@matthew-mccall matthew-mccall added the core Related to the OASIS library itself label Jun 6, 2026
@matthew-mccall matthew-mccall merged commit 05cbe70 into open-algebra:master Jun 6, 2026
9 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in OASIS Core Feature Development Jun 6, 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.

3 participants