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

Square do not evaluate as Multiply by itself #161

Closed lhotejc closed 2 months ago

lhotejc commented 4 months ago

Description

I use the two commands for differents results :

const sqTerm = ce.box(['Square',term]).evaluate().latex // (-\\frac{z}{3})^2
const sqTerm = ce.box(['Multiply', term, term]).evaluate().latex // \\frac{z^2}{9} that's what I want !

Steps to Reproduce

look at this :
https://codepen.io/lhotejc/pen/QWPPGvB

Actual Behavior

['Square', term] is evaluated diffently from ['Multiply', term, term]

Expected Behavior

Need to do the same result, no ?

Environment

Is this a regression: did it use to work in a previous version?

I do not test before.

MathLive version compute-engine 0.24.1

Operating System Linux ubuntu 22.04 LTE Browser Chrome