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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lengthConversion.d.ts","sourceRoot":"","sources":["../../../src/exercises/conversion/lengthConversion.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lengthConversion.d.ts","sourceRoot":"","sources":["../../../src/exercises/conversion/lengthConversion.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,aAAa,CAAC;AAI9D,eAAO,MAAM,gBAAgB,EAAE,QAU9B,CAAC;AAEF,wBAAgB,mBAAmB,IAAI,QAAQ,CA8C9C"}
|
|
@@ -3,7 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getLengthConversion = exports.lengthConversion = void 0;
|
|
4
4
|
const decimal_1 = require("../../math/numbers/decimals/decimal");
|
|
5
5
|
const randint_1 = require("../../math/utils/random/randint");
|
|
6
|
+
const shuffle_1 = require("../../utils/shuffle");
|
|
6
7
|
const getDistinctQuestions_1 = require("../utils/getDistinctQuestions");
|
|
8
|
+
const uuid_1 = require("uuid");
|
|
7
9
|
exports.lengthConversion = {
|
|
8
10
|
id: 'lengthConversion',
|
|
9
11
|
connector: '=',
|
|
@@ -20,10 +22,34 @@ function getLengthConversion() {
|
|
|
20
22
|
const randomUnitIndex = (0, randint_1.randint)(0, 7);
|
|
21
23
|
const randomUnitInstructionIndex = (0, randint_1.randint)(0, 7, [randomUnitIndex]);
|
|
22
24
|
const randomlength = decimal_1.DecimalConstructor.random(0, 1000, (0, randint_1.randint)(0, 4));
|
|
25
|
+
const getPropositions = (n) => {
|
|
26
|
+
const res = [];
|
|
27
|
+
res.push({
|
|
28
|
+
id: (0, uuid_1.v4)() + '',
|
|
29
|
+
statement: randomlength.multiplyByPowerOfTen(randomUnitIndex - randomUnitInstructionIndex).value + '',
|
|
30
|
+
isRightAnswer: true,
|
|
31
|
+
});
|
|
32
|
+
for (let i = 0; i < n - 1; i++) {
|
|
33
|
+
let isDuplicate;
|
|
34
|
+
let proposition;
|
|
35
|
+
do {
|
|
36
|
+
const wrongAnswer = randomlength.multiplyByPowerOfTen((0, randint_1.randint)(-3, 4, [randomUnitIndex - randomUnitInstructionIndex])).value + '';
|
|
37
|
+
proposition = {
|
|
38
|
+
id: (0, uuid_1.v4)() + '',
|
|
39
|
+
statement: wrongAnswer,
|
|
40
|
+
isRightAnswer: false,
|
|
41
|
+
};
|
|
42
|
+
isDuplicate = res.some((p) => p.statement === proposition.statement);
|
|
43
|
+
} while (isDuplicate);
|
|
44
|
+
res.push(proposition);
|
|
45
|
+
}
|
|
46
|
+
return (0, shuffle_1.shuffle)(res);
|
|
47
|
+
};
|
|
23
48
|
const question = {
|
|
24
49
|
instruction: `$${randomlength.value}$ $${units[randomUnitIndex]}$ = ... $${units[randomUnitInstructionIndex]}$`,
|
|
25
50
|
answer: randomlength.multiplyByPowerOfTen(randomUnitIndex - randomUnitInstructionIndex).value + '',
|
|
26
51
|
keys: [],
|
|
52
|
+
getPropositions,
|
|
27
53
|
};
|
|
28
54
|
return question;
|
|
29
55
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"massConversion.d.ts","sourceRoot":"","sources":["../../../src/exercises/conversion/massConversion.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"massConversion.d.ts","sourceRoot":"","sources":["../../../src/exercises/conversion/massConversion.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,aAAa,CAAC;AAI9D,eAAO,MAAM,cAAc,EAAE,QAU5B,CAAC;AAEF,wBAAgB,iBAAiB,IAAI,QAAQ,CA8C5C"}
|
|
@@ -3,7 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getMassConversion = exports.massConversion = void 0;
|
|
4
4
|
const decimal_1 = require("../../math/numbers/decimals/decimal");
|
|
5
5
|
const randint_1 = require("../../math/utils/random/randint");
|
|
6
|
+
const shuffle_1 = require("../../utils/shuffle");
|
|
6
7
|
const getDistinctQuestions_1 = require("../utils/getDistinctQuestions");
|
|
8
|
+
const uuid_1 = require("uuid");
|
|
7
9
|
exports.massConversion = {
|
|
8
10
|
id: 'massConversion',
|
|
9
11
|
connector: '=',
|
|
@@ -20,10 +22,34 @@ function getMassConversion() {
|
|
|
20
22
|
const randomUnitIndex = (0, randint_1.randint)(0, 7);
|
|
21
23
|
const randomUnitInstructionIndex = (0, randint_1.randint)(0, 7, [randomUnitIndex]);
|
|
22
24
|
const randomMass = decimal_1.DecimalConstructor.random(0, 1000, (0, randint_1.randint)(0, 4));
|
|
25
|
+
const getPropositions = (n) => {
|
|
26
|
+
const res = [];
|
|
27
|
+
res.push({
|
|
28
|
+
id: (0, uuid_1.v4)() + '',
|
|
29
|
+
statement: randomMass.multiplyByPowerOfTen(randomUnitIndex - randomUnitInstructionIndex).value + '',
|
|
30
|
+
isRightAnswer: true,
|
|
31
|
+
});
|
|
32
|
+
for (let i = 0; i < n - 1; i++) {
|
|
33
|
+
let isDuplicate;
|
|
34
|
+
let proposition;
|
|
35
|
+
do {
|
|
36
|
+
const wrongAnswer = randomMass.multiplyByPowerOfTen((0, randint_1.randint)(-3, 4, [randomUnitIndex - randomUnitInstructionIndex])).value + '';
|
|
37
|
+
proposition = {
|
|
38
|
+
id: (0, uuid_1.v4)() + '',
|
|
39
|
+
statement: wrongAnswer,
|
|
40
|
+
isRightAnswer: false,
|
|
41
|
+
};
|
|
42
|
+
isDuplicate = res.some((p) => p.statement === proposition.statement);
|
|
43
|
+
} while (isDuplicate);
|
|
44
|
+
res.push(proposition);
|
|
45
|
+
}
|
|
46
|
+
return (0, shuffle_1.shuffle)(res);
|
|
47
|
+
};
|
|
23
48
|
const question = {
|
|
24
49
|
instruction: `$${randomMass.value}$ $${units[randomUnitIndex]}$ = ... $${units[randomUnitInstructionIndex]}$`,
|
|
25
50
|
answer: randomMass.multiplyByPowerOfTen(randomUnitIndex - randomUnitInstructionIndex).value + '',
|
|
26
51
|
keys: [],
|
|
52
|
+
getPropositions,
|
|
27
53
|
};
|
|
28
54
|
return question;
|
|
29
55
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"volumeCapacityConversion.d.ts","sourceRoot":"","sources":["../../../src/exercises/conversion/volumeCapacityConversion.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"volumeCapacityConversion.d.ts","sourceRoot":"","sources":["../../../src/exercises/conversion/volumeCapacityConversion.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,aAAa,CAAC;AAI9D,eAAO,MAAM,wBAAwB,EAAE,QAUtC,CAAC;AAEF,wBAAgB,2BAA2B,IAAI,QAAQ,CAgEtD"}
|
|
@@ -4,7 +4,9 @@ exports.getVolumeCapacityConversion = exports.volumeCapacityConversion = void 0;
|
|
|
4
4
|
const decimal_1 = require("../../math/numbers/decimals/decimal");
|
|
5
5
|
const randint_1 = require("../../math/utils/random/randint");
|
|
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.volumeCapacityConversion = {
|
|
9
11
|
id: 'volumeCapacityConversion',
|
|
10
12
|
connector: '=',
|
|
@@ -30,17 +32,41 @@ function getVolumeCapacityConversion() {
|
|
|
30
32
|
if ((0, coinFlip_1.coinFlip)()) {
|
|
31
33
|
instructionUnit = volumeUnits[randomUnitIndex];
|
|
32
34
|
AsnwerUnit = capacityUnits[randomUnitInstructionIndex];
|
|
33
|
-
answer = random.multiplyByPowerOfTen(3 * (randomUnitIndex - 2) + 3 - randomUnitInstructionIndex)
|
|
35
|
+
answer = random.multiplyByPowerOfTen(3 * (randomUnitIndex - 2) + 3 - randomUnitInstructionIndex);
|
|
34
36
|
}
|
|
35
37
|
else {
|
|
36
38
|
instructionUnit = capacityUnits[randomUnitIndex];
|
|
37
39
|
AsnwerUnit = volumeUnits[randomUnitInstructionIndex];
|
|
38
|
-
answer = random.multiplyByPowerOfTen(randomUnitIndex - 3 + 3 * (2 - randomUnitInstructionIndex))
|
|
40
|
+
answer = random.multiplyByPowerOfTen(randomUnitIndex - 3 + 3 * (2 - randomUnitInstructionIndex));
|
|
39
41
|
}
|
|
42
|
+
const getPropositions = (n) => {
|
|
43
|
+
const res = [];
|
|
44
|
+
res.push({
|
|
45
|
+
id: (0, uuid_1.v4)() + '',
|
|
46
|
+
statement: answer.value + '',
|
|
47
|
+
isRightAnswer: true,
|
|
48
|
+
});
|
|
49
|
+
for (let i = 0; i < n - 1; i++) {
|
|
50
|
+
let isDuplicate;
|
|
51
|
+
let proposition;
|
|
52
|
+
do {
|
|
53
|
+
const wrongAnswer = answer.multiplyByPowerOfTen((0, randint_1.randint)(-3, 4, [0]));
|
|
54
|
+
proposition = {
|
|
55
|
+
id: (0, uuid_1.v4)() + '',
|
|
56
|
+
statement: wrongAnswer.value + '',
|
|
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
|
+
};
|
|
40
65
|
const question = {
|
|
41
66
|
instruction: `$${random.value}$ $${instructionUnit}$ = ... $${AsnwerUnit}$`,
|
|
42
|
-
answer,
|
|
67
|
+
answer: answer.value + '',
|
|
43
68
|
keys: [],
|
|
69
|
+
getPropositions,
|
|
44
70
|
};
|
|
45
71
|
return question;
|
|
46
72
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"volumeConversion.d.ts","sourceRoot":"","sources":["../../../src/exercises/conversion/volumeConversion.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"volumeConversion.d.ts","sourceRoot":"","sources":["../../../src/exercises/conversion/volumeConversion.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,aAAa,CAAC;AAI9D,eAAO,MAAM,gBAAgB,EAAE,QAU9B,CAAC;AAEF,wBAAgB,mBAAmB,IAAI,QAAQ,CAmD9C"}
|
|
@@ -3,7 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getVolumeConversion = exports.volumeConversion = void 0;
|
|
4
4
|
const decimal_1 = require("../../math/numbers/decimals/decimal");
|
|
5
5
|
const randint_1 = require("../../math/utils/random/randint");
|
|
6
|
+
const shuffle_1 = require("../../utils/shuffle");
|
|
6
7
|
const getDistinctQuestions_1 = require("../utils/getDistinctQuestions");
|
|
8
|
+
const uuid_1 = require("uuid");
|
|
7
9
|
exports.volumeConversion = {
|
|
8
10
|
id: 'volumeConversion',
|
|
9
11
|
connector: '=',
|
|
@@ -22,10 +24,34 @@ function getVolumeConversion() {
|
|
|
22
24
|
// cette manip a pour but d'éviter des conversion de type km³ --> cm³ ou le contraire (chiffre trop grand/petit)
|
|
23
25
|
randomUnitIndex - 2 < 0 ? 0 : randomUnitIndex - 2, randomUnitIndex + 2 > 7 ? 7 : randomUnitIndex + 3, [randomUnitIndex]);
|
|
24
26
|
const randomVolume = decimal_1.DecimalConstructor.random(0, 1000, (0, randint_1.randint)(0, 4));
|
|
27
|
+
const getPropositions = (n) => {
|
|
28
|
+
const res = [];
|
|
29
|
+
res.push({
|
|
30
|
+
id: (0, uuid_1.v4)() + '',
|
|
31
|
+
statement: randomVolume.multiplyByPowerOfTen(3 * (randomUnitIndex - randomUnitInstructionIndex)).value + '',
|
|
32
|
+
isRightAnswer: true,
|
|
33
|
+
});
|
|
34
|
+
for (let i = 0; i < n - 1; i++) {
|
|
35
|
+
let isDuplicate;
|
|
36
|
+
let proposition;
|
|
37
|
+
do {
|
|
38
|
+
const wrongAnswer = randomVolume.multiplyByPowerOfTen((0, randint_1.randint)(-3, 4, [randomUnitIndex - randomUnitInstructionIndex])).value + '';
|
|
39
|
+
proposition = {
|
|
40
|
+
id: (0, uuid_1.v4)() + '',
|
|
41
|
+
statement: wrongAnswer,
|
|
42
|
+
isRightAnswer: false,
|
|
43
|
+
};
|
|
44
|
+
isDuplicate = res.some((p) => p.statement === proposition.statement);
|
|
45
|
+
} while (isDuplicate);
|
|
46
|
+
res.push(proposition);
|
|
47
|
+
}
|
|
48
|
+
return (0, shuffle_1.shuffle)(res);
|
|
49
|
+
};
|
|
25
50
|
const question = {
|
|
26
51
|
instruction: `$${randomVolume.value}$ $${units[randomUnitIndex]}$ = ... $${units[randomUnitInstructionIndex]}$`,
|
|
27
52
|
answer: randomVolume.multiplyByPowerOfTen(3 * (randomUnitIndex - randomUnitInstructionIndex)).value + '',
|
|
28
53
|
keys: [],
|
|
54
|
+
getPropositions,
|
|
29
55
|
};
|
|
30
56
|
return question;
|
|
31
57
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constanteDerivative.d.ts","sourceRoot":"","sources":["../../../../src/exercises/derivation/derivative/constanteDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"constanteDerivative.d.ts","sourceRoot":"","sources":["../../../../src/exercises/derivation/derivative/constanteDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAM3E,eAAO,MAAM,mBAAmB,EAAE,QAUjC,CAAC;AAEF,wBAAgB,sBAAsB,IAAI,QAAQ,CA0CjD"}
|
|
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getConstanteDerivative = exports.constanteDerivative = void 0;
|
|
4
4
|
const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
|
|
5
5
|
const randint_1 = require("../../../math/utils/random/randint");
|
|
6
|
+
const shuffle_1 = require("../../../utils/shuffle");
|
|
7
|
+
const uuid_1 = require("uuid");
|
|
6
8
|
exports.constanteDerivative = {
|
|
7
9
|
id: 'constanteDerivative',
|
|
8
10
|
connector: '=',
|
|
@@ -16,11 +18,35 @@ exports.constanteDerivative = {
|
|
|
16
18
|
};
|
|
17
19
|
function getConstanteDerivative() {
|
|
18
20
|
const c = (0, randint_1.randint)(-9, 10, [0]);
|
|
21
|
+
const getPropositions = (n) => {
|
|
22
|
+
const propositions = [];
|
|
23
|
+
propositions.push({
|
|
24
|
+
id: (0, uuid_1.v4)(),
|
|
25
|
+
statement: c + '',
|
|
26
|
+
isRightAnswer: true,
|
|
27
|
+
});
|
|
28
|
+
for (let i = 0; i < n - 1; i++) {
|
|
29
|
+
let isDuplicate;
|
|
30
|
+
let proposition;
|
|
31
|
+
do {
|
|
32
|
+
const wrongAnswer = (0, randint_1.randint)(-9, 10);
|
|
33
|
+
proposition = {
|
|
34
|
+
id: (0, uuid_1.v4)(),
|
|
35
|
+
statement: wrongAnswer + '',
|
|
36
|
+
isRightAnswer: false,
|
|
37
|
+
};
|
|
38
|
+
isDuplicate = propositions.some((p) => p.statement === proposition.statement);
|
|
39
|
+
} while (isDuplicate);
|
|
40
|
+
propositions.push(proposition);
|
|
41
|
+
}
|
|
42
|
+
return (0, shuffle_1.shuffle)(propositions);
|
|
43
|
+
};
|
|
19
44
|
const question = {
|
|
20
45
|
instruction: `Déterminer la fonction dérivée $f'$ de la fonction $f$ définie par $f(x) = ${c}$.`,
|
|
21
46
|
startStatement: `f'(x)`,
|
|
22
47
|
answer: '0',
|
|
23
48
|
keys: [],
|
|
49
|
+
getPropositions,
|
|
24
50
|
};
|
|
25
51
|
return question;
|
|
26
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firstDegreeDerivative.d.ts","sourceRoot":"","sources":["../../../../src/exercises/derivation/derivative/firstDegreeDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"firstDegreeDerivative.d.ts","sourceRoot":"","sources":["../../../../src/exercises/derivation/derivative/firstDegreeDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAO3E,eAAO,MAAM,qBAAqB,EAAE,QAUnC,CAAC;AAEF,wBAAgB,wBAAwB,IAAI,QAAQ,CA2CnD"}
|
|
@@ -4,6 +4,8 @@ exports.getFirstDegreeDerivative = exports.firstDegreeDerivative = void 0;
|
|
|
4
4
|
const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
|
|
5
5
|
const polynomial_1 = require("../../../math/polynomials/polynomial");
|
|
6
6
|
const randint_1 = require("../../../math/utils/random/randint");
|
|
7
|
+
const shuffle_1 = require("../../../utils/shuffle");
|
|
8
|
+
const uuid_1 = require("uuid");
|
|
7
9
|
exports.firstDegreeDerivative = {
|
|
8
10
|
id: 'firstDegreeDerivative',
|
|
9
11
|
connector: '=',
|
|
@@ -18,11 +20,35 @@ exports.firstDegreeDerivative = {
|
|
|
18
20
|
function getFirstDegreeDerivative() {
|
|
19
21
|
const [a, b] = [(0, randint_1.randint)(-9, 10, [0]), (0, randint_1.randint)(-9, 10)];
|
|
20
22
|
const polynomial = new polynomial_1.Polynomial([b, a]);
|
|
23
|
+
const getPropositions = (n) => {
|
|
24
|
+
const propositions = [];
|
|
25
|
+
propositions.push({
|
|
26
|
+
id: (0, uuid_1.v4)(),
|
|
27
|
+
statement: a + '',
|
|
28
|
+
isRightAnswer: true,
|
|
29
|
+
});
|
|
30
|
+
for (let i = 0; i < n - 1; i++) {
|
|
31
|
+
let isDuplicate;
|
|
32
|
+
let proposition;
|
|
33
|
+
do {
|
|
34
|
+
const wrongAnswer = (0, randint_1.randint)(-9, 10);
|
|
35
|
+
proposition = {
|
|
36
|
+
id: (0, uuid_1.v4)(),
|
|
37
|
+
statement: wrongAnswer + '',
|
|
38
|
+
isRightAnswer: false,
|
|
39
|
+
};
|
|
40
|
+
isDuplicate = propositions.some((p) => p.statement === proposition.statement);
|
|
41
|
+
} while (isDuplicate);
|
|
42
|
+
propositions.push(proposition);
|
|
43
|
+
}
|
|
44
|
+
return (0, shuffle_1.shuffle)(propositions);
|
|
45
|
+
};
|
|
21
46
|
const question = {
|
|
22
47
|
instruction: `Déterminer la fonction dérivée $f'$ de la fonction $f$ définie par $f(x) = ${polynomial.toString()}$.`,
|
|
23
48
|
startStatement: `f'(x)`,
|
|
24
49
|
answer: a + '',
|
|
25
50
|
keys: [],
|
|
51
|
+
getPropositions,
|
|
26
52
|
};
|
|
27
53
|
return question;
|
|
28
54
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inverseFunctionDerivative.d.ts","sourceRoot":"","sources":["../../../../src/exercises/derivation/derivative/inverseFunctionDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"inverseFunctionDerivative.d.ts","sourceRoot":"","sources":["../../../../src/exercises/derivation/derivative/inverseFunctionDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAM3E,eAAO,MAAM,yBAAyB,EAAE,QAUvC,CAAC;AAEF,wBAAgB,4BAA4B,IAAI,QAAQ,CA0CvD"}
|
|
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getInverseFunctionDerivative = exports.inverseFunctionDerivative = void 0;
|
|
4
4
|
const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
|
|
5
5
|
const randint_1 = require("../../../math/utils/random/randint");
|
|
6
|
+
const shuffle_1 = require("../../../utils/shuffle");
|
|
7
|
+
const uuid_1 = require("uuid");
|
|
6
8
|
exports.inverseFunctionDerivative = {
|
|
7
9
|
id: 'inverseFunctionDerivative',
|
|
8
10
|
connector: '=',
|
|
@@ -16,11 +18,35 @@ exports.inverseFunctionDerivative = {
|
|
|
16
18
|
};
|
|
17
19
|
function getInverseFunctionDerivative() {
|
|
18
20
|
const a = (0, randint_1.randint)(-9, 10, [0]);
|
|
21
|
+
const getPropositions = (n) => {
|
|
22
|
+
const propositions = [];
|
|
23
|
+
propositions.push({
|
|
24
|
+
id: (0, uuid_1.v4)(),
|
|
25
|
+
statement: `\\frac{${-a}}{x^2}`,
|
|
26
|
+
isRightAnswer: true,
|
|
27
|
+
});
|
|
28
|
+
for (let i = 0; i < n - 1; i++) {
|
|
29
|
+
let isDuplicate;
|
|
30
|
+
let proposition;
|
|
31
|
+
do {
|
|
32
|
+
const wrongAnswer = `\\frac{${(0, randint_1.randint)(-9, 10, [0, -a])}}{x^2}`;
|
|
33
|
+
proposition = {
|
|
34
|
+
id: (0, uuid_1.v4)(),
|
|
35
|
+
statement: wrongAnswer,
|
|
36
|
+
isRightAnswer: false,
|
|
37
|
+
};
|
|
38
|
+
isDuplicate = propositions.some((p) => p.statement === proposition.statement);
|
|
39
|
+
} while (isDuplicate);
|
|
40
|
+
propositions.push(proposition);
|
|
41
|
+
}
|
|
42
|
+
return (0, shuffle_1.shuffle)(propositions);
|
|
43
|
+
};
|
|
19
44
|
const question = {
|
|
20
45
|
instruction: `Déterminer la fonction dérivée $f'$ de la fonction $f$ définie par $f(x) =\\frac{${a}}{x}$.`,
|
|
21
46
|
startStatement: `f'(x)`,
|
|
22
47
|
answer: `\\frac{${-a}}{x^2}`,
|
|
23
48
|
keys: ['x'],
|
|
49
|
+
getPropositions,
|
|
24
50
|
};
|
|
25
51
|
return question;
|
|
26
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"powerFunctionDerivative.d.ts","sourceRoot":"","sources":["../../../../src/exercises/derivation/derivative/powerFunctionDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"powerFunctionDerivative.d.ts","sourceRoot":"","sources":["../../../../src/exercises/derivation/derivative/powerFunctionDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAW3E,eAAO,MAAM,uBAAuB,EAAE,QAUrC,CAAC;AAEF,wBAAgB,0BAA0B,IAAI,QAAQ,CAwDrD"}
|
|
@@ -8,6 +8,8 @@ const multiplyNode_1 = require("../../../tree/nodes/operators/multiplyNode");
|
|
|
8
8
|
const powerNode_1 = require("../../../tree/nodes/operators/powerNode");
|
|
9
9
|
const variableNode_1 = require("../../../tree/nodes/variables/variableNode");
|
|
10
10
|
const simplify_1 = require("../../../tree/parsers/simplify");
|
|
11
|
+
const shuffle_1 = require("../../../utils/shuffle");
|
|
12
|
+
const uuid_1 = require("uuid");
|
|
11
13
|
exports.powerFunctionDerivative = {
|
|
12
14
|
id: 'powerFunctionDerivative',
|
|
13
15
|
connector: '=',
|
|
@@ -24,11 +26,35 @@ function getPowerFunctionDerivative() {
|
|
|
24
26
|
const n = (0, randint_1.randint)(2, 10);
|
|
25
27
|
const statement = (0, simplify_1.simplifyNode)(new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode(a), new powerNode_1.PowerNode(new variableNode_1.VariableNode('x'), new numberNode_1.NumberNode(n))));
|
|
26
28
|
const answerStatement = (0, simplify_1.simplifyNode)(new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode(a * n), new powerNode_1.PowerNode(new variableNode_1.VariableNode('x'), new numberNode_1.NumberNode(n - 1))));
|
|
29
|
+
const getPropositions = (numOptions) => {
|
|
30
|
+
const propositions = [];
|
|
31
|
+
propositions.push({
|
|
32
|
+
id: (0, uuid_1.v4)(),
|
|
33
|
+
statement: answerStatement.toTex(),
|
|
34
|
+
isRightAnswer: true,
|
|
35
|
+
});
|
|
36
|
+
for (let i = 0; i < numOptions - 1; i++) {
|
|
37
|
+
let isDuplicate;
|
|
38
|
+
let proposition;
|
|
39
|
+
do {
|
|
40
|
+
const wrongExponent = (0, randint_1.randint)(2, 10);
|
|
41
|
+
proposition = {
|
|
42
|
+
id: (0, uuid_1.v4)(),
|
|
43
|
+
statement: (0, simplify_1.simplifyNode)(new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode(a * wrongExponent), new powerNode_1.PowerNode(new variableNode_1.VariableNode('x'), new numberNode_1.NumberNode(wrongExponent - 1)))).toTex(),
|
|
44
|
+
isRightAnswer: false,
|
|
45
|
+
};
|
|
46
|
+
isDuplicate = propositions.some((p) => p.statement === proposition.statement);
|
|
47
|
+
} while (isDuplicate);
|
|
48
|
+
propositions.push(proposition);
|
|
49
|
+
}
|
|
50
|
+
return (0, shuffle_1.shuffle)(propositions);
|
|
51
|
+
};
|
|
27
52
|
const question = {
|
|
28
53
|
instruction: `Déterminer la fonction dérivée $f'$ de la fonction $f$ définie par $f(x) =${statement.toTex()}$.`,
|
|
29
54
|
startStatement: `f'(x)`,
|
|
30
55
|
answer: answerStatement.toTex(),
|
|
31
56
|
keys: ['x'],
|
|
57
|
+
getPropositions,
|
|
32
58
|
};
|
|
33
59
|
return question;
|
|
34
60
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rootFunctionDerivative.d.ts","sourceRoot":"","sources":["../../../../src/exercises/derivation/derivative/rootFunctionDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"rootFunctionDerivative.d.ts","sourceRoot":"","sources":["../../../../src/exercises/derivation/derivative/rootFunctionDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAO3E,eAAO,MAAM,sBAAsB,EAAE,QAUpC,CAAC;AAEF,wBAAgB,yBAAyB,IAAI,QAAQ,CA8DpD"}
|
|
@@ -4,6 +4,8 @@ exports.getRootFunctionDerivative = exports.rootFunctionDerivative = void 0;
|
|
|
4
4
|
const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
|
|
5
5
|
const randint_1 = require("../../../math/utils/random/randint");
|
|
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.rootFunctionDerivative = {
|
|
8
10
|
id: 'rootFunctionDerivative',
|
|
9
11
|
connector: '=',
|
|
@@ -29,11 +31,45 @@ function getRootFunctionDerivative() {
|
|
|
29
31
|
answer = `\\frac{${a / 2}}{\\sqrt{x}}`;
|
|
30
32
|
else
|
|
31
33
|
answer = `\\frac{${a}}{2\\sqrt{x}}`;
|
|
34
|
+
const getPropositions = (numOptions) => {
|
|
35
|
+
const propositions = [];
|
|
36
|
+
propositions.push({
|
|
37
|
+
id: (0, uuid_1.v4)(),
|
|
38
|
+
statement: answer,
|
|
39
|
+
isRightAnswer: true,
|
|
40
|
+
});
|
|
41
|
+
for (let i = 0; i < numOptions - 1; i++) {
|
|
42
|
+
let isDuplicate;
|
|
43
|
+
let proposition;
|
|
44
|
+
do {
|
|
45
|
+
const randomA = (0, randint_1.randint)(-9, 10, [0]);
|
|
46
|
+
const isEvenA = randomA / 2 === (0, round_1.round)(randomA / 2, 0);
|
|
47
|
+
if (isEvenA) {
|
|
48
|
+
proposition = {
|
|
49
|
+
id: (0, uuid_1.v4)(),
|
|
50
|
+
statement: `\\frac{${randomA / 2}}{\\sqrt{x}}`,
|
|
51
|
+
isRightAnswer: false,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
proposition = {
|
|
56
|
+
id: 'wrong' + i,
|
|
57
|
+
statement: `\\frac{${randomA}}{2\\sqrt{x}}`,
|
|
58
|
+
isRightAnswer: false,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
isDuplicate = propositions.some((p) => p.statement === proposition.statement);
|
|
62
|
+
} while (isDuplicate);
|
|
63
|
+
propositions.push(proposition);
|
|
64
|
+
}
|
|
65
|
+
return (0, shuffle_1.shuffle)(propositions);
|
|
66
|
+
};
|
|
32
67
|
const question = {
|
|
33
68
|
instruction,
|
|
34
69
|
startStatement: `f'(x)`,
|
|
35
70
|
answer,
|
|
36
71
|
keys: ['x'],
|
|
72
|
+
getPropositions,
|
|
37
73
|
};
|
|
38
74
|
return question;
|
|
39
75
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secondDegreeDerivative.d.ts","sourceRoot":"","sources":["../../../../src/exercises/derivation/derivative/secondDegreeDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"secondDegreeDerivative.d.ts","sourceRoot":"","sources":["../../../../src/exercises/derivation/derivative/secondDegreeDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAO3E,eAAO,MAAM,sBAAsB,EAAE,QAUpC,CAAC;AAEF,wBAAgB,yBAAyB,IAAI,QAAQ,CAkDpD"}
|
|
@@ -4,6 +4,8 @@ exports.getSecondDegreeDerivative = exports.secondDegreeDerivative = void 0;
|
|
|
4
4
|
const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
|
|
5
5
|
const polynomial_1 = require("../../../math/polynomials/polynomial");
|
|
6
6
|
const randint_1 = require("../../../math/utils/random/randint");
|
|
7
|
+
const shuffle_1 = require("../../../utils/shuffle");
|
|
8
|
+
const uuid_1 = require("uuid");
|
|
7
9
|
exports.secondDegreeDerivative = {
|
|
8
10
|
id: 'secondDegreeDerivative',
|
|
9
11
|
connector: '=',
|
|
@@ -19,11 +21,40 @@ function getSecondDegreeDerivative() {
|
|
|
19
21
|
const coefficients = [(0, randint_1.randint)(-9, 10), (0, randint_1.randint)(-9, 10), (0, randint_1.randint)(-9, 10, [0])];
|
|
20
22
|
const polynomial = new polynomial_1.Polynomial(coefficients);
|
|
21
23
|
const derivative = polynomial.derivate();
|
|
24
|
+
const getPropositions = (numOptions) => {
|
|
25
|
+
const propositions = [];
|
|
26
|
+
propositions.push({
|
|
27
|
+
id: (0, uuid_1.v4)(),
|
|
28
|
+
statement: derivative.toString(),
|
|
29
|
+
isRightAnswer: true,
|
|
30
|
+
});
|
|
31
|
+
for (let i = 0; i < numOptions - 1; i++) {
|
|
32
|
+
let isDuplicate;
|
|
33
|
+
let proposition;
|
|
34
|
+
do {
|
|
35
|
+
const randomCoefficients = [
|
|
36
|
+
(0, randint_1.randint)(-9, 10),
|
|
37
|
+
coefficients[1] + (0, randint_1.randint)(-3, 4),
|
|
38
|
+
coefficients[2] + (0, randint_1.randint)(-3, 4, [0]),
|
|
39
|
+
];
|
|
40
|
+
const randomPolynomial = new polynomial_1.Polynomial(randomCoefficients);
|
|
41
|
+
proposition = {
|
|
42
|
+
id: (0, uuid_1.v4)(),
|
|
43
|
+
statement: randomPolynomial.derivate().toString(),
|
|
44
|
+
isRightAnswer: false,
|
|
45
|
+
};
|
|
46
|
+
isDuplicate = propositions.some((p) => p.statement === proposition.statement);
|
|
47
|
+
} while (isDuplicate);
|
|
48
|
+
propositions.push(proposition);
|
|
49
|
+
}
|
|
50
|
+
return (0, shuffle_1.shuffle)(propositions);
|
|
51
|
+
};
|
|
22
52
|
const question = {
|
|
23
53
|
instruction: `Déterminer la fonction dérivée $f'$ de la fonction $f$ définie par $f(x) = ${polynomial.toString()}$.`,
|
|
24
54
|
startStatement: `f'(x)`,
|
|
25
55
|
answer: derivative.toString(),
|
|
26
56
|
keys: ['x'],
|
|
57
|
+
getPropositions,
|
|
27
58
|
};
|
|
28
59
|
return question;
|
|
29
60
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thirdDegreeDerivative.d.ts","sourceRoot":"","sources":["../../../../src/exercises/derivation/derivative/thirdDegreeDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"thirdDegreeDerivative.d.ts","sourceRoot":"","sources":["../../../../src/exercises/derivation/derivative/thirdDegreeDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAO3E,eAAO,MAAM,qBAAqB,EAAE,QAUnC,CAAC;AAEF,wBAAgB,wBAAwB,IAAI,QAAQ,CAqDnD"}
|
|
@@ -4,6 +4,8 @@ exports.getThirdDegreeDerivative = exports.thirdDegreeDerivative = void 0;
|
|
|
4
4
|
const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
|
|
5
5
|
const polynomial_1 = require("../../../math/polynomials/polynomial");
|
|
6
6
|
const randint_1 = require("../../../math/utils/random/randint");
|
|
7
|
+
const shuffle_1 = require("../../../utils/shuffle");
|
|
8
|
+
const uuid_1 = require("uuid");
|
|
7
9
|
exports.thirdDegreeDerivative = {
|
|
8
10
|
id: 'thirdDegreeDerivative',
|
|
9
11
|
connector: '=',
|
|
@@ -22,11 +24,39 @@ function getThirdDegreeDerivative() {
|
|
|
22
24
|
coefficients.push((0, randint_1.randint)(-9, 10, [0]));
|
|
23
25
|
const polynomial = new polynomial_1.Polynomial(coefficients);
|
|
24
26
|
const derivative = polynomial.derivate();
|
|
27
|
+
const getPropositions = (numOptions) => {
|
|
28
|
+
const propositions = [];
|
|
29
|
+
propositions.push({
|
|
30
|
+
id: (0, uuid_1.v4)(),
|
|
31
|
+
statement: derivative.toString(),
|
|
32
|
+
isRightAnswer: true,
|
|
33
|
+
});
|
|
34
|
+
for (let i = 0; i < numOptions - 1; i++) {
|
|
35
|
+
let isDuplicate;
|
|
36
|
+
let proposition;
|
|
37
|
+
do {
|
|
38
|
+
const randomCoefficients = [];
|
|
39
|
+
for (let j = 1; j <= 3; j++)
|
|
40
|
+
randomCoefficients.push((0, randint_1.randint)(-9, 10));
|
|
41
|
+
randomCoefficients.push((0, randint_1.randint)(-9, 10, [0]));
|
|
42
|
+
const randomPolynomial = new polynomial_1.Polynomial(randomCoefficients);
|
|
43
|
+
proposition = {
|
|
44
|
+
id: (0, uuid_1.v4)(),
|
|
45
|
+
statement: randomPolynomial.derivate().toString(),
|
|
46
|
+
isRightAnswer: false,
|
|
47
|
+
};
|
|
48
|
+
isDuplicate = propositions.some((p) => p.statement === proposition.statement);
|
|
49
|
+
} while (isDuplicate);
|
|
50
|
+
propositions.push(proposition);
|
|
51
|
+
}
|
|
52
|
+
return (0, shuffle_1.shuffle)(propositions);
|
|
53
|
+
};
|
|
25
54
|
const question = {
|
|
26
55
|
instruction: `Déterminer la fonction dérivée $f'$ de la fonction $f$ définie par $f(x) = ${polynomial.toString()}$.`,
|
|
27
56
|
startStatement: `f'(x)`,
|
|
28
57
|
answer: derivative.toString(),
|
|
29
58
|
keys: ['x'],
|
|
59
|
+
getPropositions,
|
|
30
60
|
};
|
|
31
61
|
return question;
|
|
32
62
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"derivativeNumberReading.d.ts","sourceRoot":"","sources":["../../../src/exercises/derivation/derivativeNumberReading.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"derivativeNumberReading.d.ts","sourceRoot":"","sources":["../../../src/exercises/derivation/derivativeNumberReading.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAa3E,eAAO,MAAM,uBAAuB,EAAE,QASrC,CAAC;AAEF,wBAAgB,0BAA0B,IAAI,QAAQ,CAsErD"}
|
|
@@ -7,7 +7,11 @@ const point_1 = require("../../math/geometry/point");
|
|
|
7
7
|
const polynomial_1 = require("../../math/polynomials/polynomial");
|
|
8
8
|
const randint_1 = require("../../math/utils/random/randint");
|
|
9
9
|
const numberNode_1 = require("../../tree/nodes/numbers/numberNode");
|
|
10
|
+
const fractionNode_1 = require("../../tree/nodes/operators/fractionNode");
|
|
11
|
+
const simplify_1 = require("../../tree/parsers/simplify");
|
|
12
|
+
const shuffle_1 = require("../../utils/shuffle");
|
|
10
13
|
const mathjs_1 = require("mathjs");
|
|
14
|
+
const uuid_1 = require("uuid");
|
|
11
15
|
exports.derivativeNumberReading = {
|
|
12
16
|
id: 'derivativeNumberReading',
|
|
13
17
|
connector: '=',
|
|
@@ -39,12 +43,38 @@ function getDerivativeNumberReading() {
|
|
|
39
43
|
`g(x) = (${droite.a.toMathString()}) * x + (${droite.b.toMathString()})`,
|
|
40
44
|
`(${xA},${yA})`,
|
|
41
45
|
];
|
|
46
|
+
const getPropositions = (n) => {
|
|
47
|
+
const res = [];
|
|
48
|
+
res.push({
|
|
49
|
+
id: (0, uuid_1.v4)() + '',
|
|
50
|
+
statement: droite.getLeadingCoefficient(),
|
|
51
|
+
isRightAnswer: true,
|
|
52
|
+
});
|
|
53
|
+
for (let i = 0; i < n - 1; i++) {
|
|
54
|
+
let isDuplicate;
|
|
55
|
+
let proposition;
|
|
56
|
+
do {
|
|
57
|
+
const wrongAnswer = droite.getLeadingCoefficient() !== '0'
|
|
58
|
+
? (0, simplify_1.simplifyNode)(new fractionNode_1.FractionNode(droite.a, new numberNode_1.NumberNode((0, randint_1.randint)(-4, 5, [0, 1]))))
|
|
59
|
+
: new numberNode_1.NumberNode((0, randint_1.randint)(-4, 5, [0]));
|
|
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
|
+
};
|
|
42
71
|
const question = {
|
|
43
72
|
instruction,
|
|
44
73
|
startStatement: 'a',
|
|
45
74
|
answer: droite.getLeadingCoefficient(),
|
|
46
75
|
commands,
|
|
47
76
|
coords: [xA - 5, xA + 5, yA - 5, yA + 5],
|
|
77
|
+
getPropositions,
|
|
48
78
|
};
|
|
49
79
|
return question;
|
|
50
80
|
}
|