I've been using Cortex.js for a project that I'm working on and I've noticed an issue with the handling of non-associative operations, specifically subtraction and division.
When I pass an array like ["Subtract", 24, 10, 3, 3] or ["Divide", 24, 4, 3] using new ComputeEngine().box(expr).evaluate().latex, Cortex.js seems to only consider the first two operands and ignores the rest. For example, ["Subtract", 24, 10, 3, 3] gives as a result 24 - 10, ignoring the 3 and 3.
However, my intention with these expressions is to perform the operations sequentially from left to right, i.e., ((24 - 10) - 3) - 3 for subtraction and (24 / 4) / 3 for division.
I understand that subtraction and division are not associative operations, but it would be helpful if Cortex.js could interpret these expressions in the way I described, at least giving an option to perform this calculation without needing to format a simple operation like ["Divide", 16, 2, 2] to ["Divide", ["Divide", 16, 2], 2].
This behavior is especially confusing because the "Add" operation does handle multiple operands as expected.
Could you please look into this issue? I believe it would make Cortex.js more intuitive and flexible for users performing complex calculations.
Hello,
I've been using Cortex.js for a project that I'm working on and I've noticed an issue with the handling of non-associative operations, specifically subtraction and division.
When I pass an array like
["Subtract", 24, 10, 3, 3]
or["Divide", 24, 4, 3]
usingnew ComputeEngine().box(expr).evaluate().latex
, Cortex.js seems to only consider the first two operands and ignores the rest. For example,["Subtract", 24, 10, 3, 3]
gives as a result24 - 10
, ignoring the3
and3
.However, my intention with these expressions is to perform the operations sequentially from left to right, i.e.,
((24 - 10) - 3) - 3
for subtraction and(24 / 4) / 3
for division.I understand that subtraction and division are not associative operations, but it would be helpful if Cortex.js could interpret these expressions in the way I described, at least giving an option to perform this calculation without needing to format a simple operation like
["Divide", 16, 2, 2]
to["Divide", ["Divide", 16, 2], 2]
. This behavior is especially confusing because the "Add" operation does handle multiple operands as expected.Could you please look into this issue? I believe it would make Cortex.js more intuitive and flexible for users performing complex calculations.
Thank you.