josdejong / josdejong/mathjs

simplify("(x^2)^0.5") should be "abs(x)"

Open
#3,329 5 comments 0 reactions 0 assignees View on GitHub
bug help wanted
Dominant language
JavaScript
Stars
15.1k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

While there are genuine use cases when returning "x" would be better (that's what most humans would expect), strictly speaking it is incorrect.

To reproduce in the mathnotepad:
```
derivative("(x^2)^0.5", "x").evaluate({x:-3})
1

derivative("(x^2)^0.5", "x", {simplify:false}).evaluate({x:-3})
-1
```
Here I evaluate the same derivative at the same point `x=-3` but get two different results.
Same problem for `x^4` and I assume all other even powers.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.