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
|
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getGeometricReasonUsage = exports.geometricReasonUsage = 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.geometricReasonUsage = {
|
|
7
9
|
id: 'geometricReasonUsage',
|
|
8
10
|
connector: '=',
|
|
@@ -19,11 +21,40 @@ function getGeometricReasonUsage() {
|
|
|
19
21
|
const startRank = (0, randint_1.randint)(0, 20);
|
|
20
22
|
const askedRank = startRank + 1;
|
|
21
23
|
const startValue = (0, randint_1.randint)(1, 10);
|
|
24
|
+
const getPropositions = (n) => {
|
|
25
|
+
const res = [];
|
|
26
|
+
res.push({
|
|
27
|
+
id: (0, uuid_1.v4)() + '',
|
|
28
|
+
statement: (startValue * reason).toString(),
|
|
29
|
+
isRightAnswer: true,
|
|
30
|
+
});
|
|
31
|
+
if (startValue + reason !== 4)
|
|
32
|
+
res.push({
|
|
33
|
+
id: (0, uuid_1.v4)() + '',
|
|
34
|
+
statement: (startValue + reason).toString(),
|
|
35
|
+
isRightAnswer: false,
|
|
36
|
+
});
|
|
37
|
+
for (let i = 0; i < (startValue + reason === 4 ? n - 1 : n - 2); i++) {
|
|
38
|
+
let isDuplicate;
|
|
39
|
+
let proposition;
|
|
40
|
+
do {
|
|
41
|
+
proposition = {
|
|
42
|
+
id: (0, uuid_1.v4)() + '',
|
|
43
|
+
statement: startValue * (reason + (0, randint_1.randint)(-reason + 1, 6, [0])) + '',
|
|
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
|
+
};
|
|
22
52
|
const question = {
|
|
23
53
|
instruction: `$(u_n)$ est une suite géométrique de raison $q = ${reason}$ et on sait que $u_{${startRank}} = ${startValue}$. Calculer : `,
|
|
24
54
|
startStatement: `u_{${askedRank}}`,
|
|
25
55
|
answer: (startValue * reason).toString(),
|
|
26
56
|
keys: ['q', 'n', 'u', 'underscore'],
|
|
57
|
+
getPropositions,
|
|
27
58
|
};
|
|
28
59
|
return question;
|
|
29
60
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometricRecurrenceFormulaUsage.d.ts","sourceRoot":"","sources":["../../../../src/exercises/sequences/geometric/geometricRecurrenceFormulaUsage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"geometricRecurrenceFormulaUsage.d.ts","sourceRoot":"","sources":["../../../../src/exercises/sequences/geometric/geometricRecurrenceFormulaUsage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAe,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAM7F,UAAU,sCAAuC,SAAQ,gBAAgB;IACvE,IAAI,EAAE,OAAO,CAAC;CACf;AAED,eAAO,MAAM,+BAA+B,EAAE,QAY7C,CAAC;AAEF,wBAAgB,kCAAkC,CAAC,OAAO,EAAE,sCAAsC,GAAG,QAAQ,CAkD5G"}
|
|
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getGeometricRecurrenceFormulaUsage = exports.geometricRecurrenceFormulaUsage = 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.geometricRecurrenceFormulaUsage = {
|
|
7
9
|
id: 'geometricRecurrenceFormulaUsage',
|
|
8
10
|
connector: '=',
|
|
@@ -19,11 +21,40 @@ function getGeometricRecurrenceFormulaUsage(options) {
|
|
|
19
21
|
const firstValue = (0, randint_1.randint)(1, 10);
|
|
20
22
|
const reason = (0, randint_1.randint)(2, 10);
|
|
21
23
|
const askedRank = firstRank + 1;
|
|
24
|
+
const getPropositions = (n) => {
|
|
25
|
+
const res = [];
|
|
26
|
+
res.push({
|
|
27
|
+
id: (0, uuid_1.v4)() + '',
|
|
28
|
+
statement: (firstValue * reason).toString(),
|
|
29
|
+
isRightAnswer: true,
|
|
30
|
+
});
|
|
31
|
+
if (firstValue + reason !== 4)
|
|
32
|
+
res.push({
|
|
33
|
+
id: (0, uuid_1.v4)() + '',
|
|
34
|
+
statement: (firstValue + reason).toString(),
|
|
35
|
+
isRightAnswer: false,
|
|
36
|
+
});
|
|
37
|
+
for (let i = 0; i < (firstValue + reason === 4 ? n - 1 : n - 2); i++) {
|
|
38
|
+
let isDuplicate;
|
|
39
|
+
let proposition;
|
|
40
|
+
do {
|
|
41
|
+
proposition = {
|
|
42
|
+
id: (0, uuid_1.v4)() + '',
|
|
43
|
+
statement: firstValue * (reason + (0, randint_1.randint)(-reason + 1, 6, [0])) + '',
|
|
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
|
+
};
|
|
22
52
|
const question = {
|
|
23
53
|
instruction: `$(u_n)$ est une suite définie par $u_{n+1} = ${reason}\\times u_n$ et $u_{${firstRank}} = ${firstValue}$. Calculer :`,
|
|
24
54
|
startStatement: `u_{${askedRank}}`,
|
|
25
55
|
answer: (firstValue * reason).toString(),
|
|
26
56
|
keys: ['q', 'n', 'u', 'underscore'],
|
|
57
|
+
getPropositions,
|
|
27
58
|
};
|
|
28
59
|
return question;
|
|
29
60
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simpifySquareRoot.d.ts","sourceRoot":"","sources":["../../../src/exercises/squareRoots/simpifySquareRoot.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"simpifySquareRoot.d.ts","sourceRoot":"","sources":["../../../src/exercises/squareRoots/simpifySquareRoot.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAe,QAAQ,EAAE,MAAM,aAAa,CAAC;AAI9D,eAAO,MAAM,kBAAkB,EAAE,QAUhC,CAAC;AAEF,wBAAgB,qBAAqB,IAAI,QAAQ,CA+ChD"}
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getSimplifySquareRoot = exports.simplifySquareRoot = void 0;
|
|
4
4
|
const squareRoot_1 = require("../../math/numbers/reals/squareRoot");
|
|
5
|
+
const shuffle_1 = require("../../utils/shuffle");
|
|
5
6
|
const getDistinctQuestions_1 = require("../utils/getDistinctQuestions");
|
|
7
|
+
const uuid_1 = require("uuid");
|
|
6
8
|
exports.simplifySquareRoot = {
|
|
7
9
|
id: 'simplifySqrt',
|
|
8
10
|
connector: '=',
|
|
@@ -19,10 +21,37 @@ function getSimplifySquareRoot() {
|
|
|
19
21
|
allowPerfectSquare: false,
|
|
20
22
|
maxSquare: 11,
|
|
21
23
|
});
|
|
24
|
+
const getPropositions = (n) => {
|
|
25
|
+
const res = [];
|
|
26
|
+
res.push({
|
|
27
|
+
id: (0, uuid_1.v4)() + '',
|
|
28
|
+
statement: squareRoot.simplify().toTree().toTex(),
|
|
29
|
+
isRightAnswer: true,
|
|
30
|
+
});
|
|
31
|
+
for (let i = 0; i < n - 1; i++) {
|
|
32
|
+
let isDuplicate;
|
|
33
|
+
let proposition;
|
|
34
|
+
do {
|
|
35
|
+
const squareRoot = squareRoot_1.SquareRootConstructor.randomSimplifiable({
|
|
36
|
+
allowPerfectSquare: false,
|
|
37
|
+
maxSquare: 11,
|
|
38
|
+
});
|
|
39
|
+
proposition = {
|
|
40
|
+
id: (0, uuid_1.v4)() + '',
|
|
41
|
+
statement: squareRoot.simplify().toTree().toTex(),
|
|
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
|
+
};
|
|
22
50
|
const question = {
|
|
23
51
|
startStatement: squareRoot.toTree().toTex(),
|
|
24
52
|
answer: squareRoot.simplify().toTree().toTex(),
|
|
25
53
|
keys: [],
|
|
54
|
+
getPropositions,
|
|
26
55
|
};
|
|
27
56
|
return question;
|
|
28
57
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"point.d.ts","sourceRoot":"","sources":["../../../src/math/geometry/point.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"point.d.ts","sourceRoot":"","sources":["../../../src/math/geometry/point.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAS7C,8BAAsB,gBAAgB;CAMrC;AAED,qBAAa,KAAK;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,IAAI,CAAC;IACR,CAAC,EAAE,IAAI,CAAC;gBACI,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI;IAM1C,KAAK,IAAI,MAAM;IAIf,eAAe,IAAI,MAAM;IAIzB,UAAU,IAAI,MAAM;IAIpB,UAAU,IAAI,MAAM;IAIpB,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,SAAM,GAAG,KAAK;IAQrC,UAAU,CAAC,CAAC,EAAE,KAAK,GAAG,MAAM;IAM5B,cAAc,CAAC,CAAC,EAAE,KAAK,GAAG,IAAI;IAO9B,OAAO,CAAC,CAAC,EAAE,KAAK,GAAG,OAAO;CAG3B;AAED;;;;;;;;;;;;GAYG"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Point = exports.PointConstructor = void 0;
|
|
4
|
+
const sqrtNode_1 = require("../../tree/nodes/functions/sqrtNode");
|
|
4
5
|
const numberNode_1 = require("../../tree/nodes/numbers/numberNode");
|
|
5
6
|
const addNode_1 = require("../../tree/nodes/operators/addNode");
|
|
6
7
|
const fractionNode_1 = require("../../tree/nodes/operators/fractionNode");
|
|
8
|
+
const powerNode_1 = require("../../tree/nodes/operators/powerNode");
|
|
9
|
+
const substractNode_1 = require("../../tree/nodes/operators/substractNode");
|
|
7
10
|
const simplify_1 = require("../../tree/parsers/simplify");
|
|
8
11
|
const mathjs_1 = require("mathjs");
|
|
9
12
|
class PointConstructor {
|
|
@@ -35,6 +38,12 @@ class Point {
|
|
|
35
38
|
const dy = this.getYnumber() - B.getYnumber();
|
|
36
39
|
return Math.sqrt(dx ** 2 + dy ** 2);
|
|
37
40
|
}
|
|
41
|
+
distanceToNode(B) {
|
|
42
|
+
const dx = new substractNode_1.SubstractNode(this.x, B.x);
|
|
43
|
+
const dy = new substractNode_1.SubstractNode(this.y, B.y);
|
|
44
|
+
const sum = new addNode_1.AddNode(new powerNode_1.PowerNode(dx, new numberNode_1.NumberNode(2)), new powerNode_1.PowerNode(dy, new numberNode_1.NumberNode(2)));
|
|
45
|
+
return new sqrtNode_1.SqrtNode((0, simplify_1.simplifyNode)(sum));
|
|
46
|
+
}
|
|
38
47
|
equalTo(B) {
|
|
39
48
|
return this.getXnumber() === B.getXnumber() && this.getYnumber() === B.getYnumber();
|
|
40
49
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"polynomial.d.ts","sourceRoot":"","sources":["../../../src/math/polynomials/polynomial.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAS7C,qBAAa,UAAU;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,YAAY,EAAE,MAAM,EAAE,CAAC;IAEvB;;;;OAIG;gBACS,YAAY,EAAE,MAAM,EAAE,EAAE,QAAQ,GAAE,MAAY;IAS1D,MAAM,CAAC,CAAC,EAAE,UAAU,GAAG,OAAO;IAG9B,QAAQ;IACR,GAAG,CAAC,CAAC,EAAE,UAAU,GAAG,UAAU;IAc9B,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,UAAU;IAM7B,QAAQ,CAAC,CAAC,EAAE,UAAU,GAAG,UAAU;IAkBnC,QAAQ,IAAI,UAAU;IAOtB,QAAQ,IAAI,UAAU;
|
|
1
|
+
{"version":3,"file":"polynomial.d.ts","sourceRoot":"","sources":["../../../src/math/polynomials/polynomial.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAS7C,qBAAa,UAAU;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,YAAY,EAAE,MAAM,EAAE,CAAC;IAEvB;;;;OAIG;gBACS,YAAY,EAAE,MAAM,EAAE,EAAE,QAAQ,GAAE,MAAY;IAS1D,MAAM,CAAC,CAAC,EAAE,UAAU,GAAG,OAAO;IAG9B,QAAQ;IACR,GAAG,CAAC,CAAC,EAAE,UAAU,GAAG,UAAU;IAc9B,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,UAAU;IAM7B,QAAQ,CAAC,CAAC,EAAE,UAAU,GAAG,UAAU;IAkBnC,QAAQ,IAAI,UAAU;IAOtB,QAAQ,IAAI,UAAU;IAQtB,SAAS,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IAM5B,MAAM,IAAI,IAAI;IAmCd,KAAK,IAAI,MAAM;IAkBf,QAAQ,IAAI,MAAM;CAGnB"}
|
|
@@ -28,6 +28,7 @@ class Polynomial {
|
|
|
28
28
|
}
|
|
29
29
|
getRoots() { }
|
|
30
30
|
add(P) {
|
|
31
|
+
var _a, _b;
|
|
31
32
|
if (P.variable !== this.variable)
|
|
32
33
|
throw Error("Can't add two polynomials with different variables");
|
|
33
34
|
const newDegree = P.degree === this.degree && P.coefficients[P.degree] === -this.coefficients[this.degree]
|
|
@@ -35,7 +36,7 @@ class Polynomial {
|
|
|
35
36
|
: Math.max(P.degree, this.degree);
|
|
36
37
|
const res = [];
|
|
37
38
|
for (let i = 0; i < newDegree + 1; i++) {
|
|
38
|
-
res[i] = P.coefficients[i] + this.coefficients[i];
|
|
39
|
+
res[i] = ((_a = P.coefficients[i]) !== null && _a !== void 0 ? _a : 0) + ((_b = this.coefficients[i]) !== null && _b !== void 0 ? _b : 0);
|
|
39
40
|
}
|
|
40
41
|
return new Polynomial(res, this.variable);
|
|
41
42
|
}
|
|
@@ -66,6 +67,12 @@ class Polynomial {
|
|
|
66
67
|
res.push(i * this.coefficients[i]);
|
|
67
68
|
return new Polynomial(res, this.variable);
|
|
68
69
|
}
|
|
70
|
+
calculate(x) {
|
|
71
|
+
let res = 0;
|
|
72
|
+
for (let i = 0; i < this.coefficients.length; i++)
|
|
73
|
+
res += x ** i * this.coefficients[i];
|
|
74
|
+
return res;
|
|
75
|
+
}
|
|
69
76
|
toTree() {
|
|
70
77
|
const recursive = (cursor) => {
|
|
71
78
|
const coeff = this.coefficients[cursor];
|
package/lib/server.js
CHANGED
|
@@ -26,26 +26,22 @@ const runServer = () => {
|
|
|
26
26
|
questions,
|
|
27
27
|
});
|
|
28
28
|
});
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
new NumberNode(1.107),
|
|
46
|
-
).toEquationExpression(),
|
|
47
|
-
);*/
|
|
48
|
-
//console.log(leadingCoefficient.generator(2));
|
|
29
|
+
app.get('/qcmExo', (req, res) => {
|
|
30
|
+
const exoId = req.query.exoId;
|
|
31
|
+
const exo = allExercises.find((exo) => exo.id == exoId);
|
|
32
|
+
if (!exo)
|
|
33
|
+
res.send('Exo not found');
|
|
34
|
+
const questions = exo === null || exo === void 0 ? void 0 : exo.generator(10);
|
|
35
|
+
console.log(questions);
|
|
36
|
+
const populatedQuestions = questions === null || questions === void 0 ? void 0 : questions.map((q) => {
|
|
37
|
+
var _a;
|
|
38
|
+
return Object.assign(Object.assign({}, q), { propositions: (_a = q.getPropositions) === null || _a === void 0 ? void 0 : _a.call(q, 4) });
|
|
39
|
+
});
|
|
40
|
+
res.json({
|
|
41
|
+
exercise: exo,
|
|
42
|
+
questions: populatedQuestions,
|
|
43
|
+
});
|
|
44
|
+
});
|
|
49
45
|
app.listen('5000', () => {
|
|
50
46
|
console.log(`[server]: Server is running at http://localhost:5000`);
|
|
51
47
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "math-exercises",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.40",
|
|
4
4
|
"description": "Math exercises generator for middle school and high school",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"files": [
|
|
@@ -17,12 +17,16 @@
|
|
|
17
17
|
"author": "Heureux Hasard",
|
|
18
18
|
"license": "ISC",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"mathjs": "^11.5.1"
|
|
20
|
+
"mathjs": "^11.5.1",
|
|
21
|
+
"uuidv4": "^6.2.13"
|
|
21
22
|
},
|
|
22
23
|
"devDependencies": {
|
|
23
24
|
"@types/cors": "^2.8.13",
|
|
24
25
|
"@types/express": "^4.17.17",
|
|
25
26
|
"@types/node": "^18.11.9",
|
|
27
|
+
"cors": "^2.8.5",
|
|
28
|
+
"dotenv": "^16.0.3",
|
|
29
|
+
"express": "^4.18.2",
|
|
26
30
|
"nodemon": "^2.0.20",
|
|
27
31
|
"prettier": "^2.8.4",
|
|
28
32
|
"ts-node": "^10.9.1",
|
|
@@ -31,10 +35,7 @@
|
|
|
31
35
|
"tsconfig-paths": "^4.1.2",
|
|
32
36
|
"tslint": "^6.1.3",
|
|
33
37
|
"tslint-config-prettier": "^1.18.0",
|
|
34
|
-
"typescript": "^4.9.3"
|
|
35
|
-
"cors": "^2.8.5",
|
|
36
|
-
"dotenv": "^16.0.3",
|
|
37
|
-
"express": "^4.18.2"
|
|
38
|
+
"typescript": "^4.9.3"
|
|
38
39
|
},
|
|
39
40
|
"repository": {
|
|
40
41
|
"type": "git",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"derivativeNumberReading.d.ts","sourceRoot":"","sources":["../../../../src/exercises/geometry/cartesian/derivativeNumberReading.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAS9D,eAAO,MAAM,uBAAuB,EAAE,QASrC,CAAC;AAEF,wBAAgB,0BAA0B,IAAI,QAAQ,CAoCrD"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getDerivativeNumberReading = exports.derivativeNumberReading = void 0;
|
|
4
|
-
const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
|
|
5
|
-
const droite_1 = require("../../../math/geometry/droite");
|
|
6
|
-
const point_1 = require("../../../math/geometry/point");
|
|
7
|
-
const polynomial_1 = require("../../../math/polynomials/polynomial");
|
|
8
|
-
const randint_1 = require("../../../math/utils/random/randint");
|
|
9
|
-
const numberNode_1 = require("../../../tree/nodes/numbers/numberNode");
|
|
10
|
-
const mathjs_1 = require("mathjs");
|
|
11
|
-
exports.derivativeNumberReading = {
|
|
12
|
-
id: 'derivativeNumberReading',
|
|
13
|
-
connector: '=',
|
|
14
|
-
instruction: '',
|
|
15
|
-
label: 'Lecture de nombre dérivé',
|
|
16
|
-
levels: ['3', '2', '1'],
|
|
17
|
-
isSingleStep: false,
|
|
18
|
-
section: 'Géométrie cartésienne',
|
|
19
|
-
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getDerivativeNumberReading, nb),
|
|
20
|
-
};
|
|
21
|
-
function getDerivativeNumberReading() {
|
|
22
|
-
let xA, yA, xB, yB;
|
|
23
|
-
let pointA, pointB;
|
|
24
|
-
do {
|
|
25
|
-
[xA, yA] = [1, 2].map((el) => (0, randint_1.randint)(-5, 6));
|
|
26
|
-
xB = xA > 0 ? (0, randint_1.randint)(xA - 4, 6) : (0, randint_1.randint)(-4, xA + 5); // l'écart entre les deux points ne soit pas grand
|
|
27
|
-
yB = yA > 0 ? (0, randint_1.randint)(yA - 4, 6) : (0, randint_1.randint)(-4, yA + 5);
|
|
28
|
-
pointA = new point_1.Point('A', new numberNode_1.NumberNode(xA), new numberNode_1.NumberNode(yA));
|
|
29
|
-
pointB = new point_1.Point('B', new numberNode_1.NumberNode(xB), new numberNode_1.NumberNode(yB));
|
|
30
|
-
} while (xB - xA === 0);
|
|
31
|
-
const droite = droite_1.DroiteConstructor.fromTwoPoints(pointA, pointB, 'D');
|
|
32
|
-
const [a, b] = [(3 * (0, randint_1.randint)(-100, 100, [0])) / 100, (2 * (0, randint_1.randint)(-4, 5)) / 100];
|
|
33
|
-
const c = (0, mathjs_1.evaluate)(droite.a.toMathString()) - a * Math.pow(xA, 2) - b * xA;
|
|
34
|
-
const d = yA - (a / 3) * Math.pow(xA, 3) - (b / 2) * Math.pow(xA, 2) - xA * c;
|
|
35
|
-
const polynome = new polynomial_1.Polynomial([d, c, b / 2, a / 3]);
|
|
36
|
-
const instruction = `Ci-dessous sont tracées la courbe de la fonction $f$ et la tangente à cette courbe au point d'abscisse $${xA}$.$\\\\$ Déterminer le coefficient directeur de la tangente qui passe par ce point.`;
|
|
37
|
-
const commands = [
|
|
38
|
-
polynome.toString(),
|
|
39
|
-
`g(x) = (${droite.a.toMathString()}) * x + (${droite.b.toMathString()})`,
|
|
40
|
-
`(${xA},${yA})`,
|
|
41
|
-
];
|
|
42
|
-
const question = {
|
|
43
|
-
instruction,
|
|
44
|
-
startStatement: 'a',
|
|
45
|
-
answer: droite.getLeadingCoefficient(),
|
|
46
|
-
commands,
|
|
47
|
-
coords: [xA - 5, xA + 5, yA - 5, yA + 5],
|
|
48
|
-
};
|
|
49
|
-
return question;
|
|
50
|
-
}
|
|
51
|
-
exports.getDerivativeNumberReading = getDerivativeNumberReading;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=derivativeNumberReading2.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"derivativeNumberReading2.d.ts","sourceRoot":"","sources":["../../../../src/exercises/geometry/cartesian/derivativeNumberReading2.ts"],"names":[],"mappings":""}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*import { Exercise, Question } from '../../../exercises/exercise';
|
|
3
|
-
import { getDistinctQuestions } from '../../../exercises/utils/getDistinctQuestions';
|
|
4
|
-
import { DroiteConstructor } from '../../../math/geometry/droite';
|
|
5
|
-
import { Point } from '../../../math/geometry/point';
|
|
6
|
-
import { Polynomial } from '../../../math/polynomials/polynomial';
|
|
7
|
-
import { randint } from '../../../math/utils/random/randint';
|
|
8
|
-
import { NumberNode } from '../../../tree/nodes/numbers/numberNode';
|
|
9
|
-
import { evaluate } from 'mathjs';
|
|
10
|
-
|
|
11
|
-
export const derivativeNumberReading2: Exercise = {
|
|
12
|
-
id: 'derivativeNumberReading2',
|
|
13
|
-
connector: '=',
|
|
14
|
-
instruction: '',
|
|
15
|
-
label: 'Lecture de nombre dérivé 2',
|
|
16
|
-
levels: ['3', '2', '1'],
|
|
17
|
-
isSingleStep: false,
|
|
18
|
-
section: 'Géométrie cartésienne',
|
|
19
|
-
generator: (nb: number) => getDistinctQuestions(getDerivativeNumberReading, nb),
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export function getDerivativeNumberReading(): Question {
|
|
23
|
-
function computePolynomial(
|
|
24
|
-
x0: number,
|
|
25
|
-
y0: number,
|
|
26
|
-
m: number,
|
|
27
|
-
x1: number,
|
|
28
|
-
y1: number,
|
|
29
|
-
x2: number,
|
|
30
|
-
y2: number,
|
|
31
|
-
x3: number,
|
|
32
|
-
y3: number,
|
|
33
|
-
): [number, number, number, number] {
|
|
34
|
-
const a = (-2 * x0 * x1 * x2 + x0 * x1 * x3 + x0 * x2 * x3 + x1 * x2 * x3) / ((x0 - x1) * (x0 - x2) * (x0 - x3));
|
|
35
|
-
const b =
|
|
36
|
-
((y0 - y1) / ((x0 - x1) * (x0 - x1)) -
|
|
37
|
-
(y0 - y2) / ((x0 - x2) * (x0 - x2)) +
|
|
38
|
-
(y0 - y3) / ((x0 - x3) * (x0 - x3))) /
|
|
39
|
-
(x0 - x1);
|
|
40
|
-
const c =
|
|
41
|
-
((m - 2 * a * x0 - b) * (x0 - x1) * (x0 - x2) * (x0 - x3) -
|
|
42
|
-
(y0 - y1) / ((x0 - x1) * (x0 - x1)) +
|
|
43
|
-
a * (x1 * x1 * (x0 - x2) + x2 * x2 * (x0 - x1) - 2 * x1 * x2 * x0) +
|
|
44
|
-
b * (x1 + x2 - 2 * x0)) /
|
|
45
|
-
((x0 - x2) * (x0 - x3));
|
|
46
|
-
const d = y0 - a * x0 * x0 * x0 - b * x0 * x0 - c * x0;
|
|
47
|
-
return [a, b, c, d];
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function generatePolynomial(
|
|
51
|
-
x0: number,
|
|
52
|
-
y0: number,
|
|
53
|
-
m: number,
|
|
54
|
-
x1: number,
|
|
55
|
-
y1: number,
|
|
56
|
-
x2: number,
|
|
57
|
-
y2: number,
|
|
58
|
-
x3: number,
|
|
59
|
-
y3: number,
|
|
60
|
-
): Polynomial {
|
|
61
|
-
const [a, b, c, d] = computePolynomial(x0, y0, m, x1, y1, x2, y2, x3, y3);
|
|
62
|
-
return new Polynomial([d, c, b, a]);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const [x1, y1, x2, y2, x3, y3] = [1, 2, 3, 4, 5, 6].map((el) => randint(-5, 6));
|
|
66
|
-
|
|
67
|
-
let xA: number, yA, xB, yB: number;
|
|
68
|
-
let pointA, pointB: Point;
|
|
69
|
-
do {
|
|
70
|
-
[xA, yA] = [1, 2].map((el) => randint(-5, 6));
|
|
71
|
-
xB = xA > 0 ? randint(xA - 4, 6) : randint(-4, xA + 5); // l'écart entre les deux points ne soit pas grand
|
|
72
|
-
yB = yA > 0 ? randint(yA - 4, 6) : randint(-4, yA + 5);
|
|
73
|
-
pointA = new Point('A', new NumberNode(xA), new NumberNode(yA));
|
|
74
|
-
pointB = new Point('B', new NumberNode(xB), new NumberNode(yB));
|
|
75
|
-
} while (xB - xA === 0);
|
|
76
|
-
|
|
77
|
-
const droite = DroiteConstructor.fromTwoPoints(pointA, pointB, 'D');
|
|
78
|
-
|
|
79
|
-
const polynome = generatePolynomial(xA, yA, evaluate(droite.a.toMathString()), x1, y1, x2, y2, x3, y3);
|
|
80
|
-
|
|
81
|
-
let instruction = `$f(x) = ${polynome.toTex()}$, $${pointA.toTexWithCoords()}$, $${pointB.toTexWithCoords()}$, $f'(${xA}) = ${droite.getLeadingCoefficient()}$`;
|
|
82
|
-
|
|
83
|
-
const question: Question = {
|
|
84
|
-
instruction,
|
|
85
|
-
//startStatement: pointA.toTexWithCoords() + ' ' + pointB.toTexWithCoords(),
|
|
86
|
-
answer: droite.a.toTex(),
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
return question;
|
|
90
|
-
}
|
|
91
|
-
*/
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"triangleArea.d.ts","sourceRoot":"","sources":["../../../../src/exercises/geometry/euclidean/triangleArea.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAM9D,eAAO,MAAM,YAAY,EAAE,QAS1B,CAAC;AAEF,wBAAgB,eAAe,IAAI,QAAQ,CA4C1C"}
|
|
File without changes
|