math-exercises 2.2.80 → 2.2.82
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/math/calcul/arithmetics/divisibiltyCriteria.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/divisibiltyCriteria.js +1 -0
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType2.d.ts +4 -1
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType2.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType2.js +79 -30
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType3.d.ts +4 -1
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType3.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType3.js +89 -39
- package/lib/exercises/math/calculLitteral/inequations/squareFunctionInequation.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/inequations/squareFunctionInequation.js +37 -17
- package/lib/exercises/math/calculLitteral/simplifying/evaluateExpression.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/simplifying/evaluateExpression.js +55 -15
- package/lib/exercises/math/derivation/derivative/convexityQuadrinomials.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/convexityQuadrinomials.js +9 -18
- package/lib/exercises/math/derivation/derivative/lnDerivativeThree.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/lnDerivativeThree.js +3 -0
- package/lib/exercises/math/derivation/derivative/thirdDegreeFunctionVariation.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/thirdDegreeFunctionVariation.js +11 -11
- package/lib/exercises/math/functions/absolute/absolueValueInequationsSup.d.ts.map +1 -1
- package/lib/exercises/math/functions/absolute/absolueValueInequationsSup.js +10 -2
- package/lib/exercises/math/functions/absolute/absoluteValueInequations.d.ts.map +1 -1
- package/lib/exercises/math/functions/absolute/absoluteValueInequations.js +11 -4
- package/lib/exercises/math/functions/basics/graphicEquation.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/graphicEquation.js +46 -28
- package/lib/exercises/math/functions/basics/graphicInequation.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/graphicInequation.js +0 -1
- package/lib/exercises/math/functions/basics/graphicInequationAffine.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/graphicInequationAffine.js +10 -3
- package/lib/exercises/math/functions/basics/twoFunctionsInequation.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/twoFunctionsInequation.js +74 -58
- package/lib/exercises/math/functions/exponentials/exponentialsVariations.d.ts.map +1 -1
- package/lib/exercises/math/functions/exponentials/exponentialsVariations.js +1 -0
- package/lib/exercises/math/functions/logarithm/log10Simplifying.d.ts +5 -2
- package/lib/exercises/math/functions/logarithm/log10Simplifying.d.ts.map +1 -1
- package/lib/exercises/math/functions/logarithm/log10Simplifying.js +2 -0
- package/lib/exercises/math/functions/logarithm/logEquation.d.ts.map +1 -1
- package/lib/exercises/math/functions/logarithm/logEquation.js +1 -0
- package/lib/exercises/math/functions/logarithm/logPowerEquation.d.ts +5 -2
- package/lib/exercises/math/functions/logarithm/logPowerEquation.d.ts.map +1 -1
- package/lib/exercises/math/functions/logarithm/logPowerEquation.js +2 -0
- package/lib/exercises/math/functions/logarithm/logSimplifiying.d.ts.map +1 -1
- package/lib/exercises/math/functions/logarithm/logSimplifiying.js +1 -0
- package/lib/exercises/math/functions/square/squareImageInterval.d.ts.map +1 -1
- package/lib/exercises/math/functions/square/squareImageInterval.js +13 -4
- package/lib/exercises/math/functions/trinoms/secondDegreeInequation.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/secondDegreeInequation.js +10 -6
- package/lib/exercises/math/functions/trinoms/trinomSignFromRoots.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/trinomSignFromRoots.js +12 -6
- package/lib/exercises/math/geometry/convexity/convexityQuadrinomialsGeo.d.ts.map +1 -1
- package/lib/exercises/math/geometry/convexity/convexityQuadrinomialsGeo.js +9 -14
- package/lib/exercises/math/matrices/matrixInversibilityDomain.d.ts.map +1 -1
- package/lib/exercises/math/matrices/matrixInversibilityDomain.js +15 -2
- package/lib/exercises/math/probaStat/binomial/binomialInequation.d.ts.map +1 -1
- package/lib/exercises/math/python/pyForLoop1Exercise.d.ts.map +1 -1
- package/lib/exercises/math/sequences/genericSequenceVariations.d.ts.map +1 -1
- package/lib/exercises/math/sets/intervals/inequalityToInterval.d.ts +2 -4
- package/lib/exercises/math/sets/intervals/inequalityToInterval.d.ts.map +1 -1
- package/lib/exercises/math/sets/intervals/inequalityToInterval.js +28 -25
- package/lib/exercises/math/sets/intervals/intervalToInequality.d.ts +2 -4
- package/lib/exercises/math/sets/intervals/intervalToInequality.d.ts.map +1 -1
- package/lib/exercises/math/sets/intervals/intervalToInequality.js +40 -78
- package/lib/exercises/math/sets/intervals/intervalsIntersection.d.ts +3 -7
- package/lib/exercises/math/sets/intervals/intervalsIntersection.d.ts.map +1 -1
- package/lib/exercises/math/sets/intervals/intervalsIntersection.js +91 -31
- package/lib/exercises/math/sets/intervals/intervalsUnion.d.ts +3 -7
- package/lib/exercises/math/sets/intervals/intervalsUnion.d.ts.map +1 -1
- package/lib/exercises/math/sets/intervals/intervalsUnion.js +58 -19
- package/lib/exercises/pc/index.d.ts +4 -0
- package/lib/exercises/pc/index.d.ts.map +1 -1
- package/lib/exercises/pc/index.js +4 -6
- package/lib/exercises/vea/equationVEA.js +2 -2
- package/lib/geogebra/lagrange.d.ts.map +1 -1
- package/lib/geogebra/spline.d.ts.map +1 -1
- package/lib/index.d.ts +49 -23
- package/lib/index.d.ts.map +1 -1
- package/lib/math/geometry/point.d.ts.map +1 -1
- package/lib/math/inequations/inequation.d.ts +1 -1
- package/lib/math/inequations/inequation.d.ts.map +1 -1
- package/lib/math/numbers/integer/integer.d.ts.map +1 -1
- package/lib/math/numbers/rationals/rational.d.ts +2 -3
- package/lib/math/numbers/rationals/rational.d.ts.map +1 -1
- package/lib/math/polynomials/trinom.d.ts +2 -4
- package/lib/math/polynomials/trinom.d.ts.map +1 -1
- package/lib/playground.d.ts.map +1 -1
- package/lib/playground.js +4 -4
- package/lib/tree/nodes/equations/equationSolutionNode.d.ts +0 -1
- package/lib/tree/nodes/equations/equationSolutionNode.d.ts.map +1 -1
- package/lib/tree/nodes/equations/equationSolutionNode.js +0 -3
- package/lib/tree/nodes/inequations/inequationNode.d.ts +2 -1
- package/lib/tree/nodes/inequations/inequationNode.d.ts.map +1 -1
- package/lib/tree/nodes/inequations/inequationNode.js +4 -3
- package/lib/tree/nodes/inequations/inequationSolutionNode.d.ts +0 -1
- package/lib/tree/nodes/inequations/inequationSolutionNode.d.ts.map +1 -1
- package/lib/tree/nodes/inequations/inequationSolutionNode.js +0 -3
- package/lib/tree/nodes/numbers/numberNode.d.ts +1 -1
- package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/multiplyNode.js +6 -1
- package/lib/tree/nodes/sets/closure.d.ts +5 -0
- package/lib/tree/nodes/sets/closure.d.ts.map +1 -1
- package/lib/tree/nodes/sets/closure.js +32 -0
- package/lib/tree/nodes/sets/discreteSetNode.d.ts +4 -4
- package/lib/tree/nodes/sets/discreteSetNode.d.ts.map +1 -1
- package/lib/tree/nodes/sets/discreteSetNode.js +3 -4
- package/lib/tree/nodes/sets/intervalNode.d.ts +13 -1
- package/lib/tree/nodes/sets/intervalNode.d.ts.map +1 -1
- package/lib/tree/nodes/sets/intervalNode.js +154 -3
- package/lib/tree/parsers/discreteSetParser.d.ts +2 -2
- package/lib/tree/parsers/discreteSetParser.d.ts.map +1 -1
- package/lib/tree/parsers/discreteSetParser.js +2 -1
- package/lib/tree/parsers/equationSolutionParser.js +1 -1
- package/lib/tree/parsers/powerParser.d.ts +1 -1
- package/lib/tree/parsers/rationalParser.d.ts +1 -1
- package/lib/tree/parsers/unionIntervalParser.d.ts.map +1 -1
- package/lib/tree/parsers/unionIntervalParser.js +3 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"equationSolutionNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/equations/equationSolutionNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,KAAK,2BAA2B,GAAG;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,WAAW,CAAA;CAAE,CAAC;AAC7E,qBAAa,oBAAqB,YAAW,IAAI;IAC/C,IAAI,EAAE,QAAQ,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,eAAe,CAAC;IAC9B,IAAI,CAAC,EAAE,WAAW,CAAC;gBAEjB,YAAY,EAAE,eAAe,EAC7B,MAAM,CAAC,EAAE,2BAA2B;IActC,aAAa;;;;;;;;;IAMb,cAAc;IAId,SAAS;IAkBT,iBAAiB,CAAC,IAAI,CAAC,EAAE,WAAW;IAQpC,YAAY;
|
|
1
|
+
{"version":3,"file":"equationSolutionNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/equations/equationSolutionNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,KAAK,2BAA2B,GAAG;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,WAAW,CAAA;CAAE,CAAC;AAC7E,qBAAa,oBAAqB,YAAW,IAAI;IAC/C,IAAI,EAAE,QAAQ,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,eAAe,CAAC;IAC9B,IAAI,CAAC,EAAE,WAAW,CAAC;gBAEjB,YAAY,EAAE,eAAe,EAC7B,MAAM,CAAC,EAAE,2BAA2B;IActC,aAAa;;;;;;;;;IAMb,cAAc;IAId,SAAS;IAkBT,iBAAiB,CAAC,IAAI,CAAC,EAAE,WAAW;IAQpC,YAAY;IAIZ,KAAK;IAGL,QAAQ;CAGT"}
|
|
@@ -18,12 +18,13 @@ export declare class InequationNode implements Node {
|
|
|
18
18
|
symbols: InegalitySymbols[];
|
|
19
19
|
};
|
|
20
20
|
toInterval(): IntervalNode;
|
|
21
|
+
/**turns x<3 into 3>x */
|
|
21
22
|
toReversed(): InequationNode;
|
|
22
23
|
toSwitched(): InequationNode;
|
|
24
|
+
toSwicthedStrictness(): InequationNode;
|
|
23
25
|
toAllValidTexs(): string[];
|
|
24
26
|
toEquivalentNodes(opts?: NodeOptions | undefined): InequationNode[];
|
|
25
27
|
toMathString(): string;
|
|
26
|
-
toMathjs(): string;
|
|
27
28
|
toAllTexs(): string[];
|
|
28
29
|
toTex(): string;
|
|
29
30
|
simplify(opts?: SimplifyOptions): InequationNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inequationNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/inequations/inequationNode.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAEjB,MAAM,mCAAmC,CAAC;AAK3C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAG/D,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAMvD,qBAAa,cAAe,YAAW,IAAI;IACzC,IAAI,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IAC/B,IAAI,EAAE,QAAQ,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;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
|
|
@@ -79,6 +79,7 @@ class InequationNode {
|
|
|
79
79
|
return new intervalNode_1.IntervalNode(leftIsInf ? infiniteNode_1.MinusInfinityNode : this.children[1], rightIsInf ? infiniteNode_1.PlusInfinityNode : this.children[1], closure);
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
+
/**turns x<3 into 3>x */
|
|
82
83
|
toReversed() {
|
|
83
84
|
const newChildren = [...this.children].reverse();
|
|
84
85
|
const newSymbols = this.symbols.map((el) => new inequation_1.InequationSymbol(el).reversed());
|
|
@@ -87,6 +88,9 @@ class InequationNode {
|
|
|
87
88
|
toSwitched() {
|
|
88
89
|
return new InequationNode(this.children, this.symbols.map((el) => new inequation_1.InequationSymbol(el).reversed()));
|
|
89
90
|
}
|
|
91
|
+
toSwicthedStrictness() {
|
|
92
|
+
return new InequationNode(this.children, this.symbols.map((el) => new inequation_1.InequationSymbol(el).strictnessToggled()));
|
|
93
|
+
}
|
|
90
94
|
toAllValidTexs() {
|
|
91
95
|
return this.toEquivalentNodes().map((node) => node.toTex());
|
|
92
96
|
}
|
|
@@ -105,9 +109,6 @@ class InequationNode {
|
|
|
105
109
|
toMathString() {
|
|
106
110
|
return this.tex;
|
|
107
111
|
}
|
|
108
|
-
toMathjs() {
|
|
109
|
-
return this.tex;
|
|
110
|
-
}
|
|
111
112
|
toAllTexs() {
|
|
112
113
|
return [this.toTex()];
|
|
113
114
|
}
|
|
@@ -24,7 +24,6 @@ export declare class InequationSolutionNode implements Node {
|
|
|
24
24
|
toAllValidTexs(): string[];
|
|
25
25
|
toEquivalentNodes(opts?: NodeOptions): (import("./inequationNode").InequationNode | InequationSolutionNode)[];
|
|
26
26
|
toMathString(): string;
|
|
27
|
-
toMathjs(): string;
|
|
28
27
|
toTex(): string;
|
|
29
28
|
simplify(): this;
|
|
30
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inequationSolutionNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/inequations/inequationSolutionNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAkB,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE9D,KAAK,6BAA6B,GAAG;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,WAAW,CAAA;CAAE,CAAC;AAC/E,qBAAa,sBAAuB,YAAW,IAAI;IACjD,IAAI,EAAE,QAAQ,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,YAAY,GAAG,iBAAiB,CAAC;IACnD,IAAI,CAAC,EAAE,WAAW,CAAC;gBAEjB,gBAAgB,EAAE,YAAY,GAAG,iBAAiB,EAClD,MAAM,CAAC,EAAE,6BAA6B;IAaxC,aAAa;;;;;;;;;IAMb,SAAS;IAUT,cAAc;IAId,iBAAiB,CAAC,IAAI,CAAC,EAAE,WAAW;IAepC,YAAY;
|
|
1
|
+
{"version":3,"file":"inequationSolutionNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/inequations/inequationSolutionNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAkB,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE9D,KAAK,6BAA6B,GAAG;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,WAAW,CAAA;CAAE,CAAC;AAC/E,qBAAa,sBAAuB,YAAW,IAAI;IACjD,IAAI,EAAE,QAAQ,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,YAAY,GAAG,iBAAiB,CAAC;IACnD,IAAI,CAAC,EAAE,WAAW,CAAC;gBAEjB,gBAAgB,EAAE,YAAY,GAAG,iBAAiB,EAClD,MAAM,CAAC,EAAE,6BAA6B;IAaxC,aAAa;;;;;;;;;IAMb,SAAS;IAUT,cAAc;IAId,iBAAiB,CAAC,IAAI,CAAC,EAAE,WAAW;IAepC,YAAY;IAIZ,KAAK;IAGL,QAAQ;CAGT"}
|
|
@@ -24,7 +24,7 @@ export declare class NumberNode implements AlgebraicNode {
|
|
|
24
24
|
toAllValidTexs(): string[];
|
|
25
25
|
toEquivalentNodes(): this[];
|
|
26
26
|
evaluate(vars?: Record<string, number>): number;
|
|
27
|
-
simplify(opts?: SimplifyOptions):
|
|
27
|
+
simplify(opts?: SimplifyOptions): AlgebraicNode | NumberNode;
|
|
28
28
|
equals(node: AlgebraicNode): boolean;
|
|
29
29
|
toDetailedEvaluation(vars: Record<string, AlgebraicNode>): this;
|
|
30
30
|
derivative(varName?: string | undefined): AlgebraicNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multiplyNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/multiplyNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EACL,uBAAuB,EACvB,WAAW,EAEZ,MAAM,gBAAgB,CAAC;AAYxB,OAAO,EACL,aAAa,EACb,eAAe,EAEhB,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"multiplyNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/multiplyNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EACL,uBAAuB,EACvB,WAAW,EAEZ,MAAM,gBAAgB,CAAC;AAY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 +20,7 @@ const addNode_1 = require("./addNode");
|
|
|
20
20
|
const round_1 = require("../../../math/utils/round");
|
|
21
21
|
const colorize_1 = require("../../../utils/latex/colorize");
|
|
22
22
|
const substractNode_1 = require("./substractNode");
|
|
23
|
+
const constantNode_1 = require("../numbers/constantNode");
|
|
23
24
|
function isMultiplyNode(a) {
|
|
24
25
|
return (0, operatorNode_1.isOperatorNode)(a) && a.id === operatorNode_1.OperatorIds.multiply;
|
|
25
26
|
}
|
|
@@ -91,10 +92,14 @@ class MultiplyNode {
|
|
|
91
92
|
return (0, colorize_1.colorize)("-" + rightTex, color);
|
|
92
93
|
// }
|
|
93
94
|
}
|
|
95
|
+
//!this is atrocious
|
|
94
96
|
let showTimesSign = !opts?.forceDotSign &&
|
|
95
97
|
(opts?.forceTimesSign ||
|
|
96
98
|
!isNaN(+rightTex[0]) ||
|
|
97
|
-
(this.rightChild.isNumeric &&
|
|
99
|
+
(this.rightChild.isNumeric &&
|
|
100
|
+
this.leftChild.isNumeric &&
|
|
101
|
+
!(0, constantNode_1.isConstantNode)(this.rightChild) &&
|
|
102
|
+
!(0, sqrtNode_1.isSqrtNode)(this.rightChild)) ||
|
|
98
103
|
(0, numberNode_1.isNumberNode)(this.rightChild) ||
|
|
99
104
|
((0, variableNode_1.isVariableNode)(this.leftChild) &&
|
|
100
105
|
(0, variableNode_1.isVariableNode)(this.rightChild) &&
|
|
@@ -11,7 +11,12 @@ export declare abstract class Closure {
|
|
|
11
11
|
static rightReverse(closure: ClosureType): ClosureType;
|
|
12
12
|
static switch(closure: ClosureType): ClosureType;
|
|
13
13
|
static fromBrackets(left: "[" | "]", right: "]" | "["): ClosureType;
|
|
14
|
+
static toBrackets(closure: ClosureType): string[];
|
|
14
15
|
static isLeftOpen(closure: ClosureType): boolean;
|
|
15
16
|
static isRightOpen(closure: ClosureType): boolean;
|
|
17
|
+
static getLessLeftStrict: (a: "[" | "]", b: "[" | "]") => "[" | "]";
|
|
18
|
+
static getLessRightStrict: (a: "[" | "]", b: "[" | "]") => "[" | "]";
|
|
19
|
+
static getMostLeftStrict: (a: "[" | "]", b: "[" | "]") => "[" | "]";
|
|
20
|
+
static getMostRightStrict: (a: "[" | "]", b: "[" | "]") => "[" | "]";
|
|
16
21
|
}
|
|
17
22
|
//# sourceMappingURL=closure.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"closure.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/sets/closure.ts"],"names":[],"mappings":"AAEA,oBAAY,WAAW;IACrB,EAAE,IAAA;IACF,EAAE,IAAA;IACF,EAAE,IAAA;IACF,EAAE,IAAA;CACH;AAED,8BAAsB,OAAO;IAC3B,MAAM,CAAC,MAAM;IAcb,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,WAAW;IAYnC,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,WAAW;IAYvC,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,WAAW;IAYxC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,WAAW;IAYlC,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,GAAG,GAAG,GAAG,EAAE,KAAK,EAAE,GAAG,GAAG,GAAG;IAQrD,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,WAAW;IAUtC,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,WAAW;
|
|
1
|
+
{"version":3,"file":"closure.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/sets/closure.ts"],"names":[],"mappings":"AAEA,oBAAY,WAAW;IACrB,EAAE,IAAA;IACF,EAAE,IAAA;IACF,EAAE,IAAA;IACF,EAAE,IAAA;CACH;AAED,8BAAsB,OAAO;IAC3B,MAAM,CAAC,MAAM;IAcb,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,WAAW;IAYnC,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,WAAW;IAYvC,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,WAAW;IAYxC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,WAAW;IAYlC,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,GAAG,GAAG,GAAG,EAAE,KAAK,EAAE,GAAG,GAAG,GAAG;IAQrD,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,WAAW;IAatC,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,WAAW;IAUtC,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,WAAW;IAWvC,MAAM,CAAC,iBAAiB,MAAO,GAAG,GAAG,GAAG,KAAK,GAAG,GAAG,GAAG,eAGpD;IACF,MAAM,CAAC,kBAAkB,MAAO,GAAG,GAAG,GAAG,KAAK,GAAG,GAAG,GAAG,eAGrD;IACF,MAAM,CAAC,iBAAiB,MAAO,GAAG,GAAG,GAAG,KAAK,GAAG,GAAG,GAAG,eAGpD;IACF,MAAM,CAAC,kBAAkB,MAAO,GAAG,GAAG,GAAG,KAAK,GAAG,GAAG,GAAG,eAGrD;CACH"}
|
|
@@ -83,6 +83,18 @@ class Closure {
|
|
|
83
83
|
else
|
|
84
84
|
return ClosureType.OF;
|
|
85
85
|
}
|
|
86
|
+
static toBrackets(closure) {
|
|
87
|
+
switch (closure) {
|
|
88
|
+
case ClosureType.FF:
|
|
89
|
+
return ["[", "]"];
|
|
90
|
+
case ClosureType.FO:
|
|
91
|
+
return ["[", "["];
|
|
92
|
+
case ClosureType.OF:
|
|
93
|
+
return ["]", "]"];
|
|
94
|
+
case ClosureType.OO:
|
|
95
|
+
return ["]", "["];
|
|
96
|
+
}
|
|
97
|
+
}
|
|
86
98
|
static isLeftOpen(closure) {
|
|
87
99
|
switch (closure) {
|
|
88
100
|
case ClosureType.FF:
|
|
@@ -105,3 +117,23 @@ class Closure {
|
|
|
105
117
|
}
|
|
106
118
|
}
|
|
107
119
|
exports.Closure = Closure;
|
|
120
|
+
Closure.getLessLeftStrict = (a, b) => {
|
|
121
|
+
if (a === "[" || b === "[")
|
|
122
|
+
return "[";
|
|
123
|
+
return "]";
|
|
124
|
+
};
|
|
125
|
+
Closure.getLessRightStrict = (a, b) => {
|
|
126
|
+
if (a === "]" || b === "]")
|
|
127
|
+
return "]";
|
|
128
|
+
return "[";
|
|
129
|
+
};
|
|
130
|
+
Closure.getMostLeftStrict = (a, b) => {
|
|
131
|
+
if (a === "]" || b === "]")
|
|
132
|
+
return "]";
|
|
133
|
+
return "[";
|
|
134
|
+
};
|
|
135
|
+
Closure.getMostRightStrict = (a, b) => {
|
|
136
|
+
if (a === "[" || b === "[")
|
|
137
|
+
return "[";
|
|
138
|
+
return "]";
|
|
139
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AlgebraicNode } from "../algebraicNode";
|
|
1
2
|
import { Node, NodeIds, NodeOptions, NodeType } from "../node";
|
|
2
3
|
import { SetIds, SetNode } from "./setNode";
|
|
3
4
|
export declare function isDiscreteSetNode(a: Node): a is DiscreteSetNode;
|
|
@@ -5,9 +6,9 @@ export declare class DiscreteSetNode implements SetNode {
|
|
|
5
6
|
type: NodeType;
|
|
6
7
|
id: SetIds;
|
|
7
8
|
opts?: NodeOptions | undefined;
|
|
8
|
-
elements:
|
|
9
|
+
elements: AlgebraicNode[];
|
|
9
10
|
isEmpty: boolean;
|
|
10
|
-
constructor(elements:
|
|
11
|
+
constructor(elements: AlgebraicNode[], opts?: NodeOptions);
|
|
11
12
|
isEmptySet(): boolean;
|
|
12
13
|
toAllValidTexs(): string[];
|
|
13
14
|
toIdentifiers(): {
|
|
@@ -18,10 +19,9 @@ export declare class DiscreteSetNode implements SetNode {
|
|
|
18
19
|
};
|
|
19
20
|
toEquivalentNodes(opts?: NodeOptions): DiscreteSetNode[];
|
|
20
21
|
toMathString(): string;
|
|
21
|
-
toMathjs(): string;
|
|
22
22
|
toTex(): string;
|
|
23
23
|
toDeleteRandomElement(): DiscreteSetNode;
|
|
24
|
-
simplify():
|
|
24
|
+
simplify(): DiscreteSetNode;
|
|
25
25
|
}
|
|
26
26
|
export declare const EmptySet: DiscreteSetNode;
|
|
27
27
|
//# sourceMappingURL=discreteSetNode.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discreteSetNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/sets/discreteSetNode.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,OAAO,EAAa,MAAM,WAAW,CAAC;AACvD,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,eAAe,CAE/D;AACD,qBAAa,eAAgB,YAAW,OAAO;IAC7C,IAAI,EAAE,QAAQ,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IAC/B,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"discreteSetNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/sets/discreteSetNode.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,OAAO,EAAa,MAAM,WAAW,CAAC;AACvD,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,eAAe,CAE/D;AACD,qBAAa,eAAgB,YAAW,OAAO;IAC7C,IAAI,EAAE,QAAQ,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IAC/B,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,OAAO,EAAE,OAAO,CAAC;gBACL,QAAQ,EAAE,aAAa,EAAE,EAAE,IAAI,CAAC,EAAE,WAAW;IAOzD,UAAU;IAGV,cAAc;IAGd,aAAa;;;;;;IAMb,iBAAiB,CAAC,IAAI,CAAC,EAAE,WAAW;IAyBpC,YAAY;IAIZ,KAAK;IAOL,qBAAqB;IAMrB,QAAQ;CAOT;AAED,eAAO,MAAM,QAAQ,iBAA0B,CAAC"}
|
|
@@ -55,9 +55,6 @@ class DiscreteSetNode {
|
|
|
55
55
|
toMathString() {
|
|
56
56
|
return `{${this.elements.map((el) => el.toTex()).join(";")}}`;
|
|
57
57
|
}
|
|
58
|
-
toMathjs() {
|
|
59
|
-
return `{${this.elements.map((el) => el.toTex()).join(";")}}`;
|
|
60
|
-
}
|
|
61
58
|
toTex() {
|
|
62
59
|
if (!this.elements.length)
|
|
63
60
|
return `\\varnothing`;
|
|
@@ -72,7 +69,9 @@ class DiscreteSetNode {
|
|
|
72
69
|
return new DiscreteSetNode(newElements);
|
|
73
70
|
}
|
|
74
71
|
simplify() {
|
|
75
|
-
return this
|
|
72
|
+
return new DiscreteSetNode(this.elements
|
|
73
|
+
.map((el) => el.simplify())
|
|
74
|
+
.sort((a, b) => a.evaluate() - b.evaluate()));
|
|
76
75
|
}
|
|
77
76
|
}
|
|
78
77
|
exports.DiscreteSetNode = DiscreteSetNode;
|
|
@@ -3,9 +3,15 @@ import { InequationNode } from "../inequations/inequationNode";
|
|
|
3
3
|
import { Node, NodeIds, NodeOptions, NodeType } from "../node";
|
|
4
4
|
import { NodeIdentifiers } from "../nodeConstructor";
|
|
5
5
|
import { ClosureType } from "./closure";
|
|
6
|
+
import { DiscreteSetNode } from "./discreteSetNode";
|
|
6
7
|
import { SetIds, SetNode } from "./setNode";
|
|
7
8
|
import { UnionIntervalNode } from "./unionIntervalNode";
|
|
8
9
|
export declare function isIntervalNode(a: Node): a is IntervalNode;
|
|
10
|
+
export declare abstract class IntervalNodeConstructor {
|
|
11
|
+
static random(): IntervalNode;
|
|
12
|
+
static differentRandoms(nb: number): IntervalNode[];
|
|
13
|
+
static fromIdentifiers(ids: IntervalNodeIdentifiers): IntervalNode;
|
|
14
|
+
}
|
|
9
15
|
export type IntervalNodeIdentifiers = {
|
|
10
16
|
id: NodeIds;
|
|
11
17
|
leftChild: NodeIdentifiers;
|
|
@@ -26,7 +32,7 @@ export declare class IntervalNode implements SetNode {
|
|
|
26
32
|
toEquivalentNodes(opts?: NodeOptions): IntervalNode[];
|
|
27
33
|
toInequality(middleChild?: AlgebraicNode): InequationNode;
|
|
28
34
|
toMathString(): string;
|
|
29
|
-
|
|
35
|
+
equals(i: IntervalNode): boolean;
|
|
30
36
|
toReversedClosure(): IntervalNode;
|
|
31
37
|
toLeftReversedClosure(): IntervalNode;
|
|
32
38
|
toRightReversedClosure(): IntervalNode;
|
|
@@ -37,5 +43,11 @@ export declare class IntervalNode implements SetNode {
|
|
|
37
43
|
toIdentifiers(): IntervalNodeIdentifiers;
|
|
38
44
|
toText(isPlural: boolean, isFeminine: boolean): string;
|
|
39
45
|
simplify(opts?: SimplifyOptions): IntervalNode;
|
|
46
|
+
isLeftClosed(): boolean;
|
|
47
|
+
isRightClosed(): boolean;
|
|
48
|
+
includes(a: AlgebraicNode): boolean;
|
|
49
|
+
isDisjoint(otherInt: IntervalNode): void;
|
|
50
|
+
intersection(otherInt: IntervalNode): DiscreteSetNode | IntervalNode;
|
|
51
|
+
union(otherInt: IntervalNode): IntervalNode | UnionIntervalNode;
|
|
40
52
|
}
|
|
41
53
|
//# sourceMappingURL=intervalNode.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intervalNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/sets/intervalNode.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"intervalNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/sets/intervalNode.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,IAA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Y,CAAC,WAAW,CAAC,EAAE,aAAa;IA4BxC,YAAY;IAIZ,MAAM,CAAC,CAAC,EAAE,YAAY;IAMtB,iBAAiB;IAGjB,qBAAqB;IAGrB,sBAAsB;IAGtB,wBAAwB;IAYxB,YAAY;IAkCZ,KAAK;IAWL,SAAS,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,MAAM,EAAE;IAOvC,aAAa,IAAI,uBAAuB;IAUxC,MAAM,CAAC,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO;IAiB7C,QAAQ,CAAC,IAAI,CAAC,EAAE,eAAe;IAS/B,YAAY;IAGZ,aAAa;IAGb,QAAQ,CAAC,CAAC,EAAE,aAAa,GAAG,OAAO;IAanC,UAAU,CAAC,QAAQ,EAAE,YAAY;IAEjC,YAAY,CAAC,QAAQ,EAAE,YAAY;IAwDnC,KAAK,CAAC,QAAQ,EAAE,YAAY,GAAG,YAAY,GAAG,iBAAiB;CAkDhE"}
|
|
@@ -1,20 +1,84 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IntervalNode = exports.isIntervalNode = void 0;
|
|
3
|
+
exports.IntervalNode = exports.IntervalNodeConstructor = exports.isIntervalNode = void 0;
|
|
4
|
+
const randint_1 = require("../../../math/utils/random/randint");
|
|
5
|
+
const coinFlip_1 = require("../../../utils/alea/coinFlip");
|
|
4
6
|
const random_1 = require("../../../utils/alea/random");
|
|
5
7
|
const cartesianProducts_1 = require("../../../utils/arrays/cartesianProducts");
|
|
6
8
|
const inequationNode_1 = require("../inequations/inequationNode");
|
|
7
9
|
const node_1 = require("../node");
|
|
10
|
+
const nodeConstructor_1 = require("../nodeConstructor");
|
|
8
11
|
const constantNode_1 = require("../numbers/constantNode");
|
|
9
12
|
const infiniteNode_1 = require("../numbers/infiniteNode");
|
|
10
13
|
const variableNode_1 = require("../variables/variableNode");
|
|
11
14
|
const closure_1 = require("./closure");
|
|
15
|
+
const discreteSetNode_1 = require("./discreteSetNode");
|
|
12
16
|
const setNode_1 = require("./setNode");
|
|
13
17
|
const unionIntervalNode_1 = require("./unionIntervalNode");
|
|
14
18
|
function isIntervalNode(a) {
|
|
15
19
|
return (0, setNode_1.isSetNode)(a) && a.id === setNode_1.SetIds.interval;
|
|
16
20
|
}
|
|
17
21
|
exports.isIntervalNode = isIntervalNode;
|
|
22
|
+
class IntervalNodeConstructor {
|
|
23
|
+
static random() {
|
|
24
|
+
const randType = (0, randint_1.randint)(0, 6);
|
|
25
|
+
let a, b;
|
|
26
|
+
let min, max, closure;
|
|
27
|
+
switch (randType) {
|
|
28
|
+
case 0:
|
|
29
|
+
min = infiniteNode_1.MinusInfinityNode;
|
|
30
|
+
max = (0, randint_1.randint)(-10, 10).toTree();
|
|
31
|
+
closure = (0, coinFlip_1.coinFlip)() ? closure_1.ClosureType.OF : closure_1.ClosureType.OO;
|
|
32
|
+
break;
|
|
33
|
+
case 1:
|
|
34
|
+
min = (0, randint_1.randint)(-10, 10).toTree();
|
|
35
|
+
max = infiniteNode_1.PlusInfinityNode;
|
|
36
|
+
closure = (0, coinFlip_1.coinFlip)() ? closure_1.ClosureType.OO : closure_1.ClosureType.FO;
|
|
37
|
+
break;
|
|
38
|
+
case 2:
|
|
39
|
+
a = (0, randint_1.randint)(-10, 10);
|
|
40
|
+
min = a.toTree();
|
|
41
|
+
max = (0, randint_1.randint)(a + 1, a + 10).toTree();
|
|
42
|
+
closure = closure_1.ClosureType.FF;
|
|
43
|
+
break;
|
|
44
|
+
case 3:
|
|
45
|
+
a = (0, randint_1.randint)(-10, 10);
|
|
46
|
+
min = a.toTree();
|
|
47
|
+
max = (0, randint_1.randint)(a + 1, a + 10).toTree();
|
|
48
|
+
closure = closure_1.ClosureType.OF;
|
|
49
|
+
break;
|
|
50
|
+
case 4:
|
|
51
|
+
a = (0, randint_1.randint)(-10, 10);
|
|
52
|
+
min = a.toTree();
|
|
53
|
+
max = (0, randint_1.randint)(a + 1, a + 10).toTree();
|
|
54
|
+
closure = closure_1.ClosureType.FO;
|
|
55
|
+
break;
|
|
56
|
+
case 5:
|
|
57
|
+
default:
|
|
58
|
+
a = (0, randint_1.randint)(-10, 10);
|
|
59
|
+
min = a.toTree();
|
|
60
|
+
max = (0, randint_1.randint)(a + 1, a + 10).toTree();
|
|
61
|
+
closure = closure_1.ClosureType.OO;
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
return new IntervalNode(min, max, closure);
|
|
65
|
+
}
|
|
66
|
+
static differentRandoms(nb) {
|
|
67
|
+
const res = [];
|
|
68
|
+
for (let i = 0; i < nb; i++) {
|
|
69
|
+
let interval;
|
|
70
|
+
do {
|
|
71
|
+
interval = this.random();
|
|
72
|
+
} while (res.some((int) => int.equals(interval)));
|
|
73
|
+
res.push(this.random());
|
|
74
|
+
}
|
|
75
|
+
return res;
|
|
76
|
+
}
|
|
77
|
+
static fromIdentifiers(ids) {
|
|
78
|
+
return new IntervalNode((0, nodeConstructor_1.reifyAlgebraic)(ids.leftChild), (0, nodeConstructor_1.reifyAlgebraic)(ids.rightChild), ids.closure, ids.opts);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
exports.IntervalNodeConstructor = IntervalNodeConstructor;
|
|
18
82
|
class IntervalNode {
|
|
19
83
|
constructor(a, b, closure, opts) {
|
|
20
84
|
this.type = node_1.NodeType.set;
|
|
@@ -59,8 +123,8 @@ class IntervalNode {
|
|
|
59
123
|
toMathString() {
|
|
60
124
|
return this.toTex();
|
|
61
125
|
}
|
|
62
|
-
|
|
63
|
-
return this.
|
|
126
|
+
equals(i) {
|
|
127
|
+
return (i.a.equals(this.a) && i.b.equals(this.b) && i.closure === this.closure);
|
|
64
128
|
}
|
|
65
129
|
toReversedClosure() {
|
|
66
130
|
return new IntervalNode(this.a, this.b, closure_1.Closure.reverse(this.closure));
|
|
@@ -140,5 +204,92 @@ class IntervalNode {
|
|
|
140
204
|
simplify(opts) {
|
|
141
205
|
return new IntervalNode(this.a.simplify(opts), this.b.simplify(opts), this.closure, this.opts);
|
|
142
206
|
}
|
|
207
|
+
isLeftClosed() {
|
|
208
|
+
return this.closure === closure_1.ClosureType.FF || this.closure === closure_1.ClosureType.FO;
|
|
209
|
+
}
|
|
210
|
+
isRightClosed() {
|
|
211
|
+
return this.closure === closure_1.ClosureType.FF || this.closure === closure_1.ClosureType.OF;
|
|
212
|
+
}
|
|
213
|
+
includes(a) {
|
|
214
|
+
const ev = a.evaluate();
|
|
215
|
+
const aEv = this.a.evaluate();
|
|
216
|
+
const bEv = this.b.evaluate();
|
|
217
|
+
if (ev === Number.NEGATIVE_INFINITY)
|
|
218
|
+
return aEv === Number.NEGATIVE_INFINITY;
|
|
219
|
+
if (ev === Number.POSITIVE_INFINITY)
|
|
220
|
+
return bEv === Number.POSITIVE_INFINITY;
|
|
221
|
+
if (Math.abs(ev - aEv) < 0.0000000001)
|
|
222
|
+
return this.isLeftClosed();
|
|
223
|
+
if (Math.abs(ev - bEv) < 0.0000000001)
|
|
224
|
+
return this.isRightClosed();
|
|
225
|
+
return ev > aEv && ev < bEv;
|
|
226
|
+
}
|
|
227
|
+
isDisjoint(otherInt) { }
|
|
228
|
+
intersection(otherInt) {
|
|
229
|
+
const [thisA, thisB] = [this.a.evaluate(), this.b.evaluate()];
|
|
230
|
+
const [otherA, otherB] = [otherInt.a.evaluate(), otherInt.b.evaluate()];
|
|
231
|
+
const ordered = thisA < otherA ? [this, otherInt] : [otherInt, this];
|
|
232
|
+
const orderedEv = ordered.map((e) => {
|
|
233
|
+
return [e.a.evaluate(), e.b.evaluate()];
|
|
234
|
+
});
|
|
235
|
+
const orderedBrackets = ordered.map((int) => closure_1.Closure.toBrackets(int.closure));
|
|
236
|
+
if (ordered[0].includes(ordered[1].a) ||
|
|
237
|
+
Math.abs(thisA - otherA) < 0.0000000001) {
|
|
238
|
+
if (Math.abs(orderedEv[0][1] - orderedEv[1][0]) < 0.0000000001) {
|
|
239
|
+
return new discreteSetNode_1.DiscreteSetNode([ordered[1].a]);
|
|
240
|
+
}
|
|
241
|
+
let leftBracket = "[";
|
|
242
|
+
if (Math.abs(thisA - otherA) < 0.0000000001) {
|
|
243
|
+
leftBracket = closure_1.Closure.getMostLeftStrict(orderedBrackets[0][0], orderedBrackets[1][0]);
|
|
244
|
+
}
|
|
245
|
+
else
|
|
246
|
+
leftBracket = orderedBrackets[1][0];
|
|
247
|
+
let rightBracket = "[";
|
|
248
|
+
if (Math.abs(thisB - otherB) < 0.0000000001) {
|
|
249
|
+
rightBracket = closure_1.Closure.getMostRightStrict(orderedBrackets[0][1], orderedBrackets[1][1]);
|
|
250
|
+
return new IntervalNode(ordered[1].a, ordered[1].b, closure_1.Closure.fromBrackets(leftBracket, rightBracket));
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
const rightBornIndex = ordered[0].b.evaluate() < ordered[1].b.evaluate() ? 0 : 1;
|
|
254
|
+
const right = ordered[rightBornIndex].b;
|
|
255
|
+
rightBracket = orderedBrackets[rightBornIndex][1];
|
|
256
|
+
return new IntervalNode(ordered[1].a, right, closure_1.Closure.fromBrackets(leftBracket, rightBracket));
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
else {
|
|
260
|
+
return discreteSetNode_1.EmptySet;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
union(otherInt) {
|
|
264
|
+
const [thisA, thisB] = [this.a.evaluate(), this.b.evaluate()];
|
|
265
|
+
const [otherA, otherB] = [otherInt.a.evaluate(), otherInt.b.evaluate()];
|
|
266
|
+
const ordered = thisA < otherA ? [this, otherInt] : [otherInt, this];
|
|
267
|
+
const orderedBrackets = ordered.map((int) => closure_1.Closure.toBrackets(int.closure));
|
|
268
|
+
if (ordered[0].includes(ordered[1].a) ||
|
|
269
|
+
ordered[1].includes(ordered[0].b) ||
|
|
270
|
+
ordered[1].includes(ordered[0].a) ||
|
|
271
|
+
Math.abs(thisA - otherA) < 0.0000000001) {
|
|
272
|
+
let leftBracket = "[";
|
|
273
|
+
if (Math.abs(thisA - otherA) < 0.0000000001) {
|
|
274
|
+
leftBracket = closure_1.Closure.getLessLeftStrict(orderedBrackets[0][0], orderedBrackets[1][0]);
|
|
275
|
+
}
|
|
276
|
+
else
|
|
277
|
+
leftBracket = orderedBrackets[0][0];
|
|
278
|
+
let rightBracket = "[";
|
|
279
|
+
if (Math.abs(thisB - otherB) < 0.0000000001) {
|
|
280
|
+
rightBracket = closure_1.Closure.getLessRightStrict(orderedBrackets[0][1], orderedBrackets[1][1]);
|
|
281
|
+
return new IntervalNode(ordered[0].a, ordered[1].b, closure_1.Closure.fromBrackets(leftBracket, rightBracket));
|
|
282
|
+
}
|
|
283
|
+
else {
|
|
284
|
+
const rightBornIndex = ordered[0].b.evaluate() > ordered[1].b.evaluate() ? 0 : 1;
|
|
285
|
+
const right = ordered[rightBornIndex].b;
|
|
286
|
+
rightBracket = orderedBrackets[rightBornIndex][1];
|
|
287
|
+
return new IntervalNode(ordered[0].a, right, closure_1.Closure.fromBrackets(leftBracket, rightBracket));
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
else {
|
|
291
|
+
return new unionIntervalNode_1.UnionIntervalNode([ordered[0], ordered[1]], this.opts);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
143
294
|
}
|
|
144
295
|
exports.IntervalNode = IntervalNode;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const discreteSetParser: (str: string) => false |
|
|
1
|
+
import { DiscreteSetNode } from "../nodes/sets/discreteSetNode";
|
|
2
|
+
export declare const discreteSetParser: (str: string) => false | DiscreteSetNode;
|
|
3
3
|
//# sourceMappingURL=discreteSetParser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discreteSetParser.d.ts","sourceRoot":"","sources":["../../../src/tree/parsers/discreteSetParser.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"discreteSetParser.d.ts","sourceRoot":"","sources":["../../../src/tree/parsers/discreteSetParser.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAIhE,eAAO,MAAM,iBAAiB,QAAS,MAAM,4BAe5C,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.discreteSetParser = void 0;
|
|
4
|
+
const discreteSetNode_1 = require("../nodes/sets/discreteSetNode");
|
|
4
5
|
const latexParser_1 = require("./latexParser");
|
|
5
6
|
const discreteSetParser = (str) => {
|
|
6
7
|
try {
|
|
@@ -14,7 +15,7 @@ const discreteSetParser = (str) => {
|
|
|
14
15
|
const elements = formated.split(";").map((e) => (0, latexParser_1.parseAlgebraic)(e));
|
|
15
16
|
if (elements.some((e) => !e))
|
|
16
17
|
return false;
|
|
17
|
-
return elements;
|
|
18
|
+
return new discreteSetNode_1.DiscreteSetNode(elements);
|
|
18
19
|
}
|
|
19
20
|
catch (err) {
|
|
20
21
|
return false;
|
|
@@ -17,7 +17,7 @@ const equationSolutionParser = (str, variable = "x") => {
|
|
|
17
17
|
: undefined;
|
|
18
18
|
if (varNode === undefined)
|
|
19
19
|
return false;
|
|
20
|
-
if (children[varNode].name !==
|
|
20
|
+
if (children[varNode].name !== variable)
|
|
21
21
|
return false;
|
|
22
22
|
const scalar = children[(varNode + 1) % 2];
|
|
23
23
|
if (!(0, algebraicNode_1.isAlgebraicNode)(scalar) || !scalar.isNumeric)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const powerParser: (ans: string) => false | import("../nodes/
|
|
1
|
+
export declare const powerParser: (ans: string) => false | import("../nodes/functions/sqrtNode").SqrtNode | import("../nodes/operators/powerNode").PowerNode | import("../nodes/operators/fractionNode").FractionNode;
|
|
2
2
|
//# sourceMappingURL=powerParser.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { FractionNode } from "../nodes/operators/fractionNode";
|
|
2
|
-
export declare const rationalParser: (ans: string) => false | import("../nodes/numbers/constantNode").ConstantNode | import("../nodes/numbers/numberNode").NumberNode |
|
|
2
|
+
export declare const rationalParser: (ans: string) => false | import("../nodes/numbers/constantNode").ConstantNode | import("../nodes/numbers/numberNode").NumberNode | import("../nodes/functions/oppositeNode").OppositeNode<import("../nodes/algebraicNode").AlgebraicNode> | FractionNode;
|
|
3
3
|
//# sourceMappingURL=rationalParser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unionIntervalParser.d.ts","sourceRoot":"","sources":["../../../src/tree/parsers/unionIntervalParser.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAIpE,KAAK,IAAI,GAAG;IACV,4BAA4B,CAAC,EAAE,OAAO,CAAC;IACvC,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AACF,eAAO,MAAM,mBAAmB,QAAS,MAAM,SAAS,IAAI,
|
|
1
|
+
{"version":3,"file":"unionIntervalParser.d.ts","sourceRoot":"","sources":["../../../src/tree/parsers/unionIntervalParser.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAIpE,KAAK,IAAI,GAAG;IACV,4BAA4B,CAAC,EAAE,OAAO,CAAC;IACvC,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AACF,eAAO,MAAM,mBAAmB,QAAS,MAAM,SAAS,IAAI,6CAmB3D,CAAC"}
|
|
@@ -17,7 +17,9 @@ const unionIntervalParser = (ans, opts) => {
|
|
|
17
17
|
return false;
|
|
18
18
|
if (intervals.length === 1)
|
|
19
19
|
return intervals[0];
|
|
20
|
-
return new unionIntervalNode_1.UnionIntervalNode(intervals)
|
|
20
|
+
return new unionIntervalNode_1.UnionIntervalNode(intervals.sort((a, b) => {
|
|
21
|
+
return a.a.evaluate() - b.a.evaluate();
|
|
22
|
+
}));
|
|
21
23
|
}
|
|
22
24
|
catch (err) {
|
|
23
25
|
return false;
|