math-exercises 1.3.39 → 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 -1
- package/lib/exercises/geometry/euclidean/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
|
@@ -5,6 +5,8 @@ const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQues
|
|
|
5
5
|
const triangles_1 = require("../../../math/geometry/triangles");
|
|
6
6
|
const randint_1 = require("../../../math/utils/random/randint");
|
|
7
7
|
const round_1 = require("../../../math/utils/round");
|
|
8
|
+
const shuffle_1 = require("../../../utils/shuffle");
|
|
9
|
+
const uuid_1 = require("uuid");
|
|
8
10
|
exports.trigonometrySideCalcul = {
|
|
9
11
|
id: 'trigonometrySideCalcul',
|
|
10
12
|
connector: '=',
|
|
@@ -40,12 +42,35 @@ function getTrigonometrySideCalcul() {
|
|
|
40
42
|
highlightedSide: sides[randsideQuestion],
|
|
41
43
|
}),
|
|
42
44
|
];
|
|
45
|
+
const getPropositions = (n) => {
|
|
46
|
+
const res = [];
|
|
47
|
+
res.push({
|
|
48
|
+
id: (0, uuid_1.v4)() + '',
|
|
49
|
+
statement: `${(0, round_1.round)(sideLengths[randsideQuestion], 1)}`,
|
|
50
|
+
isRightAnswer: true,
|
|
51
|
+
});
|
|
52
|
+
for (let i = 0; i < n - 1; i++) {
|
|
53
|
+
let isDuplicate;
|
|
54
|
+
let proposition;
|
|
55
|
+
do {
|
|
56
|
+
proposition = {
|
|
57
|
+
id: (0, uuid_1.v4)() + '',
|
|
58
|
+
statement: `${(0, round_1.round)((0, randint_1.randint)(11, 100) / 10, 1)}`,
|
|
59
|
+
isRightAnswer: false,
|
|
60
|
+
};
|
|
61
|
+
isDuplicate = res.some((p) => p.statement === proposition.statement);
|
|
62
|
+
} while (isDuplicate);
|
|
63
|
+
res.push(proposition);
|
|
64
|
+
}
|
|
65
|
+
return (0, shuffle_1.shuffle)(res);
|
|
66
|
+
};
|
|
43
67
|
const question = {
|
|
44
68
|
instruction: `Le triangle ${triangle.getTriangleName()} rectangle en ${triangle.getRightAngle()} tel que ${sides[randside]} = $${sideLengths[randside]}$ cm et $\\widehat{${angle[randAngle]}}$ = $${angleValue[randAngle]}$°.$\\\\$ Calculer ${sides[randsideQuestion]} à $0,1$ cm près.`,
|
|
45
69
|
answer: `${(0, round_1.round)(sideLengths[randsideQuestion], 1)}`,
|
|
46
70
|
keys: [...vertices, 'equal', '°', 'cos', 'sin', 'tan', 'arccos', 'arcsin', 'arctan'],
|
|
47
71
|
commands,
|
|
48
72
|
coords: triangle.generateCoords(),
|
|
73
|
+
getPropositions,
|
|
49
74
|
};
|
|
50
75
|
return question;
|
|
51
76
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scalarProductViaCoords.d.ts","sourceRoot":"","sources":["../../../../src/exercises/geometry/vectors/scalarProductViaCoords.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"scalarProductViaCoords.d.ts","sourceRoot":"","sources":["../../../../src/exercises/geometry/vectors/scalarProductViaCoords.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAe,MAAM,0BAA0B,CAAC;AAS3E,eAAO,MAAM,sBAAsB,EAAE,QAUpC,CAAC;AAEF,wBAAgB,iCAAiC,IAAI,QAAQ,CA2C5D"}
|
|
@@ -4,7 +4,10 @@ exports.getScalarProductViaCoordsQuestion = exports.scalarProductViaCoords = voi
|
|
|
4
4
|
const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
|
|
5
5
|
const vector_1 = require("../../../math/geometry/vector");
|
|
6
6
|
const randTupleInt_1 = require("../../../math/utils/random/randTupleInt");
|
|
7
|
+
const randint_1 = require("../../../math/utils/random/randint");
|
|
7
8
|
const numberNode_1 = require("../../../tree/nodes/numbers/numberNode");
|
|
9
|
+
const shuffle_1 = require("../../../utils/shuffle");
|
|
10
|
+
const uuid_1 = require("uuid");
|
|
8
11
|
exports.scalarProductViaCoords = {
|
|
9
12
|
id: 'scalarProductViaCoords',
|
|
10
13
|
connector: '=',
|
|
@@ -20,11 +23,35 @@ function getScalarProductViaCoordsQuestion() {
|
|
|
20
23
|
const [coords1, coords2] = (0, randTupleInt_1.distinctRandTupleInt)(2, 2, { from: -9, to: 10 });
|
|
21
24
|
const u = new vector_1.Vector('u', new numberNode_1.NumberNode(coords1[0]), new numberNode_1.NumberNode(coords1[1]));
|
|
22
25
|
const v = new vector_1.Vector('v', new numberNode_1.NumberNode(coords2[0]), new numberNode_1.NumberNode(coords2[1]));
|
|
26
|
+
const correctAnswer = u.scalarProduct(v).toTex();
|
|
27
|
+
const getPropositions = (n) => {
|
|
28
|
+
const res = [];
|
|
29
|
+
res.push({
|
|
30
|
+
id: (0, uuid_1.v4)() + '',
|
|
31
|
+
statement: correctAnswer,
|
|
32
|
+
isRightAnswer: true,
|
|
33
|
+
});
|
|
34
|
+
for (let i = 0; i < n - 1; i++) {
|
|
35
|
+
let isDuplicate;
|
|
36
|
+
let proposition;
|
|
37
|
+
do {
|
|
38
|
+
proposition = {
|
|
39
|
+
id: (0, uuid_1.v4)() + '',
|
|
40
|
+
statement: (0, randint_1.randint)(-100, 100, [0]) + '',
|
|
41
|
+
isRightAnswer: false,
|
|
42
|
+
};
|
|
43
|
+
isDuplicate = res.some((p) => p.statement === proposition.statement);
|
|
44
|
+
} while (isDuplicate);
|
|
45
|
+
res.push(proposition);
|
|
46
|
+
}
|
|
47
|
+
return (0, shuffle_1.shuffle)(res);
|
|
48
|
+
};
|
|
23
49
|
return {
|
|
24
50
|
instruction: `Soit $${u.toTexWithCoords()}$ et $${v.toTexWithCoords()}$. Calculer $${u.toTex()}\\cdot ${v.toTex()}$.`,
|
|
25
51
|
startStatement: `${u.toTex()}\\cdot ${v.toTex()}`,
|
|
26
|
-
answer:
|
|
52
|
+
answer: correctAnswer,
|
|
27
53
|
keys: [],
|
|
54
|
+
getPropositions,
|
|
28
55
|
};
|
|
29
56
|
}
|
|
30
57
|
exports.getScalarProductViaCoordsQuestion = getScalarProductViaCoordsQuestion;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applyPercent.d.ts","sourceRoot":"","sources":["../../../src/exercises/percent/applyPercent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"applyPercent.d.ts","sourceRoot":"","sources":["../../../src/exercises/percent/applyPercent.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,aAAa,CAAC;AAI9D,eAAO,MAAM,YAAY,EAAE,QAU1B,CAAC;AAEF,wBAAgB,uBAAuB,IAAI,QAAQ,CA4DlD"}
|
|
@@ -4,7 +4,9 @@ exports.getApplyPercentQuestion = exports.applyPercent = void 0;
|
|
|
4
4
|
const randint_1 = require("../../math/utils/random/randint");
|
|
5
5
|
const round_1 = require("../../math/utils/round");
|
|
6
6
|
const coinFlip_1 = require("../../utils/coinFlip");
|
|
7
|
+
const shuffle_1 = require("../../utils/shuffle");
|
|
7
8
|
const getDistinctQuestions_1 = require("../utils/getDistinctQuestions");
|
|
9
|
+
const uuid_1 = require("uuid");
|
|
8
10
|
exports.applyPercent = {
|
|
9
11
|
id: 'applyPercent',
|
|
10
12
|
connector: '=',
|
|
@@ -31,10 +33,38 @@ function getApplyPercentQuestion() {
|
|
|
31
33
|
ans = (0, round_1.round)(ans, 2);
|
|
32
34
|
instruction = `Appliquer une baisse de $${randPercent}\\%$ à $${randNbr}$.`;
|
|
33
35
|
}
|
|
36
|
+
const getPropositions = (n) => {
|
|
37
|
+
const res = [];
|
|
38
|
+
res.push({
|
|
39
|
+
id: (0, uuid_1.v4)() + '',
|
|
40
|
+
statement: ans.toString(),
|
|
41
|
+
isRightAnswer: true,
|
|
42
|
+
});
|
|
43
|
+
for (let i = 0; i < n - 1; i++) {
|
|
44
|
+
let isDuplicate;
|
|
45
|
+
let proposition;
|
|
46
|
+
do {
|
|
47
|
+
let wrongAnswer = ans;
|
|
48
|
+
const deviation = Math.random() < 0.5 ? -1 : 1;
|
|
49
|
+
const percentDeviation = Math.random() * 20 + 1;
|
|
50
|
+
wrongAnswer += deviation * (percentDeviation / 100) * ans;
|
|
51
|
+
wrongAnswer = (0, round_1.round)(wrongAnswer, 2);
|
|
52
|
+
proposition = {
|
|
53
|
+
id: (0, uuid_1.v4)() + '',
|
|
54
|
+
statement: wrongAnswer.toString(),
|
|
55
|
+
isRightAnswer: false,
|
|
56
|
+
};
|
|
57
|
+
isDuplicate = res.some((p) => p.statement === proposition.statement);
|
|
58
|
+
} while (isDuplicate);
|
|
59
|
+
res.push(proposition);
|
|
60
|
+
}
|
|
61
|
+
return (0, shuffle_1.shuffle)(res);
|
|
62
|
+
};
|
|
34
63
|
const question = {
|
|
35
64
|
instruction,
|
|
36
65
|
answer: ans.toString(),
|
|
37
66
|
keys: ['percent'],
|
|
67
|
+
getPropositions,
|
|
38
68
|
};
|
|
39
69
|
return question;
|
|
40
70
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"averageEvolutionRate.d.ts","sourceRoot":"","sources":["../../../src/exercises/percent/averageEvolutionRate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"averageEvolutionRate.d.ts","sourceRoot":"","sources":["../../../src/exercises/percent/averageEvolutionRate.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,aAAa,CAAC;AAI9D,eAAO,MAAM,oBAAoB,EAAE,QAUlC,CAAC;AAEF,wBAAgB,uBAAuB,IAAI,QAAQ,CAmDlD"}
|
|
@@ -3,7 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getAverageEvolutionRate = exports.averageEvolutionRate = void 0;
|
|
4
4
|
const randint_1 = require("../../math/utils/random/randint");
|
|
5
5
|
const round_1 = require("../../math/utils/round");
|
|
6
|
+
const shuffle_1 = require("../../utils/shuffle");
|
|
6
7
|
const getDistinctQuestions_1 = require("../utils/getDistinctQuestions");
|
|
8
|
+
const uuid_1 = require("uuid");
|
|
7
9
|
exports.averageEvolutionRate = {
|
|
8
10
|
id: 'averageEvolutionRate',
|
|
9
11
|
connector: '=',
|
|
@@ -19,11 +21,39 @@ function getAverageEvolutionRate() {
|
|
|
19
21
|
const rate = (0, randint_1.randint)(1, 100);
|
|
20
22
|
const nbMois = (0, randint_1.randint)(2, 13);
|
|
21
23
|
const instruction = `Un prix augmente de $${rate}\\%$ en $${nbMois}$ mois. Quel est le taux d'évolution mensuel moyen ?`;
|
|
22
|
-
const answer =
|
|
24
|
+
const answer = (0, round_1.round)((Math.pow(1 + rate / 100, 1 / nbMois) - 1) * 100, 2);
|
|
25
|
+
const getPropositions = (n) => {
|
|
26
|
+
const res = [];
|
|
27
|
+
res.push({
|
|
28
|
+
id: (0, uuid_1.v4)() + '',
|
|
29
|
+
statement: `${answer}\\%`,
|
|
30
|
+
isRightAnswer: true,
|
|
31
|
+
});
|
|
32
|
+
for (let i = 0; i < n - 1; i++) {
|
|
33
|
+
let isDuplicate;
|
|
34
|
+
let proposition;
|
|
35
|
+
do {
|
|
36
|
+
let wrongAnswer = answer;
|
|
37
|
+
const deviation = Math.random() < 0.5 ? -1 : 1;
|
|
38
|
+
const percentDeviation = Math.random() * 10 + 1;
|
|
39
|
+
wrongAnswer += deviation * percentDeviation;
|
|
40
|
+
wrongAnswer = (0, round_1.round)(wrongAnswer, 2);
|
|
41
|
+
proposition = {
|
|
42
|
+
id: (0, uuid_1.v4)() + '',
|
|
43
|
+
statement: `${wrongAnswer}\\%`,
|
|
44
|
+
isRightAnswer: false,
|
|
45
|
+
};
|
|
46
|
+
isDuplicate = res.some((p) => p.statement === proposition.statement);
|
|
47
|
+
} while (isDuplicate);
|
|
48
|
+
res.push(proposition);
|
|
49
|
+
}
|
|
50
|
+
return (0, shuffle_1.shuffle)(res);
|
|
51
|
+
};
|
|
23
52
|
const question = {
|
|
24
53
|
instruction,
|
|
25
|
-
answer
|
|
54
|
+
answer: answer + `\\%`,
|
|
26
55
|
keys: ['percent'],
|
|
56
|
+
getPropositions,
|
|
27
57
|
};
|
|
28
58
|
return question;
|
|
29
59
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"globalPercent.d.ts","sourceRoot":"","sources":["../../../src/exercises/percent/globalPercent.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"globalPercent.d.ts","sourceRoot":"","sources":["../../../src/exercises/percent/globalPercent.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,aAAa,CAAC;AAK9D,eAAO,MAAM,aAAa,EAAE,QAU3B,CAAC;AAEF,wBAAgB,wBAAwB,IAAI,QAAQ,CAkEnD"}
|
|
@@ -4,6 +4,8 @@ exports.getGlobalPercentQuestion = exports.globalPercent = void 0;
|
|
|
4
4
|
const randint_1 = require("../../math/utils/random/randint");
|
|
5
5
|
const mathjs_1 = require("mathjs");
|
|
6
6
|
const getDistinctQuestions_1 = require("../utils/getDistinctQuestions");
|
|
7
|
+
const uuid_1 = require("uuid");
|
|
8
|
+
const shuffle_1 = require("../../utils/shuffle");
|
|
7
9
|
exports.globalPercent = {
|
|
8
10
|
id: 'globalPercent',
|
|
9
11
|
connector: '=',
|
|
@@ -34,10 +36,38 @@ function getGlobalPercentQuestion() {
|
|
|
34
36
|
ans = (0, mathjs_1.round)((ans - 1) * 100, 2);
|
|
35
37
|
instruction += ". \nDéterminer le taux d'évolution global du prix de cet article.";
|
|
36
38
|
const answer = `${ans} \\%`;
|
|
39
|
+
const getPropositions = (n) => {
|
|
40
|
+
const res = [];
|
|
41
|
+
res.push({
|
|
42
|
+
id: (0, uuid_1.v4)() + '',
|
|
43
|
+
statement: answer,
|
|
44
|
+
isRightAnswer: true,
|
|
45
|
+
});
|
|
46
|
+
for (let i = 0; i < n - 1; i++) {
|
|
47
|
+
let isDuplicate;
|
|
48
|
+
let proposition;
|
|
49
|
+
do {
|
|
50
|
+
let wrongAnswer = ans;
|
|
51
|
+
const deviation = Math.random() < 0.5 ? -1 : 1;
|
|
52
|
+
const percentDeviation = Math.random() * 20 + 1;
|
|
53
|
+
wrongAnswer += deviation * percentDeviation;
|
|
54
|
+
wrongAnswer = (0, mathjs_1.round)(wrongAnswer, 2);
|
|
55
|
+
proposition = {
|
|
56
|
+
id: (0, uuid_1.v4)() + '',
|
|
57
|
+
statement: `${wrongAnswer} \\%`,
|
|
58
|
+
isRightAnswer: false,
|
|
59
|
+
};
|
|
60
|
+
isDuplicate = res.some((p) => p.statement === proposition.statement);
|
|
61
|
+
} while (isDuplicate);
|
|
62
|
+
res.push(proposition);
|
|
63
|
+
}
|
|
64
|
+
return (0, shuffle_1.shuffle)(res);
|
|
65
|
+
};
|
|
37
66
|
const question = {
|
|
38
67
|
instruction,
|
|
39
68
|
answer,
|
|
40
69
|
keys: ['percent'],
|
|
70
|
+
getPropositions,
|
|
41
71
|
};
|
|
42
72
|
return question;
|
|
43
73
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reciprocalPercentage.d.ts","sourceRoot":"","sources":["../../../src/exercises/percent/reciprocalPercentage.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"reciprocalPercentage.d.ts","sourceRoot":"","sources":["../../../src/exercises/percent/reciprocalPercentage.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,aAAa,CAAC;AAK9D,eAAO,MAAM,oBAAoB,EAAE,QAUlC,CAAC;AAEF,wBAAgB,+BAA+B,IAAI,QAAQ,CAqD1D"}
|
|
@@ -4,6 +4,8 @@ exports.getReciprocalPercentageQuestion = exports.reciprocalPercentage = void 0;
|
|
|
4
4
|
const randint_1 = require("../../math/utils/random/randint");
|
|
5
5
|
const mathjs_1 = require("mathjs");
|
|
6
6
|
const getDistinctQuestions_1 = require("../utils/getDistinctQuestions");
|
|
7
|
+
const uuid_1 = require("uuid");
|
|
8
|
+
const shuffle_1 = require("../../utils/shuffle");
|
|
7
9
|
exports.reciprocalPercentage = {
|
|
8
10
|
id: 'reciprocalPercentage',
|
|
9
11
|
connector: '=',
|
|
@@ -22,10 +24,38 @@ function getReciprocalPercentageQuestion() {
|
|
|
22
24
|
let a = (0, randint_1.randint)(0, 2);
|
|
23
25
|
let instruction = `Le prix d'un article subit une ${tab[a]} de $${randPercent}\\%$. Quelle évolution devra-t-il subir pour revenir à son prix initial ?`;
|
|
24
26
|
ans = a == 0 ? (1 / (1 + randPercent / 100) - 1) * 100 : (1 / (1 - randPercent / 100) - 1) * 100;
|
|
27
|
+
const getPropositions = (n) => {
|
|
28
|
+
const res = [];
|
|
29
|
+
res.push({
|
|
30
|
+
id: (0, uuid_1.v4)() + '',
|
|
31
|
+
statement: `${ans > 0 ? '+' + (0, mathjs_1.round)(ans, 2) : (0, mathjs_1.round)(ans, 2)} \\%`,
|
|
32
|
+
isRightAnswer: true,
|
|
33
|
+
});
|
|
34
|
+
for (let i = 0; i < n - 1; i++) {
|
|
35
|
+
let isDuplicate;
|
|
36
|
+
let proposition;
|
|
37
|
+
do {
|
|
38
|
+
let wrongAnswer = ans;
|
|
39
|
+
const deviation = Math.random() < 0.5 ? -1 : 1;
|
|
40
|
+
const percentDeviation = Math.random() * 20 + 1;
|
|
41
|
+
wrongAnswer += deviation * percentDeviation;
|
|
42
|
+
wrongAnswer = (0, mathjs_1.round)(wrongAnswer, 2);
|
|
43
|
+
proposition = {
|
|
44
|
+
id: (0, uuid_1.v4)() + '',
|
|
45
|
+
statement: `${wrongAnswer > 0 ? '+' + wrongAnswer : wrongAnswer} \\%`,
|
|
46
|
+
isRightAnswer: false,
|
|
47
|
+
};
|
|
48
|
+
isDuplicate = res.some((p) => p.statement === proposition.statement);
|
|
49
|
+
} while (isDuplicate);
|
|
50
|
+
res.push(proposition);
|
|
51
|
+
}
|
|
52
|
+
return (0, shuffle_1.shuffle)(res);
|
|
53
|
+
};
|
|
25
54
|
const question = {
|
|
26
55
|
instruction,
|
|
27
56
|
answer: `${ans > 0 ? '+' + (0, mathjs_1.round)(ans, 2) : (0, mathjs_1.round)(ans, 2)} \\%`,
|
|
28
57
|
keys: ['percent'],
|
|
58
|
+
getPropositions,
|
|
29
59
|
};
|
|
30
60
|
return question;
|
|
31
61
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"powersDivision.d.ts","sourceRoot":"","sources":["../../../src/exercises/powers/powersDivision.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"powersDivision.d.ts","sourceRoot":"","sources":["../../../src/exercises/powers/powersDivision.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,aAAa,CAAC;AAI9D,eAAO,MAAM,cAAc,EAAE,QAS5B,CAAC;AACF,eAAO,MAAM,mBAAmB,EAAE,QAUjC,CAAC;AAEF,wBAAgB,yBAAyB,CAAC,kBAAkB,GAAE,OAAe,GAAG,QAAQ,CAkDvF"}
|
|
@@ -9,7 +9,9 @@ const randint_1 = require("../../math/utils/random/randint");
|
|
|
9
9
|
const numberNode_1 = require("../../tree/nodes/numbers/numberNode");
|
|
10
10
|
const fractionNode_1 = require("../../tree/nodes/operators/fractionNode");
|
|
11
11
|
const powerNode_1 = require("../../tree/nodes/operators/powerNode");
|
|
12
|
+
const shuffle_1 = require("../../utils/shuffle");
|
|
12
13
|
const getDistinctQuestions_1 = require("../utils/getDistinctQuestions");
|
|
14
|
+
const uuid_1 = require("uuid");
|
|
13
15
|
exports.powersDivision = {
|
|
14
16
|
id: 'powersDivision',
|
|
15
17
|
connector: '=',
|
|
@@ -32,14 +34,40 @@ exports.powersOfTenDivision = {
|
|
|
32
34
|
keys: [],
|
|
33
35
|
};
|
|
34
36
|
function getPowersDivisionQuestion(useOnlyPowersOfTen = false) {
|
|
35
|
-
|
|
37
|
+
let a = useOnlyPowersOfTen ? 10 : (0, randint_1.randint)(-11, 11, [0]);
|
|
36
38
|
const [b, c] = [1, 2].map((el) => (0, randint_1.randint)(-11, 11));
|
|
37
39
|
const statement = new fractionNode_1.FractionNode(new powerNode_1.PowerNode(new numberNode_1.NumberNode(a), new numberNode_1.NumberNode(b)), new powerNode_1.PowerNode(new numberNode_1.NumberNode(a), new numberNode_1.NumberNode(c)));
|
|
38
40
|
const answerTree = new power_1.Power(a, b - c).simplify();
|
|
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 wrongPower = b - c + (0, randint_1.randint)(-5, 6, [0, c - b]);
|
|
53
|
+
const wrongAnswerTree = new power_1.Power(a === 1 || a === -1 ? (0, randint_1.randint)(-3, 4, [-1, 1]) : a, wrongPower).simplify(); // pour éviter les 1 1 -1 1 dans propositions
|
|
54
|
+
const wrongAnswer = wrongAnswerTree.toTex();
|
|
55
|
+
proposition = {
|
|
56
|
+
id: (0, uuid_1.v4)() + '',
|
|
57
|
+
statement: wrongAnswer,
|
|
58
|
+
isRightAnswer: false,
|
|
59
|
+
};
|
|
60
|
+
isDuplicate = res.some((p) => p.statement === proposition.statement);
|
|
61
|
+
} while (isDuplicate);
|
|
62
|
+
res.push(proposition);
|
|
63
|
+
}
|
|
64
|
+
return (0, shuffle_1.shuffle)(res);
|
|
65
|
+
};
|
|
39
66
|
const question = {
|
|
40
67
|
startStatement: statement.toTex(),
|
|
41
68
|
answer: answerTree.toTex(),
|
|
42
69
|
keys: [],
|
|
70
|
+
getPropositions,
|
|
43
71
|
};
|
|
44
72
|
return question;
|
|
45
73
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"powersOfTenToDecimal.d.ts","sourceRoot":"","sources":["../../../src/exercises/powers/powersOfTenToDecimal.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"powersOfTenToDecimal.d.ts","sourceRoot":"","sources":["../../../src/exercises/powers/powersOfTenToDecimal.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,aAAa,CAAC;AAI9D,eAAO,MAAM,oBAAoB,EAAE,QAUlC,CAAC;AAEF,wBAAgB,8BAA8B,IAAI,QAAQ,CA8CzD"}
|
|
@@ -8,7 +8,9 @@ const power_1 = require("../../math/numbers/integer/power");
|
|
|
8
8
|
const randint_1 = require("../../math/utils/random/randint");
|
|
9
9
|
const numberNode_1 = require("../../tree/nodes/numbers/numberNode");
|
|
10
10
|
const powerNode_1 = require("../../tree/nodes/operators/powerNode");
|
|
11
|
+
const shuffle_1 = require("../../utils/shuffle");
|
|
11
12
|
const getDistinctQuestions_1 = require("../utils/getDistinctQuestions");
|
|
13
|
+
const uuid_1 = require("uuid");
|
|
12
14
|
exports.powersOfTenToDecimal = {
|
|
13
15
|
id: 'powersOfTenToDecimal',
|
|
14
16
|
connector: '=',
|
|
@@ -24,10 +26,36 @@ function getPowersOfTenDivisionQuestion() {
|
|
|
24
26
|
const randPower = (0, randint_1.randint)(-6, 8);
|
|
25
27
|
const statement = new powerNode_1.PowerNode(new numberNode_1.NumberNode(10), new numberNode_1.NumberNode(randPower));
|
|
26
28
|
const answerTree = new power_1.Power(10, randPower).toDecimalWriting().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
|
+
for (let i = 0; i < n - 1; i++) {
|
|
37
|
+
let isDuplicate;
|
|
38
|
+
let proposition;
|
|
39
|
+
do {
|
|
40
|
+
const wrongPower = randPower + (0, randint_1.randint)(-3, 4, [0]);
|
|
41
|
+
const wrongAnswerTree = new power_1.Power(10, wrongPower).toDecimalWriting().toTree();
|
|
42
|
+
const wrongAnswer = wrongAnswerTree.toTex();
|
|
43
|
+
proposition = {
|
|
44
|
+
id: (0, uuid_1.v4)() + '',
|
|
45
|
+
statement: wrongAnswer,
|
|
46
|
+
isRightAnswer: false,
|
|
47
|
+
};
|
|
48
|
+
isDuplicate = res.some((p) => p.statement === proposition.statement);
|
|
49
|
+
} while (isDuplicate);
|
|
50
|
+
res.push(proposition);
|
|
51
|
+
}
|
|
52
|
+
return (0, shuffle_1.shuffle)(res);
|
|
53
|
+
};
|
|
27
54
|
const question = {
|
|
28
55
|
startStatement: statement.toTex(),
|
|
29
56
|
answer: answerTree.toTex(),
|
|
30
57
|
keys: [],
|
|
58
|
+
getPropositions,
|
|
31
59
|
};
|
|
32
60
|
return question;
|
|
33
61
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"powersPower.d.ts","sourceRoot":"","sources":["../../../src/exercises/powers/powersPower.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"powersPower.d.ts","sourceRoot":"","sources":["../../../src/exercises/powers/powersPower.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,aAAa,CAAC;AAI9D,eAAO,MAAM,gBAAgB,EAAE,QAS9B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,QAUzB,CAAC;AAEF,wBAAgB,sBAAsB,CAAC,kBAAkB,GAAE,OAAe,GAAG,QAAQ,CA+CpF"}
|
|
@@ -8,7 +8,9 @@ const power_1 = require("../../math/numbers/integer/power");
|
|
|
8
8
|
const randint_1 = require("../../math/utils/random/randint");
|
|
9
9
|
const numberNode_1 = require("../../tree/nodes/numbers/numberNode");
|
|
10
10
|
const powerNode_1 = require("../../tree/nodes/operators/powerNode");
|
|
11
|
+
const shuffle_1 = require("../../utils/shuffle");
|
|
11
12
|
const getDistinctQuestions_1 = require("../utils/getDistinctQuestions");
|
|
13
|
+
const uuid_1 = require("uuid");
|
|
12
14
|
exports.powersOfTenPower = {
|
|
13
15
|
id: 'powersOfTenPower',
|
|
14
16
|
connector: '=',
|
|
@@ -35,10 +37,36 @@ function getPowersPowerQuestion(useOnlyPowersOfTen = false) {
|
|
|
35
37
|
const [b, c] = [1, 2].map((el) => (0, randint_1.randint)(-11, 11));
|
|
36
38
|
const statement = new powerNode_1.PowerNode(new powerNode_1.PowerNode(new numberNode_1.NumberNode(a), new numberNode_1.NumberNode(b)), new numberNode_1.NumberNode(c));
|
|
37
39
|
let answerTree = new power_1.Power(a, b * c).simplify();
|
|
40
|
+
const getPropositions = (n) => {
|
|
41
|
+
const res = [];
|
|
42
|
+
res.push({
|
|
43
|
+
id: (0, uuid_1.v4)() + '',
|
|
44
|
+
statement: answerTree.toTex(),
|
|
45
|
+
isRightAnswer: true,
|
|
46
|
+
});
|
|
47
|
+
for (let i = 0; i < n - 1; i++) {
|
|
48
|
+
let isDuplicate;
|
|
49
|
+
let proposition;
|
|
50
|
+
do {
|
|
51
|
+
const wrongExponent = b * c + (0, randint_1.randint)(-11, 11, [0]);
|
|
52
|
+
const wrongAnswerTree = new power_1.Power(a, wrongExponent).simplify();
|
|
53
|
+
const wrongAnswer = wrongAnswerTree.toTex();
|
|
54
|
+
proposition = {
|
|
55
|
+
id: (0, uuid_1.v4)() + '',
|
|
56
|
+
statement: wrongAnswer,
|
|
57
|
+
isRightAnswer: false,
|
|
58
|
+
};
|
|
59
|
+
isDuplicate = res.some((p) => p.statement === proposition.statement);
|
|
60
|
+
} while (isDuplicate);
|
|
61
|
+
res.push(proposition);
|
|
62
|
+
}
|
|
63
|
+
return (0, shuffle_1.shuffle)(res);
|
|
64
|
+
};
|
|
38
65
|
const question = {
|
|
39
66
|
startStatement: statement.toTex(),
|
|
40
67
|
answer: answerTree.toTex(),
|
|
41
68
|
keys: [],
|
|
69
|
+
getPropositions,
|
|
42
70
|
};
|
|
43
71
|
return question;
|
|
44
72
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"powersProduct.d.ts","sourceRoot":"","sources":["../../../src/exercises/powers/powersProduct.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"powersProduct.d.ts","sourceRoot":"","sources":["../../../src/exercises/powers/powersProduct.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,aAAa,CAAC;AAI9D,eAAO,MAAM,kBAAkB,EAAE,QAShC,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,QAU3B,CAAC;AAEF,wBAAgB,wBAAwB,CAAC,kBAAkB,GAAE,OAAe,GAAG,QAAQ,CAkDtF"}
|
|
@@ -9,7 +9,9 @@ const randint_1 = require("../../math/utils/random/randint");
|
|
|
9
9
|
const numberNode_1 = require("../../tree/nodes/numbers/numberNode");
|
|
10
10
|
const multiplyNode_1 = require("../../tree/nodes/operators/multiplyNode");
|
|
11
11
|
const powerNode_1 = require("../../tree/nodes/operators/powerNode");
|
|
12
|
+
const shuffle_1 = require("../../utils/shuffle");
|
|
12
13
|
const getDistinctQuestions_1 = require("../utils/getDistinctQuestions");
|
|
14
|
+
const uuid_1 = require("uuid");
|
|
13
15
|
exports.powersOfTenProduct = {
|
|
14
16
|
id: 'powersOfTenProduct',
|
|
15
17
|
connector: '=',
|
|
@@ -32,14 +34,40 @@ exports.powersProduct = {
|
|
|
32
34
|
keys: [],
|
|
33
35
|
};
|
|
34
36
|
function getPowersProductQuestion(useOnlyPowersOfTen = false) {
|
|
35
|
-
const a = useOnlyPowersOfTen ? 10 : (0, randint_1.randint)(-11, 11);
|
|
37
|
+
const a = useOnlyPowersOfTen ? 10 : (0, randint_1.randint)(-11, 11, [0]);
|
|
36
38
|
const [b, c] = [1, 2].map((el) => (0, randint_1.randint)(-11, 11));
|
|
37
39
|
const statement = new multiplyNode_1.MultiplyNode(new powerNode_1.PowerNode(new numberNode_1.NumberNode(a), new numberNode_1.NumberNode(b)), new powerNode_1.PowerNode(new numberNode_1.NumberNode(a), new numberNode_1.NumberNode(c)));
|
|
38
40
|
const answerTree = new power_1.Power(a, b + c).simplify();
|
|
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 wrongExponent = b + c + (0, randint_1.randint)(-11, 11, [0, -b - c]);
|
|
53
|
+
const wrongAnswerTree = new power_1.Power(a === 1 || a === -1 ? (0, randint_1.randint)(-3, 4, [-1, 1]) : a, wrongExponent).simplify();
|
|
54
|
+
const wrongAnswer = wrongAnswerTree.toTex();
|
|
55
|
+
proposition = {
|
|
56
|
+
id: (0, uuid_1.v4)() + '',
|
|
57
|
+
statement: wrongAnswer,
|
|
58
|
+
isRightAnswer: false,
|
|
59
|
+
};
|
|
60
|
+
isDuplicate = res.some((p) => p.statement === proposition.statement);
|
|
61
|
+
} while (isDuplicate);
|
|
62
|
+
res.push(proposition);
|
|
63
|
+
}
|
|
64
|
+
return (0, shuffle_1.shuffle)(res);
|
|
65
|
+
};
|
|
39
66
|
const question = {
|
|
40
67
|
startStatement: statement.toTex(),
|
|
41
68
|
answer: answerTree.toTex(),
|
|
42
69
|
keys: [],
|
|
70
|
+
getPropositions,
|
|
43
71
|
};
|
|
44
72
|
return question;
|
|
45
73
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scientificToDecimal.d.ts","sourceRoot":"","sources":["../../../src/exercises/powers/scientificToDecimal.ts"],"names":[],"mappings":"AAAA;;MAEM;
|
|
1
|
+
{"version":3,"file":"scientificToDecimal.d.ts","sourceRoot":"","sources":["../../../src/exercises/powers/scientificToDecimal.ts"],"names":[],"mappings":"AAAA;;MAEM;AASN,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,aAAa,CAAC;AAI9D,eAAO,MAAM,mBAAmB,EAAE,QAWjC,CAAC;AAEF,wBAAgB,8BAA8B,IAAI,QAAQ,CAkDzD"}
|
|
@@ -10,7 +10,9 @@ const randint_1 = require("../../math/utils/random/randint");
|
|
|
10
10
|
const numberNode_1 = require("../../tree/nodes/numbers/numberNode");
|
|
11
11
|
const multiplyNode_1 = require("../../tree/nodes/operators/multiplyNode");
|
|
12
12
|
const powerNode_1 = require("../../tree/nodes/operators/powerNode");
|
|
13
|
+
const shuffle_1 = require("../../utils/shuffle");
|
|
13
14
|
const getDistinctQuestions_1 = require("../utils/getDistinctQuestions");
|
|
15
|
+
const uuid_1 = require("uuid");
|
|
14
16
|
exports.scientificToDecimal = {
|
|
15
17
|
id: 'scientificToDecimal',
|
|
16
18
|
connector: '=',
|
|
@@ -29,10 +31,35 @@ function getScientificToDecimalQuestion() {
|
|
|
29
31
|
const randDecimal = decimal_1.DecimalConstructor.fromParts(int + '', fracPart);
|
|
30
32
|
const statement = new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode(randDecimal.value), new powerNode_1.PowerNode(new numberNode_1.NumberNode(10), new numberNode_1.NumberNode(randPower)));
|
|
31
33
|
const answerTree = randDecimal.multiplyByPowerOfTen(randPower).toTree();
|
|
34
|
+
const getPropositions = (n) => {
|
|
35
|
+
const res = [];
|
|
36
|
+
res.push({
|
|
37
|
+
id: (0, uuid_1.v4)() + '',
|
|
38
|
+
statement: answerTree.toTex(),
|
|
39
|
+
isRightAnswer: true,
|
|
40
|
+
});
|
|
41
|
+
for (let i = 0; i < n - 1; i++) {
|
|
42
|
+
let isDuplicate;
|
|
43
|
+
let proposition;
|
|
44
|
+
do {
|
|
45
|
+
const wrongAnswerTree = randDecimal.multiplyByPowerOfTen((0, randint_1.randint)(-6, 8, [randPower])).toTree();
|
|
46
|
+
const wrongAnswer = wrongAnswerTree.toTex();
|
|
47
|
+
proposition = {
|
|
48
|
+
id: (0, uuid_1.v4)() + '',
|
|
49
|
+
statement: 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: statement.toTex(),
|
|
34
60
|
answer: answerTree.toTex(),
|
|
35
61
|
keys: [],
|
|
62
|
+
getPropositions,
|
|
36
63
|
};
|
|
37
64
|
return question;
|
|
38
65
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conditionalProbability.d.ts","sourceRoot":"","sources":["../../../src/exercises/proba/conditionalProbability.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"conditionalProbability.d.ts","sourceRoot":"","sources":["../../../src/exercises/proba/conditionalProbability.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,aAAa,CAAC;AAM9D,eAAO,MAAM,sBAAsB,EAAE,QAUpC,CAAC;AAEF,wBAAgB,yBAAyB,IAAI,QAAQ,CA4GpD"}
|
|
@@ -4,6 +4,8 @@ exports.getConditionalProbability = exports.conditionalProbability = void 0;
|
|
|
4
4
|
const randint_1 = require("../../math/utils/random/randint");
|
|
5
5
|
const getDistinctQuestions_1 = require("../utils/getDistinctQuestions");
|
|
6
6
|
const round_1 = require("../../math/utils/round");
|
|
7
|
+
const shuffle_1 = require("../../utils/shuffle");
|
|
8
|
+
const uuid_1 = require("uuid");
|
|
7
9
|
exports.conditionalProbability = {
|
|
8
10
|
id: 'conditionalProbability',
|
|
9
11
|
connector: '=',
|
|
@@ -63,11 +65,34 @@ function getConditionalProbability() {
|
|
|
63
65
|
break;
|
|
64
66
|
}
|
|
65
67
|
}
|
|
68
|
+
const getPropositions = (n) => {
|
|
69
|
+
const res = [];
|
|
70
|
+
res.push({
|
|
71
|
+
id: (0, uuid_1.v4)() + '',
|
|
72
|
+
statement: answer,
|
|
73
|
+
isRightAnswer: true,
|
|
74
|
+
});
|
|
75
|
+
for (let i = 0; i < n - 1; i++) {
|
|
76
|
+
let isDuplicate;
|
|
77
|
+
let proposition;
|
|
78
|
+
do {
|
|
79
|
+
proposition = {
|
|
80
|
+
id: (0, uuid_1.v4)() + '',
|
|
81
|
+
statement: Math.floor(Math.random() * 100) / 100 + '',
|
|
82
|
+
isRightAnswer: false,
|
|
83
|
+
};
|
|
84
|
+
isDuplicate = res.some((p) => p.statement === proposition.statement);
|
|
85
|
+
} while (isDuplicate);
|
|
86
|
+
res.push(proposition);
|
|
87
|
+
}
|
|
88
|
+
return (0, shuffle_1.shuffle)(res);
|
|
89
|
+
};
|
|
66
90
|
const question = {
|
|
67
91
|
instruction,
|
|
68
92
|
startStatement,
|
|
69
93
|
answer,
|
|
70
94
|
keys: ['p', 'cap', 'underscore'],
|
|
95
|
+
getPropositions,
|
|
71
96
|
};
|
|
72
97
|
return question;
|
|
73
98
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"marginalAndConditionalFrequency.d.ts","sourceRoot":"","sources":["../../../src/exercises/proba/marginalAndConditionalFrequency.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"marginalAndConditionalFrequency.d.ts","sourceRoot":"","sources":["../../../src/exercises/proba/marginalAndConditionalFrequency.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,aAAa,CAAC;AAI9D,eAAO,MAAM,+BAA+B,EAAE,QAU7C,CAAC;AAEF,wBAAgB,kCAAkC,IAAI,QAAQ,CAiG7D"}
|