josdejong/mathjs

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

开放

#3,329 创建于 2024年11月29日

 (5 条评论) (0 个反应) (0 位负责人)JavaScript (1,314 个派生)batch import
bughelp wanted

仓库指标

星标
 (15,065 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

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.

贡献者指南