davidedc / Algebrite

Computer Algebra System in Javascript (Typescript)
http://algebrite.org
MIT License
966 stars 59 forks source link

exponent power rule not equivalent for fraction exponents #77

Closed brianmickel closed 5 years ago

brianmickel commented 5 years ago

in: simplify(x^(5/2) - sqrt(x^5)) out: x^(5/2)-(x^5)^(1/2) expected out: 0

in: simplify(8*x^(9/3) - 8*(x^9)^(1/3)) out: 8*(x^3-(x^9)^(1/3)) expected out: 0

davidedc commented 5 years ago

Hi @brianmickel,

  1. in the second example, x^(9/3) is the same as x^3. However, x^3 and (x^9)^(1/3) have different graphs (x^3 is defined and has negative values for x<0, while (x^9)^(1/3) is not defined).

  2. In the first example, you are right I could say the result is 0 but only if I could also add the constraint when x>=0. If x<0 then the subtraction of those two is not zero, but rather is undefined. Since Algebrite can't track that constraint when x>=0, it can't give 0 because that would be incorrect when x<0, hence the expression is left as is. This is indeed a limitation of Algebrite, however I can't let that simplification happen without having a constraint system in place to specify for which values of x that simplification holds, otherwise I get incorrect results in other places

Closing for the time being.