josdejong/mathjs

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

Offen

#3.329 geöffnet am 29.11.2024

 (5 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)JavaScript (1.314 Forks)batch import
bughelp wanted

Repository-Metriken

Stars
 (15.065 Sterne)
PR-Merge-Metriken
 (PR-Metriken ausstehend)

Beschreibung

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