cortex-js / compute-engine

An engine for symbolic manipulation and numeric evaluation of math formulas expressed with MathJSON
https://cortexjs.io
MIT License
356 stars 42 forks source link

Missing simplifications #174

Closed holgerengels closed 2 months ago

holgerengels commented 2 months ago

Description

Some expected simplifications are not applied

Steps to Reproduce

  1. a^n·a^m = a^{n+m)

ce.parse("e^xe^x").simplify() produces: ["Power","ExponentialE",["Multiply",2,"x"]] .. which is correct

ce.parse("e^{2x}e^x").simplify() produces: ["Multiply",["Power","ExponentialE","x"],["Power","ExponentialE",["Multiply",2,"x"]]] .. which is unexpected expected: ["Power","ExponentialE",["Multiply",3,"x"]]

  1. \frac{a^n}{a^m} = a^{n-m)

ce.parse("\\frac{e^x}{e^x}").simplify() produces: ["Divide",["Power","ExponentialE","x"],["Power","ExponentialE","x"]] .. no simplification takes place expected: "1"

Version: "@cortex-js/compute-engine": "^0.25.0" Operating System Linux 6.8.0-35