math-exercises 1.3.38 → 1.3.40
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/calcul/addAndSub.d.ts.map +1 -1
- package/lib/exercises/calcul/addAndSub.js +29 -2
- package/lib/exercises/calcul/addAndSubWithoutRelatives.d.ts.map +1 -1
- package/lib/exercises/calcul/addAndSubWithoutRelatives.js +26 -0
- package/lib/exercises/calcul/arithmetics/primeNumbers.d.ts.map +1 -1
- package/lib/exercises/calcul/arithmetics/primeNumbers.js +48 -9
- package/lib/exercises/calcul/fractions/fractionAndIntegerDivision.d.ts.map +1 -1
- package/lib/exercises/calcul/fractions/fractionAndIntegerDivision.js +29 -0
- package/lib/exercises/calcul/fractions/fractionAndIntegerProduct.d.ts.map +1 -1
- package/lib/exercises/calcul/fractions/fractionAndIntegerProduct.js +27 -0
- package/lib/exercises/calcul/fractions/fractionAndIntegerSum.d.ts.map +1 -1
- package/lib/exercises/calcul/fractions/fractionAndIntegerSum.js +27 -0
- package/lib/exercises/calcul/fractions/fractionToPercentToDecimal.d.ts.map +1 -1
- package/lib/exercises/calcul/fractions/fractionToPercentToDecimal.js +48 -1
- package/lib/exercises/calcul/fractions/fractionsDivision.d.ts.map +1 -1
- package/lib/exercises/calcul/fractions/fractionsDivision.js +27 -0
- package/lib/exercises/calcul/fractions/fractionsProduct.d.ts.map +1 -1
- package/lib/exercises/calcul/fractions/fractionsProduct.js +27 -0
- package/lib/exercises/calcul/fractions/fractionsSum.d.ts.map +1 -1
- package/lib/exercises/calcul/fractions/fractionsSum.js +27 -0
- package/lib/exercises/calcul/fractions/simplifyFraction.d.ts.map +1 -1
- package/lib/exercises/calcul/fractions/simplifyFraction.js +26 -0
- package/lib/exercises/calcul/mentalCaluls.ts/mentalAddAndSub.d.ts.map +1 -1
- package/lib/exercises/calcul/mentalCaluls.ts/mentalAddAndSub.js +30 -0
- package/lib/exercises/calcul/mentalCaluls.ts/mentalDivisions.d.ts.map +1 -1
- package/lib/exercises/calcul/mentalCaluls.ts/mentalDivisions.js +29 -0
- package/lib/exercises/calcul/mentalCaluls.ts/mentalMultiplications.d.ts.map +1 -1
- package/lib/exercises/calcul/mentalCaluls.ts/mentalMultiplications.js +26 -0
- package/lib/exercises/calcul/mentalCaluls.ts/mentalPercentage.d.ts.map +1 -1
- package/lib/exercises/calcul/mentalCaluls.ts/mentalPercentage.js +65 -0
- package/lib/exercises/calcul/operations/operationsPriorities.d.ts.map +1 -1
- package/lib/exercises/calcul/operations/operationsPriorities.js +25 -0
- package/lib/exercises/calcul/operations/operationsPrioritiesWithoutRelative.d.ts.map +1 -1
- package/lib/exercises/calcul/operations/operationsPrioritiesWithoutRelative.js +25 -0
- package/lib/exercises/calcul/proportionality/proportionalityTable.d.ts +4 -0
- package/lib/exercises/calcul/proportionality/proportionalityTable.d.ts.map +1 -0
- package/lib/exercises/calcul/proportionality/proportionalityTable.js +78 -0
- package/lib/exercises/calcul/rounding/rounding.d.ts.map +1 -1
- package/lib/exercises/calcul/rounding/rounding.js +49 -0
- package/lib/exercises/calculLitteral/distributivity/doubleDistributivity.d.ts.map +1 -1
- package/lib/exercises/calculLitteral/distributivity/doubleDistributivity.js +45 -0
- package/lib/exercises/calculLitteral/distributivity/firstIdentity.d.ts.map +1 -1
- package/lib/exercises/calculLitteral/distributivity/firstIdentity.js +45 -0
- package/lib/exercises/calculLitteral/distributivity/secondIdentity.d.ts.map +1 -1
- package/lib/exercises/calculLitteral/distributivity/secondIdentity.js +45 -0
- package/lib/exercises/calculLitteral/distributivity/simpleDistributivity.d.ts.map +1 -1
- package/lib/exercises/calculLitteral/distributivity/simpleDistributivity.js +45 -1
- package/lib/exercises/calculLitteral/distributivity/thirdIdentity.d.ts.map +1 -1
- package/lib/exercises/calculLitteral/distributivity/thirdIdentity.js +45 -0
- package/lib/exercises/calculLitteral/equation/equationSimpleSquare.d.ts.map +1 -1
- package/lib/exercises/calculLitteral/equation/equationSimpleSquare.js +106 -0
- package/lib/exercises/calculLitteral/equation/equationType1Exercise.d.ts.map +1 -1
- package/lib/exercises/calculLitteral/equation/equationType1Exercise.js +27 -0
- package/lib/exercises/calculLitteral/equation/equationType2Exercise.d.ts.map +1 -1
- package/lib/exercises/calculLitteral/equation/equationType2Exercise.js +27 -0
- package/lib/exercises/calculLitteral/equation/equationType3Exercise.d.ts.map +1 -1
- package/lib/exercises/calculLitteral/equation/equationType3Exercise.js +27 -0
- package/lib/exercises/calculLitteral/equation/equationType4Exercise.d.ts.map +1 -1
- package/lib/exercises/calculLitteral/equation/equationType4Exercise.js +27 -0
- package/lib/exercises/calculLitteral/equation/evaluateExpression.d.ts +4 -0
- package/lib/exercises/calculLitteral/equation/evaluateExpression.d.ts.map +1 -0
- package/lib/exercises/calculLitteral/equation/evaluateExpression.js +61 -0
- package/lib/exercises/calculLitteral/equation/firstDegreeEquation.d.ts.map +1 -1
- package/lib/exercises/calculLitteral/equation/firstDegreeEquation.js +25 -0
- package/lib/exercises/calculLitteral/equation/fractionEquation.d.ts.map +1 -1
- package/lib/exercises/calculLitteral/equation/fractionEquation.js +32 -0
- package/lib/exercises/calculLitteral/equation/multiplicationEquation.d.ts.map +1 -1
- package/lib/exercises/calculLitteral/equation/multiplicationEquation.js +35 -0
- package/lib/exercises/calculLitteral/factorisation/factoIdRmq1.d.ts.map +1 -1
- package/lib/exercises/calculLitteral/factorisation/factoIdRmq1.js +32 -0
- package/lib/exercises/calculLitteral/factorisation/factoIdRmq2.d.ts.map +1 -1
- package/lib/exercises/calculLitteral/factorisation/factoIdRmq2.js +38 -0
- package/lib/exercises/calculLitteral/factorisation/factoIdRmq3.d.ts.map +1 -1
- package/lib/exercises/calculLitteral/factorisation/factoIdRmq3.js +44 -0
- package/lib/exercises/calculLitteral/factorisation/factoType1Exercise.d.ts.map +1 -1
- package/lib/exercises/calculLitteral/factorisation/factoType1Exercise.js +42 -0
- package/lib/exercises/calculLitteral/simplifying/reduceExpression.d.ts +4 -0
- package/lib/exercises/calculLitteral/simplifying/reduceExpression.d.ts.map +1 -0
- package/lib/exercises/calculLitteral/simplifying/reduceExpression.js +118 -0
- package/lib/exercises/conversion/aeraConversion.d.ts.map +1 -1
- package/lib/exercises/conversion/aeraConversion.js +27 -0
- package/lib/exercises/conversion/capacityConversion.d.ts.map +1 -1
- package/lib/exercises/conversion/capacityConversion.js +27 -0
- package/lib/exercises/conversion/lengthConversion.d.ts.map +1 -1
- package/lib/exercises/conversion/lengthConversion.js +26 -0
- package/lib/exercises/conversion/massConversion.d.ts.map +1 -1
- package/lib/exercises/conversion/massConversion.js +26 -0
- package/lib/exercises/conversion/volumeCapacityConversion.d.ts.map +1 -1
- package/lib/exercises/conversion/volumeCapacityConversion.js +29 -3
- package/lib/exercises/conversion/volumeConversion.d.ts.map +1 -1
- package/lib/exercises/conversion/volumeConversion.js +26 -0
- package/lib/exercises/derivation/derivative/constanteDerivative.d.ts.map +1 -1
- package/lib/exercises/derivation/derivative/constanteDerivative.js +26 -0
- package/lib/exercises/derivation/derivative/firstDegreeDerivative.d.ts.map +1 -1
- package/lib/exercises/derivation/derivative/firstDegreeDerivative.js +26 -0
- package/lib/exercises/derivation/derivative/inverseFunctionDerivative.d.ts.map +1 -1
- package/lib/exercises/derivation/derivative/inverseFunctionDerivative.js +26 -0
- package/lib/exercises/derivation/derivative/powerFunctionDerivative.d.ts.map +1 -1
- package/lib/exercises/derivation/derivative/powerFunctionDerivative.js +26 -0
- package/lib/exercises/derivation/derivative/rootFunctionDerivative.d.ts.map +1 -1
- package/lib/exercises/derivation/derivative/rootFunctionDerivative.js +36 -0
- package/lib/exercises/derivation/derivative/secondDegreeDerivative.d.ts.map +1 -1
- package/lib/exercises/derivation/derivative/secondDegreeDerivative.js +31 -0
- package/lib/exercises/derivation/derivative/thirdDegreeDerivative.d.ts.map +1 -1
- package/lib/exercises/derivation/derivative/thirdDegreeDerivative.js +30 -0
- package/lib/exercises/derivation/derivativeNumberReading.d.ts.map +1 -1
- package/lib/exercises/derivation/derivativeNumberReading.js +30 -0
- package/lib/exercises/exercise.d.ts +6 -0
- package/lib/exercises/exercise.d.ts.map +1 -1
- package/lib/exercises/exercises.d.ts.map +1 -1
- package/lib/exercises/exercises.js +8 -0
- package/lib/exercises/geometry/cartesian/distanceBetweenTwoPoints.d.ts +4 -0
- package/lib/exercises/geometry/cartesian/distanceBetweenTwoPoints.d.ts.map +1 -0
- package/lib/exercises/geometry/cartesian/distanceBetweenTwoPoints.js +101 -0
- package/lib/exercises/geometry/cartesian/leadingCoefficient.d.ts.map +1 -1
- package/lib/exercises/geometry/cartesian/leadingCoefficient.js +30 -0
- package/lib/exercises/geometry/cartesian/leadingCoefficientCalculV1.d.ts.map +1 -1
- package/lib/exercises/geometry/cartesian/leadingCoefficientCalculV1.js +26 -0
- package/lib/exercises/geometry/cartesian/leadingCoefficientCalculV2.d.ts.map +1 -1
- package/lib/exercises/geometry/cartesian/leadingCoefficientCalculV2.js +26 -0
- package/lib/exercises/geometry/cartesian/midpoint.d.ts.map +1 -1
- package/lib/exercises/geometry/cartesian/midpoint.js +29 -0
- package/lib/exercises/geometry/euclidean/circleArea.d.ts.map +1 -1
- package/lib/exercises/geometry/euclidean/circleArea.js +28 -1
- package/lib/exercises/geometry/euclidean/circleCircumference.d.ts.map +1 -1
- package/lib/exercises/geometry/euclidean/circleCircumference.js +28 -1
- package/lib/exercises/geometry/euclidean/pythagore.d.ts.map +1 -1
- package/lib/exercises/geometry/euclidean/pythagore.js +47 -0
- package/lib/exercises/geometry/euclidean/pythagoreCalcul.d.ts.map +1 -1
- package/lib/exercises/geometry/euclidean/pythagoreCalcul.js +28 -0
- package/lib/exercises/geometry/euclidean/rectangleArea.d.ts.map +1 -1
- package/lib/exercises/geometry/euclidean/rectangleArea.js +25 -0
- package/lib/exercises/geometry/euclidean/rectanglePerimeter.d.ts.map +1 -1
- package/lib/exercises/geometry/euclidean/rectanglePerimeter.js +25 -0
- package/lib/exercises/geometry/euclidean/rightTriangleArea.d.ts.map +1 -1
- package/lib/exercises/geometry/euclidean/rightTriangleArea.js +25 -0
- package/lib/exercises/geometry/euclidean/squareArea.d.ts.map +1 -1
- package/lib/exercises/geometry/euclidean/squareArea.js +25 -0
- package/lib/exercises/geometry/euclidean/squarePerimeter.d.ts.map +1 -1
- package/lib/exercises/geometry/euclidean/squarePerimeter.js +25 -0
- package/lib/exercises/geometry/euclidean/thales.d.ts.map +1 -1
- package/lib/exercises/geometry/euclidean/thales.js +44 -1
- package/lib/exercises/geometry/euclidean/thalesCalcul.d.ts.map +1 -1
- package/lib/exercises/geometry/euclidean/thalesCalcul.js +25 -0
- package/lib/exercises/geometry/euclidean/triangleArea.d.ts.map +1 -0
- package/lib/exercises/geometry/euclidean/{TriangleArea.js → triangleArea.js} +24 -0
- package/lib/exercises/geometry/euclidean/triangleAreaV2.d.ts.map +1 -1
- package/lib/exercises/geometry/euclidean/triangleAreaV2.js +32 -1
- package/lib/exercises/geometry/euclidean/trianglePerimeter.d.ts.map +1 -1
- package/lib/exercises/geometry/euclidean/trianglePerimeter.js +26 -0
- package/lib/exercises/geometry/euclidean/trigonometry.d.ts.map +1 -1
- package/lib/exercises/geometry/euclidean/trigonometry.js +39 -0
- package/lib/exercises/geometry/euclidean/trigonometryAngleCalcul.d.ts.map +1 -1
- package/lib/exercises/geometry/euclidean/trigonometryAngleCalcul.js +24 -0
- package/lib/exercises/geometry/euclidean/trigonometrySideCalcul.d.ts.map +1 -1
- package/lib/exercises/geometry/euclidean/trigonometrySideCalcul.js +25 -0
- package/lib/exercises/geometry/vectors/scalarProductViaCoords.d.ts.map +1 -1
- package/lib/exercises/geometry/vectors/scalarProductViaCoords.js +28 -1
- package/lib/exercises/percent/applyPercent.d.ts.map +1 -1
- package/lib/exercises/percent/applyPercent.js +30 -0
- package/lib/exercises/percent/averageEvolutionRate.d.ts.map +1 -1
- package/lib/exercises/percent/averageEvolutionRate.js +32 -2
- package/lib/exercises/percent/globalPercent.d.ts.map +1 -1
- package/lib/exercises/percent/globalPercent.js +30 -0
- package/lib/exercises/percent/reciprocalPercentage.d.ts.map +1 -1
- package/lib/exercises/percent/reciprocalPercentage.js +30 -0
- package/lib/exercises/powers/powersDivision.d.ts.map +1 -1
- package/lib/exercises/powers/powersDivision.js +29 -1
- package/lib/exercises/powers/powersOfTenToDecimal.d.ts.map +1 -1
- package/lib/exercises/powers/powersOfTenToDecimal.js +28 -0
- package/lib/exercises/powers/powersPower.d.ts.map +1 -1
- package/lib/exercises/powers/powersPower.js +28 -0
- package/lib/exercises/powers/powersProduct.d.ts.map +1 -1
- package/lib/exercises/powers/powersProduct.js +29 -1
- package/lib/exercises/powers/scientificToDecimal.d.ts.map +1 -1
- package/lib/exercises/powers/scientificToDecimal.js +27 -0
- package/lib/exercises/proba/conditionalProbability.d.ts.map +1 -1
- package/lib/exercises/proba/conditionalProbability.js +25 -0
- package/lib/exercises/proba/marginalAndConditionalFrequency.d.ts.map +1 -1
- package/lib/exercises/proba/marginalAndConditionalFrequency.js +25 -0
- package/lib/exercises/proba/probabilityTree.d.ts.map +1 -1
- package/lib/exercises/proba/probabilityTree.js +33 -6
- package/lib/exercises/sequences/arithmetic/arithmeticExplicitFormulaUsage.d.ts.map +1 -1
- package/lib/exercises/sequences/arithmetic/arithmeticExplicitFormulaUsage.js +25 -0
- package/lib/exercises/sequences/arithmetic/arithmeticFindExplicitFormula.d.ts.map +1 -1
- package/lib/exercises/sequences/arithmetic/arithmeticFindExplicitFormula.js +25 -0
- package/lib/exercises/sequences/arithmetic/arithmeticFindReason.d.ts.map +1 -1
- package/lib/exercises/sequences/arithmetic/arithmeticFindReason.js +25 -0
- package/lib/exercises/sequences/arithmetic/arithmeticReasonUsage.d.ts.map +1 -1
- package/lib/exercises/sequences/arithmetic/arithmeticReasonUsage.js +25 -0
- package/lib/exercises/sequences/arithmetic/arithmeticRecurrenceFormulaUsage.d.ts.map +1 -1
- package/lib/exercises/sequences/arithmetic/arithmeticRecurrenceFormulaUsage.js +25 -0
- package/lib/exercises/sequences/arithmetic/arithmeticThresholdFind.d.ts.map +1 -1
- package/lib/exercises/sequences/arithmetic/arithmeticThresholdFind.js +25 -0
- package/lib/exercises/sequences/geometric/geometricExplicitFormulaUsage.d.ts.map +1 -1
- package/lib/exercises/sequences/geometric/geometricExplicitFormulaUsage.js +25 -0
- package/lib/exercises/sequences/geometric/geometricFindExplicitFormula.d.ts.map +1 -1
- package/lib/exercises/sequences/geometric/geometricFindExplicitFormula.js +31 -0
- package/lib/exercises/sequences/geometric/geometricFindReason.d.ts.map +1 -1
- package/lib/exercises/sequences/geometric/geometricFindReason.js +31 -0
- package/lib/exercises/sequences/geometric/geometricReasonUsage.d.ts.map +1 -1
- package/lib/exercises/sequences/geometric/geometricReasonUsage.js +31 -0
- package/lib/exercises/sequences/geometric/geometricRecurrenceFormulaUsage.d.ts.map +1 -1
- package/lib/exercises/sequences/geometric/geometricRecurrenceFormulaUsage.js +31 -0
- package/lib/exercises/squareRoots/simpifySquareRoot.d.ts.map +1 -1
- package/lib/exercises/squareRoots/simpifySquareRoot.js +29 -0
- package/lib/math/geometry/point.d.ts +1 -0
- package/lib/math/geometry/point.d.ts.map +1 -1
- package/lib/math/geometry/point.js +9 -0
- package/lib/math/polynomials/polynomial.d.ts +1 -0
- package/lib/math/polynomials/polynomial.d.ts.map +1 -1
- package/lib/math/polynomials/polynomial.js +8 -1
- package/lib/server.js +16 -20
- package/package.json +7 -6
- package/lib/exercises/geometry/cartesian/derivativeNumberReading.d.ts +0 -4
- package/lib/exercises/geometry/cartesian/derivativeNumberReading.d.ts.map +0 -1
- package/lib/exercises/geometry/cartesian/derivativeNumberReading.js +0 -51
- package/lib/exercises/geometry/cartesian/derivativeNumberReading2.d.ts +0 -1
- package/lib/exercises/geometry/cartesian/derivativeNumberReading2.d.ts.map +0 -1
- package/lib/exercises/geometry/cartesian/derivativeNumberReading2.js +0 -91
- package/lib/exercises/geometry/euclidean/TriangleArea.d.ts.map +0 -1
- /package/lib/exercises/geometry/euclidean/{TriangleArea.d.ts → triangleArea.d.ts} +0 -0
|
@@ -4,10 +4,13 @@ exports.getSecondIdentityQuestion = exports.secondIdentity = void 0;
|
|
|
4
4
|
const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
|
|
5
5
|
const integer_1 = require("../../../math/numbers/integer/integer");
|
|
6
6
|
const affine_1 = require("../../../math/polynomials/affine");
|
|
7
|
+
const polynomial_1 = require("../../../math/polynomials/polynomial");
|
|
7
8
|
const discreteSet_1 = require("../../../math/sets/discreteSet");
|
|
8
9
|
const intervals_1 = require("../../../math/sets/intervals/intervals");
|
|
9
10
|
const numberNode_1 = require("../../../tree/nodes/numbers/numberNode");
|
|
10
11
|
const powerNode_1 = require("../../../tree/nodes/operators/powerNode");
|
|
12
|
+
const shuffle_1 = require("../../../utils/shuffle");
|
|
13
|
+
const uuid_1 = require("uuid");
|
|
11
14
|
exports.secondIdentity = {
|
|
12
15
|
id: 'idRmq2',
|
|
13
16
|
connector: '=',
|
|
@@ -25,10 +28,52 @@ function getSecondIdentityQuestion() {
|
|
|
25
28
|
const affine = affine_1.AffineConstructor.random(intervalA, intervalB);
|
|
26
29
|
const statementTree = new powerNode_1.PowerNode(affine.toTree(), new numberNode_1.NumberNode(2));
|
|
27
30
|
const answerTree = affine.multiply(affine).toTree();
|
|
31
|
+
const getPropositions = (n) => {
|
|
32
|
+
const res = [];
|
|
33
|
+
res.push({
|
|
34
|
+
id: (0, uuid_1.v4)() + '',
|
|
35
|
+
statement: answerTree.toTex(),
|
|
36
|
+
isRightAnswer: true,
|
|
37
|
+
});
|
|
38
|
+
res.push({
|
|
39
|
+
id: (0, uuid_1.v4)() + '',
|
|
40
|
+
statement: new polynomial_1.Polynomial([-(affine.b ** 2), 0, affine.a ** 2]).toTree().toTex(),
|
|
41
|
+
isRightAnswer: false,
|
|
42
|
+
});
|
|
43
|
+
if (n > 2)
|
|
44
|
+
res.push({
|
|
45
|
+
id: (0, uuid_1.v4)() + '',
|
|
46
|
+
statement: new polynomial_1.Polynomial([affine.b ** 2, affine.a * affine.b, affine.a ** 2]).toTree().toTex(),
|
|
47
|
+
isRightAnswer: false,
|
|
48
|
+
});
|
|
49
|
+
if (n > 3)
|
|
50
|
+
res.push({
|
|
51
|
+
id: (0, uuid_1.v4)() + '',
|
|
52
|
+
statement: new polynomial_1.Polynomial([-(affine.b ** 2), -(affine.a ** 2 + affine.b ** 2), affine.a ** 2]).toTree().toTex(),
|
|
53
|
+
isRightAnswer: false,
|
|
54
|
+
});
|
|
55
|
+
for (let i = 0; i < n - 4; i++) {
|
|
56
|
+
let isDuplicate;
|
|
57
|
+
let proposition;
|
|
58
|
+
do {
|
|
59
|
+
const affineTemp = affine_1.AffineConstructor.random(intervalA, intervalB);
|
|
60
|
+
const wrongAnswer = affine.multiply(affineTemp).toTree();
|
|
61
|
+
proposition = {
|
|
62
|
+
id: (0, uuid_1.v4)() + '',
|
|
63
|
+
statement: wrongAnswer.toTex(),
|
|
64
|
+
isRightAnswer: false,
|
|
65
|
+
};
|
|
66
|
+
isDuplicate = res.some((p) => p.statement === proposition.statement);
|
|
67
|
+
} while (isDuplicate);
|
|
68
|
+
res.push(proposition);
|
|
69
|
+
}
|
|
70
|
+
return (0, shuffle_1.shuffle)(res);
|
|
71
|
+
};
|
|
28
72
|
return {
|
|
29
73
|
startStatement: statementTree.toTex(),
|
|
30
74
|
answer: answerTree.toTex(),
|
|
31
75
|
keys: ['x'],
|
|
76
|
+
getPropositions,
|
|
32
77
|
};
|
|
33
78
|
}
|
|
34
79
|
exports.getSecondIdentityQuestion = getSecondIdentityQuestion;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simpleDistributivity.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/distributivity/simpleDistributivity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"simpleDistributivity.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/distributivity/simpleDistributivity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAW3E,eAAO,MAAM,oBAAoB,EAAE,QAUlC,CAAC;AAEF,wBAAgB,+BAA+B,IAAI,QAAQ,CAkE1D"}
|
|
@@ -8,6 +8,8 @@ const discreteSet_1 = require("../../../math/sets/discreteSet");
|
|
|
8
8
|
const intervals_1 = require("../../../math/sets/intervals/intervals");
|
|
9
9
|
const numberNode_1 = require("../../../tree/nodes/numbers/numberNode");
|
|
10
10
|
const multiplyNode_1 = require("../../../tree/nodes/operators/multiplyNode");
|
|
11
|
+
const shuffle_1 = require("../../../utils/shuffle");
|
|
12
|
+
const uuid_1 = require("uuid");
|
|
11
13
|
exports.simpleDistributivity = {
|
|
12
14
|
id: 'simpleDistri',
|
|
13
15
|
connector: '=',
|
|
@@ -20,15 +22,57 @@ exports.simpleDistributivity = {
|
|
|
20
22
|
keys: ['x'],
|
|
21
23
|
};
|
|
22
24
|
function getSimpleDistributivityQuestion() {
|
|
23
|
-
const
|
|
25
|
+
const excludeNbrs = [new integer_1.Integer(-1), new integer_1.Integer(0), new integer_1.Integer(1)];
|
|
26
|
+
const interval = new intervals_1.Interval('[[-10; 10]]').difference(new discreteSet_1.DiscreteSet(excludeNbrs));
|
|
24
27
|
const affine = affine_1.AffineConstructor.random(interval, interval);
|
|
25
28
|
const coeff = interval.getRandomElement();
|
|
26
29
|
const statementTree = new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode(coeff.value), affine.toTree());
|
|
27
30
|
const answerTree = affine.times(coeff.value).toTree();
|
|
31
|
+
const getPropositions = (n) => {
|
|
32
|
+
const res = [];
|
|
33
|
+
res.push({
|
|
34
|
+
id: (0, uuid_1.v4)() + '',
|
|
35
|
+
statement: answerTree.toTex(),
|
|
36
|
+
isRightAnswer: true,
|
|
37
|
+
});
|
|
38
|
+
res.push({
|
|
39
|
+
id: (0, uuid_1.v4)() + '',
|
|
40
|
+
statement: new affine_1.Affine(coeff.value * affine.a, affine.b).toTree().toTex(),
|
|
41
|
+
isRightAnswer: false,
|
|
42
|
+
});
|
|
43
|
+
if (n > 2)
|
|
44
|
+
res.push({
|
|
45
|
+
id: (0, uuid_1.v4)() + '',
|
|
46
|
+
statement: new affine_1.Affine(affine.a, coeff.value * affine.b).toTree().toTex(),
|
|
47
|
+
isRightAnswer: false,
|
|
48
|
+
});
|
|
49
|
+
if (n > 3)
|
|
50
|
+
res.push({
|
|
51
|
+
id: (0, uuid_1.v4)() + '',
|
|
52
|
+
statement: affine.times(-coeff.value).toTree().toTex(),
|
|
53
|
+
isRightAnswer: false,
|
|
54
|
+
});
|
|
55
|
+
for (let i = 0; i < n - 4; i++) {
|
|
56
|
+
let isDuplicate;
|
|
57
|
+
let proposition;
|
|
58
|
+
do {
|
|
59
|
+
const wrongAnswer = affine_1.AffineConstructor.random(interval, interval).toTree();
|
|
60
|
+
proposition = {
|
|
61
|
+
id: (0, uuid_1.v4)() + '',
|
|
62
|
+
statement: wrongAnswer.toTex(),
|
|
63
|
+
isRightAnswer: false,
|
|
64
|
+
};
|
|
65
|
+
isDuplicate = res.some((p) => p.statement === proposition.statement);
|
|
66
|
+
} while (isDuplicate);
|
|
67
|
+
res.push(proposition);
|
|
68
|
+
}
|
|
69
|
+
return (0, shuffle_1.shuffle)(res);
|
|
70
|
+
};
|
|
28
71
|
return {
|
|
29
72
|
startStatement: statementTree.toTex(),
|
|
30
73
|
answer: answerTree.toTex(),
|
|
31
74
|
keys: ['x'],
|
|
75
|
+
getPropositions,
|
|
32
76
|
};
|
|
33
77
|
}
|
|
34
78
|
exports.getSimpleDistributivityQuestion = getSimpleDistributivityQuestion;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thirdIdentity.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/distributivity/thirdIdentity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"thirdIdentity.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/distributivity/thirdIdentity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAW3E,eAAO,MAAM,aAAa,EAAE,QAU3B,CAAC;AAEF,wBAAgB,wBAAwB,IAAI,QAAQ,CAkEnD"}
|
|
@@ -7,6 +7,8 @@ const affine_1 = require("../../../math/polynomials/affine");
|
|
|
7
7
|
const discreteSet_1 = require("../../../math/sets/discreteSet");
|
|
8
8
|
const intervals_1 = require("../../../math/sets/intervals/intervals");
|
|
9
9
|
const multiplyNode_1 = require("../../../tree/nodes/operators/multiplyNode");
|
|
10
|
+
const shuffle_1 = require("../../../utils/shuffle");
|
|
11
|
+
const uuid_1 = require("uuid");
|
|
10
12
|
exports.thirdIdentity = {
|
|
11
13
|
id: 'idRmq3',
|
|
12
14
|
connector: '=',
|
|
@@ -24,10 +26,53 @@ function getThirdIdentityQuestion() {
|
|
|
24
26
|
const affine2 = new affine_1.Affine(affine.a, -affine.b);
|
|
25
27
|
const statementTree = new multiplyNode_1.MultiplyNode(affine.toTree(), affine2.toTree());
|
|
26
28
|
const answerTree = affine.multiply(affine2).toTree();
|
|
29
|
+
const getPropositions = (n) => {
|
|
30
|
+
const res = [];
|
|
31
|
+
res.push({
|
|
32
|
+
id: (0, uuid_1.v4)() + '',
|
|
33
|
+
statement: answerTree.toTex(),
|
|
34
|
+
isRightAnswer: true,
|
|
35
|
+
});
|
|
36
|
+
res.push({
|
|
37
|
+
id: (0, uuid_1.v4)() + '',
|
|
38
|
+
statement: affine.multiply(affine2.opposite()).toTree().toTex(),
|
|
39
|
+
isRightAnswer: false,
|
|
40
|
+
});
|
|
41
|
+
if (n > 2)
|
|
42
|
+
res.push({
|
|
43
|
+
id: (0, uuid_1.v4)() + '',
|
|
44
|
+
statement: affine.multiply(affine).toTree().toTex(),
|
|
45
|
+
isRightAnswer: false,
|
|
46
|
+
});
|
|
47
|
+
if (n > 3)
|
|
48
|
+
res.push({
|
|
49
|
+
id: (0, uuid_1.v4)() + '',
|
|
50
|
+
statement: affine2.multiply(affine2.opposite()).toTree().toTex(),
|
|
51
|
+
isRightAnswer: false,
|
|
52
|
+
});
|
|
53
|
+
for (let i = 0; i < n - 4; i++) {
|
|
54
|
+
let isDuplicate;
|
|
55
|
+
let proposition;
|
|
56
|
+
do {
|
|
57
|
+
const affineTemp = affine_1.AffineConstructor.random(interval, interval);
|
|
58
|
+
const affineTemp2 = new affine_1.Affine(affineTemp.a, -affineTemp.b);
|
|
59
|
+
const wrongAnswer = affineTemp.multiply(affineTemp2).toTree();
|
|
60
|
+
proposition = {
|
|
61
|
+
id: (0, uuid_1.v4)() + '',
|
|
62
|
+
statement: wrongAnswer.toTex(),
|
|
63
|
+
isRightAnswer: false,
|
|
64
|
+
};
|
|
65
|
+
isDuplicate = res.some((p) => p.statement === proposition.statement);
|
|
66
|
+
} while (isDuplicate);
|
|
67
|
+
res.push(proposition);
|
|
68
|
+
}
|
|
69
|
+
return (0, shuffle_1.shuffle)(res);
|
|
70
|
+
};
|
|
27
71
|
return {
|
|
28
72
|
startStatement: statementTree.toTex(),
|
|
29
73
|
answer: answerTree.toTex(),
|
|
30
74
|
keys: ['x'],
|
|
75
|
+
getPropositions,
|
|
31
76
|
};
|
|
32
77
|
}
|
|
33
78
|
exports.getThirdIdentityQuestion = getThirdIdentityQuestion;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"equationSimpleSquare.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/equation/equationSimpleSquare.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"equationSimpleSquare.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/equation/equationSimpleSquare.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAO3E,eAAO,MAAM,oBAAoB,EAAE,QAUlC,CAAC;AAOF,wBAAgB,uBAAuB,IAAI,QAAQ,CAmJlD"}
|
|
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getEquationSimpleSquare = exports.equationSimpleSquare = void 0;
|
|
4
4
|
const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
|
|
5
5
|
const randint_1 = require("../../../math/utils/random/randint");
|
|
6
|
+
const coinFlip_1 = require("../../../utils/coinFlip");
|
|
7
|
+
const shuffle_1 = require("../../../utils/shuffle");
|
|
8
|
+
const uuid_1 = require("uuid");
|
|
6
9
|
exports.equationSimpleSquare = {
|
|
7
10
|
id: 'equationSimpleSquare',
|
|
8
11
|
connector: '=',
|
|
@@ -37,10 +40,113 @@ function getEquationSimpleSquare() {
|
|
|
37
40
|
}
|
|
38
41
|
if (randNbr < 0)
|
|
39
42
|
answer = `\\emptyset`;
|
|
43
|
+
const getPropositions = (n) => {
|
|
44
|
+
const res = [];
|
|
45
|
+
res.push({
|
|
46
|
+
id: (0, uuid_1.v4)() + '',
|
|
47
|
+
statement: answer,
|
|
48
|
+
isRightAnswer: true,
|
|
49
|
+
});
|
|
50
|
+
if (ans === Math.floor(ans)) {
|
|
51
|
+
res.push({
|
|
52
|
+
id: (0, uuid_1.v4)() + '',
|
|
53
|
+
statement: `${ans}`,
|
|
54
|
+
isRightAnswer: false,
|
|
55
|
+
});
|
|
56
|
+
if (n > 2)
|
|
57
|
+
res.push({
|
|
58
|
+
id: (0, uuid_1.v4)() + '',
|
|
59
|
+
statement: `${ans + (0, randint_1.randint)(-ans + 1, 7, [0])}`,
|
|
60
|
+
isRightAnswer: false,
|
|
61
|
+
});
|
|
62
|
+
for (let i = 0; i < n - 3; i++) {
|
|
63
|
+
let isDuplicate;
|
|
64
|
+
let proposition;
|
|
65
|
+
do {
|
|
66
|
+
const tempAns = ans + (0, randint_1.randint)(-ans + 1, 7, [0]);
|
|
67
|
+
proposition = {
|
|
68
|
+
id: (0, uuid_1.v4)() + '',
|
|
69
|
+
statement: (0, coinFlip_1.coinFlip)() ? `\\{${tempAns}\\ ; -${tempAns}\\}` : `\\emptyset`,
|
|
70
|
+
isRightAnswer: false,
|
|
71
|
+
};
|
|
72
|
+
isDuplicate = res.some((p) => p.statement === proposition.statement);
|
|
73
|
+
} while (isDuplicate);
|
|
74
|
+
res.push(proposition);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
else if (randNbr >= 0 && ans !== Math.floor(ans)) {
|
|
78
|
+
const factor = higherFactor(randNbr);
|
|
79
|
+
const radicand = randNbr / factor ** 2;
|
|
80
|
+
res.push({
|
|
81
|
+
id: (0, uuid_1.v4)() + '',
|
|
82
|
+
statement: `${factor}\\sqrt{${radicand}}`,
|
|
83
|
+
isRightAnswer: false,
|
|
84
|
+
});
|
|
85
|
+
if (n > 2)
|
|
86
|
+
res.push({
|
|
87
|
+
id: (0, uuid_1.v4)() + '',
|
|
88
|
+
statement: `${radicand}\\sqrt{${factor}}`,
|
|
89
|
+
isRightAnswer: false,
|
|
90
|
+
});
|
|
91
|
+
if (n > 3)
|
|
92
|
+
res.push({
|
|
93
|
+
id: (0, uuid_1.v4)() + '',
|
|
94
|
+
statement: `${Math.floor(ans)}`,
|
|
95
|
+
isRightAnswer: false,
|
|
96
|
+
});
|
|
97
|
+
for (let i = 0; i < n - 4; i++) {
|
|
98
|
+
let isDuplicate;
|
|
99
|
+
let proposition;
|
|
100
|
+
do {
|
|
101
|
+
const tempFactor = factor + (0, randint_1.randint)(-factor + 1, 7, [0]);
|
|
102
|
+
const tempRadicand = radicand + (0, randint_1.randint)(-radicand + 1, 7, [0]);
|
|
103
|
+
proposition = {
|
|
104
|
+
id: (0, uuid_1.v4)() + '',
|
|
105
|
+
statement: (0, coinFlip_1.coinFlip)()
|
|
106
|
+
? `\\{${tempFactor}\\sqrt{${tempRadicand}}\\ ; -${tempFactor}\\sqrt{${tempRadicand}} \\}`
|
|
107
|
+
: `\\emptyset`,
|
|
108
|
+
isRightAnswer: false,
|
|
109
|
+
};
|
|
110
|
+
isDuplicate = res.some((p) => p.statement === proposition.statement);
|
|
111
|
+
} while (isDuplicate);
|
|
112
|
+
res.push(proposition);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
res.push({
|
|
117
|
+
id: (0, uuid_1.v4)() + '',
|
|
118
|
+
statement: `-\\sqrt${-randNbr}`,
|
|
119
|
+
isRightAnswer: false,
|
|
120
|
+
});
|
|
121
|
+
if (n > 2)
|
|
122
|
+
res.push({
|
|
123
|
+
id: (0, uuid_1.v4)() + '',
|
|
124
|
+
statement: `${Math.floor(Math.sqrt(-randNbr))}`,
|
|
125
|
+
isRightAnswer: false,
|
|
126
|
+
});
|
|
127
|
+
for (let i = 0; i < n - 3; i++) {
|
|
128
|
+
let isDuplicate;
|
|
129
|
+
let proposition;
|
|
130
|
+
do {
|
|
131
|
+
const factor = (0, randint_1.randint)(2, 5);
|
|
132
|
+
const radicand = (0, randint_1.randint)(2, -randNbr);
|
|
133
|
+
proposition = {
|
|
134
|
+
id: (0, uuid_1.v4)() + '',
|
|
135
|
+
statement: `\\{${factor}\\sqrt{${radicand}}\\ ; -${factor}\\sqrt{${radicand}} \\}`,
|
|
136
|
+
isRightAnswer: false,
|
|
137
|
+
};
|
|
138
|
+
isDuplicate = res.some((p) => p.statement === proposition.statement);
|
|
139
|
+
} while (isDuplicate);
|
|
140
|
+
res.push(proposition);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return (0, shuffle_1.shuffle)(res);
|
|
144
|
+
};
|
|
40
145
|
const question = {
|
|
41
146
|
instruction,
|
|
42
147
|
answer,
|
|
43
148
|
keys: ['x', 'S', 'equal', 'lbrace', 'rbrace', 'semicolon', 'emptyset'],
|
|
149
|
+
getPropositions,
|
|
44
150
|
};
|
|
45
151
|
return question;
|
|
46
152
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"equationType1Exercise.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/equation/equationType1Exercise.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"equationType1Exercise.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/equation/equationType1Exercise.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAW3E;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAE,QAUnC,CAAC;AAEF,wBAAgB,gCAAgC,IAAI,QAAQ,CA8C3D"}
|
|
@@ -6,7 +6,10 @@ const integer_1 = require("../../../math/numbers/integer/integer");
|
|
|
6
6
|
const affine_1 = require("../../../math/polynomials/affine");
|
|
7
7
|
const discreteSet_1 = require("../../../math/sets/discreteSet");
|
|
8
8
|
const intervals_1 = require("../../../math/sets/intervals/intervals");
|
|
9
|
+
const randint_1 = require("../../../math/utils/random/randint");
|
|
9
10
|
const equalNode_1 = require("../../../tree/nodes/operators/equalNode");
|
|
11
|
+
const shuffle_1 = require("../../../utils/shuffle");
|
|
12
|
+
const uuid_1 = require("uuid");
|
|
10
13
|
/**
|
|
11
14
|
* type x+a=b
|
|
12
15
|
*/
|
|
@@ -29,10 +32,34 @@ function getEquationType1ExerciseQuestion() {
|
|
|
29
32
|
const solution = b.value - a.value;
|
|
30
33
|
const affine = new affine_1.Affine(1, a.value).toTree();
|
|
31
34
|
const tree = new equalNode_1.EqualNode(affine, b.toTree());
|
|
35
|
+
const getPropositions = (n) => {
|
|
36
|
+
const res = [];
|
|
37
|
+
res.push({
|
|
38
|
+
id: (0, uuid_1.v4)() + '',
|
|
39
|
+
statement: `x = ${solution}`,
|
|
40
|
+
isRightAnswer: true,
|
|
41
|
+
});
|
|
42
|
+
for (let i = 0; i < n - 1; i++) {
|
|
43
|
+
let isDuplicate;
|
|
44
|
+
let proposition;
|
|
45
|
+
do {
|
|
46
|
+
const wrongAnswer = solution + (0, randint_1.randint)(-3, 4, [0]);
|
|
47
|
+
proposition = {
|
|
48
|
+
id: (0, uuid_1.v4)() + '',
|
|
49
|
+
statement: `x = ${wrongAnswer}`,
|
|
50
|
+
isRightAnswer: false,
|
|
51
|
+
};
|
|
52
|
+
isDuplicate = res.some((p) => p.statement === proposition.statement);
|
|
53
|
+
} while (isDuplicate);
|
|
54
|
+
res.push(proposition);
|
|
55
|
+
}
|
|
56
|
+
return (0, shuffle_1.shuffle)(res);
|
|
57
|
+
};
|
|
32
58
|
const question = {
|
|
33
59
|
startStatement: tree.toTex(),
|
|
34
60
|
answer: `x = ${solution}`,
|
|
35
61
|
keys: ['x', 'S', 'equal', 'lbrace', 'rbrace', 'semicolon', 'emptyset'],
|
|
62
|
+
getPropositions,
|
|
36
63
|
};
|
|
37
64
|
return question;
|
|
38
65
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"equationType2Exercise.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/equation/equationType2Exercise.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"equationType2Exercise.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/equation/equationType2Exercise.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAa3E;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAE,QAUnC,CAAC;AAEF,wBAAgB,gCAAgC,IAAI,QAAQ,CAkD3D"}
|
|
@@ -7,8 +7,11 @@ const rational_1 = require("../../../math/numbers/rationals/rational");
|
|
|
7
7
|
const affine_1 = require("../../../math/polynomials/affine");
|
|
8
8
|
const discreteSet_1 = require("../../../math/sets/discreteSet");
|
|
9
9
|
const intervals_1 = require("../../../math/sets/intervals/intervals");
|
|
10
|
+
const randint_1 = require("../../../math/utils/random/randint");
|
|
10
11
|
const equalNode_1 = require("../../../tree/nodes/operators/equalNode");
|
|
11
12
|
const variableNode_1 = require("../../../tree/nodes/variables/variableNode");
|
|
13
|
+
const shuffle_1 = require("../../../utils/shuffle");
|
|
14
|
+
const uuid_1 = require("uuid");
|
|
12
15
|
/**
|
|
13
16
|
* type ax=b
|
|
14
17
|
*/
|
|
@@ -32,10 +35,34 @@ function getEquationType2ExerciseQuestion() {
|
|
|
32
35
|
const affine = new affine_1.Affine(a.value, 0).toTree();
|
|
33
36
|
const tree = new equalNode_1.EqualNode(affine, b.toTree());
|
|
34
37
|
const answer = new equalNode_1.EqualNode(new variableNode_1.VariableNode('x'), solution.toTree());
|
|
38
|
+
const getPropositions = (n) => {
|
|
39
|
+
const res = [];
|
|
40
|
+
res.push({
|
|
41
|
+
id: (0, uuid_1.v4)() + '',
|
|
42
|
+
statement: answer.toTex(),
|
|
43
|
+
isRightAnswer: true,
|
|
44
|
+
});
|
|
45
|
+
for (let i = 0; i < n - 1; i++) {
|
|
46
|
+
let isDuplicate;
|
|
47
|
+
let proposition;
|
|
48
|
+
do {
|
|
49
|
+
const wrongAnswer = new rational_1.Rational(b.value + (0, randint_1.randint)(-7, 8, [0, -b.value]), a.value + (0, randint_1.randint)(-7, 8, [-a.value, 0])).simplify();
|
|
50
|
+
proposition = {
|
|
51
|
+
id: (0, uuid_1.v4)() + '',
|
|
52
|
+
statement: new equalNode_1.EqualNode(new variableNode_1.VariableNode('x'), wrongAnswer.toTree()).toTex(),
|
|
53
|
+
isRightAnswer: false,
|
|
54
|
+
};
|
|
55
|
+
isDuplicate = res.some((p) => p.statement === proposition.statement);
|
|
56
|
+
} while (isDuplicate);
|
|
57
|
+
res.push(proposition);
|
|
58
|
+
}
|
|
59
|
+
return (0, shuffle_1.shuffle)(res);
|
|
60
|
+
};
|
|
35
61
|
const question = {
|
|
36
62
|
startStatement: tree.toTex(),
|
|
37
63
|
answer: answer.toTex(),
|
|
38
64
|
keys: ['x', 'S', 'equal', 'lbrace', 'rbrace', 'semicolon', 'emptyset'],
|
|
65
|
+
getPropositions,
|
|
39
66
|
};
|
|
40
67
|
return question;
|
|
41
68
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"equationType3Exercise.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/equation/equationType3Exercise.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"equationType3Exercise.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/equation/equationType3Exercise.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAa3E;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAE,QAWnC,CAAC;AAEF,wBAAgB,gCAAgC,IAAI,QAAQ,CAqD3D"}
|
|
@@ -7,8 +7,11 @@ const rational_1 = require("../../../math/numbers/rationals/rational");
|
|
|
7
7
|
const affine_1 = require("../../../math/polynomials/affine");
|
|
8
8
|
const discreteSet_1 = require("../../../math/sets/discreteSet");
|
|
9
9
|
const intervals_1 = require("../../../math/sets/intervals/intervals");
|
|
10
|
+
const randint_1 = require("../../../math/utils/random/randint");
|
|
10
11
|
const equalNode_1 = require("../../../tree/nodes/operators/equalNode");
|
|
11
12
|
const variableNode_1 = require("../../../tree/nodes/variables/variableNode");
|
|
13
|
+
const shuffle_1 = require("../../../utils/shuffle");
|
|
14
|
+
const uuid_1 = require("uuid");
|
|
12
15
|
/**
|
|
13
16
|
* type ax+b=c
|
|
14
17
|
*/
|
|
@@ -33,10 +36,34 @@ function getEquationType3ExerciseQuestion() {
|
|
|
33
36
|
const solution = new rational_1.Rational(c.value - b.value, a.value).simplify();
|
|
34
37
|
const statementTree = new equalNode_1.EqualNode(affine, c.toTree());
|
|
35
38
|
const answerTree = new equalNode_1.EqualNode(new variableNode_1.VariableNode('x'), solution.toTree());
|
|
39
|
+
const getPropositions = (n) => {
|
|
40
|
+
const res = [];
|
|
41
|
+
res.push({
|
|
42
|
+
id: (0, uuid_1.v4)() + '',
|
|
43
|
+
statement: answerTree.toTex(),
|
|
44
|
+
isRightAnswer: true,
|
|
45
|
+
});
|
|
46
|
+
for (let i = 0; i < n - 1; i++) {
|
|
47
|
+
let isDuplicate;
|
|
48
|
+
let proposition;
|
|
49
|
+
do {
|
|
50
|
+
const wrongAnswer = new rational_1.Rational(c.value - b.value + (0, randint_1.randint)(-7, 8, [0, -c.value + b.value]), a.value + (0, randint_1.randint)(-7, 8, [-a.value, 0])).simplify();
|
|
51
|
+
proposition = {
|
|
52
|
+
id: (0, uuid_1.v4)() + '',
|
|
53
|
+
statement: new equalNode_1.EqualNode(new variableNode_1.VariableNode('x'), wrongAnswer.toTree()).toTex(),
|
|
54
|
+
isRightAnswer: false,
|
|
55
|
+
};
|
|
56
|
+
isDuplicate = res.some((p) => p.statement === proposition.statement);
|
|
57
|
+
} while (isDuplicate);
|
|
58
|
+
res.push(proposition);
|
|
59
|
+
}
|
|
60
|
+
return (0, shuffle_1.shuffle)(res);
|
|
61
|
+
};
|
|
36
62
|
const question = {
|
|
37
63
|
startStatement: statementTree.toTex(),
|
|
38
64
|
answer: answerTree.toTex(),
|
|
39
65
|
keys: ['x', 'S', 'equal', 'lbrace', 'rbrace', 'semicolon', 'emptyset'],
|
|
66
|
+
getPropositions,
|
|
40
67
|
};
|
|
41
68
|
return question;
|
|
42
69
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"equationType4Exercise.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/equation/equationType4Exercise.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"equationType4Exercise.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/equation/equationType4Exercise.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAa3E;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAE,QAWnC,CAAC;AAEF,wBAAgB,gCAAgC,IAAI,QAAQ,CAwD3D"}
|
|
@@ -7,8 +7,11 @@ const rational_1 = require("../../../math/numbers/rationals/rational");
|
|
|
7
7
|
const affine_1 = require("../../../math/polynomials/affine");
|
|
8
8
|
const discreteSet_1 = require("../../../math/sets/discreteSet");
|
|
9
9
|
const intervals_1 = require("../../../math/sets/intervals/intervals");
|
|
10
|
+
const randint_1 = require("../../../math/utils/random/randint");
|
|
10
11
|
const equalNode_1 = require("../../../tree/nodes/operators/equalNode");
|
|
11
12
|
const variableNode_1 = require("../../../tree/nodes/variables/variableNode");
|
|
13
|
+
const shuffle_1 = require("../../../utils/shuffle");
|
|
14
|
+
const uuid_1 = require("uuid");
|
|
12
15
|
/**
|
|
13
16
|
* type ax+b=cx+d
|
|
14
17
|
*/
|
|
@@ -35,10 +38,34 @@ function getEquationType4ExerciseQuestion() {
|
|
|
35
38
|
const solution = new rational_1.Rational(d.value - b.value, a.value - c.value).simplify();
|
|
36
39
|
const statementTree = new equalNode_1.EqualNode(affines[0].toTree(), affines[1].toTree());
|
|
37
40
|
const answerTree = new equalNode_1.EqualNode(new variableNode_1.VariableNode('x'), solution.toTree());
|
|
41
|
+
const getPropositions = (n) => {
|
|
42
|
+
const res = [];
|
|
43
|
+
res.push({
|
|
44
|
+
id: (0, uuid_1.v4)() + '',
|
|
45
|
+
statement: answerTree.toTex(),
|
|
46
|
+
isRightAnswer: true,
|
|
47
|
+
});
|
|
48
|
+
for (let i = 0; i < n - 1; i++) {
|
|
49
|
+
let isDuplicate;
|
|
50
|
+
let proposition;
|
|
51
|
+
do {
|
|
52
|
+
const wrongAnswer = new rational_1.Rational(d.value - b.value + (0, randint_1.randint)(-7, 8, [0, -d.value + b.value]), a.value - c.value + (0, randint_1.randint)(-7, 8, [-a.value + c.value, 0])).simplify();
|
|
53
|
+
proposition = {
|
|
54
|
+
id: (0, uuid_1.v4)() + '',
|
|
55
|
+
statement: new equalNode_1.EqualNode(new variableNode_1.VariableNode('x'), wrongAnswer.toTree()).toTex(),
|
|
56
|
+
isRightAnswer: false,
|
|
57
|
+
};
|
|
58
|
+
isDuplicate = res.some((p) => p.statement === proposition.statement);
|
|
59
|
+
} while (isDuplicate);
|
|
60
|
+
res.push(proposition);
|
|
61
|
+
}
|
|
62
|
+
return (0, shuffle_1.shuffle)(res);
|
|
63
|
+
};
|
|
38
64
|
const question = {
|
|
39
65
|
startStatement: statementTree.toTex(),
|
|
40
66
|
answer: answerTree.toTex(),
|
|
41
67
|
keys: ['x', 'S', 'equal', 'lbrace', 'rbrace', 'semicolon', 'emptyset'],
|
|
68
|
+
getPropositions,
|
|
42
69
|
};
|
|
43
70
|
return question;
|
|
44
71
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evaluateExpression.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/equation/evaluateExpression.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAQ3E,eAAO,MAAM,kBAAkB,EAAE,QAUhC,CAAC;AAEF,wBAAgB,qBAAqB,IAAI,QAAQ,CAiDhD"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getEvaluateExpression = exports.evaluateExpression = void 0;
|
|
4
|
+
const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
|
|
5
|
+
const polynomial_1 = require("../../../math/polynomials/polynomial");
|
|
6
|
+
const randint_1 = require("../../../math/utils/random/randint");
|
|
7
|
+
const coinFlip_1 = require("../../../utils/coinFlip");
|
|
8
|
+
const shuffle_1 = require("../../../utils/shuffle");
|
|
9
|
+
const uuid_1 = require("uuid");
|
|
10
|
+
exports.evaluateExpression = {
|
|
11
|
+
id: 'evaluateExpression',
|
|
12
|
+
connector: '=',
|
|
13
|
+
instruction: '',
|
|
14
|
+
label: 'Evaluer une expression',
|
|
15
|
+
levels: ['4', '3', '2'],
|
|
16
|
+
section: 'Équations',
|
|
17
|
+
isSingleStep: true,
|
|
18
|
+
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getEvaluateExpression, nb),
|
|
19
|
+
keys: ['x', 'S', 'equal', 'lbrace', 'rbrace', 'semicolon', 'emptyset'],
|
|
20
|
+
};
|
|
21
|
+
function getEvaluateExpression() {
|
|
22
|
+
const rand = (0, coinFlip_1.coinFlip)();
|
|
23
|
+
const polynome1 = new polynomial_1.Polynomial([(0, randint_1.randint)(-9, 10), (0, randint_1.randint)(-5, 6, [0])]);
|
|
24
|
+
const polynome2 = new polynomial_1.Polynomial([(0, randint_1.randint)(-9, 10), (0, randint_1.randint)(-9, 10), (0, randint_1.randint)(-4, 5, [0])]);
|
|
25
|
+
const xValue = (0, randint_1.randint)(-9, 10);
|
|
26
|
+
const statement = rand
|
|
27
|
+
? `Calculer $${polynome1.toTree().toTex()}$ pour x = $${xValue}$`
|
|
28
|
+
: `Calculer $${polynome2.toTree().toTex()}$ pour x = $${xValue}$`;
|
|
29
|
+
const answer = rand ? polynome1.calculate(xValue) : polynome2.calculate(xValue);
|
|
30
|
+
const getPropositions = (n) => {
|
|
31
|
+
const res = [];
|
|
32
|
+
res.push({
|
|
33
|
+
id: (0, uuid_1.v4)() + '',
|
|
34
|
+
statement: answer + '',
|
|
35
|
+
isRightAnswer: true,
|
|
36
|
+
});
|
|
37
|
+
for (let i = 0; i < n - 1; i++) {
|
|
38
|
+
let isDuplicate;
|
|
39
|
+
let proposition;
|
|
40
|
+
do {
|
|
41
|
+
const wrongAnswer = answer + (0, randint_1.randint)(-10, 11, [0]);
|
|
42
|
+
proposition = {
|
|
43
|
+
id: (0, uuid_1.v4)() + '',
|
|
44
|
+
statement: wrongAnswer + '',
|
|
45
|
+
isRightAnswer: false,
|
|
46
|
+
};
|
|
47
|
+
isDuplicate = res.some((p) => p.statement === proposition.statement);
|
|
48
|
+
} while (isDuplicate);
|
|
49
|
+
res.push(proposition);
|
|
50
|
+
}
|
|
51
|
+
return (0, shuffle_1.shuffle)(res);
|
|
52
|
+
};
|
|
53
|
+
const question = {
|
|
54
|
+
instruction: statement,
|
|
55
|
+
answer: answer + '',
|
|
56
|
+
keys: ['x', 'S', 'equal', 'lbrace', 'rbrace', 'semicolon', 'emptyset'],
|
|
57
|
+
getPropositions,
|
|
58
|
+
};
|
|
59
|
+
return question;
|
|
60
|
+
}
|
|
61
|
+
exports.getEvaluateExpression = getEvaluateExpression;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firstDegreeEquation.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/equation/firstDegreeEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"firstDegreeEquation.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/equation/firstDegreeEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAQ3E,eAAO,MAAM,mBAAmB,EAAE,QAUjC,CAAC;AAEF,wBAAgB,sBAAsB,IAAI,QAAQ,CA0CjD"}
|