math-exercises 2.2.94 → 2.2.96
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/fractions/fractionSquare.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionSquare.js +2 -1
- package/lib/exercises/math/calcul/fractions/fractionsSum.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionsSum.js +2 -1
- package/lib/exercises/math/calcul/fractions/fractionsSumsMultiplesDenominators.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionsSumsMultiplesDenominators.js +2 -1
- package/lib/exercises/math/calcul/fractions/fractionsSumsPrimeDenominators.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionsSumsPrimeDenominators.js +2 -1
- package/lib/exercises/math/calcul/fractions/fractionsSumsSameDenominators.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionsSumsSameDenominators.js +2 -1
- package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.d.ts.map +1 -1
- package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.js +2 -1
- package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivityWithCoeff.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivityWithCoeff.js +0 -4
- package/lib/exercises/math/calculLitteral/distributivity/firstIdentity.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/distributivity/firstIdentity.js +82 -34
- package/lib/exercises/math/calculLitteral/distributivity/identitiesWithNonIntegers.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/distributivity/identitiesWithNonIntegers.js +2 -1
- package/lib/exercises/math/calculLitteral/distributivity/secondIdentity.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/distributivity/secondIdentity.js +86 -36
- package/lib/exercises/math/calculLitteral/distributivity/thirdIdentity.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/distributivity/thirdIdentity.js +82 -32
- package/lib/exercises/math/calculLitteral/equation/equationSimpleSquare.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equationSimpleSquare.js +2 -1
- package/lib/exercises/math/calculLitteral/factorisation/factoByX.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/factorisation/factoByX.js +2 -1
- package/lib/exercises/math/calculLitteral/factorisation/factoIdRmq1.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/factorisation/factoIdRmq1.js +2 -1
- package/lib/exercises/math/calculLitteral/factorisation/factoIdRmq2.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/factorisation/factoIdRmq2.js +2 -1
- package/lib/exercises/math/calculLitteral/factorisation/factoIdRmq3.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/factorisation/factoIdRmq3.js +2 -1
- package/lib/exercises/math/calculLitteral/factorisation/factoType1Exercise.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/factorisation/factoType1Exercise.js +3 -1
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType0.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType0.js +2 -1
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType1.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType1.js +2 -1
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType2.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType2.js +2 -1
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType3.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType3.js +2 -1
- package/lib/exercises/math/calculLitteral/inequations/squareFunctionInequation.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/inequations/squareFunctionInequation.js +2 -1
- package/lib/exercises/math/calculLitteral/simplifying/distributeAndSimplify.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/simplifying/distributeAndSimplify.js +38 -16
- package/lib/exercises/math/calculLitteral/simplifying/reduceExpression.d.ts +3 -3
- package/lib/exercises/math/calculLitteral/simplifying/reduceExpression.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/simplifying/reduceExpression.js +171 -75
- package/lib/exercises/math/dataReading/index.d.ts +2 -0
- package/lib/exercises/math/dataReading/index.d.ts.map +1 -0
- package/lib/exercises/math/dataReading/index.js +17 -0
- package/lib/exercises/math/dataReading/tableReading.d.ts +8 -0
- package/lib/exercises/math/dataReading/tableReading.d.ts.map +1 -0
- package/lib/exercises/math/dataReading/tableReading.js +105 -0
- package/lib/exercises/math/derivation/derivative/convexityQuadrinomials.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/convexityQuadrinomials.js +2 -1
- package/lib/exercises/math/derivation/derivative/expDerivativeFour.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/expDerivativeFour.js +2 -1
- package/lib/exercises/math/derivation/derivative/expDerivativeThree.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/expDerivativeThree.js +2 -1
- package/lib/exercises/math/derivation/derivative/lnDerivativeThree.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/lnDerivativeThree.js +2 -1
- package/lib/exercises/math/derivation/derivative/powerCompositionDerivation.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/powerCompositionDerivation.js +75 -11
- package/lib/exercises/math/derivation/derivative/quotientDerivative.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/quotientDerivative.js +2 -1
- package/lib/exercises/math/derivation/derivative/rootFunctionDerivative.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/rootFunctionDerivative.js +2 -1
- package/lib/exercises/math/derivation/derivative/sqrtCompositionDerivation.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/sqrtCompositionDerivation.js +2 -1
- package/lib/exercises/math/derivation/derivative/thirdDegreeDerivative.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/thirdDegreeDerivative.js +2 -1
- package/lib/exercises/math/derivation/derivative/thirdDegreeFunctionVariation.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/thirdDegreeFunctionVariation.js +2 -1
- package/lib/exercises/math/functions/absolute/absolueValueAffineEquation.d.ts.map +1 -1
- package/lib/exercises/math/functions/absolute/absolueValueAffineEquation.js +2 -1
- package/lib/exercises/math/functions/absolute/absolueValueInequationsSup.d.ts.map +1 -1
- package/lib/exercises/math/functions/absolute/absolueValueInequationsSup.js +2 -1
- package/lib/exercises/math/functions/absolute/absoluteValueInequations.d.ts.map +1 -1
- package/lib/exercises/math/functions/absolute/absoluteValueInequations.js +2 -1
- package/lib/exercises/math/functions/affines/affineExpressionFromTwoImages.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/affineExpressionFromTwoImages.js +2 -2
- package/lib/exercises/math/functions/affines/affineExpressionReading.js +2 -1
- package/lib/exercises/math/functions/affines/signFunction.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/signFunction.js +2 -1
- package/lib/exercises/math/functions/basics/graphicEquation.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/graphicEquation.js +2 -1
- package/lib/exercises/math/functions/basics/graphicInequation.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/graphicInequation.js +2 -1
- package/lib/exercises/math/functions/basics/graphicInequationAffine.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/graphicInequationAffine.js +2 -1
- package/lib/exercises/math/functions/basics/imageFunction.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/imageFunction.js +2 -1
- package/lib/exercises/math/functions/basics/twoFunctionsInequation.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/twoFunctionsInequation.js +2 -1
- package/lib/exercises/math/functions/exponential/expEquation.d.ts.map +1 -1
- package/lib/exercises/math/functions/exponential/expEquation.js +2 -1
- package/lib/exercises/math/functions/logarithm/logPowerEquation.d.ts.map +1 -1
- package/lib/exercises/math/functions/logarithm/logPowerEquation.js +2 -1
- package/lib/exercises/math/functions/sign/affineProductSign.d.ts.map +1 -1
- package/lib/exercises/math/functions/sign/affineProductSign.js +2 -1
- package/lib/exercises/math/functions/square/squareImageInterval.d.ts.map +1 -1
- package/lib/exercises/math/functions/square/squareImageInterval.js +2 -1
- package/lib/exercises/math/functions/trinoms/coefficientsIdentification.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/coefficientsIdentification.js +2 -1
- package/lib/exercises/math/functions/trinoms/secondDegreeInequation.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/secondDegreeInequation.js +2 -1
- package/lib/exercises/math/functions/trinoms/trinomSignFromRoots.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/trinomSignFromRoots.js +2 -1
- package/lib/exercises/math/geometry/cartesian/readAbscissOnLine.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/readAbscissOnLine.js +2 -1
- package/lib/exercises/math/geometry/cartesian/readAbscissOnSemiLine.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/readAbscissOnSemiLine.js +2 -1
- package/lib/exercises/math/geometry/convexity/convexityQuadrinomialsGeo.d.ts.map +1 -1
- package/lib/exercises/math/geometry/convexity/convexityQuadrinomialsGeo.js +2 -1
- package/lib/exercises/math/geometry/parametric/extractPointFromParametricLine.d.ts.map +1 -1
- package/lib/exercises/math/geometry/parametric/extractPointFromParametricLine.js +2 -1
- package/lib/exercises/math/geometry/parametric/extractVectorFromParametricLine.d.ts.map +1 -1
- package/lib/exercises/math/geometry/parametric/extractVectorFromParametricLine.js +2 -1
- package/lib/exercises/math/index.d.ts +1 -0
- package/lib/exercises/math/index.d.ts.map +1 -1
- package/lib/exercises/math/index.js +1 -0
- package/lib/exercises/math/matrices/matrixInversibilityDomain.d.ts.map +1 -1
- package/lib/exercises/math/matrices/matrixInversibilityDomain.js +2 -1
- package/lib/exercises/math/percent/index.d.ts +1 -0
- package/lib/exercises/math/percent/index.d.ts.map +1 -1
- package/lib/exercises/math/percent/index.js +1 -1
- package/lib/exercises/math/percent/percentWritings.d.ts.map +1 -1
- package/lib/exercises/math/percent/percentWritings.js +10 -1
- package/lib/exercises/math/powers/powersMixOperations.d.ts.map +1 -1
- package/lib/exercises/math/powers/powersMixOperations.js +2 -1
- package/lib/exercises/math/probaStat/diceBasicProbas.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/diceBasicProbas.js +72 -20
- package/lib/exercises/math/probaStat/probabilityTree.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/probabilityTree.js +2 -1
- package/lib/exercises/math/sampling/confidenceInterval.d.ts.map +1 -1
- package/lib/exercises/math/sampling/confidenceInterval.js +2 -1
- package/lib/exercises/math/sampling/fluctuationInterval.d.ts.map +1 -1
- package/lib/exercises/math/sampling/fluctuationInterval.js +2 -1
- package/lib/exercises/math/sequences/geometric/geometricExplicitFormulaUsage.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/geometricExplicitFormulaUsage.js +2 -1
- package/lib/exercises/math/sets/intervals/inequalityToInterval.d.ts.map +1 -1
- package/lib/exercises/math/sets/intervals/inequalityToInterval.js +2 -1
- package/lib/exercises/math/sets/intervals/intervalsIntersection.d.ts.map +1 -1
- package/lib/exercises/math/sets/intervals/intervalsIntersection.js +2 -1
- package/lib/exercises/math/sets/intervals/intervalsUnion.d.ts.map +1 -1
- package/lib/exercises/math/sets/intervals/intervalsUnion.js +2 -1
- package/lib/exercises/math/trigonometry/degreeToRadians.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/degreeToRadians.js +2 -1
- package/lib/exercises/math/trigonometry/mainAngleMeasure.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/mainAngleMeasure.js +2 -1
- package/lib/exercises/vea/equationVEA.d.ts.map +1 -1
- package/lib/exercises/vea/equationVEA.js +2 -1
- package/lib/exercises/vea/rationalVEA.d.ts.map +1 -1
- package/lib/exercises/vea/rationalVEA.js +3 -2
- package/lib/exercises/vea/sqrtVEA.d.ts.map +1 -1
- package/lib/exercises/vea/sqrtVEA.js +2 -1
- package/lib/index.d.ts +9 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/tree/nodes/algebraicNode.d.ts +1 -0
- package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/addNode.d.ts +2 -1
- package/lib/tree/nodes/operators/addNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/addNode.js +22 -4
- package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/fractionNode.js +1 -1
- package/lib/tree/nodes/operators/multiplyNode.d.ts +2 -1
- package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/multiplyNode.js +13 -1
- package/lib/tree/nodes/operators/operatorNode.d.ts +5 -0
- package/lib/tree/nodes/operators/operatorNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/operatorNode.js +5 -1
- package/lib/tree/nodes/polynomials/monomNode.d.ts +2 -6
- package/lib/tree/nodes/polynomials/monomNode.d.ts.map +1 -1
- package/lib/tree/nodes/polynomials/monomNode.js +102 -94
- package/lib/tree/parsers/affineParser.d.ts +1 -1
- package/lib/tree/parsers/affineParser.d.ts.map +1 -1
- package/lib/tree/parsers/affineParser.js +18 -22
- package/lib/tree/parsers/discreteSetParser.d.ts.map +1 -1
- package/lib/tree/parsers/discreteSetParser.js +2 -1
- package/lib/tree/parsers/equationSolutionParser.d.ts.map +1 -1
- package/lib/tree/parsers/equationSolutionParser.js +2 -1
- package/lib/tree/parsers/inequationParser.d.ts.map +1 -1
- package/lib/tree/parsers/inequationParser.js +2 -1
- package/lib/tree/parsers/intervalParser.d.ts.map +1 -1
- package/lib/tree/parsers/intervalParser.js +3 -2
- package/lib/tree/parsers/latexParser.js +3 -3
- package/lib/tree/parsers/monomParser.d.ts.map +1 -1
- package/lib/tree/parsers/monomParser.js +2 -1
- package/lib/tree/parsers/polynomialParser.d.ts +5 -1
- package/lib/tree/parsers/polynomialParser.d.ts.map +1 -1
- package/lib/tree/parsers/polynomialParser.js +5 -4
- package/lib/tree/parsers/powerParser.d.ts.map +1 -1
- package/lib/tree/parsers/powerParser.js +2 -1
- package/lib/tree/parsers/purifyLatex.d.ts +1 -1
- package/lib/tree/parsers/purifyLatex.js +1 -1
- package/lib/tree/parsers/sqrtParser.d.ts.map +1 -1
- package/lib/tree/parsers/sqrtParser.js +2 -1
- package/lib/tree/parsers/trinomParser.d.ts.map +1 -1
- package/lib/tree/parsers/trinomParser.js +2 -1
- package/lib/tree/parsers/unionIntervalParser.d.ts.map +1 -1
- package/lib/tree/parsers/unionIntervalParser.js +2 -1
- package/lib/utils/alea/random.js +1 -1
- package/lib/utils/alea/shuffle.js +1 -1
- package/lib/utils/errors/handleVEAError.d.ts +2 -0
- package/lib/utils/errors/handleVEAError.d.ts.map +1 -0
- package/lib/utils/errors/handleVEAError.js +9 -0
- package/package.json +1 -1
|
@@ -4,6 +4,7 @@ exports.rationalVEA = void 0;
|
|
|
4
4
|
const numberNode_1 = require("../../tree/nodes/numbers/numberNode");
|
|
5
5
|
const latexParser_1 = require("../../tree/parsers/latexParser");
|
|
6
6
|
const rationalParser_1 = require("../../tree/parsers/rationalParser");
|
|
7
|
+
const handleVEAError_1 = require("../../utils/errors/handleVEAError");
|
|
7
8
|
const rationalVEA = (studentAns, answer, { allowNonIrreductible, decimalPrecision, allowDecimal } = {
|
|
8
9
|
allowNonIrreductible: true,
|
|
9
10
|
decimalPrecision: undefined,
|
|
@@ -26,7 +27,7 @@ const rationalVEA = (studentAns, answer, { allowNonIrreductible, decimalPrecisio
|
|
|
26
27
|
//! accepte bien les arrondis au centième par ex, mais va aussi accepter les arrondis au millième
|
|
27
28
|
//! je juge ca ok
|
|
28
29
|
return (Math.abs(parsed.evaluate() - parsedAnswer.evaluate()) <
|
|
29
|
-
Math.pow(10, -decimalPrecision
|
|
30
|
+
Math.pow(10, -decimalPrecision));
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
33
|
else if (allowNonIrreductible) {
|
|
@@ -38,7 +39,7 @@ const rationalVEA = (studentAns, answer, { allowNonIrreductible, decimalPrecisio
|
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
41
|
catch (err) {
|
|
41
|
-
return
|
|
42
|
+
return (0, handleVEAError_1.handleVEAError)(err);
|
|
42
43
|
}
|
|
43
44
|
};
|
|
44
45
|
exports.rationalVEA = rationalVEA;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqrtVEA.d.ts","sourceRoot":"","sources":["../../../src/exercises/vea/sqrtVEA.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sqrtVEA.d.ts","sourceRoot":"","sources":["../../../src/exercises/vea/sqrtVEA.ts"],"names":[],"mappings":"AAOA,KAAK,IAAI,GAAG;IACV,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC;AACF,eAAO,MAAM,OAAO,eACN,MAAM,UACV,MAAM,mDACkC,IAAI,YA0BrD,CAAC"}
|
|
@@ -4,6 +4,7 @@ exports.sqrtVEA = void 0;
|
|
|
4
4
|
const numberNode_1 = require("../../tree/nodes/numbers/numberNode");
|
|
5
5
|
const latexParser_1 = require("../../tree/parsers/latexParser");
|
|
6
6
|
const sqrtParser_1 = require("../../tree/parsers/sqrtParser");
|
|
7
|
+
const handleVEAError_1 = require("../../utils/errors/handleVEAError");
|
|
7
8
|
const sqrtVEA = (studentAns, answer, { allowNonIrreductible, decimalApproxAllowed } = {
|
|
8
9
|
allowNonIrreductible: true,
|
|
9
10
|
}) => {
|
|
@@ -27,7 +28,7 @@ const sqrtVEA = (studentAns, answer, { allowNonIrreductible, decimalApproxAllowe
|
|
|
27
28
|
}
|
|
28
29
|
}
|
|
29
30
|
catch (err) {
|
|
30
|
-
return
|
|
31
|
+
return (0, handleVEAError_1.handleVEAError)(err);
|
|
31
32
|
}
|
|
32
33
|
};
|
|
33
34
|
exports.sqrtVEA = sqrtVEA;
|
package/lib/index.d.ts
CHANGED
|
@@ -382,9 +382,9 @@ declare const mathExercises: (Exercise<{
|
|
|
382
382
|
poly2: number[];
|
|
383
383
|
xValue: number;
|
|
384
384
|
}, {}> | Exercise<{
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
385
|
+
variable: string;
|
|
386
|
+
coeffs: number[][];
|
|
387
|
+
order: number[];
|
|
388
388
|
}, {}> | Exercise<{
|
|
389
389
|
firstTermIsAffine: boolean;
|
|
390
390
|
a: number;
|
|
@@ -1336,6 +1336,9 @@ declare const mathExercises: (Exercise<{
|
|
|
1336
1336
|
price: number;
|
|
1337
1337
|
evolution: number;
|
|
1338
1338
|
askingFinalPrice: boolean;
|
|
1339
|
+
}, {}> | Exercise<{
|
|
1340
|
+
percent: number;
|
|
1341
|
+
target: "percentToDecimal" | "decimalToPercent" | "fractionToPercent" | "percentToFraction";
|
|
1339
1342
|
}, {}> | Exercise<{
|
|
1340
1343
|
int: number;
|
|
1341
1344
|
power: number;
|
|
@@ -1813,6 +1816,9 @@ declare const mathExercises: (Exercise<{
|
|
|
1813
1816
|
n: number;
|
|
1814
1817
|
isRepresentative: boolean;
|
|
1815
1818
|
wordingType: number;
|
|
1819
|
+
}, {}> | Exercise<{
|
|
1820
|
+
values: number[][];
|
|
1821
|
+
caseAsked: number;
|
|
1816
1822
|
}, {}>)[];
|
|
1817
1823
|
declare const pcExercises: (Exercise<{
|
|
1818
1824
|
numbers: number[];
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAG1D,OAAO,yBAAyB,CAAC;AAEjC,QAAA,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,E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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAA6B,CAAC;AAE/C,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -8,6 +8,7 @@ export type SimplifyOptions = {
|
|
|
8
8
|
towardsDistribute?: boolean;
|
|
9
9
|
decimalToFractions?: boolean;
|
|
10
10
|
forceIsolateMonomCoeffs?: boolean;
|
|
11
|
+
forbidAdditions?: boolean;
|
|
11
12
|
};
|
|
12
13
|
export interface AlgebraicNode extends Node {
|
|
13
14
|
evaluate: (vars?: Record<string, number>) => number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"algebraicNode.d.ts","sourceRoot":"","sources":["../../../src/tree/nodes/algebraicNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAE3C,MAAM,MAAM,eAAe,GAAG;IAC5B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,uBAAuB,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"algebraicNode.d.ts","sourceRoot":"","sources":["../../../src/tree/nodes/algebraicNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAE3C,MAAM,MAAM,eAAe,GAAG;IAC5B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AACF,MAAM,WAAW,aAAc,SAAQ,IAAI;IACzC,QAAQ,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,MAAM,CAAC;IACpD,oBAAoB,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,KAAK,aAAa,CAAC;IAC7E,iBAAiB,EAAE,CAAC,IAAI,CAAC,EAAE,WAAW,KAAK,aAAa,EAAE,CAAC;IAC3D,QAAQ,EAAE,CAAC,IAAI,CAAC,EAAE,eAAe,KAAK,aAAa,CAAC;IACpD,MAAM,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,OAAO,CAAC;IACzC,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,KAAK,aAAa,CAAC;CACjD;AAED,eAAO,MAAM,eAAe,SAAU,IAAI,0BACA,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Node, NodeIds, NodeOptions, NodeType, ToTexOptions } from "../node";
|
|
2
|
-
import { CommutativeOperatorNode, OperatorIds } from "./operatorNode";
|
|
2
|
+
import { CommutativeOperatorNode, DeepShuffleOpts, OperatorIds } from "./operatorNode";
|
|
3
3
|
import { AlgebraicNode, SimplifyOptions } from "../algebraicNode";
|
|
4
4
|
export declare function isAddNode(a: Node): a is AddNode;
|
|
5
5
|
export declare const add: (a: AlgebraicNode | number | string, b: AlgebraicNode | number | string) => AddNode;
|
|
@@ -12,6 +12,7 @@ export declare class AddNode implements CommutativeOperatorNode {
|
|
|
12
12
|
isNumeric: boolean;
|
|
13
13
|
constructor(leftChild: AlgebraicNode, rightChild: AlgebraicNode, opts?: NodeOptions);
|
|
14
14
|
shuffle: () => void;
|
|
15
|
+
deepShuffle: (opts?: DeepShuffleOpts) => AddNode;
|
|
15
16
|
toMathString(): string;
|
|
16
17
|
toEquivalentNodes(opts?: NodeOptions): AlgebraicNode[];
|
|
17
18
|
toAllTexs(): string[];
|
|
@@ -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,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EACL,uBAAuB,EACvB,WAAW,
|
|
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,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EACL,uBAAuB,EACvB,eAAe,EACf,WAAW,EAIZ,MAAM,gBAAgB,CAAC;AAKxB,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAYlE,wBAAgB,SAAS,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,OAAO,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
const left = (0, operatorNode_1.isCommutativeOperatorNode)(this.leftChild)
|
|
37
|
+
? this.leftChild.deepShuffle(opts)
|
|
38
|
+
: this.leftChild;
|
|
39
|
+
const right = (0, operatorNode_1.isCommutativeOperatorNode)(this.rightChild)
|
|
40
|
+
? this.rightChild.deepShuffle(opts)
|
|
41
|
+
: this.rightChild;
|
|
42
|
+
if ((0, coinFlip_1.coinFlip)() && (!opts || opts?.nodeIdsToShuffle?.includes(this.id)))
|
|
43
|
+
return new AddNode(right, left, this.opts);
|
|
44
|
+
else
|
|
45
|
+
return new AddNode(left, right, this.opts);
|
|
46
|
+
};
|
|
35
47
|
this.id = operatorNode_1.OperatorIds.add;
|
|
36
48
|
this.leftChild = leftChild;
|
|
37
49
|
this.rightChild = rightChild;
|
|
@@ -131,13 +143,19 @@ class AddNode {
|
|
|
131
143
|
if (externals.length === 1)
|
|
132
144
|
return externals[0];
|
|
133
145
|
const simplifyExternalNodes = (a, b) => {
|
|
134
|
-
const fracSimplify =
|
|
146
|
+
const fracSimplify = opts?.forbidAdditions
|
|
147
|
+
? undefined
|
|
148
|
+
: addSimplifyFrac(a, b, opts);
|
|
135
149
|
if (fracSimplify)
|
|
136
150
|
return fracSimplify;
|
|
137
|
-
const nbSimplify =
|
|
151
|
+
const nbSimplify = opts?.forbidAdditions
|
|
152
|
+
? undefined
|
|
153
|
+
: addSimplifyNumbers(a, b, opts);
|
|
138
154
|
if (nbSimplify)
|
|
139
155
|
return nbSimplify;
|
|
140
|
-
const monomSimplify =
|
|
156
|
+
const monomSimplify = opts?.forbidAdditions
|
|
157
|
+
? undefined
|
|
158
|
+
: addSimplifyMonoms(a, b, opts);
|
|
141
159
|
if (monomSimplify)
|
|
142
160
|
return monomSimplify;
|
|
143
161
|
//TODO gérer le reste
|
|
@@ -225,7 +243,7 @@ class AddNode {
|
|
|
225
243
|
const simplifyIteration = () => {
|
|
226
244
|
counter++;
|
|
227
245
|
if (counter > 1000)
|
|
228
|
-
throw new Error("Too many iterations in simplify");
|
|
246
|
+
throw new Error("should-throw Too many iterations in simplify");
|
|
229
247
|
for (let i = 0; i < externals.length - 1; i++) {
|
|
230
248
|
const left = externals[i];
|
|
231
249
|
for (let j = i + 1; j < externals.length; j++) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fractionNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/fractionNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,YAAY,EAAkB,MAAM,gBAAgB,CAAC;AAK3E,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAKlE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"fractionNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/fractionNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,YAAY,EAAkB,MAAM,gBAAgB,CAAC;AAK3E,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAKlE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAIrD,wBAAgB,cAAc,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,YAAY,CAEzD;AAED,eAAO,MAAM,IAAI,MACZ,aAAa,GAAG,MAAM,GAAG,MAAM,KAC/B,aAAa,GAAG,MAAM,GAAG,MAAM,SAC3B,WAAW,iBAOnB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,EAAE,EAAE,OAAO,CAAC,QAAQ,CAAC;IACrB,SAAS,EAAE,eAAe,CAAC;IAC3B,UAAU,EAAE,eAAe,CAAC;CAC7B,CAAC;AACF,qBAAa,YAAa,YAAW,YAAY;IAC/C,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB;;;OAGG;IACH,EAAE,EAAE,WAAW,CAAC;IAChB,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,aAAa,CAAC;IAC1B,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;gBAEjB,SAAS,EAAE,aAAa,EACxB,UAAU,EAAE,aAAa,EACzB,IAAI,CAAC,EAAE,WAAW;IAiBpB,YAAY,IAAI,MAAM;IAItB,aAAa,IAAI,uBAAuB;IAQxC,UAAU;IAGV,iBAAiB,CAAC,IAAI,CAAC,EAAE,WAAW;IA+BpC,cAAc,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,MAAM,EAAE;IAG5C,SAAS;IAUT,KAAK,IAAI,MAAM;IA2Bf,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAMtC,QAAQ,CAAC,IAAI,CAAC,EAAE,eAAe,GAAG,aAAa;IAmN/C,MAAM,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO;IAOpC,oBAAoB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC;IAOxD,sBAAsB;IAQtB,UAAU,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,aAAa;CAGxD"}
|
|
@@ -255,7 +255,7 @@ class FractionNode {
|
|
|
255
255
|
const simplifyIteration = () => {
|
|
256
256
|
counter++;
|
|
257
257
|
if (counter > 1000)
|
|
258
|
-
throw new Error("Too many iterations in simplify");
|
|
258
|
+
throw new Error("should-throw Too many iterations in simplify");
|
|
259
259
|
for (let i = 0; i < externalsNums.length; i++) {
|
|
260
260
|
const num = externalsNums[i];
|
|
261
261
|
for (let j = 0; j < externalsDenums.length; j++) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Node, NodeIds, NodeOptions, NodeType, ToTexOptions } from "../node";
|
|
2
|
-
import { CommutativeOperatorNode, OperatorIds } from "./operatorNode";
|
|
2
|
+
import { CommutativeOperatorNode, DeepShuffleOpts, OperatorIds } from "./operatorNode";
|
|
3
3
|
import { AlgebraicNode, SimplifyOptions } from "../algebraicNode";
|
|
4
4
|
export declare function isMultiplyNode(a: Node): a is MultiplyNode;
|
|
5
5
|
export declare const multiply: (a: AlgebraicNode | number | string, b: AlgebraicNode | number | string, opts?: NodeOptions) => MultiplyNode;
|
|
@@ -13,6 +13,7 @@ export declare class MultiplyNode implements CommutativeOperatorNode {
|
|
|
13
13
|
isNumeric: boolean;
|
|
14
14
|
constructor(leftChild: AlgebraicNode, rightChild: AlgebraicNode, opts?: NodeOptions);
|
|
15
15
|
shuffle: () => void;
|
|
16
|
+
deepShuffle: (opts?: DeepShuffleOpts) => MultiplyNode;
|
|
16
17
|
toReversed: () => MultiplyNode;
|
|
17
18
|
toMathString(): string;
|
|
18
19
|
toTex(options?: ToTexOptions): string;
|
|
@@ -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,
|
|
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,eAAe,EACf,WAAW,EAGZ,MAAM,gBAAgB,CAAC;AAYxB,OAAO,EACL,aAAa,EACb,eAAe,EAEhB,MAAM,kBAAkB,CAAC;AAU1B,wBAAgB,cAA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
49
49
|
if ((0, coinFlip_1.coinFlip)())
|
|
50
50
|
[this.leftChild, this.rightChild] = [this.rightChild, this.leftChild];
|
|
51
51
|
};
|
|
52
|
+
this.deepShuffle = (opts) => {
|
|
53
|
+
const left = (0, operatorNode_1.isCommutativeOperatorNode)(this.leftChild)
|
|
54
|
+
? this.leftChild.deepShuffle(opts)
|
|
55
|
+
: this.leftChild;
|
|
56
|
+
const right = (0, operatorNode_1.isCommutativeOperatorNode)(this.rightChild)
|
|
57
|
+
? this.rightChild.deepShuffle(opts)
|
|
58
|
+
: this.rightChild;
|
|
59
|
+
if ((0, coinFlip_1.coinFlip)() && (!opts || opts?.nodeIdsToShuffle?.includes(this.id)))
|
|
60
|
+
return new MultiplyNode(right, left, this.opts);
|
|
61
|
+
else
|
|
62
|
+
return new MultiplyNode(left, right, this.opts);
|
|
63
|
+
};
|
|
52
64
|
this.toReversed = () => {
|
|
53
65
|
return new MultiplyNode(this.rightChild, this.leftChild, this.opts);
|
|
54
66
|
};
|
|
@@ -371,7 +383,7 @@ class MultiplyNode {
|
|
|
371
383
|
const simplifyIteration = () => {
|
|
372
384
|
counter++;
|
|
373
385
|
if (counter > 1000)
|
|
374
|
-
throw new Error("Too many iterations in simplify");
|
|
386
|
+
throw new Error("should-throw Too many iterations in simplify");
|
|
375
387
|
for (let i = 0; i < externals.length - 1; i++) {
|
|
376
388
|
const left = externals[i];
|
|
377
389
|
for (let j = i + 1; j < externals.length; j++) {
|
|
@@ -18,8 +18,13 @@ export interface OperatorNode extends AlgebraicNode {
|
|
|
18
18
|
rightChild: AlgebraicNode;
|
|
19
19
|
}
|
|
20
20
|
export declare function isOperatorNode(a: Node): a is OperatorNode;
|
|
21
|
+
export declare function isCommutativeOperatorNode(a: Node): a is CommutativeOperatorNode;
|
|
22
|
+
export type DeepShuffleOpts = {
|
|
23
|
+
nodeIdsToShuffle: OperatorIds[];
|
|
24
|
+
};
|
|
21
25
|
export interface CommutativeOperatorNode extends OperatorNode {
|
|
22
26
|
shuffle: () => void;
|
|
27
|
+
deepShuffle: (opts?: DeepShuffleOpts) => CommutativeOperatorNode;
|
|
23
28
|
toAllTexs: () => string[];
|
|
24
29
|
}
|
|
25
30
|
//# sourceMappingURL=operatorNode.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operatorNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/operatorNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,IAAI,
|
|
1
|
+
{"version":3,"file":"operatorNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/operatorNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAqB,MAAM,SAAS,CAAC;AAElD,oBAAY,WAAW;IACrB,GAAG,IAAA;IACH,SAAS,IAAA;IACT,QAAQ,IAAA;IACR,QAAQ,IAAA;IACR,MAAM,IAAA;IACN,KAAK,IAAA;IACL,KAAK,IAAA;IACL,QAAQ,IAAA;IACR,mBAAmB,IAAA;IACnB,MAAM,IAAA;CACP;AAED,MAAM,WAAW,YAAa,SAAQ,aAAa;IACjD,EAAE,EAAE,WAAW,CAAC;IAChB,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,aAAa,CAAC;CAC3B;AACD,wBAAgB,cAAc,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,YAAY,CAEzD;AAED,wBAAgB,yBAAyB,CACvC,CAAC,EAAE,IAAI,GACN,CAAC,IAAI,uBAAuB,CAI9B;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,gBAAgB,EAAE,WAAW,EAAE,CAAC;CACjC,CAAC;AACF,MAAM,WAAW,uBAAwB,SAAQ,YAAY;IAC3D,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,WAAW,EAAE,CAAC,IAAI,CAAC,EAAE,eAAe,KAAK,uBAAuB,CAAC;IACjE,SAAS,EAAE,MAAM,MAAM,EAAE,CAAC;CAC3B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isOperatorNode = exports.OperatorIds = void 0;
|
|
3
|
+
exports.isCommutativeOperatorNode = exports.isOperatorNode = exports.OperatorIds = void 0;
|
|
4
4
|
const node_1 = require("../node");
|
|
5
5
|
var OperatorIds;
|
|
6
6
|
(function (OperatorIds) {
|
|
@@ -19,3 +19,7 @@ function isOperatorNode(a) {
|
|
|
19
19
|
return a.type === node_1.NodeType.operator;
|
|
20
20
|
}
|
|
21
21
|
exports.isOperatorNode = isOperatorNode;
|
|
22
|
+
function isCommutativeOperatorNode(a) {
|
|
23
|
+
return (isOperatorNode(a) && [OperatorIds.add, OperatorIds.multiply].includes(a.id));
|
|
24
|
+
}
|
|
25
|
+
exports.isCommutativeOperatorNode = isCommutativeOperatorNode;
|
|
@@ -2,7 +2,7 @@ import { AlgebraicNode, SimplifyOptions } from "../algebraicNode";
|
|
|
2
2
|
import { Node, NodeIds, NodeOptions, NodeType } from "../node";
|
|
3
3
|
export declare const monom: (a: AlgebraicNode | number | string, degree: number, opts?: MonomNodeOptions) => MonomNode;
|
|
4
4
|
export declare function isMonomNode(a: Node): a is MonomNode;
|
|
5
|
-
export declare function parseToMonomNode(a: Node
|
|
5
|
+
export declare function parseToMonomNode(a: Node): false | MonomNode;
|
|
6
6
|
type MonomNodeOptions = {
|
|
7
7
|
variable: string;
|
|
8
8
|
};
|
|
@@ -38,11 +38,7 @@ export declare class MonomNode implements AlgebraicNode {
|
|
|
38
38
|
};
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
|
-
export declare const parseToMonom: (node: AlgebraicNode
|
|
42
|
-
variable: string;
|
|
43
|
-
maxDegree: undefined;
|
|
44
|
-
minDegree: number;
|
|
45
|
-
}) => false | MonomNode;
|
|
41
|
+
export declare const parseToMonom: (node: AlgebraicNode) => false | MonomNode;
|
|
46
42
|
type Opts = {
|
|
47
43
|
variable?: string;
|
|
48
44
|
maxDegree?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"monomNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/polynomials/monomNode.ts"],"names":[],"mappings":"AACA,OAAO,EACL,aAAa,EACb,eAAe,EAEhB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAM/D,eAAO,MAAM,KAAK,MACb,aAAa,GAAG,MAAM,GAAG,MAAM,UAC1B,MAAM,SACP,gBAAgB,cAMxB,CAAC;AACF,wBAAgB,WAAW,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,SAAS,CAEnD;AAED,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,IAAI,
|
|
1
|
+
{"version":3,"file":"monomNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/polynomials/monomNode.ts"],"names":[],"mappings":"AACA,OAAO,EACL,aAAa,EACb,eAAe,EAEhB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAM/D,eAAO,MAAM,KAAK,MACb,aAAa,GAAG,MAAM,GAAG,MAAM,UAC1B,MAAM,SACP,gBAAgB,cAMxB,CAAC;AACF,wBAAgB,WAAW,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,SAAS,CAEnD;AAED,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,IAAI,qBAGvC;AACD,KAAK,gBAAgB,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAO7C;;;GAGG;AACH,qBAAa,SAAU,YAAW,aAAa;IAC7C,CAAC,EAAE,aAAa,CAAC;IACjB,MAAM,EAAE,M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