math-exercises 2.2.10 → 2.2.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/exercises/exercise.d.ts.map +1 -1
- package/lib/exercises/math/calcul/decimals/index.d.ts +3 -0
- package/lib/exercises/math/calcul/decimals/index.d.ts.map +1 -0
- package/lib/exercises/math/calcul/decimals/index.js +18 -0
- package/lib/exercises/math/calcul/decimals/multiplyDecimalByNegativeTens.d.ts +8 -0
- package/lib/exercises/math/calcul/decimals/multiplyDecimalByNegativeTens.d.ts.map +1 -0
- package/lib/exercises/math/calcul/decimals/multiplyDecimalByNegativeTens.js +53 -0
- package/lib/exercises/math/calcul/decimals/multiplyDecimalByTens.d.ts +9 -0
- package/lib/exercises/math/calcul/decimals/multiplyDecimalByTens.d.ts.map +1 -0
- package/lib/exercises/math/calcul/decimals/multiplyDecimalByTens.js +63 -0
- package/lib/exercises/math/calcul/index.d.ts +2 -0
- package/lib/exercises/math/calcul/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/index.js +2 -0
- package/lib/exercises/math/calcul/operations/index.d.ts +2 -0
- package/lib/exercises/math/calcul/operations/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/operations/index.js +2 -0
- package/lib/exercises/math/calcul/operations/operationsPriorities.d.ts +1 -1
- package/lib/exercises/math/calcul/operations/operationsPriorities.d.ts.map +1 -1
- package/lib/exercises/math/calcul/operations/operationsPriorities.js +20 -5
- package/lib/exercises/math/calcul/operations/operationsPrioritiesParenthesis.d.ts +8 -0
- package/lib/exercises/math/calcul/operations/operationsPrioritiesParenthesis.d.ts.map +1 -0
- package/lib/exercises/math/calcul/operations/operationsPrioritiesParenthesis.js +111 -0
- package/lib/exercises/math/calcul/operations/operationsPrioritiesParenthesisNoRelatives.d.ts +8 -0
- package/lib/exercises/math/calcul/operations/operationsPrioritiesParenthesisNoRelatives.d.ts.map +1 -0
- package/lib/exercises/math/calcul/operations/operationsPrioritiesParenthesisNoRelatives.js +127 -0
- package/lib/exercises/math/calcul/operations/operationsPrioritiesWithoutRelative.d.ts.map +1 -1
- package/lib/exercises/math/calcul/operations/operationsPrioritiesWithoutRelative.js +18 -1
- package/lib/exercises/math/calcul/ordering/decimalOrdering.d.ts +9 -0
- package/lib/exercises/math/calcul/ordering/decimalOrdering.d.ts.map +1 -0
- package/lib/exercises/math/calcul/ordering/decimalOrdering.js +77 -0
- package/lib/exercises/math/calcul/ordering/framing.d.ts +1 -0
- package/lib/exercises/math/calcul/ordering/framing.d.ts.map +1 -0
- package/lib/exercises/math/calcul/ordering/framing.js +193 -0
- package/lib/exercises/math/calcul/ordering/index.d.ts +3 -0
- package/lib/exercises/math/calcul/ordering/index.d.ts.map +1 -0
- package/lib/exercises/math/calcul/ordering/index.js +19 -0
- package/lib/exercises/math/calcul/ordering/integerOrdering.d.ts +8 -0
- package/lib/exercises/math/calcul/ordering/integerOrdering.d.ts.map +1 -0
- package/lib/exercises/math/calcul/ordering/integerOrdering.js +61 -0
- package/lib/exercises/math/derivation/derivative/powerFunctionDerivative.js +1 -1
- package/lib/exercises/math/functions/affines/leadingCoeffAndOriginOrdinate.js +1 -1
- package/lib/exercises/math/functions/basics/graphicInequation.js +6 -6
- package/lib/exercises/math/functions/basics/twoFunctionsInequation.js +6 -6
- package/lib/exercises/math/percent/htToTTC.d.ts +8 -0
- package/lib/exercises/math/percent/htToTTC.d.ts.map +1 -0
- package/lib/exercises/math/percent/htToTTC.js +50 -0
- package/lib/exercises/math/percent/index.d.ts +2 -0
- package/lib/exercises/math/percent/index.d.ts.map +1 -1
- package/lib/exercises/math/percent/index.js +2 -0
- package/lib/exercises/math/percent/ttcToHT.d.ts +8 -0
- package/lib/exercises/math/percent/ttcToHT.d.ts.map +1 -0
- package/lib/exercises/math/percent/ttcToHT.js +50 -0
- package/lib/exercises/math/probaStat/stats1var/marginalAndConditionalFrequency.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/marginalAndConditionalFrequency.js +2 -11
- package/lib/exercises/pc/chemicalReactions/stoichiometricReaction.js +1 -1
- package/lib/exercises/pc/electricity/ohmicConductorOrGenerator.js +1 -1
- package/lib/exercises/pc/motion/typeOfAcceleration.js +1 -1
- package/lib/exercises/pc/motion/typeOfMovement.js +1 -1
- package/lib/exercises/pc/recognizeRefractionOrReflectionAngles.js +1 -1
- package/lib/index.d.ts +27 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/math/numbers/decimals/decimal.d.ts +2 -0
- package/lib/math/numbers/decimals/decimal.d.ts.map +1 -1
- package/lib/math/numbers/decimals/decimal.js +18 -0
- package/lib/math/sets/intervals/intervals.d.ts.map +1 -1
- package/lib/math/sets/intervals/intervals.js +2 -2
- package/lib/playground.d.ts.map +1 -1
- package/lib/playground.js +0 -5
- package/lib/tree/nodes/inequations/inequationSolutionNode.js +1 -1
- package/lib/tree/nodes/node.d.ts +2 -0
- package/lib/tree/nodes/node.d.ts.map +1 -1
- package/lib/tree/nodes/operators/addNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/addNode.js +9 -6
- package/lib/tree/nodes/sets/intervalNode.js +1 -1
- package/lib/tree/nodes/sets/unionIntervalNode.js +1 -1
- package/lib/types/keyProps.d.ts +13 -0
- package/lib/types/keyProps.d.ts.map +1 -0
- package/lib/types/keyProps.js +2 -0
- package/package.json +1 -1
|
@@ -8,15 +8,6 @@ const exercise_1 = require("../../../exercise");
|
|
|
8
8
|
const getDistinctQuestions_1 = require("../../../utils/getDistinctQuestions");
|
|
9
9
|
const getAnswer = (rand, x1, x2, x3, x4) => {
|
|
10
10
|
const x = x1 + x2 + x3 + x4;
|
|
11
|
-
const total = x1 + x2 + x3 + x4;
|
|
12
|
-
const totalA = x1 + x3;
|
|
13
|
-
const totalB = x2 + x4;
|
|
14
|
-
const totalC = x1 + x2;
|
|
15
|
-
const totalD = x3 + x4;
|
|
16
|
-
const A_C = x1;
|
|
17
|
-
const A_D = x3;
|
|
18
|
-
const B_C = x2;
|
|
19
|
-
const B_D = x4;
|
|
20
11
|
let freqString;
|
|
21
12
|
let frequence;
|
|
22
13
|
let answer;
|
|
@@ -112,8 +103,8 @@ const getPropositions = (n, { answer, rand, x1, x2, x3, x4 }) => {
|
|
|
112
103
|
const propositions = [];
|
|
113
104
|
(0, exercise_1.addValidProp)(propositions, answer);
|
|
114
105
|
while (propositions.length < n) {
|
|
115
|
-
const
|
|
116
|
-
const { answer: answerTree } = getAnswer(
|
|
106
|
+
const fakeRand = (0, randint_1.randint)(0, 12);
|
|
107
|
+
const { answer: answerTree } = getAnswer(fakeRand, x1, x2, x3, x4);
|
|
117
108
|
(0, exercise_1.tryToAddWrongProp)(propositions, answerTree.toTex());
|
|
118
109
|
}
|
|
119
110
|
return (0, shuffle_1.shuffle)(propositions);
|
package/lib/index.d.ts
CHANGED
|
@@ -129,7 +129,7 @@ declare const mathExercises: (import("./exercises/exercise").Exercise<{
|
|
|
129
129
|
a: number;
|
|
130
130
|
b: number;
|
|
131
131
|
c: number;
|
|
132
|
-
d: number;
|
|
132
|
+
d: number | undefined;
|
|
133
133
|
}> | import("./exercises/exercise").Exercise<{
|
|
134
134
|
type: number;
|
|
135
135
|
flip: number;
|
|
@@ -141,6 +141,12 @@ declare const mathExercises: (import("./exercises/exercise").Exercise<{
|
|
|
141
141
|
nodeIds: any;
|
|
142
142
|
type: number;
|
|
143
143
|
subType: number;
|
|
144
|
+
}> | import("./exercises/exercise").Exercise<{
|
|
145
|
+
nodeIds: any;
|
|
146
|
+
type: number;
|
|
147
|
+
}> | import("./exercises/exercise").Exercise<{
|
|
148
|
+
nodeIds: any;
|
|
149
|
+
type: number;
|
|
144
150
|
}> | import("./exercises/exercise").Exercise<{
|
|
145
151
|
randQuation: number;
|
|
146
152
|
x1: string | number;
|
|
@@ -177,6 +183,20 @@ declare const mathExercises: (import("./exercises/exercise").Exercise<{
|
|
|
177
183
|
}> | import("./exercises/exercise").Exercise<{
|
|
178
184
|
a: number;
|
|
179
185
|
b: number;
|
|
186
|
+
}> | import("./exercises/exercise").Exercise<{
|
|
187
|
+
type: number;
|
|
188
|
+
a: number;
|
|
189
|
+
b: number;
|
|
190
|
+
}> | import("./exercises/exercise").Exercise<{
|
|
191
|
+
dec: number;
|
|
192
|
+
pow: number;
|
|
193
|
+
isDivide: boolean;
|
|
194
|
+
}> | import("./exercises/exercise").Exercise<{
|
|
195
|
+
dec: number;
|
|
196
|
+
pow: number;
|
|
197
|
+
}> | import("./exercises/exercise").Exercise<{
|
|
198
|
+
a: number;
|
|
199
|
+
b: number;
|
|
180
200
|
}> | import("./exercises/exercise").Exercise<{
|
|
181
201
|
a: number;
|
|
182
202
|
b: number;
|
|
@@ -1074,6 +1094,12 @@ declare const mathExercises: (import("./exercises/exercise").Exercise<{
|
|
|
1074
1094
|
lefties: number;
|
|
1075
1095
|
}> | import("./exercises/exercise").Exercise<{}> | import("./exercises/exercise").Exercise<{
|
|
1076
1096
|
evolution: number;
|
|
1097
|
+
}> | import("./exercises/exercise").Exercise<{
|
|
1098
|
+
TVA: number;
|
|
1099
|
+
ht: number;
|
|
1100
|
+
}> | import("./exercises/exercise").Exercise<{
|
|
1101
|
+
TTC: number;
|
|
1102
|
+
TVA: number;
|
|
1077
1103
|
}> | import("./exercises/exercise").Exercise<{
|
|
1078
1104
|
int: number;
|
|
1079
1105
|
power: number;
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAI3D,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,MAAM,EAAE,MAAM,aAAa,CAAC;QAC5B,SAAS,EAAE,MAAM,MAAM,CAAC;QACxB,YAAY,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,KAAK,aAAa,CAAC;KACpD;IACD,UAAU,MAAM;QACd,MAAM,EAAE,MAAM,aAAa,CAAC;QAC5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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAA6B,CAAC;AAE/C,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -32,5 +32,7 @@ export declare class Decimal implements Nombre {
|
|
|
32
32
|
toRational(): Rational | import("../integer/integer").Integer;
|
|
33
33
|
toTree(): NumberNode;
|
|
34
34
|
toPercentNode(): PercentNode;
|
|
35
|
+
toLowerBound(tenthPower: number): Decimal;
|
|
36
|
+
toUpperBound(tenthPower: number): Decimal;
|
|
35
37
|
}
|
|
36
38
|
//# sourceMappingURL=decimal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decimal.d.ts","sourceRoot":"","sources":["../../../../src/math/numbers/decimals/decimal.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAEvE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,eAAO,MAAM,iBAAiB,UAAyC,CAAC;AACxE,8BAAsB,kBAAkB;IACtC,MAAM,CAAC,cAAc,CAAC,SA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,UAAyC,CAAC;AACxE,8BAAsB,kBAAkB;IACtC,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,GAAE,MAAU,GAAG,MAAM;IAY1E,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO;IAMpE,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO;IAK/D,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO;CAMrD;AAED,qBAAa,OAAQ,YAAW,MAAM;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,aAAsB;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;gBACR,KAAK,EAAE,MAAM,GAAG,MAAM;IASlC,MAAM,CAAC,CAAC,EAAE,MAAM;IAIhB;;;;OAIG;IACH,KAAK,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAIhC,oBAAoB,CAAC,KAAK,EAAE,MAAM;IAkClC,gBAAgB;IA6BhB,oBAAoB,CAAC,QAAQ,CAAC,EAAE,MAAM;IAwCtC,cAAc,CAAC,IAAI,EAAE,MAAM;IAS3B,UAAU;IAMV,MAAM;IAIN,aAAa;IAIb,YAAY,CAAC,UAAU,EAAE,MAAM;IAS/B,YAAY,CAAC,UAAU,EAAE,MAAM;CAShC"}
|
|
@@ -171,5 +171,23 @@ class Decimal {
|
|
|
171
171
|
toPercentNode() {
|
|
172
172
|
return new percentNode_1.PercentNode(this.multiplyByPowerOfTen(2).value);
|
|
173
173
|
}
|
|
174
|
+
toLowerBound(tenthPower) {
|
|
175
|
+
if (tenthPower > 0)
|
|
176
|
+
throw Error("not implemented : lower bound positive");
|
|
177
|
+
const rounded = (0, round_1.round)(this.value, -tenthPower);
|
|
178
|
+
if (rounded > this.value)
|
|
179
|
+
return new Decimal((0, round_1.round)(rounded - Math.pow(10, tenthPower), -tenthPower));
|
|
180
|
+
else
|
|
181
|
+
return new Decimal(rounded);
|
|
182
|
+
}
|
|
183
|
+
toUpperBound(tenthPower) {
|
|
184
|
+
if (tenthPower > 0)
|
|
185
|
+
throw Error("not implemented : lower bound positive");
|
|
186
|
+
const rounded = (0, round_1.round)(this.value, -tenthPower);
|
|
187
|
+
if (rounded < this.value)
|
|
188
|
+
return new Decimal((0, round_1.round)(rounded + Math.pow(10, tenthPower), -tenthPower));
|
|
189
|
+
else
|
|
190
|
+
return new Decimal(rounded);
|
|
191
|
+
}
|
|
174
192
|
}
|
|
175
193
|
exports.Decimal = Decimal;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intervals.d.ts","sourceRoot":"","sources":["../../../../src/math/sets/intervals/intervals.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAc,MAAM,2BAA2B,CAAC;AAI/D,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAM/D,OAAO,EAAW,WAAW,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EACL,eAAe,EAEhB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAGlE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,8BAAsB,mBAAmB;IACvC,MAAM,CAAC,MAAM;IA2Cb,MAAM,CAAC,gBAAgB,CAAC,EAAE,EAAE,MAAM;CAWnC;AAED,qBAAa,QAAS,YAAW,gBAAgB;IAC/C,OAAO,EAAE,aAAa,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,OA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AAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,aAAa,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,WAAW,CAAC;IACrB,WAAW,EAAE,GAAG,GAAG,GAAG,CAAC;IACvB,YAAY,EAAE,GAAG,GAAG,GAAG,CAAC;IACxB,oBAAoB,EAAE,MAAM,GAAG,GAAG,CAAC;IACnC,qBAAqB,EAAE,MAAM,GAAG,GAAG,CAAC;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,OAAO,CAAC;gBACL,GAAG,EAAE,aAAa,EAAE,GAAG,EAAE,aAAa,EAAE,OAAO,EAAE,WAAW;IAkBxE,MAAM,CAAC,QAAQ,EAAE,QAAQ;IAOzB,KAAK,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO;IA6ClC,YAAY,CAAC,QAAQ,EAAE,QAAQ;IA0C/B,WAAW,IAAI,MAAM;IAGrB,KAAK,IAAI,MAAM;IAIf,YAAY,IAAI,MAAM;IAmBtB,gBAAgB,IAAI,MAAM;IAI1B,MAAM;CAGP"}
|
|
@@ -115,7 +115,7 @@ class Interval {
|
|
|
115
115
|
interval.rightBracket === "[")) {
|
|
116
116
|
const firstInterval = this.min < interval.min ? this : interval;
|
|
117
117
|
const secondInterval = this.min < interval.min ? interval : this;
|
|
118
|
-
return new mathSet_1.MathSet(`${unionLeftBracket}
|
|
118
|
+
return new mathSet_1.MathSet(`${unionLeftBracket}${firstInterval.minTex};${firstInterval.maxTex}${firstInterval.rightBracket}\\cup${secondInterval.leftBracket}${secondInterval.minTex};${secondInterval.maxTex}${unionRightBracket}`, () => (0, coinFlip_1.coinFlip)()
|
|
119
119
|
? firstInterval.getRandomElement()
|
|
120
120
|
: secondInterval.getRandomElement());
|
|
121
121
|
}
|
|
@@ -161,7 +161,7 @@ class Interval {
|
|
|
161
161
|
return `${this.minTex};${this.maxTex}`;
|
|
162
162
|
}
|
|
163
163
|
toTex() {
|
|
164
|
-
return `${this.leftBracket}
|
|
164
|
+
return `${this.leftBracket}${this.insideToTex()}${this.rightBracket}`;
|
|
165
165
|
}
|
|
166
166
|
toInequality() {
|
|
167
167
|
const isLeftClosed = this.closure === closure_1.ClosureType.FO || this.closure === closure_1.ClosureType.FF;
|
package/lib/playground.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playground.d.ts","sourceRoot":"","sources":["../src/playground.ts"],"names":[],"mappings":"AAoBA,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"playground.d.ts","sourceRoot":"","sources":["../src/playground.ts"],"names":[],"mappings":"AAoBA,eAAO,MAAM,UAAU,YActB,CAAC"}
|
package/lib/playground.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.playground = void 0;
|
|
4
|
-
const intervals_1 = require("./math/sets/intervals/intervals");
|
|
5
|
-
const closure_1 = require("./tree/nodes/sets/closure");
|
|
6
|
-
const discreteSetNode_1 = require("./tree/nodes/sets/discreteSetNode");
|
|
7
4
|
const playground = () => {
|
|
8
5
|
// const node = new AddNode(
|
|
9
6
|
// new MultiplyNode(new Affine(1, 0).toTree(), new Affine(3, 1).toTree()),
|
|
@@ -18,7 +15,5 @@ const playground = () => {
|
|
|
18
15
|
// const parsed = NodeConstructor.fromIdentifiers(ids);
|
|
19
16
|
// console.log(node);
|
|
20
17
|
// console.log(parsed);
|
|
21
|
-
console.log(new intervals_1.Interval((3).toTree(), (5).toTree(), closure_1.ClosureType.FF));
|
|
22
|
-
console.log(new discreteSetNode_1.DiscreteSetNode([(2).toTree()]));
|
|
23
18
|
};
|
|
24
19
|
exports.playground = playground;
|
|
@@ -55,7 +55,7 @@ class InequationSolutionNode {
|
|
|
55
55
|
return `S={${this.intervalSolution.toMathjs()}}`;
|
|
56
56
|
}
|
|
57
57
|
toTex() {
|
|
58
|
-
return `S
|
|
58
|
+
return `S=${this.intervalSolution.toTex()}`;
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
exports.InequationSolutionNode = InequationSolutionNode;
|
package/lib/tree/nodes/node.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export type NodeOptions = {
|
|
|
22
22
|
allowLnOfOne?: boolean;
|
|
23
23
|
allowPowerOne?: boolean;
|
|
24
24
|
allowSimplifySqrt?: boolean;
|
|
25
|
+
forceParenthesis?: boolean;
|
|
25
26
|
};
|
|
26
27
|
export type ToTexOptions = {
|
|
27
28
|
displayStyle?: boolean;
|
|
@@ -30,6 +31,7 @@ export type ToTexOptions = {
|
|
|
30
31
|
hideUnit?: boolean;
|
|
31
32
|
notScientific?: boolean;
|
|
32
33
|
forceNoSimplification?: boolean;
|
|
34
|
+
forceParenthesis?: boolean;
|
|
33
35
|
};
|
|
34
36
|
export declare enum NodeIds {
|
|
35
37
|
add = 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../src/tree/nodes/node.ts"],"names":[],"mappings":"AAAA,oBAAY,QAAQ;IAClB,MAAM,IAAA;IACN,QAAQ,IAAA;IACR,QAAQ,IAAA;IACR,QAAQ,IAAA;IACR,QAAQ,IAAA;IACR,UAAU,IAAA;IACV,KAAK,IAAA;IACL,MAAM,IAAA;IACN,QAAQ,IAAA;IACR,OAAO,IAAA;IACP,MAAM,KAAA;IACN,GAAG,KAAA;CACJ;AACD,MAAM,MAAM,WAAW,GAAG;IACxB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,4BAA4B,CAAC,EAAE,OAAO,CAAC;IACvC,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,4BAA4B,CAAC,EAAE,OAAO,CAAC;IACvC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB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AAA;IACL,KAAK,IAAA;IACL,MAAM,IAAA;IACN,OAAO,IAAA;IACP,QAAQ,IAAA;IACR,QAAQ,KAAA;IACR,OAAO,KAAA;IACP,WAAW,KAAA;IACX,QAAQ,KAAA;IACR,KAAK,KAAA;IACL,OAAO,KAAA;IACP,KAAK,KAAA;IACL,UAAU,KAAA;IACV,gBAAgB,KAAA;IAChB,GAAG,KAAA;IACH,MAAM,KAAA;IACN,MAAM,KAAA;IACN,MAAM,KAAA;IACN,GAAG,KAAA;IACH,GAAG,KAAA;IACH,GAAG,KAAA;IACH,GAAG,KAAA;IACH,KAAK,KAAA;IACL,GAAG,KAAA;IACH,IAAI,KAAA;IACJ,QAAQ,KAAA;IACR,QAAQ,KAAA;IACR,MAAM,KAAA;IACN,MAAM,KAAA;IACN,KAAK,KAAA;IACL,MAAM,KAAA;IACN,UAAU,KAAA;IACV,kBAAkB,KAAA;CACnB;AAED,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,YAAY,EAAE,MAAM,MAAM,CAAC;IAC3B,iBAAiB,EAAE,CAAC,IAAI,CAAC,EAAE,WAAW,KAAK,IAAI,EAAE,CAAC;IAClD,cAAc,EAAE,CAAC,IAAI,CAAC,EAAE,WAAW,KAAK,MAAM,EAAE,CAAC;IACjD,KAAK,EAAE,CAAC,IAAI,CAAC,EAAE,YAAY,KAAK,MAAM,CAAC;IAGvC,aAAa,EAAE,MAAM;QAAE,EAAE,EAAE,OAAO,CAAA;KAAE,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC5D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/addNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"addNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/addNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAgB,MAAM,SAAS,CAAC;AAC7E,OAAO,EACL,uBAAuB,EACvB,WAAW,EAGZ,MAAM,gBAAgB,CAAC;AAKxB,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAOlE,wBAAgB,SAAS,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,OAAO,CAE/C;AAED,qBAAa,OAAQ,YAAW,uBAAuB;IACrD,EAAE,EAAE,WAAW,CAAC;IAChB,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,aAAa,CAAC;IAC1B,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;gBAEjB,SAAS,EAAE,aAAa,EACxB,UAAU,EAAE,aAAa,EACzB,IAAI,CAAC,EAAE,WAAW;IASpB,OAAO,aAGL;IAEF,YAAY,IAAI,MAAM;IAItB,iBAAiB,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,aAAa,EAAE;IAoCtD,SAAS,IAAI,MAAM,EAAE;IAIrB,cAAc,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,MAAM,EAAE;IAK5C,KAAK,IAAI,MAAM;IAUf,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAMrC,QAAQ,CAAC,IAAI,CAAC,EAAE,eAAe,GAAG,aAAa;IA0K/C,aAAa;;;;;;;;;IAOb,MAAM,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO;CAUrC"}
|
|
@@ -17,11 +17,6 @@ function isAddNode(a) {
|
|
|
17
17
|
return (0, operatorNode_1.isOperatorNode)(a) && a.id === operatorNode_1.OperatorIds.add;
|
|
18
18
|
}
|
|
19
19
|
exports.isAddNode = isAddNode;
|
|
20
|
-
const addNodeToTex = (leftTex, rightTex) => {
|
|
21
|
-
if (rightTex === "0")
|
|
22
|
-
return leftTex;
|
|
23
|
-
return `${leftTex}${rightTex[0] === "-" ? "" : "+"}${rightTex}`;
|
|
24
|
-
};
|
|
25
20
|
class AddNode {
|
|
26
21
|
constructor(leftChild, rightChild, opts) {
|
|
27
22
|
this.shuffle = () => {
|
|
@@ -79,7 +74,15 @@ class AddNode {
|
|
|
79
74
|
}
|
|
80
75
|
toTex() {
|
|
81
76
|
const rightTex = this.rightChild.toTex();
|
|
82
|
-
|
|
77
|
+
const leftTex = this.leftChild.toTex();
|
|
78
|
+
if (rightTex === "0")
|
|
79
|
+
return leftTex;
|
|
80
|
+
const tex = `${leftTex}${rightTex[0] === "-" ? "" : "+"}${rightTex}`;
|
|
81
|
+
if (this.opts?.forceParenthesis) {
|
|
82
|
+
return `\\left(${tex}\\right)`;
|
|
83
|
+
}
|
|
84
|
+
else
|
|
85
|
+
return tex;
|
|
83
86
|
}
|
|
84
87
|
evaluate(vars) {
|
|
85
88
|
return this.leftChild.evaluate(vars) + this.rightChild.evaluate(vars);
|
|
@@ -100,7 +100,7 @@ class IntervalNode {
|
|
|
100
100
|
const right = this.closure === closure_1.ClosureType.FF || this.closure === closure_1.ClosureType.OF
|
|
101
101
|
? "]"
|
|
102
102
|
: "[";
|
|
103
|
-
return `${left}
|
|
103
|
+
return `${left}${this.a.toTex()};${this.b.toTex()}${right}`;
|
|
104
104
|
}
|
|
105
105
|
toIdentifiers() {
|
|
106
106
|
return {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { KeyId } from "./keyIds";
|
|
2
|
+
export type KeyProps = {
|
|
3
|
+
id: KeyId;
|
|
4
|
+
label: string;
|
|
5
|
+
labelType: "raw" | "tex" | "svg";
|
|
6
|
+
mathfieldInstructions?: MathfieldInstructions;
|
|
7
|
+
onClick?: () => void;
|
|
8
|
+
};
|
|
9
|
+
export interface MathfieldInstructions {
|
|
10
|
+
method: "write" | "cmd" | "keystroke" | "typedText";
|
|
11
|
+
content: string | ((currentLatex: string) => string);
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=keyProps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyProps.d.ts","sourceRoot":"","sources":["../../src/types/keyProps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,KAAK,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;IACjC,qBAAqB,CAAC,EAAE,qBAAqB,CAAC;IAC9C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AACF,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,OAAO,GAAG,KAAK,GAAG,WAAW,GAAG,WAAW,CAAC;IACpD,OAAO,EAAE,MAAM,GAAG,CAAC,CAAC,YAAY,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC;CACtD"}
|