compute-engine icon indicating copy to clipboard operation
compute-engine copied to clipboard

2x = 5 solves fine, 2x = sqrt(5x) does not report an error or a solution

Open LasseMunk opened this issue 11 months ago • 0 comments

Please follow the template below. If you don't, your issue may be closed without being addressed.

Include code fragments or CodePen.io links to illustrate the issue. Do not include screenshots of code.

....
mathInputSolveFor(value, "x");
....

export const mathInputSolveFor = (mathInput: string, solveFor: string) => {
  const expr = computeEngine.parse(mathInput);
  const solution = expr.solve(solveFor);

  return isType(solution) ? solution.toString() : null;
};   

Actual Result

For 2x = 10, result is working x = 5

for 2x = sqrt(5x) or similar, if I console log solution then it's an empty array and no error is reported in the console

Expected Result

in wolfram alpha: solve for x, 2x = sqrt(5x) output: x = 5/4

Environment

"@cortex-js/compute-engine": "^0.26.4", "mathlive": "^0.101.2", "vue": "^3.5.12",

LasseMunk avatar Dec 04 '24 12:12 LasseMunk