Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merging of the evaluator and approximator modifiers #49

Closed
JarnaChao09 opened this issue Oct 12, 2022 · 0 comments · Fixed by #52
Closed

Merging of the evaluator and approximator modifiers #49

JarnaChao09 opened this issue Oct 12, 2022 · 0 comments · Fixed by #52
Labels
enhancement New feature or request

Comments

@JarnaChao09
Copy link
Contributor

Reasoning

Having separate steps that specifically handle only symbolic and numerical computation is very limiting. The current plan wouldn't allow for partial evaluation of functions

>>> y = 2
>>> f(x, y) = x ^ 2 + y ^ 2

would return undefined with the current plan for the evaluator and approximator stages.

Proposed solution

Change the behavior of the evaluator to act like both the current evaluator and the approximator, removing the need for an approximator in the first place. The modify function would now return a (Expression, Option<Expression>) where the left value would be the simplest form while the right value would be an approximated form. If both are equal, then the right value would be a None, otherwise, it will hold the approximated value.

This would make the below examples of partial evaluation to become possible

>>> y = 1
>>> z = 1
>>> <x, y, z> dot <2, 2, 2>
(2 * x + 2 * y + 2 * z, Some(2 * x + 4))

>>> y = 2
>>> x ^ 2 + diff(y ^ 2, y)
(x ^ 2 + 2 * y, Some(x ^ 2 + 4))

while also in the long term, allowing for the functionality seen here where the exact form is returned but an approximate form is also given

This method could also allow for multiple fallbacks, such as if an integral is unable to be found symbolically, then the evaluator could fall back onto the approximated form of the integral (through various numeric integration methods such trapezoid, midpoint, simpsons, gauss legendre, gauss konrod, clenshaw curtis) to continue the evaluation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants