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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fractionSquare.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionSquare.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"fractionSquare.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionSquare.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAgBlC,KAAK,WAAW,GAAG;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AA6FF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAiBhD,CAAC"}
|
|
@@ -7,6 +7,7 @@ const rational_1 = require("../../../../math/numbers/rationals/rational");
|
|
|
7
7
|
const fractionNode_1 = require("../../../../tree/nodes/operators/fractionNode");
|
|
8
8
|
const powerNode_1 = require("../../../../tree/nodes/operators/powerNode");
|
|
9
9
|
const latexParser_1 = require("../../../../tree/parsers/latexParser");
|
|
10
|
+
const handleVEAError_1 = require("../../../../utils/errors/handleVEAError");
|
|
10
11
|
const alignTex_1 = require("../../../../utils/latex/alignTex");
|
|
11
12
|
const getPropositions = (n, { answer, denum, num }) => {
|
|
12
13
|
const propositions = [];
|
|
@@ -67,7 +68,7 @@ const isAnswerValid = (ans, { answer }) => {
|
|
|
67
68
|
return parsed.simplify().toTex() === answer;
|
|
68
69
|
}
|
|
69
70
|
catch (err) {
|
|
70
|
-
return
|
|
71
|
+
return (0, handleVEAError_1.handleVEAError)(err);
|
|
71
72
|
}
|
|
72
73
|
};
|
|
73
74
|
const getFractionSquareQuestion = (ops) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fractionsSum.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionsSum.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"fractionsSum.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionsSum.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,0BAA0B,CAAC;AAWlC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AAyGF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAgBvD,CAAC"}
|
|
@@ -7,6 +7,7 @@ const rational_1 = require("../../../../math/numbers/rationals/rational");
|
|
|
7
7
|
const addNode_1 = require("../../../../tree/nodes/operators/addNode");
|
|
8
8
|
const rationalParser_1 = require("../../../../tree/parsers/rationalParser");
|
|
9
9
|
const shuffle_1 = require("../../../../utils/alea/shuffle");
|
|
10
|
+
const handleVEAError_1 = require("../../../../utils/errors/handleVEAError");
|
|
10
11
|
const getInstruction = (identifiers, opts) => {
|
|
11
12
|
const { rational, rational2 } = identifiers;
|
|
12
13
|
const rationalObj = new rational_1.Rational(rational[0], rational[1]);
|
|
@@ -67,7 +68,7 @@ const isAnswerValid = (ans, { rational, rational2 }, opts) => {
|
|
|
67
68
|
return texs.includes(parsed.simplify().toTex());
|
|
68
69
|
}
|
|
69
70
|
catch (err) {
|
|
70
|
-
return
|
|
71
|
+
return (0, handleVEAError_1.handleVEAError)(err);
|
|
71
72
|
}
|
|
72
73
|
else
|
|
73
74
|
return texs.includes(ans);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fractionsSumsMultiplesDenominators.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionsSumsMultiplesDenominators.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"fractionsSumsMultiplesDenominators.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionsSumsMultiplesDenominators.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,0BAA0B,CAAC;AAYlC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AA2FF,eAAO,MAAM,kCAAkC,EAAE,QAAQ,CAAC,WAAW,CAkBpE,CAAC"}
|
|
@@ -8,6 +8,7 @@ const randint_1 = require("../../../../math/utils/random/randint");
|
|
|
8
8
|
const addNode_1 = require("../../../../tree/nodes/operators/addNode");
|
|
9
9
|
const rationalParser_1 = require("../../../../tree/parsers/rationalParser");
|
|
10
10
|
const coinFlip_1 = require("../../../../utils/alea/coinFlip");
|
|
11
|
+
const handleVEAError_1 = require("../../../../utils/errors/handleVEAError");
|
|
11
12
|
const getFractionsSumsMultiplesDenominatorsQuestion = (opts) => {
|
|
12
13
|
let denom1 = (0, randint_1.randint)(2, 10);
|
|
13
14
|
let denom2 = denom1 * (0, randint_1.randint)(2, 10);
|
|
@@ -58,7 +59,7 @@ const isAnswerValid = (ans, { answer, denom1, denom2, num1, num2 }, opts) => {
|
|
|
58
59
|
return texs.includes(parsed.simplify().toTex());
|
|
59
60
|
}
|
|
60
61
|
catch (err) {
|
|
61
|
-
return
|
|
62
|
+
return (0, handleVEAError_1.handleVEAError)(err);
|
|
62
63
|
}
|
|
63
64
|
}
|
|
64
65
|
else
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fractionsSumsPrimeDenominators.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionsSumsPrimeDenominators.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"fractionsSumsPrimeDenominators.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionsSumsPrimeDenominators.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,0BAA0B,CAAC;AAYlC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AA6FF,eAAO,MAAM,8BAA8B,EAAE,QAAQ,CAAC,WAAW,CAkBhE,CAAC"}
|
|
@@ -8,6 +8,7 @@ const gcd_1 = require("../../../../math/utils/arithmetic/gcd");
|
|
|
8
8
|
const randint_1 = require("../../../../math/utils/random/randint");
|
|
9
9
|
const addNode_1 = require("../../../../tree/nodes/operators/addNode");
|
|
10
10
|
const rationalParser_1 = require("../../../../tree/parsers/rationalParser");
|
|
11
|
+
const handleVEAError_1 = require("../../../../utils/errors/handleVEAError");
|
|
11
12
|
const getFractionsSumsPrimeDenominatorsQuestion = (opts) => {
|
|
12
13
|
const denom1 = (0, randint_1.randint)(2, 13);
|
|
13
14
|
let denom2 = 0;
|
|
@@ -59,7 +60,7 @@ const isAnswerValid = (ans, { answer, denom1, denom2, num1, num2 }, opts) => {
|
|
|
59
60
|
return texs.includes(parsed.simplify().toTex());
|
|
60
61
|
}
|
|
61
62
|
catch (err) {
|
|
62
|
-
return
|
|
63
|
+
return (0, handleVEAError_1.handleVEAError)(err);
|
|
63
64
|
}
|
|
64
65
|
}
|
|
65
66
|
else
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fractionsSumsSameDenominators.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionsSumsSameDenominators.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"fractionsSumsSameDenominators.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionsSumsSameDenominators.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,0BAA0B,CAAC;AAgBlC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAgIF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,CAmB/D,CAAC"}
|
|
@@ -11,6 +11,7 @@ const fractionNode_1 = require("../../../../tree/nodes/operators/fractionNode");
|
|
|
11
11
|
const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
|
|
12
12
|
const rationalParser_1 = require("../../../../tree/parsers/rationalParser");
|
|
13
13
|
const operatorComposition_1 = require("../../../../tree/utilities/operatorComposition");
|
|
14
|
+
const handleVEAError_1 = require("../../../../utils/errors/handleVEAError");
|
|
14
15
|
const alignTex_1 = require("../../../../utils/latex/alignTex");
|
|
15
16
|
const getFractionsSumsSameDenominatorsQuestion = (opts) => {
|
|
16
17
|
const denom = (0, randint_1.randint)(2, 15);
|
|
@@ -85,7 +86,7 @@ const isAnswerValid = (ans, { answer, denom, num1, num2 }, opts) => {
|
|
|
85
86
|
return texs.includes(parsed.simplify().toTex());
|
|
86
87
|
}
|
|
87
88
|
catch (err) {
|
|
88
|
-
return
|
|
89
|
+
return (0, handleVEAError_1.handleVEAError)(err);
|
|
89
90
|
}
|
|
90
91
|
}
|
|
91
92
|
else {
|
package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findCoeffInProportionalTableNonIntegers.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"findCoeffInProportionalTableNonIntegers.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,0BAA0B,CAAC;AAkBlC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,GAAG,CAAC;IACd,OAAO,EAAE,GAAG,EAAE,CAAC;IACf,OAAO,EAAE,GAAG,EAAE,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAyHF,KAAK,OAAO,GAAG;IACb,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,iBAAiB,EAAE,MAAM,EAAE,CAAC;CAC7B,CAAC;AAoBF,eAAO,MAAM,uCAAuC,EAAE,QAAQ,CAC5D,WAAW,EACX,OAAO,CAsBR,CAAC"}
|
package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.js
CHANGED
|
@@ -11,6 +11,7 @@ const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
|
|
|
11
11
|
const latexParser_1 = require("../../../../tree/parsers/latexParser");
|
|
12
12
|
const random_1 = require("../../../../utils/alea/random");
|
|
13
13
|
const doWhile_1 = require("../../../../utils/doWhile");
|
|
14
|
+
const handleVEAError_1 = require("../../../../utils/errors/handleVEAError");
|
|
14
15
|
const dollarize_1 = require("../../../../utils/latex/dollarize");
|
|
15
16
|
const mdTable_1 = require("../../../../utils/markdown/mdTable");
|
|
16
17
|
const getPropositions = (n, { answer, coeffType }) => {
|
|
@@ -58,7 +59,7 @@ const isAnswerValid = (ans, { answer }) => {
|
|
|
58
59
|
return parsed.simplify().toTex() === answer;
|
|
59
60
|
}
|
|
60
61
|
catch (err) {
|
|
61
|
-
return
|
|
62
|
+
return (0, handleVEAError_1.handleVEAError)(err);
|
|
62
63
|
}
|
|
63
64
|
};
|
|
64
65
|
const getFindCoeffInProportionalTableNonIntegersQuestion = (opts) => {
|
package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivityWithCoeff.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doubleDistributivityWithCoeff.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/doubleDistributivityWithCoeff.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AASlC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;
|
|
1
|
+
{"version":3,"file":"doubleDistributivityWithCoeff.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/doubleDistributivityWithCoeff.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AASlC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAyIF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,CAmB/D,CAAC"}
|
|
@@ -89,9 +89,6 @@ const isAnswerValid = (ans, { answer, affine1, affine2, coeff }) => {
|
|
|
89
89
|
const answerTree = affine1Obj.times(coeff).multiply(affine2Obj).toTree();
|
|
90
90
|
return answerTree.toAllValidTexs().includes(ans);
|
|
91
91
|
};
|
|
92
|
-
const isGGBAnswerValid = (ans, { ggbAnswer }) => {
|
|
93
|
-
throw Error("GGBVea not implemented");
|
|
94
|
-
};
|
|
95
92
|
exports.doubleDistributivityWithCoeff = {
|
|
96
93
|
id: "doubleDistributivityWithCoeff",
|
|
97
94
|
connector: "=",
|
|
@@ -104,7 +101,6 @@ exports.doubleDistributivityWithCoeff = {
|
|
|
104
101
|
freeTimer: 60,
|
|
105
102
|
getPropositions,
|
|
106
103
|
isAnswerValid,
|
|
107
|
-
isGGBAnswerValid,
|
|
108
104
|
subject: "Mathématiques",
|
|
109
105
|
hasHintAndCorrection: true,
|
|
110
106
|
getHint,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firstIdentity.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/firstIdentity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"firstIdentity.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/firstIdentity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAOR,YAAY,EAEZ,iBAAiB,EACjB,GAAG,EAGJ,MAAM,0BAA0B,CAAC;AAelC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA2EF,eAAO,MAAM,wBAAwB,EAAE,iBAAiB,CAAC,WAAW,CAwBnE,CAAC;AAEF,eAAO,MAAM,4BAA4B,EAAE,YAAY,CAAC,WAAW,CAkClE,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,GAAG,CAAC,WAAW,CAgBvD,CAAC;AAMF,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,WAAW,CAmB/C,CAAC"}
|
|
@@ -11,34 +11,42 @@ const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
|
|
|
11
11
|
const powerNode_1 = require("../../../../tree/nodes/operators/powerNode");
|
|
12
12
|
const alignTex_1 = require("../../../../utils/latex/alignTex");
|
|
13
13
|
const shuffle_1 = require("../../../../utils/alea/shuffle");
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
max: 11,
|
|
21
|
-
});
|
|
14
|
+
const handleVEAError_1 = require("../../../../utils/errors/handleVEAError");
|
|
15
|
+
const latexParser_1 = require("../../../../tree/parsers/latexParser");
|
|
16
|
+
const substractNode_1 = require("../../../../tree/nodes/operators/substractNode");
|
|
17
|
+
const getStatementNode = (identifiers) => {
|
|
18
|
+
const { a, b } = identifiers;
|
|
19
|
+
const affine = new affine_1.Affine(a, b);
|
|
22
20
|
const statementTree = new powerNode_1.PowerNode(affine.toTree(), new numberNode_1.NumberNode(2));
|
|
23
|
-
|
|
21
|
+
return statementTree;
|
|
22
|
+
};
|
|
23
|
+
const getStartStatement = (identifiers) => {
|
|
24
|
+
return getStatementNode(identifiers).toTex();
|
|
25
|
+
};
|
|
26
|
+
const getInstruction = (identifiers) => {
|
|
27
|
+
return `Développer et réduire :
|
|
28
|
+
|
|
29
|
+
$$
|
|
30
|
+
${getStartStatement(identifiers)}
|
|
31
|
+
$$`;
|
|
32
|
+
};
|
|
33
|
+
const getHint = (identifiers) => {
|
|
34
|
+
const affine = new affine_1.Affine(identifiers.a, identifiers.b);
|
|
24
35
|
const aMonom = new multiplyNode_1.MultiplyNode(affine.a.toTree(), "x".toTree());
|
|
25
|
-
|
|
26
|
-
const question = {
|
|
27
|
-
instruction: `Développer et réduire : $${statementTex}$`,
|
|
28
|
-
startStatement: statementTex,
|
|
29
|
-
answer,
|
|
30
|
-
keys: ["x"],
|
|
31
|
-
answerFormat: "tex",
|
|
32
|
-
identifiers: { a: affine.a, b: affine.b },
|
|
33
|
-
hint: `Utilise l'identité remarquable :
|
|
36
|
+
return `Utilise l'identité remarquable :
|
|
34
37
|
|
|
35
38
|
$$
|
|
36
39
|
(a+b)^2 = a^2 + 2ab+b^2
|
|
37
40
|
$$
|
|
38
41
|
|
|
39
|
-
en prenant $a=${aMonom.toTex()}$ et $b=${affine.b}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
en prenant $a=${aMonom.toTex()}$ et $b=${affine.b}$.`;
|
|
43
|
+
};
|
|
44
|
+
const getCorrection = (identifiers) => {
|
|
45
|
+
const affine = new affine_1.Affine(identifiers.a, identifiers.b);
|
|
46
|
+
const statementTex = getStartStatement(identifiers);
|
|
47
|
+
const answer = getAnswer(identifiers);
|
|
48
|
+
const aMonom = new multiplyNode_1.MultiplyNode(affine.a.toTree(), "x".toTree());
|
|
49
|
+
return `On utilise l'identité remarquable :
|
|
42
50
|
|
|
43
51
|
$$
|
|
44
52
|
(a+b)^2 = a^2 + 2ab+b^2
|
|
@@ -46,15 +54,41 @@ $$
|
|
|
46
54
|
|
|
47
55
|
en prenant $a=${aMonom.toTex()}$ et $b=${affine.b}$.
|
|
48
56
|
|
|
57
|
+
Cela donne donc :
|
|
58
|
+
|
|
49
59
|
${(0, alignTex_1.alignTex)([
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
60
|
+
[
|
|
61
|
+
statementTex,
|
|
62
|
+
"=",
|
|
63
|
+
new addNode_1.AddNode(new addNode_1.AddNode(new powerNode_1.SquareNode(aMonom), new multiplyNode_1.MultiplyNode((2).toTree(), new multiplyNode_1.MultiplyNode(aMonom, affine.b.toTree()))), new powerNode_1.SquareNode(affine.b.toTree())).toTex(),
|
|
64
|
+
],
|
|
65
|
+
["", "=", answer],
|
|
66
|
+
])}
|
|
67
|
+
`;
|
|
68
|
+
};
|
|
69
|
+
const getAnswer = (identifiers) => {
|
|
70
|
+
const affine = new affine_1.Affine(identifiers.a, identifiers.b);
|
|
71
|
+
const answer = affine.multiply(affine).toTree().toTex();
|
|
72
|
+
return answer;
|
|
73
|
+
};
|
|
74
|
+
const getFirstIdentityQuestion = () => {
|
|
75
|
+
const affine = affine_1.AffineConstructor.random({
|
|
76
|
+
min: 1,
|
|
77
|
+
max: 11,
|
|
78
|
+
}, {
|
|
79
|
+
min: 1,
|
|
80
|
+
max: 11,
|
|
81
|
+
});
|
|
82
|
+
const identifiers = { a: affine.a, b: affine.b };
|
|
83
|
+
const question = {
|
|
84
|
+
instruction: getInstruction(identifiers),
|
|
85
|
+
startStatement: getStartStatement(identifiers),
|
|
86
|
+
answer: getAnswer(identifiers),
|
|
87
|
+
keys: ["x"],
|
|
88
|
+
answerFormat: "tex",
|
|
89
|
+
identifiers,
|
|
90
|
+
hint: getHint(identifiers),
|
|
91
|
+
correction: getCorrection(identifiers),
|
|
58
92
|
};
|
|
59
93
|
return question;
|
|
60
94
|
};
|
|
@@ -78,11 +112,20 @@ const getFirstIdentityPropositions = (n, { answer, a, b }) => {
|
|
|
78
112
|
return (0, shuffle_1.shuffle)(propositions);
|
|
79
113
|
};
|
|
80
114
|
exports.getFirstIdentityPropositions = getFirstIdentityPropositions;
|
|
81
|
-
const isFirstIdentityAnswerValid = (ans, { a, b }) => {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
115
|
+
const isFirstIdentityAnswerValid = (ans, { answer, a, b }) => {
|
|
116
|
+
try {
|
|
117
|
+
const parsed = (0, latexParser_1.parseAlgebraic)(ans);
|
|
118
|
+
if (!parsed)
|
|
119
|
+
return false;
|
|
120
|
+
if (!(0, addNode_1.isAddNode)(parsed) && !(0, substractNode_1.isSubstractNode)(parsed))
|
|
121
|
+
return false;
|
|
122
|
+
return (parsed
|
|
123
|
+
.simplify({ forbidFactorize: true, towardsDistribute: true })
|
|
124
|
+
.toTex() === answer);
|
|
125
|
+
}
|
|
126
|
+
catch (err) {
|
|
127
|
+
return (0, handleVEAError_1.handleVEAError)(err);
|
|
128
|
+
}
|
|
86
129
|
};
|
|
87
130
|
exports.isFirstIdentityAnswerValid = isFirstIdentityAnswerValid;
|
|
88
131
|
const tests = () => {
|
|
@@ -102,4 +145,9 @@ exports.firstIdentity = {
|
|
|
102
145
|
isAnswerValid: exports.isFirstIdentityAnswerValid,
|
|
103
146
|
subject: "Mathématiques",
|
|
104
147
|
hasHintAndCorrection: true,
|
|
148
|
+
getAnswer,
|
|
149
|
+
getInstruction,
|
|
150
|
+
getCorrection,
|
|
151
|
+
getHint,
|
|
152
|
+
getStartStatement,
|
|
105
153
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identitiesWithNonIntegers.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/identitiesWithNonIntegers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAMlC,OAAO,EAEL,eAAe,EAEhB,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"identitiesWithNonIntegers.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/identitiesWithNonIntegers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAMlC,OAAO,EAEL,eAAe,EAEhB,MAAM,kCAAkC,CAAC;AAU1C,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,eAAe,CAAC;IACnB,CAAC,EAAE,eAAe,CAAC;CACpB,CAAC;AA2HF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAgB3D,CAAC"}
|
|
@@ -14,6 +14,7 @@ const substractNode_1 = require("../../../../tree/nodes/operators/substractNode"
|
|
|
14
14
|
const trinomNode_1 = require("../../../../tree/nodes/polynomials/trinomNode");
|
|
15
15
|
const polynomialParser_1 = require("../../../../tree/parsers/polynomialParser");
|
|
16
16
|
const random_1 = require("../../../../utils/alea/random");
|
|
17
|
+
const handleVEAError_1 = require("../../../../utils/errors/handleVEAError");
|
|
17
18
|
const getPropositions = (n, { answer, a, b, type }) => {
|
|
18
19
|
const propositions = [];
|
|
19
20
|
(0, exercise_1.addValidProp)(propositions, answer);
|
|
@@ -79,7 +80,7 @@ const isAnswerValid = (ans, { answer, ...identifiers }) => {
|
|
|
79
80
|
.toTex() === answer);
|
|
80
81
|
}
|
|
81
82
|
catch (err) {
|
|
82
|
-
return
|
|
83
|
+
return (0, handleVEAError_1.handleVEAError)(err);
|
|
83
84
|
}
|
|
84
85
|
};
|
|
85
86
|
//type1 (ax+b)^2
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secondIdentity.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/secondIdentity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"secondIdentity.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/secondIdentity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAOR,YAAY,EAEZ,iBAAiB,EACjB,GAAG,EAGJ,MAAM,0BAA0B,CAAC;AAiBlC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAiFF,eAAO,MAAM,yBAAyB,EAAE,iBAAiB,CAAC,WAAW,CAuBpE,CAAC;AAEF,eAAO,MAAM,6BAA6B,EAAE,YAAY,CAAC,WAAW,CAqCnE,CAAC;AAEF,eAAO,MAAM,2BAA2B,EAAE,GAAG,CAAC,WAAW,CAgBxD,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAkBhD,CAAC"}
|
|
@@ -12,35 +12,54 @@ const powerNode_1 = require("../../../../tree/nodes/operators/powerNode");
|
|
|
12
12
|
const substractNode_1 = require("../../../../tree/nodes/operators/substractNode");
|
|
13
13
|
const alignTex_1 = require("../../../../utils/latex/alignTex");
|
|
14
14
|
const shuffle_1 = require("../../../../utils/alea/shuffle");
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
min: -10,
|
|
21
|
-
max: 0,
|
|
22
|
-
});
|
|
15
|
+
const latexParser_1 = require("../../../../tree/parsers/latexParser");
|
|
16
|
+
const handleVEAError_1 = require("../../../../utils/errors/handleVEAError");
|
|
17
|
+
const getStatementNode = (identifiers) => {
|
|
18
|
+
const { a, b } = identifiers;
|
|
19
|
+
const affine = new affine_1.Affine(a, b);
|
|
23
20
|
const statementTree = new powerNode_1.PowerNode(affine.toTree(), new numberNode_1.NumberNode(2));
|
|
24
|
-
|
|
21
|
+
return statementTree;
|
|
22
|
+
};
|
|
23
|
+
const getStartStatement = (identifiers) => {
|
|
24
|
+
const statementTree = getStatementNode(identifiers);
|
|
25
|
+
const statementTex = statementTree.toTex();
|
|
26
|
+
return statementTex;
|
|
27
|
+
};
|
|
28
|
+
const getInstruction = (identifiers) => {
|
|
29
|
+
const { a, b } = identifiers;
|
|
30
|
+
return `Développer et réduire :
|
|
31
|
+
|
|
32
|
+
$$
|
|
33
|
+
${getStartStatement(identifiers)}
|
|
34
|
+
$$`;
|
|
35
|
+
};
|
|
36
|
+
const getHint = (identifiers) => {
|
|
37
|
+
const { a, b } = identifiers;
|
|
38
|
+
const affine = new affine_1.Affine(a, b);
|
|
25
39
|
const aMonom = new multiplyNode_1.MultiplyNode(affine.a.toTree(), "x".toTree());
|
|
26
40
|
const bPositive = -affine.b;
|
|
27
|
-
|
|
28
|
-
const question = {
|
|
29
|
-
instruction: `Développer et réduire : $${statementTex}$`,
|
|
30
|
-
startStatement: statementTex,
|
|
31
|
-
answer,
|
|
32
|
-
keys: ["x"],
|
|
33
|
-
answerFormat: "tex",
|
|
34
|
-
identifiers: { a: affine.a, b: affine.b },
|
|
35
|
-
hint: `Utilise l'identité remarquable
|
|
41
|
+
return `Utilise l'identité remarquable
|
|
36
42
|
|
|
37
43
|
$$
|
|
38
44
|
(a-b)^2 = a^2 - 2ab+b^2
|
|
39
45
|
$$
|
|
40
46
|
|
|
41
|
-
en prenant $a=${aMonom.toTex()}$ et $b=${bPositive}
|
|
42
|
-
|
|
43
|
-
|
|
47
|
+
en prenant $a=${aMonom.toTex()}$ et $b=${bPositive}$`;
|
|
48
|
+
};
|
|
49
|
+
const getAnswer = (identifiers) => {
|
|
50
|
+
const { a, b } = identifiers;
|
|
51
|
+
const affine = new affine_1.Affine(a, b);
|
|
52
|
+
const answer = affine.multiply(affine).toTree().toTex();
|
|
53
|
+
return answer;
|
|
54
|
+
};
|
|
55
|
+
const getCorrection = (identifiers) => {
|
|
56
|
+
const { a, b } = identifiers;
|
|
57
|
+
const affine = new affine_1.Affine(a, b);
|
|
58
|
+
const aMonom = new multiplyNode_1.MultiplyNode(affine.a.toTree(), "x".toTree());
|
|
59
|
+
const bPositive = -affine.b;
|
|
60
|
+
const statementTex = getStartStatement(identifiers);
|
|
61
|
+
const answer = getAnswer(identifiers);
|
|
62
|
+
return `On utilise l'identité remarquable
|
|
44
63
|
|
|
45
64
|
$$
|
|
46
65
|
(a-b)^2 = a^2 - 2ab+b^2
|
|
@@ -49,14 +68,33 @@ $$
|
|
|
49
68
|
en prenant $a=${aMonom.toTex()}$ et $b=${bPositive}$ :
|
|
50
69
|
|
|
51
70
|
${(0, alignTex_1.alignTex)([
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
71
|
+
[
|
|
72
|
+
statementTex,
|
|
73
|
+
"=",
|
|
74
|
+
new addNode_1.AddNode(new substractNode_1.SubstractNode(new powerNode_1.SquareNode(aMonom), new multiplyNode_1.MultiplyNode((2).toTree(), new multiplyNode_1.MultiplyNode(aMonom, bPositive.toTree()))), new powerNode_1.SquareNode(bPositive.toTree())).toTex(),
|
|
75
|
+
],
|
|
76
|
+
["", "=", answer],
|
|
77
|
+
])}
|
|
78
|
+
`;
|
|
79
|
+
};
|
|
80
|
+
const getSecondIdentityQuestion = () => {
|
|
81
|
+
const affine = affine_1.AffineConstructor.random({
|
|
82
|
+
min: 1,
|
|
83
|
+
max: 11,
|
|
84
|
+
}, {
|
|
85
|
+
min: -10,
|
|
86
|
+
max: 0,
|
|
87
|
+
});
|
|
88
|
+
const identifiers = { a: affine.a, b: affine.b };
|
|
89
|
+
const question = {
|
|
90
|
+
instruction: getInstruction(identifiers),
|
|
91
|
+
startStatement: getStartStatement(identifiers),
|
|
92
|
+
answer: getAnswer(identifiers),
|
|
93
|
+
keys: ["x"],
|
|
94
|
+
answerFormat: "tex",
|
|
95
|
+
identifiers,
|
|
96
|
+
hint: getHint(identifiers),
|
|
97
|
+
correction: getCorrection(identifiers),
|
|
60
98
|
};
|
|
61
99
|
return question;
|
|
62
100
|
};
|
|
@@ -82,19 +120,26 @@ const getSecondIdentityPropositions = (n, { answer, a, b }) => {
|
|
|
82
120
|
return (0, shuffle_1.shuffle)(propositions);
|
|
83
121
|
};
|
|
84
122
|
exports.getSecondIdentityPropositions = getSecondIdentityPropositions;
|
|
85
|
-
const isSecondIdentityAnswerValid = (ans, { a, b }) => {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
123
|
+
const isSecondIdentityAnswerValid = (ans, { a, b, answer }) => {
|
|
124
|
+
try {
|
|
125
|
+
const parsed = (0, latexParser_1.parseAlgebraic)(ans);
|
|
126
|
+
if (!parsed)
|
|
127
|
+
return false;
|
|
128
|
+
if (!(0, addNode_1.isAddNode)(parsed) && !(0, substractNode_1.isSubstractNode)(parsed))
|
|
129
|
+
return false;
|
|
130
|
+
return (parsed
|
|
131
|
+
.simplify({ forbidFactorize: true, towardsDistribute: true })
|
|
132
|
+
.toTex() === answer);
|
|
133
|
+
}
|
|
134
|
+
catch (err) {
|
|
135
|
+
return (0, handleVEAError_1.handleVEAError)(err);
|
|
136
|
+
}
|
|
90
137
|
};
|
|
91
138
|
exports.isSecondIdentityAnswerValid = isSecondIdentityAnswerValid;
|
|
92
139
|
exports.secondIdentity = {
|
|
93
140
|
id: "idRmq2",
|
|
94
141
|
connector: "=",
|
|
95
142
|
label: "Identité remarquable $(a-b)^2$",
|
|
96
|
-
levels: ["3ème", "2nde"],
|
|
97
|
-
sections: ["Calcul littéral"],
|
|
98
143
|
isSingleStep: false,
|
|
99
144
|
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(exports.getSecondIdentityQuestion, nb),
|
|
100
145
|
getPropositions: exports.getSecondIdentityPropositions,
|
|
@@ -103,4 +148,9 @@ exports.secondIdentity = {
|
|
|
103
148
|
freeTimer: 60,
|
|
104
149
|
subject: "Mathématiques",
|
|
105
150
|
hasHintAndCorrection: true,
|
|
151
|
+
getInstruction,
|
|
152
|
+
getCorrection,
|
|
153
|
+
getHint,
|
|
154
|
+
getAnswer,
|
|
155
|
+
getStartStatement,
|
|
106
156
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thirdIdentity.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/thirdIdentity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"thirdIdentity.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/thirdIdentity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAOR,YAAY,EAEZ,iBAAiB,EACjB,GAAG,EAGJ,MAAM,0BAA0B,CAAC;AAiBlC,KAAK,WAAW,GAAG;IACjB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB,CAAC;AAoEF,eAAO,MAAM,wBAAwB,EAAE,iBAAiB,CAAC,WAAW,CAkBnE,CAAC;AAEF,eAAO,MAAM,4BAA4B,EAAE,YAAY,CAAC,WAAW,CA2BlE,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,GAAG,CAAC,WAAW,CAgBvD,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,WAAW,CAiB/C,CAAC"}
|