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

Failed derivative mutates the mathematical expression #3094

Closed
sylee957 opened this issue Nov 12, 2023 · 2 comments
Closed

Failed derivative mutates the mathematical expression #3094

sylee957 opened this issue Nov 12, 2023 · 2 comments
Labels

Comments

@sylee957
Copy link
Contributor

sylee957 commented Nov 12, 2023

Describe the bug

If I try-catch the evaluation of derivative, the expression gets unexpected mutation in-place if it fails
I'm using 12.0.0

To Reproduce
Steps to reproduce the behavior.

https://codesandbox.io/s/fast-worker-pnq7lf?file=/src/App.tsx

const expr = math.parse("min(x, y)");
console.log(math.format(expr));
try {
  const dx = math.derivative(expr, "x");
} catch {}
console.log(math.format(expr));
min(x, y) 
min(0, 0)
@josdejong
Copy link
Owner

Thanks for reporting!

Fixed via a1f3b7c (not yet published)

@josdejong
Copy link
Owner

The fix is published now in v12.1.0

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

No branches or pull requests

2 participants