diff --git a/cypress/e2e/DoenetML/assignNames/collections.cy.js b/cypress/e2e/DoenetML/assignNames/collections.cy.js
index 2d5543a464..4ca0a199a9 100644
--- a/cypress/e2e/DoenetML/assignNames/collections.cy.js
+++ b/cypress/e2e/DoenetML/assignNames/collections.cy.js
@@ -3704,262 +3704,262 @@ describe('Collection assignName Tests', function () {
cy.log('Move point all six points again');
cy.window().then(async (win) => {
- await win.callAction1({
+ win.callAction1({
actionName: "movePoint",
componentName: "/q1",
args: { x: -4, y: 6 }
});
- await win.callAction1({
+ win.callAction1({
actionName: "movePoint",
componentName: "/q2",
args: { x: -5, y: 5 }
});
- await win.callAction1({
+ win.callAction1({
actionName: "movePoint",
componentName: "/q3",
args: { x: -6, y: 4 }
});
- await win.callAction1({
+ win.callAction1({
actionName: "movePoint",
componentName: "/q4",
args: { x: -7, y: 3 }
});
- await win.callAction1({
+ win.callAction1({
actionName: "movePoint",
componentName: "/q5",
args: { x: -8, y: 2 }
});
- await win.callAction1({
+ win.callAction1({
actionName: "movePoint",
componentName: "/q6",
args: { x: -9, y: 1 }
});
+ })
- cy.get('#\\/q6 .mjx-mrow').should('contain.text', '(−9,1)')
+ cy.get('#\\/q6 .mjx-mrow').should('contain.text', '(−9,1)')
- cy.get('#\\/p1').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('(−4,6)')
- })
- cy.get('#\\/p2').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('(−5,5)')
- })
- cy.get('#\\/p3').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('(−6,4)')
- })
- cy.get('#\\/p4').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('(−7,3)')
- })
+ cy.get('#\\/p1').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('(−4,6)')
+ })
+ cy.get('#\\/p2').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('(−5,5)')
+ })
+ cy.get('#\\/p3').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('(−6,4)')
+ })
+ cy.get('#\\/p4').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('(−7,3)')
+ })
- cy.get('#\\/p1shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('(−4,6)')
- })
- cy.get('#\\/p2shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('(−5,5)')
- })
- cy.get('#\\/p3shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('(−6,4)')
- })
- cy.get('#\\/p4shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('(−7,3)')
- })
+ cy.get('#\\/p1shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('(−4,6)')
+ })
+ cy.get('#\\/p2shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('(−5,5)')
+ })
+ cy.get('#\\/p3shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('(−6,4)')
+ })
+ cy.get('#\\/p4shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('(−7,3)')
+ })
- cy.get('#\\/q1').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('(−4,6)')
- })
- cy.get('#\\/q2').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('(−5,5)')
- })
- cy.get('#\\/q3').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('(−6,4)')
- })
- cy.get('#\\/q4').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('(−7,3)')
- })
- cy.get('#\\/q5').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('(−8,2)')
- })
- cy.get('#\\/q6').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('(−9,1)')
- })
+ cy.get('#\\/q1').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('(−4,6)')
+ })
+ cy.get('#\\/q2').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('(−5,5)')
+ })
+ cy.get('#\\/q3').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('(−6,4)')
+ })
+ cy.get('#\\/q4').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('(−7,3)')
+ })
+ cy.get('#\\/q5').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('(−8,2)')
+ })
+ cy.get('#\\/q6').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('(−9,1)')
+ })
- cy.get('#\\/q1shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('(−4,6)')
- })
- cy.get('#\\/q2shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('(−5,5)')
- })
- cy.get('#\\/q3shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('(−6,4)')
- })
- cy.get('#\\/q4shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('(−7,3)')
- })
- cy.get('#\\/q5shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('(−8,2)')
- })
- cy.get('#\\/q6shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('(−9,1)')
- })
+ cy.get('#\\/q1shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('(−4,6)')
+ })
+ cy.get('#\\/q2shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('(−5,5)')
+ })
+ cy.get('#\\/q3shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('(−6,4)')
+ })
+ cy.get('#\\/q4shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('(−7,3)')
+ })
+ cy.get('#\\/q5shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('(−8,2)')
+ })
+ cy.get('#\\/q6shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('(−9,1)')
+ })
- cy.get('#\\/x11').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('−4')
- })
- cy.get('#\\/x12').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('−5')
- })
- cy.get('#\\/x13').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('−6')
- })
- cy.get('#\\/x14').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('−7')
- })
- cy.get('#\\/x15').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('−8')
- })
- cy.get('#\\/x16').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('−9')
- })
+ cy.get('#\\/x11').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('−4')
+ })
+ cy.get('#\\/x12').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('−5')
+ })
+ cy.get('#\\/x13').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('−6')
+ })
+ cy.get('#\\/x14').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('−7')
+ })
+ cy.get('#\\/x15').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('−8')
+ })
+ cy.get('#\\/x16').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('−9')
+ })
- cy.get('#\\/x11shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('−4')
- })
- cy.get('#\\/x12shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('−5')
- })
- cy.get('#\\/x13shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('−6')
- })
- cy.get('#\\/x14shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('−7')
- })
- cy.get('#\\/x15shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('−8')
- })
- cy.get('#\\/x16shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('−9')
- })
+ cy.get('#\\/x11shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('−4')
+ })
+ cy.get('#\\/x12shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('−5')
+ })
+ cy.get('#\\/x13shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('−6')
+ })
+ cy.get('#\\/x14shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('−7')
+ })
+ cy.get('#\\/x15shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('−8')
+ })
+ cy.get('#\\/x16shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('−9')
+ })
- cy.get('#\\/x21').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('−4')
- })
- cy.get('#\\/x22').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('−5')
- })
- cy.get('#\\/x23').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('−6')
- })
- cy.get('#\\/x24').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('−7')
- })
+ cy.get('#\\/x21').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('−4')
+ })
+ cy.get('#\\/x22').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('−5')
+ })
+ cy.get('#\\/x23').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('−6')
+ })
+ cy.get('#\\/x24').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('−7')
+ })
- cy.get('#\\/x21shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('−4')
- })
- cy.get('#\\/x22shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('−5')
- })
- cy.get('#\\/x23shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('−6')
- })
- cy.get('#\\/x24shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('−7')
- })
+ cy.get('#\\/x21shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('−4')
+ })
+ cy.get('#\\/x22shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('−5')
+ })
+ cy.get('#\\/x23shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('−6')
+ })
+ cy.get('#\\/x24shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('−7')
+ })
- cy.get('#\\/x31').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('−4')
- })
- cy.get('#\\/x32').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('−5')
- })
- cy.get('#\\/x33').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('−6')
- })
- cy.get('#\\/x34').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('−7')
- })
+ cy.get('#\\/x31').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('−4')
+ })
+ cy.get('#\\/x32').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('−5')
+ })
+ cy.get('#\\/x33').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('−6')
+ })
+ cy.get('#\\/x34').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('−7')
+ })
- cy.get('#\\/x31shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('−4')
- })
- cy.get('#\\/x32shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('−5')
- })
- cy.get('#\\/x33shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('−6')
- })
- cy.get('#\\/x34shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('−7')
- })
+ cy.get('#\\/x31shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('−4')
+ })
+ cy.get('#\\/x32shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('−5')
+ })
+ cy.get('#\\/x33shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('−6')
+ })
+ cy.get('#\\/x34shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('−7')
+ })
- cy.get('#\\/x41').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('−4')
- })
- cy.get('#\\/x42').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('−5')
- })
- cy.get('#\\/x43').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('−6')
- })
- cy.get('#\\/x44').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('−7')
- })
+ cy.get('#\\/x41').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('−4')
+ })
+ cy.get('#\\/x42').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('−5')
+ })
+ cy.get('#\\/x43').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('−6')
+ })
+ cy.get('#\\/x44').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('−7')
+ })
- cy.get('#\\/x41shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('−4')
- })
- cy.get('#\\/x42shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('−5')
- })
- cy.get('#\\/x43shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('−6')
- })
- cy.get('#\\/x44shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('−7')
- })
+ cy.get('#\\/x41shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('−4')
+ })
+ cy.get('#\\/x42shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('−5')
+ })
+ cy.get('#\\/x43shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('−6')
+ })
+ cy.get('#\\/x44shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('−7')
+ })
- cy.get('#\\/x51').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('−4')
- })
- cy.get('#\\/x52').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('−5')
- })
- cy.get('#\\/x53').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('−6')
- })
- cy.get('#\\/x54').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('−7')
- })
- cy.get('#\\/x55').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('−8')
- })
- cy.get('#\\/x56').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('−9')
- })
+ cy.get('#\\/x51').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('−4')
+ })
+ cy.get('#\\/x52').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('−5')
+ })
+ cy.get('#\\/x53').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('−6')
+ })
+ cy.get('#\\/x54').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('−7')
+ })
+ cy.get('#\\/x55').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('−8')
+ })
+ cy.get('#\\/x56').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('−9')
+ })
- cy.get('#\\/x51shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('−4')
- })
- cy.get('#\\/x52shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('−5')
- })
- cy.get('#\\/x53shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('−6')
- })
- cy.get('#\\/x54shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('−7')
- })
- cy.get('#\\/x55shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('−8')
- })
- cy.get('#\\/x56shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
- expect(text.trim()).equal('−9')
- })
+ cy.get('#\\/x51shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('−4')
+ })
+ cy.get('#\\/x52shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('−5')
+ })
+ cy.get('#\\/x53shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('−6')
+ })
+ cy.get('#\\/x54shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('−7')
+ })
+ cy.get('#\\/x55shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('−8')
+ })
+ cy.get('#\\/x56shadow').find('.mjx-mrow').eq(0).invoke('text').then((text) => {
+ expect(text.trim()).equal('−9')
})
cy.log('0 and 3 points, remembers old 3rd value');
diff --git a/cypress/e2e/DoenetML/equality/mathexpressions.cy.js b/cypress/e2e/DoenetML/equality/mathexpressions.cy.js
index b38b1cca2f..900046bc7f 100644
--- a/cypress/e2e/DoenetML/equality/mathexpressions.cy.js
+++ b/cypress/e2e/DoenetML/equality/mathexpressions.cy.js
@@ -1,13 +1,3 @@
-import cssesc from 'cssesc';
-
-function cesc(s) {
- s = cssesc(s, { isIdentifier: true });
- if (s.slice(0, 2) === '\\#') {
- s = s.slice(1);
- }
- return s;
-}
-
describe('Math expressions equality tests', function () {
beforeEach(() => {
@@ -15,491 +5,901 @@ describe('Math expressions equality tests', function () {
cy.visit('/cypressTest')
})
- it('inverse trig', () => {
- cy.window().then(async (win) => {
- win.postMessage({
- doenetML: `
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Prefill with m:
Prefill with m:
Result:
Value: $input1
Raw value: $input1.rawRendererValue
@@ -5784,10 +5784,10 @@ describe('MathInput Tag Tests', function () { cy.get(`#\\/input1 .mq-editable-field`).invoke('text').then((text) => { - expect(text.replace(/[\s\u200B-\u200D\uFEFF]/g, '')).equal('ab∫baf(x)dx') + expect(text.replace(/[\s\u200B-\u200D\uFEFF]/g, '')).equal('ab∫ba^f(x)dx') }) cy.get('#\\/pv1 .mjx-mrow').eq(0).should('have.text', '\uff3f') - cy.get('#\\/pr1').should('have.text', 'Raw value: \\frac{a}{b} \\int_a^b f(x) dx') + cy.get('#\\/pr1').should('have.text', 'Raw value: \\frac{a}{b} \\int_a^b \\hat{f}(x) dx') cy.get(`#\\/input2 .mq-editable-field`).invoke('text').then((text) => { expect(text.replace(/[\s\u200B-\u200D\uFEFF]/g, '')).equal('hellothere(a)(b)') @@ -5806,7 +5806,7 @@ describe('MathInput Tag Tests', function () { let stateVariables = await win.returnAllStateVariables1(); expect(stateVariables['/input1'].stateValues.value).eq('\uff3f'); expect(stateVariables['/input1'].stateValues.immediateValue).eq('\uff3f'); - expect(stateVariables['/input1'].stateValues.rawRendererValue).eq('\\frac{a}{b} \\int_a^b f(x) dx'); + expect(stateVariables['/input1'].stateValues.rawRendererValue).eq('\\frac{a}{b} \\int_a^b \\hat{f}(x) dx'); expect(stateVariables['/input2'].stateValues.value).eqls(["*", "h", "e", "l", "l", "o", "t", "h", "e", "r", "e", "a", "b"]) expect(stateVariables['/input2'].stateValues.immediateValue).eqls(["*", "h", "e", "l", "l", "o", "t", "h", "e", "r", "e", "a", "b"]) expect(stateVariables['/input2'].stateValues.rawRendererValue).eq('hello\\ there (a)(b)'); @@ -5815,19 +5815,19 @@ describe('MathInput Tag Tests', function () { expect(stateVariables['/input3'].stateValues.rawRendererValue).eq('\\text{hello there} (a)(b)'); }) - cy.get("#\\/input1 textarea").type("{ctrl+end}{leftArrow}{leftArrow}{leftArrow}{leftArrow}{leftArrow}{leftArrow}{backspace}{backspace}{backspace}{enter}", { force: true }) + cy.get("#\\/input1 textarea").type("{ctrl+end}{leftArrow}{leftArrow}{leftArrow}{leftArrow}{leftArrow}{leftArrow}{backspace}{backspace}f{enter}", { force: true }) - cy.get('#\\/pv1 .mjx-mrow').should('contain.text', '(ab)af(x)dx') + cy.get('#\\/pv1 .mjx-mrow').should('contain.text', '(ab)∫baf(x)dx') cy.get(`#\\/input1 .mq-editable-field`).invoke('text').then((text) => { - expect(text.replace(/[\s\u200B-\u200D\uFEFF]/g, '')).equal('abaf(x)dx') + expect(text.replace(/[\s\u200B-\u200D\uFEFF]/g, '')).equal('ab∫baf(x)dx') }) - cy.get('#\\/pr1').should('have.text', 'Raw value: \\frac{a}{b}af(x)dx') + cy.get('#\\/pr1').should('have.text', 'Raw value: \\frac{a}{b}\\int_a^bf(x)dx') cy.window().then(async (win) => { let stateVariables = await win.returnAllStateVariables1(); - expect(stateVariables['/input1'].stateValues.value).eqls(["*", ["/", "a", "b"], "a", ["apply", "f", "x"], "d", "x"]) - expect(stateVariables['/input1'].stateValues.immediateValue).eqls(["*", ["/", "a", "b"], "a", ["apply", "f", "x"], "d", "x"]) - expect(stateVariables['/input1'].stateValues.rawRendererValue).eq('\\frac{a}{b}af(x)dx'); + // expect(stateVariables['/input1'].stateValues.value).eqls(["*", ["/", "a", "b"], "a", ["apply", "f", "x"], "d", "x"]) + // expect(stateVariables['/input1'].stateValues.immediateValue).eqls(["*", ["/", "a", "b"], "a", ["apply", "f", "x"], "d", "x"]) + expect(stateVariables['/input1'].stateValues.rawRendererValue).eq('\\frac{a}{b}\\int_a^bf(x)dx'); }) cy.get("#\\/input2 textarea").type("{ctrl+end}{leftArrow}{leftArrow}{leftArrow}{leftArrow}{leftArrow}{leftArrow}{backspace}{backspace}{backspace}{backspace}{backspace}{backspace}{enter}", { force: true }) @@ -7557,13 +7557,13 @@ describe('MathInput Tag Tests', function () { cy.get('#\\/mi2 textarea').type("{end}{shift+home}{backspace}$45.23{enter}", { force: true }); cy.get('#\\/mi3 textarea').type("{end}{shift+home}{backspace}$45.23{enter}", { force: true }); - cy.get('#\\/m1 .mjx-mrow').should('contain.text', '\uff3f') + cy.get('#\\/m1 .mjx-mrow').should('contain.text', '$45.23') cy.get('#\\/m2 .mjx-mrow').should('contain.text', '45.23') cy.get('#\\/m3 .mjx-mrow').should('contain.text', '45.23') cy.window().then(async (win) => { let stateVariables = await win.returnAllStateVariables1(); - expect(stateVariables["/mi1"].stateValues.value).eq('\uff3f') + expect(stateVariables["/mi1"].stateValues.value).eqls(['unit', '$', 45.23]) expect(stateVariables["/mi2"].stateValues.value).eq(45.23) expect(stateVariables["/mi3"].stateValues.value).eq(45.23) }); @@ -7573,13 +7573,13 @@ describe('MathInput Tag Tests', function () { cy.get('#\\/mi2 textarea').type("{end}{shift+home}{backspace}78%{enter}", { force: true }); cy.get('#\\/mi3 textarea').type("{end}{shift+home}{backspace}78%{enter}", { force: true }); - cy.get('#\\/m1 .mjx-mrow').should('contain.text', '\uff3f') + cy.get('#\\/m1 .mjx-mrow').should('contain.text', '78%') cy.get('#\\/m2 .mjx-mrow').should('contain.text', '78') cy.get('#\\/m3 .mjx-mrow').should('contain.text', '78') cy.window().then(async (win) => { let stateVariables = await win.returnAllStateVariables1(); - expect(stateVariables["/mi1"].stateValues.value).eq('\uff3f') + expect(stateVariables["/mi1"].stateValues.value).eqls(['unit', 78, '%']) expect(stateVariables["/mi2"].stateValues.value).eq(78) expect(stateVariables["/mi3"].stateValues.value).eq(78) }); @@ -7588,13 +7588,13 @@ describe('MathInput Tag Tests', function () { cy.get('#\\/mi2 textarea').type(`{end}{shift+home}{backspace}$34,000%dx{enter}`, { force: true }); cy.get('#\\/mi3 textarea').type(`{end}{shift+home}{backspace}$34,000%dx{enter}`, { force: true }); - cy.get('#\\/m1 .mjx-mrow').should('contain.text', '\uff3f') + cy.get('#\\/m1 .mjx-mrow').should('contain.text', '$(34000%)dx') cy.get('#\\/m2 .mjx-mrow').should('contain.text', '34,0dx') cy.get('#\\/m3 .mjx-mrow').should('contain.text', '34000') cy.window().then(async (win) => { let stateVariables = await win.returnAllStateVariables1(); - expect(stateVariables["/mi1"].stateValues.value).eq('\uff3f') + expect(stateVariables["/mi1"].stateValues.value).eqls(['unit', '$', ['*', ['unit', 34000, '%'], "d", "x"]]) expect(stateVariables["/mi2"].stateValues.value).eqls(["list", 34, ["*", 0, "d", "x"]]) expect(stateVariables["/mi3"].stateValues.value).eq(34000) }); diff --git a/cypress/e2e/DoenetML/tagSpecific/mathoperators.cy.js b/cypress/e2e/DoenetML/tagSpecific/mathoperators.cy.js index bb9f85a92e..cd886c6abe 100644 --- a/cypress/e2e/DoenetML/tagSpecific/mathoperators.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/mathoperators.cy.js @@ -2071,10 +2071,10 @@ describe('Math Operator Tag Tests', function () { expect(text.trim()).equal('1') }); cy.get('#\\/_floor4').find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('floor(2.1x)') + expect(text.trim()).equal('⌊2.1x⌋') }); cy.get('#\\/_ceil4').find('.mjx-mrow').eq(0).invoke('text').then((text) => { - expect(text.trim()).equal('ceil(−3.2y)') + expect(text.trim()).equal('⌈−3.2y⌉') }); cy.window().then(async (win) => { diff --git a/cypress/e2e/DoenetML/tagSpecific/selectrandomnumbers.cy.js b/cypress/e2e/DoenetML/tagSpecific/selectrandomnumbers.cy.js index 9c8af532df..c746d34fab 100644 --- a/cypress/e2e/DoenetML/tagSpecific/selectrandomnumbers.cy.js +++ b/cypress/e2e/DoenetML/tagSpecific/selectrandomnumbers.cy.js @@ -47,7 +47,7 @@ describe('SelectRandomNumbers Tag Tests', function () { let varX = me.math.variance(samples, 'uncorrected'); expect(meanX).closeTo(0.5, 0.05); - expect(varX).closeTo(1 / 12, 0.005) + expect(varX).closeTo(1 / 12, 0.02) let firstSelect = stateVariables[stateVariables[stateVariables["/_map1"].replacements[0].componentName].replacements[0].componentName] expect(firstSelect.stateValues.mean).closeTo(0.5, 1E-10) @@ -102,7 +102,7 @@ describe('SelectRandomNumbers Tag Tests', function () { let varX = me.math.variance(samples, 'uncorrected'); expect(meanX).closeTo(4, 0.5); - expect(varX).closeTo(8 ** 2 / 12, 0.5) + expect(varX).closeTo(8 ** 2 / 12, 1) let firstSelect = stateVariables[stateVariables[stateVariables["/_map1"].replacements[0].componentName].replacements[0].componentName] expect(firstSelect.stateValues.mean).closeTo(4, 1E-10) @@ -156,7 +156,7 @@ describe('SelectRandomNumbers Tag Tests', function () { let varX = me.math.variance(samples, 'uncorrected'); expect(meanX).closeTo(-4.5, 0.05); - expect(varX).closeTo(1 / 12, 0.01) + expect(varX).closeTo(1 / 12, 0.02) let firstSelect = stateVariables[stateVariables[stateVariables["/_map1"].replacements[0].componentName].replacements[0].componentName] expect(firstSelect.stateValues.mean).closeTo(-4.5, 1E-10) @@ -312,7 +312,7 @@ describe('SelectRandomNumbers Tag Tests', function () { let meanX = me.math.mean(samples); let varX = me.math.variance(samples, 'uncorrected'); - expect(meanX).closeTo(0, 0.1); + expect(meanX).closeTo(0, 0.2); expect(varX).closeTo(1, 0.2) let firstSelect = stateVariables[stateVariables[stateVariables["/_map1"].replacements[0].componentName].replacements[0].componentName] @@ -1467,7 +1467,7 @@ describe('SelectRandomNumbers Tag Tests', function () { cy.get('#\\/_text1').should('have.text', 'a') //wait for page to load - + cy.window().then(async (win) => { let stateVariables = await win.returnAllStateVariables1(); @@ -1476,15 +1476,15 @@ describe('SelectRandomNumbers Tag Tests', function () { let n3 = stateVariables["/n3"].stateValues.value; let n4 = stateVariables["/n4"].stateValues.value; - cy.get('#\\/n1').should('have.text', String(Math.round(n1*10**8)/10**8)) - cy.get('#\\/n2').should('have.text', String(Math.round(n2*10**1)/10**1)) - cy.get('#\\/n3').should('have.text', String(Math.round(n3*10**3)/10**3)) - cy.get('#\\/n4').should('have.text', String(n4)+".0") + cy.get('#\\/n1').should('have.text', String(Math.round(n1 * 10 ** 8) / 10 ** 8)) + cy.get('#\\/n2').should('have.text', String(Math.round(n2 * 10 ** 1) / 10 ** 1)) + cy.get('#\\/n3').should('have.text', String(Math.round(n3 * 10 ** 3) / 10 ** 3)) + cy.get('#\\/n4').should('have.text', String(n4) + ".0") - cy.get('#\\/n1a').should('have.text', String(Math.round(n1*10**8)/10**8)) - cy.get('#\\/n2a').should('have.text', String(Math.round(n2*10**1)/10**1)) - cy.get('#\\/n3a').should('have.text', String(Math.round(n3*10**3)/10**3)) - cy.get('#\\/n4a').should('have.text', String(n4)+".0") + cy.get('#\\/n1a').should('have.text', String(Math.round(n1 * 10 ** 8) / 10 ** 8)) + cy.get('#\\/n2a').should('have.text', String(Math.round(n2 * 10 ** 1) / 10 ** 1)) + cy.get('#\\/n3a').should('have.text', String(Math.round(n3 * 10 ** 3) / 10 ** 3)) + cy.get('#\\/n4a').should('have.text', String(n4) + ".0") }); diff --git a/src/Core/Core.js b/src/Core/Core.js index fadbe3f8c8..2278fbabc4 100644 --- a/src/Core/Core.js +++ b/src/Core/Core.js @@ -4801,13 +4801,19 @@ export default class Core { args.dependencyNamesByKey = stateVarObj.dependencyNames.namesByKey; // only include array keys that exist + // unless given a Javascript array let newDesiredStateVariableValues = {}; for (let vName in args.desiredStateVariableValues) { - newDesiredStateVariableValues[vName] = {} - for (let key in args.desiredStateVariableValues[vName]) { - if (args.arrayKeys.includes(key)) { - newDesiredStateVariableValues[vName][key] = args.desiredStateVariableValues[vName][key]; + if (Array.isArray(args.desiredStateVariableValues[vName])) { + newDesiredStateVariableValues[vName] = args.desiredStateVariableValues[vName]; + } else { + newDesiredStateVariableValues[vName] = {} + + for (let key in args.desiredStateVariableValues[vName]) { + if (args.arrayKeys.includes(key)) { + newDesiredStateVariableValues[vName][key] = args.desiredStateVariableValues[vName][key]; + } } } } @@ -8470,11 +8476,6 @@ export default class Core { await this.processStateVariableTriggers(); - // it is possible that components were added back to componentNamesToUpdateRenderers - // while processing the renderer instructions - // so delete any names that were just addressed - componentNamesToUpdate.forEach(cName => this.updateInfo.componentsToUpdateRenderers.delete(cName)); - // TODO: when should we actually warn of unmatchedChildren // It shouldn't be just on update, but also on initial construction! // Also, should be more than a console.warn @@ -9355,7 +9356,7 @@ export default class Core { } } } else { - if (depStateVarObj.nDimensions === 1) { + if (depStateVarObj.nDimensions === 1 || !Array.isArray(newInstruction.desiredValue)) { Object.assign(arrayInstructionInProgress.desiredValue, newInstruction.desiredValue); } else { // need to convert multidimensional array (newInstruction.desiredValue) diff --git a/src/Core/components/Math.js b/src/Core/components/Math.js index b7b13c6944..8d0c265e80 100644 --- a/src/Core/components/Math.js +++ b/src/Core/components/Math.js @@ -2134,7 +2134,10 @@ function calculateExpressionWithCodes({ dependencyValues, changes }) { // if don't have any string or math children, // set expressionWithCodes to be null, // which will indicate that value should use valueShadow - return { setValue: { expressionWithCodes: null } } + return { + setValue: { expressionWithCodes: null }, + setEssentialValue: { expressionWithCodes: null } + } } } diff --git a/src/Core/components/Point.js b/src/Core/components/Point.js index 094fea22e4..18e57822ed 100644 --- a/src/Core/components/Point.js +++ b/src/Core/components/Point.js @@ -12,6 +12,7 @@ export default class Point extends GraphicalComponent { movePoint: this.movePoint.bind(this), switchPoint: this.switchPoint.bind(this), pointClicked: this.pointClicked.bind(this), + mouseDownOnPoint: this.mouseDownOnPoint.bind(this), }); } diff --git a/src/Core/utils/booleanLogic.js b/src/Core/utils/booleanLogic.js index c1cd72f81e..55b85d1cc6 100644 --- a/src/Core/utils/booleanLogic.js +++ b/src/Core/utils/booleanLogic.js @@ -816,19 +816,11 @@ export function splitSymbolsIfMath({ logicTree, nonMathCodes, foundNonMath = fal let operands = logicTree.slice(1); if (["and", "not", "or"].includes(operator)) { - if (operator === "apply") { - return [operator, operands[0], ...operands.slice(1).map(x => splitSymbolsIfMath({ - logicTree: x, - nonMathCodes, foundNonMath, - init - }))] - } else { - return [operator, ...operands.map(x => splitSymbolsIfMath({ - logicTree: x, - nonMathCodes, foundNonMath, - init - }))] - } + return [operator, ...operands.map(x => splitSymbolsIfMath({ + logicTree: x, + nonMathCodes, foundNonMath, + init + }))] } if (operands.some(x => nonMathCodes.includes(x))) { @@ -836,11 +828,58 @@ export function splitSymbolsIfMath({ logicTree, nonMathCodes, foundNonMath = fal } if (operator === "apply") { - return [operator, operands[0], ...operands.slice(1).map(x => splitSymbolsIfMath({ + + operands = [operands[0], ...operands.slice(1).map(x => splitSymbolsIfMath({ logicTree: x, nonMathCodes, foundNonMath, init: false - }))] + }))]; + + // look for int + let foundInt = false; + if (operands[0] === "int") { + foundInt = true; + } else if (Array.isArray(operands[0])) { + if (operands[0][0] === "^") { + if (operands[0][1] === "int") { + foundInt = true; + } else if (Array.isArray(operands[0][1])) { + if (operands[0][1][0] === "_" && operands[0][1][1] === "int") { + foundInt = true; + } + } + } else if (operands[0][0] === "_") { + if (operands[0][1] === "int") { + foundInt = true; + } + } + } + + if (foundInt) { + + + // round trip from tree -> math-expression -> tree to flatten tree + operands = me.fromAst([operator, ...operands]).tree.slice(1); + + let integrand = operands[1]; + if (Array.isArray(integrand) && integrand[0] === "*") { + // look for consecutive factors of "d" followed by a string + + let ds = []; + for (let i = 0; i < integrand.length - 1; i++) { + let factor1 = integrand[i]; + if (factor1 === "d") { + let factor2 = integrand[i + 1]; + integrand.splice(i, 2); + ds.push(["d", factor2]); + i--; + } + } + integrand.push(...ds); + + } + } + return [operator, ...operands]; } else if (operator === "angle") { let newOperands = []; for (let op of operands) { diff --git a/src/Core/utils/checkEquality.js b/src/Core/utils/checkEquality.js index 3c197dd67b..1fd4ff8bb2 100644 --- a/src/Core/utils/checkEquality.js +++ b/src/Core/utils/checkEquality.js @@ -76,7 +76,7 @@ export default function checkEquality({ } } - let normalize = function (x) { + let normalize = function (x, forNumeric = false) { if (!(x instanceof me.class)) { x = me.fromAst(x); } @@ -87,20 +87,26 @@ export default function checkEquality({ x = me.fromAst(setStringsInTreeToLowerCase(x.tree)); } - if (simplify === "none") { + let effectiveSimplify = simplify, effectiveExpand = expand; + if (forNumeric) { + effectiveSimplify = "full"; + effectiveExpand = true; + } + + if (effectiveSimplify === "none") { if (allowedErrorInNumbers > 0) { // only if allowing rounding, do we replace constants with floats x = x.constants_to_floats(); } - } else if (simplify === "numberspreserveorder") { + } else if (effectiveSimplify === "numberspreserveorder") { x = x.evaluate_numbers({ max_digits: Infinity, skip_ordering: true }); - } else if (simplify === "number") { + } else if (effectiveSimplify === "number") { x = x.evaluate_numbers({ max_digits: Infinity }); } else { x = x.evaluate_numbers({ max_digits: Infinity, evaluate_functions: true }); } return normalizeMathExpression({ - value: x, simplify: simplify, expand: expand + value: x, simplify: effectiveSimplify, expand: effectiveExpand }); } @@ -110,8 +116,14 @@ export default function checkEquality({ if (symbolicEquality) { check_equality = function (a, b) { - let expr_a = normalize(a); - let expr_b = normalize(b); + let expr_a = a; + let expr_b = b; + if (!(a instanceof me.class)) { + expr_a = me.fromAst(a); + } + if (!(b instanceof me.class)) { + expr_b = me.fromAst(b); + } if (nSignErrorsMatched > 0) { // We have to make a deep copy @@ -262,6 +274,11 @@ export default function checkEquality({ let matchByExactPositionsOnRecursion = false; if (haveMathExpressions) { + + // normalize at the beginning so that expand vectors, etc. + object1 = normalize(object1, !symbolicEquality); + object2 = normalize(object2, !symbolicEquality); + // if can convert same type of math-expression // change object1 and object2 to array of asts // otherwise return that are unequal diff --git a/src/Core/utils/copy.js b/src/Core/utils/copy.js index 3d39aa34a7..44f19fc1e6 100644 --- a/src/Core/utils/copy.js +++ b/src/Core/utils/copy.js @@ -64,7 +64,7 @@ export function postProcessCopy({ serializedComponents, componentName, if (init) { downDep[component.originalName][0].firstLevelReplacement = true; } - if(markAsPrimaryShadow) { + if (markAsPrimaryShadow) { downDep[component.originalName][0].isPrimaryShadow = true; } if (component.state) { @@ -401,7 +401,7 @@ export async function verifyReplacementsMatchSpecifiedType({ component, // if the only discrepancy is the components are the wrong type, // with number of sources matching the number of components - // then wrap that each replacement with a blank component we are creating, + // then wrap each replacement with a blank component we are creating, // i.e., add each current replacement as the child of a new component let wrapExistingReplacements = replacementTypes.length === requiredLength @@ -410,8 +410,21 @@ export async function verifyReplacementsMatchSpecifiedType({ component, // let uniqueIdentifiersUsed; let originalReplacements; + if (wrapExistingReplacements && replacementChanges) { + // if we have replacement changes, we can wrap only if we are replacing all components + // in a single add + if (replacementChanges.length === 1 && replacementChanges[0].numberReplacementsToReplace === requiredLength) { + originalReplacements = replacementChanges[0].serializedReplacements; + } else { + wrapExistingReplacements = false; + } + } + + if (wrapExistingReplacements) { - originalReplacements = replacements; + if (!originalReplacements) { + originalReplacements = replacements; + } } else { // since clearing out all replacements, reset all workspace variables workspace.numReplacementsBySource = []; diff --git a/src/Viewer/core.js b/src/Viewer/core.js index 734803379d..c6e137980a 100644 --- a/src/Viewer/core.js +++ b/src/Viewer/core.js @@ -1,111 +1,588 @@ -var Core=function(){"use strict";class ParameterStack{constructor(e){this.stack=[{}],void 0!==e&&Object.assign(this.parameters,e)}get parameters(){return this.stack[this.stack.length-1]}push(e,t=!0){let n={};t?(Object.assign(n,this.parameters),void 0!==e&&Object.assign(n,e)):n=e,this.stack.push(n)}pop(){let e=this.stack.pop();return 0===this.stack.length&&(this.stack=[{}]),e}}class Numerics{constructor({maxIterationsRoot:e=80,maxIterationsMinimize:t=500,eps:n=1e-6}={}){this.maxIterationsRoot=e,this.maxIterationsMinimize=t,this.eps=n}fzero(e,t,n){var r,a,i,o,s,l,u,c,p,d,m,f,h,y,b,g,v,T,N,C,A=this.eps,S=this.maxIterationsRoot,x=0;if(Array.isArray(t)){if(t.length<2)throw new Error("fzero: length of array x0 has to be at least two.");r=t[0],o=e.call(n,r),a=t[1],s=e.call(n,a)}else{for(r=t,o=e.call(n,r),d=(c=[.9*(u=0===r?1:r),1.1*u,u-1,u+1,.5*u,1.5*u,-u,2*u,-10*u,10*u]).length,p=0;p1)if(16==t||8==t){for(u=16==t?4:3,--p;p%u;p++)m+="0";for(p=(f=$(m,i,t)).length;!f[p-1];--p);for(u=1,m="1.";u
p)for(o-=p;o--;)m+="0";else o
t)return e.length=t,!0}function Q(e){return new this(e).abs()}function ee(e){return new this(e).acos()}function te(e){return new this(e).acosh()}function ne(e,t){return new this(e).plus(t)}function re(e){return new this(e).asin()}function ae(e){return new this(e).asinh()}function ie(e){return new this(e).atan()}function oe(e){return new this(e).atanh()}function se(e,t){e=new this(e),t=new this(t);var n,r=this.precision,a=this.rounding,i=r+4;return e.s&&t.s?e.d||t.d?!t.d||e.isZero()?(n=t.s<0?M(this,r,a):new this(0)).s=e.s:!e.d||t.isZero()?(n=M(this,i,1).times(.5)).s=e.s:t.s<0?(this.precision=i,this.rounding=1,n=this.atan(D(e,t,i,1)),t=M(this,i,1),this.precision=r,this.rounding=a,n=e.s<0?n.minus(t):n.plus(t)):n=this.atan(D(e,t,i,1)):(n=M(this,i,1).times(t.s>0?.25:.75)).s=e.s:n=new this(NaN),n}function le(e){return new this(e).cbrt()}function ue(e){return I(e=new this(e),e.e+1,2)}function ce(e,t,n){return new this(e).clamp(t,n)}function pe(e){if(!e||"object"!=typeof e)throw Error(m+"Object expected");var t,n,r,a=!0===e.defaults,i=["precision",1,s,"rounding",0,8,"toExpNeg",-o,0,"toExpPos",0,o,"maxE",0,o,"minE",-o,0,"modulo",0,9];for(t=0;t new s({data:e.map((e=>[e])),size:[c,1]})))}})),name$2A="usolveAll",dependencies$2A=["typed","matrix","divideScalar","multiplyScalar","subtract","equalScalar","DenseMatrix"],createUsolveAll=factory(name$2A,dependencies$2A,(e=>{var{typed:t,matrix:n,divideScalar:r,multiplyScalar:a,subtract:i,equalScalar:o,DenseMatrix:s}=e,l=createSolveValidation({DenseMatrix:s});return t(name$2A,{"SparseMatrix, Array | Matrix":function(e,t){return function(e,t){for(var n=[l(e,t,!0)._data.map((e=>e[0]))],u=e._size[0],c=e._size[1],p=e._values,d=e._index,m=e._ptr,f=c-1;f>=0;f--)for(var h=n.length,y=0;y0;)u++,l--;var c=a.slice(u).join(""),p=isNumber$1(t)&&c.length||c.match(/[1-9]/)?"."+c:"",d=a.slice(0,u).join("")+p+"e"+(r>=0?"+":"")+i.toString();return n.sign+d}function toFixed$2(e,t){if(isNaN(e)||!isFinite(e))return String(e);var n=splitNumber(e),r="number"==typeof t?roundDigits(n,n.exponent+1+t):n,a=r.coefficients,i=r.exponent+1,s=i+(t||0);return a.length0?"."+a.join(""):"")+"e"+(i>=0?"+":"")+i}function toPrecision(e,t,n){if(isNaN(e)||!isFinite(e))return String(e);var r=n&&void 0!==n.lowerExp?n.lowerExp:-3,a=n&&void 0!==n.upperExp?n.upperExp:5,i=splitNumber(e),s=t?roundDigits(i,t):i;if(s.exponent=0?"+":"")+r.toString()}function toExponential(e,t){return void 0!==t?e.toExponential(t-1):e.toExponential()}function toFixed$1(e,t){return e.toFixed(t)}function endsWith(e,t){var n=e.length-t.length,r=e.length;return e.substring(n,r)===t}function format$1(e,t){var n=_format(e,t);return t&&"object"==typeof t&&"truncate"in t&&n.length>t.truncate?n.substring(0,t.truncate-3)+"...":n}function _format(e,t){return"number"==typeof e?format$3(e,t):isBigNumber(e)?format$2(e,t):looksLikeFraction(e)?t&&"decimal"===t.fraction?e.toString():e.s*e.n+"/"+e.d:Array.isArray(e)?formatArray(e,t):isString$1(e)?'"'+e+'"':"function"==typeof e?e.syntax?String(e.syntax):"function":e&&"object"==typeof e?"function"==typeof e.format?e.format(t):e&&e.toString(t)!=={}.toString()?e.toString(t):"{"+Object.keys(e).map((n=>'"'+n+'": '+format$1(e[n],t))).join(", ")+"}":String(e)}function stringify(e){for(var t=String(e),n="",r=0;rt.test(e)))}function join(e,t){return Array.prototype.join.call(e,t)}function identify(e){if(!Array.isArray(e))throw new TypeError("Array input expected");if(0===e.length)return e;var t=[],n=0;t[0]={value:e[0],identifier:0};for(var r=1;r0;--r)u[s++]=0;for(r=d.length;r>i;){if(u[--r]0&&(a+1===s&&(i+="."),i+=getZeroString(r))),i}function getBase10Exponent(e,t){var n=e[0];for(t*=LOG_BASE;n>=10;n/=10)t++;return t}function getLn10(e,t,n){if(t>LN10_PRECISION)throw external=!0,n&&(e.precision=n),Error(precisionLimitExceeded);return finalise(new e(LN10$1),t,1,!0)}function getPi(e,t,n){if(t>PI_PRECISION)throw Error(precisionLimitExceeded);return finalise(new e(PI),t,n,!0)}function getPrecision(e){var t=e.length-1,n=t*LOG_BASE+1;if(t=e[t]){for(;t%10==0;t/=10)n--;for(t=e[0];t>=10;t/=10)n++}return n}function getZeroString(e){for(var t="";e--;)t+="0";return t}function intPow(e,t,n,r){var a,i=new e(1),s=Math.ceil(r/LOG_BASE+4);for(external=!1;;){if(n%2&&truncate((i=i.times(t)).d,s)&&(a=!0),0===(n=mathfloor(n/2))){n=i.d.length-1,a&&0===i.d[n]&&++i.d[n];break}truncate((t=t.times(t)).d,s)}return external=!0,i}function isOdd(e){return 1&e.d[e.d.length-1]}function maxOrMin(e,t,n){for(var r,a=new e(t[0]),i=0;++it.re?1:e.res-1||o>p-1)&&(c(this,Math.max(i+1,s),Math.max(o+1,p),a),s=this._size[0],p=this._size[1]),validateIndex(i,s),validateIndex(o,p);var f=l(i,this._ptr[o],this._ptr[o+1],this._index);return fu)break}return l}throw new RangeError("Matrix must be square (size: "+format$1(i)+")")},DenseMatrix:a,any:clone$2});function a(e){var t=e._size,n=e._data;switch(t.length){case 1:if(1===t[0])return clone$2(n[0]);throw new RangeError("Matrix must be square (size: "+format$1(t)+")");case 2:var a=t[0];if(a===t[1]){for(var i=0,o=0;o{var{typed:t,Index:n}=e;return t(name$1v,{"...number | string | BigNumber | Range | Array | Matrix":function(e){var t=e.map((function(e){return isBigNumber(e)?e.toNumber():Array.isArray(e)||isMatrix(e)?e.map((function(e){return isBigNumber(e)?e.toNumber():e})):e})),r=new n;return n.apply(r,t),r}})})),keywords=new Set(["end"]),name$1u="Node",dependencies$1u=["mathWithTransform"],createNode=factory(name$1u,dependencies$1u,(e=>{var{mathWithTransform:t}=e;function n(){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator")}return n.prototype.evaluate=function(e){return this.compile().evaluate(e)},n.prototype.type="Node",n.prototype.isNode=!0,n.prototype.comment="",n.prototype.compile=function(){var e=this._compile(t,{}),n={};return{evaluate:function(t){var r=createMap$1(t);return function(e){for(var t of[...keywords])if(e.has(t))throw new Error('Scope contains an illegal symbol, "'+t+'" is a reserved keyword')}(r),e(r,n,null)}}},n.prototype._compile=function(e,t){throw new Error("Method _compile should be implemented by type "+this.type)},n.prototype.forEach=function(e){throw new Error("Cannot run forEach on a Node interface")},n.prototype.map=function(e){throw new Error("Cannot run map on a Node interface")},n.prototype._ifNode=function(e){if(!isNode(e))throw new TypeError("Callback function must return a Node");return e},n.prototype.traverse=function(e){e(this,null,null),function e(t,n){t.forEach((function(t,r,a){n(t,r,a),e(t,n)}))}(this,e)},n.prototype.transform=function(e){return function t(n,r,a){var i=e(n,r,a);return i!==n?i:n.map(t)}(this,null,null)},n.prototype.filter=function(e){var t=[];return this.traverse((function(n,r,a){e(n,r,a)&&t.push(n)})),t},n.prototype.clone=function(){throw new Error("Cannot clone a Node interface")},n.prototype.cloneDeep=function(){return this.map((function(e){return e.cloneDeep()}))},n.prototype.equals=function(e){return!!e&&deepStrictEqual(this,e)},n.prototype.toString=function(e){var t=this._getCustomString(e);return void 0!==t?t:this._toString(e)},n.prototype.toJSON=function(){throw new Error("Cannot serialize object: toJSON not implemented by "+this.type)},n.prototype.toHTML=function(e){var t=this._getCustomString(e);return void 0!==t?t:this.toHTML(e)},n.prototype._toString=function(){throw new Error("_toString not implemented for "+this.type)},n.prototype.toTex=function(e){var t=this._getCustomString(e);return void 0!==t?t:this._toTex(e)},n.prototype._toTex=function(e){throw new Error("_toTex not implemented for "+this.type)},n.prototype._getCustomString=function(e){if(e&&"object"==typeof e)switch(typeof e.handler){case"object":case"undefined":return;case"function":return e.handler(this,e);default:throw new TypeError("Object or function expected as callback")}},n.prototype.getIdentifier=function(){return this.type},n.prototype.getContent=function(){return this},n}),{isClass:!0,isNode:!0});function errorTransform(e){return e&&e.isIndexError?new IndexError(e.index+1,e.min+1,void 0!==e.max?e.max+1:void 0):e}function accessFactory(e){var{subset:t}=e;return function(e,n){try{if(Array.isArray(e))return t(e,n);if(e&&"function"==typeof e.subset)return e.subset(n);if("string"==typeof e)return t(e,n);if("object"==typeof e){if(!n.isObjectProperty())throw new TypeError("Cannot apply a numeric index as object property");return getSafeProperty(e,n.getObjectProperty())}throw new TypeError("Cannot apply index: unsupported type of object")}catch(e){throw errorTransform(e)}}}var name$1t="AccessorNode",dependencies$1t=["subset","Node"],createAccessorNode=factory(name$1t,dependencies$1t,(e=>{var{subset:t,Node:n}=e,r=accessFactory({subset:t});function a(e,t){if(!(this instanceof a))throw new SyntaxError("Constructor must be called with the new operator");if(!isNode(e))throw new TypeError('Node expected for parameter "object"');if(!isIndexNode(t))throw new TypeError('IndexNode expected for parameter "index"');this.object=e||null,this.index=t,Object.defineProperty(this,"name",{get:function(){return this.index?this.index.isObjectProperty()?this.index.getObjectProperty():"":this.object.name||""}.bind(this),set:function(){throw new Error("Cannot assign a new name, name is read-only")}})}function i(e){return!(isAccessorNode(e)||isArrayNode(e)||isConstantNode(e)||isFunctionNode(e)||isObjectNode(e)||isParenthesisNode(e)||isSymbolNode(e))}return a.prototype=new n,a.prototype.type="AccessorNode",a.prototype.isAccessorNode=!0,a.prototype._compile=function(e,t){var n=this.object._compile(e,t),a=this.index._compile(e,t);if(this.index.isObjectProperty()){var i=this.index.getObjectProperty();return function(e,t,r){return getSafeProperty(n(e,t,r),i)}}return function(e,t,i){var o=n(e,t,i),s=a(e,t,o);return r(o,s)}},a.prototype.forEach=function(e){e(this.object,"object",this),e(this.index,"index",this)},a.prototype.map=function(e){return new a(this._ifNode(e(this.object,"object",this)),this._ifNode(e(this.index,"index",this)))},a.prototype.clone=function(){return new a(this.object,this.index)},a.prototype._toString=function(e){var t=this.object.toString(e);return i(this.object)&&(t="("+t+")"),t+this.index.toString(e)},a.prototype.toHTML=function(e){var t=this.object.toHTML(e);return i(this.object)&&(t='('+t+')'),t+this.index.toHTML(e)},a.prototype._toTex=function(e){var t=this.object.toTex(e);return i(this.object)&&(t="\\left(' + object + '\\right)"),t+this.index.toTex(e)},a.prototype.toJSON=function(){return{mathjs:"AccessorNode",object:this.object,index:this.index}},a.fromJSON=function(e){return new a(e.object,e.index)},a}),{isClass:!0,isNode:!0}),name$1s="ArrayNode",dependencies$1s=["Node"],createArrayNode=factory(name$1s,dependencies$1s,(e=>{var{Node:t}=e;function n(e){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(this.items=e||[],!Array.isArray(this.items)||!this.items.every(isNode))throw new TypeError("Array containing Nodes expected")}return n.prototype=new t,n.prototype.type="ArrayNode",n.prototype.isArrayNode=!0,n.prototype._compile=function(e,t){var n=map$2(this.items,(function(n){return n._compile(e,t)}));if("Array"!==e.config.matrix){var r=e.matrix;return function(e,t,a){return r(map$2(n,(function(n){return n(e,t,a)})))}}return function(e,t,r){return map$2(n,(function(n){return n(e,t,r)}))}},n.prototype.forEach=function(e){for(var t=0;t
')},r.prototype._toTex=function(e){return this.blocks.map((function(t){return t.node.toTex(e)+(t.visible?"":";")})).join("\\;\\;\n")},r}),{isClass:!0,isNode:!0}),name$1p="ConditionalNode",dependencies$1p=["Node"],createConditionalNode=factory(name$1p,dependencies$1p,(e=>{var{Node:t}=e;function n(e,t,r){if(!(this instanceof n))throw new SyntaxError("Constructor must be called with the new operator");if(!isNode(e))throw new TypeError("Parameter condition must be a Node");if(!isNode(t))throw new TypeError("Parameter trueExpr must be a Node");if(!isNode(r))throw new TypeError("Parameter falseExpr must be a Node");this.condition=e,this.trueExpr=t,this.falseExpr=r}return n.prototype=new t,n.prototype.type="ConditionalNode",n.prototype.isConditionalNode=!0,n.prototype._compile=function(e,t){var n=this.condition._compile(e,t),r=this.trueExpr._compile(e,t),a=this.falseExpr._compile(e,t);return function(e,t,i){return function(e){if("number"==typeof e||"boolean"==typeof e||"string"==typeof e)return!!e;if(e){if(isBigNumber(e))return!e.isZero();if(isComplex(e))return!(!e.re&&!e.im);if(isUnit(e))return!!e.value}if(null==e)return!1;throw new TypeError('Unsupported type of condition "'+typeOf$1(e)+'"')}(n(e,t,i))?r(e,t,i):a(e,t,i)}},n.prototype.forEach=function(e){e(this.condition,"condition",this),e(this.trueExpr,"trueExpr",this),e(this.falseExpr,"falseExpr",this)},n.prototype.map=function(e){return new n(this._ifNode(e(this.condition,"condition",this)),this._ifNode(e(this.trueExpr,"trueExpr",this)),this._ifNode(e(this.falseExpr,"falseExpr",this)))},n.prototype.clone=function(){return new n(this.condition,this.trueExpr,this.falseExpr)},n.prototype._toString=function(e){var t=e&&e.parenthesis?e.parenthesis:"keep",n=getPrecedence(this,t),r=this.condition.toString(e),a=getPrecedence(this.condition,t);("all"===t||"OperatorNode"===this.condition.type||null!==a&&a<=n)&&(r="("+r+")");var i=this.trueExpr.toString(e),o=getPrecedence(this.trueExpr,t);("all"===t||"OperatorNode"===this.trueExpr.type||null!==o&&o<=n)&&(i="("+i+")");var s=this.falseExpr.toString(e),l=getPrecedence(this.falseExpr,t);return("all"===t||"OperatorNode"===this.falseExpr.type||null!==l&&l<=n)&&(s="("+s+")"),r+" ? "+i+" : "+s},n.prototype.toJSON=function(){return{mathjs:"ConditionalNode",condition:this.condition,trueExpr:this.trueExpr,falseExpr:this.falseExpr}},n.fromJSON=function(e){return new n(e.condition,e.trueExpr,e.falseExpr)},n.prototype.toHTML=function(e){var t=e&&e.parenthesis?e.parenthesis:"keep",n=getPrecedence(this,t),r=this.condition.toHTML(e),a=getPrecedence(this.condition,t);("all"===t||"OperatorNode"===this.condition.type||null!==a&&a<=n)&&(r='('+r+')');var i=this.trueExpr.toHTML(e),o=getPrecedence(this.trueExpr,t);("all"===t||"OperatorNode"===this.trueExpr.type||null!==o&&o<=n)&&(i='('+i+')');var s=this.falseExpr.toHTML(e),l=getPrecedence(this.falseExpr,t);return("all"===t||"OperatorNode"===this.falseExpr.type||null!==l&&l<=n)&&(s='('+s+')'),r+'?'+i+':'+s},n.prototype._toTex=function(e){return"\\begin{cases} {"+this.trueExpr.toTex(e)+"}, &\\quad{\\text{if }\\;"+this.condition.toTex(e)+"}\\\\{"+this.falseExpr.toTex(e)+"}, &\\quad{\\text{otherwise}}\\end{cases}"},n}),{isClass:!0,isNode:!0}),_extends=Object.assign||function(e){for(var t=1;t