math-exercises 3.0.71 → 3.0.73
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/exercise.d.ts +3 -1
- package/lib/exercises/exercise.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/getParityBetweenTwoNumbers.d.ts +9 -0
- package/lib/exercises/math/calcul/arithmetics/getParityBetweenTwoNumbers.d.ts.map +1 -0
- package/lib/exercises/math/calcul/arithmetics/getParityBetweenTwoNumbers.js +114 -0
- package/lib/exercises/math/calcul/arithmetics/imageOfSquareFunction.d.ts +8 -0
- package/lib/exercises/math/calcul/arithmetics/imageOfSquareFunction.d.ts.map +1 -0
- package/lib/exercises/math/calcul/arithmetics/imageOfSquareFunction.js +152 -0
- package/lib/exercises/math/calcul/arithmetics/index.d.ts +9 -0
- package/lib/exercises/math/calcul/arithmetics/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/index.js +9 -0
- package/lib/exercises/math/calcul/arithmetics/isInequalityTrue.d.ts +15 -0
- package/lib/exercises/math/calcul/arithmetics/isInequalityTrue.d.ts.map +1 -0
- package/lib/exercises/math/calcul/arithmetics/isInequalityTrue.js +143 -0
- package/lib/exercises/math/calcul/arithmetics/isPointOnCubicFunction.d.ts +9 -0
- package/lib/exercises/math/calcul/arithmetics/isPointOnCubicFunction.d.ts.map +1 -0
- package/lib/exercises/math/calcul/arithmetics/isPointOnCubicFunction.js +111 -0
- package/lib/exercises/math/calcul/arithmetics/isPointOnFunction.d.ts +10 -0
- package/lib/exercises/math/calcul/arithmetics/isPointOnFunction.d.ts.map +1 -0
- package/lib/exercises/math/calcul/arithmetics/isPointOnFunction.js +133 -0
- package/lib/exercises/math/calcul/arithmetics/isPointOnReciprocalFunction.d.ts +9 -0
- package/lib/exercises/math/calcul/arithmetics/isPointOnReciprocalFunction.d.ts.map +1 -0
- package/lib/exercises/math/calcul/arithmetics/isPointOnReciprocalFunction.js +117 -0
- package/lib/exercises/math/calcul/arithmetics/minNumberInequality.d.ts +13 -0
- package/lib/exercises/math/calcul/arithmetics/minNumberInequality.d.ts.map +1 -0
- package/lib/exercises/math/calcul/arithmetics/minNumberInequality.js +192 -0
- package/lib/exercises/math/calcul/arithmetics/primeNumberIdentification.d.ts +7 -0
- package/lib/exercises/math/calcul/arithmetics/primeNumberIdentification.d.ts.map +1 -0
- package/lib/exercises/math/calcul/arithmetics/primeNumberIdentification.js +84 -0
- package/lib/exercises/math/calcul/arithmetics/squareRootCalculation.d.ts +8 -0
- package/lib/exercises/math/calcul/arithmetics/squareRootCalculation.d.ts.map +1 -0
- package/lib/exercises/math/calcul/arithmetics/squareRootCalculation.js +107 -0
- package/lib/exercises/math/calcul/fractions/fractionAndIntegerSum.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionAndIntegerSum.js +37 -0
- package/lib/exercises/math/calcul/fractions/fractionToPercentToDecimal.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionToPercentToDecimal.js +57 -6
- package/lib/exercises/math/calcul/fractions/fractionsOperations.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionsOperations.js +64 -22
- package/lib/exercises/math/calcul/fractions/fractionsSubstraction.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionsSubstraction.js +143 -4
- package/lib/exercises/math/calcul/fractions/fractionsSum.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionsSum.js +141 -3
- package/lib/exercises/math/calcul/fractions/index.d.ts +1 -0
- package/lib/exercises/math/calcul/fractions/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/index.js +1 -0
- package/lib/exercises/math/calcul/fractions/periodicWritingToFraction.js +3 -3
- package/lib/exercises/math/calcul/fractions/powerNotation.d.ts +9 -0
- package/lib/exercises/math/calcul/fractions/powerNotation.d.ts.map +1 -0
- package/lib/exercises/math/calcul/fractions/powerNotation.js +125 -0
- package/lib/exercises/math/calcul/proportionality/proportionalityTable.d.ts.map +1 -1
- package/lib/exercises/math/calcul/proportionality/proportionalityTable.js +29 -5
- package/lib/exercises/math/calcul/sign/absoluteNumber.d.ts +7 -0
- package/lib/exercises/math/calcul/sign/absoluteNumber.d.ts.map +1 -0
- package/lib/exercises/math/calcul/sign/absoluteNumber.js +80 -0
- package/lib/exercises/math/calcul/sign/index.d.ts +1 -0
- package/lib/exercises/math/calcul/sign/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/sign/index.js +1 -0
- package/lib/exercises/math/calculLitteral/equation/binomialsTrinomialsProposedSolutions.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/binomialsTrinomialsProposedSolutions.js +67 -21
- package/lib/exercises/math/calculLitteral/equation/equa3.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equa3.js +0 -2
- package/lib/exercises/math/calculLitteral/equation/equationWithDistributivity.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equationWithDistributivity.js +53 -9
- package/lib/exercises/math/calculLitteral/equation/factorizeEquation.d.ts +9 -0
- package/lib/exercises/math/calculLitteral/equation/factorizeEquation.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/equation/factorizeEquation.js +145 -0
- package/lib/exercises/math/calculLitteral/equation/index.d.ts +1 -0
- package/lib/exercises/math/calculLitteral/equation/index.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/index.js +1 -0
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType2.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType2.js +32 -4
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType3.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType3.js +30 -2
- package/lib/exercises/math/calculLitteral/inequations/index.d.ts +1 -0
- package/lib/exercises/math/calculLitteral/inequations/index.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/inequations/index.js +1 -0
- package/lib/exercises/math/calculLitteral/inequations/inequationsSign.d.ts +9 -0
- package/lib/exercises/math/calculLitteral/inequations/inequationsSign.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/inequations/inequationsSign.js +75 -0
- package/lib/exercises/math/calculLitteral/inequations/inverseInequality.d.ts +9 -0
- package/lib/exercises/math/calculLitteral/inequations/inverseInequality.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/inequations/inverseInequality.js +120 -0
- package/lib/exercises/math/calculLitteral/simplifying/distributeAndSimplify.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/simplifying/distributeAndSimplify.js +43 -1
- package/lib/exercises/math/curve/index.d.ts +3 -0
- package/lib/exercises/math/curve/index.d.ts.map +1 -0
- package/lib/exercises/math/curve/index.js +2 -0
- package/lib/exercises/math/curve/sqrtCurvePoint.d.ts +8 -0
- package/lib/exercises/math/curve/sqrtCurvePoint.d.ts.map +1 -0
- package/lib/exercises/math/curve/sqrtCurvePoint.js +132 -0
- package/lib/exercises/math/curve/squareCurvePoint.d.ts +8 -0
- package/lib/exercises/math/curve/squareCurvePoint.d.ts.map +1 -0
- package/lib/exercises/math/curve/squareCurvePoint.js +133 -0
- package/lib/exercises/math/functions/absolute/index.d.ts +2 -0
- package/lib/exercises/math/functions/absolute/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/absolute/index.js +2 -0
- package/lib/exercises/math/functions/absolute/removeAbsNotation.d.ts +8 -0
- package/lib/exercises/math/functions/absolute/removeAbsNotation.d.ts.map +1 -0
- package/lib/exercises/math/functions/absolute/removeAbsNotation.js +105 -0
- package/lib/exercises/math/functions/absolute/removeAbsNotationSign.d.ts +8 -0
- package/lib/exercises/math/functions/absolute/removeAbsNotationSign.d.ts.map +1 -0
- package/lib/exercises/math/functions/absolute/removeAbsNotationSign.js +108 -0
- package/lib/exercises/math/functions/affines/affineExpressionReading.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/affineExpressionReading.js +36 -0
- package/lib/exercises/math/functions/basics/index.d.ts +1 -0
- package/lib/exercises/math/functions/basics/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/index.js +1 -0
- package/lib/exercises/math/functions/basics/valueTableCompletion.d.ts +7 -0
- package/lib/exercises/math/functions/basics/valueTableCompletion.d.ts.map +1 -0
- package/lib/exercises/math/functions/basics/valueTableCompletion.js +78 -0
- package/lib/exercises/math/functions/cube/imageOfCubeFunction.d.ts +8 -0
- package/lib/exercises/math/functions/cube/imageOfCubeFunction.d.ts.map +1 -0
- package/lib/exercises/math/functions/cube/imageOfCubeFunction.js +142 -0
- package/lib/exercises/math/functions/cube/index.d.ts +1 -0
- package/lib/exercises/math/functions/cube/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/cube/index.js +1 -0
- package/lib/exercises/math/functions/square/getImageOfSquareRootFunction.d.ts +8 -0
- package/lib/exercises/math/functions/square/getImageOfSquareRootFunction.d.ts.map +1 -0
- package/lib/exercises/math/functions/square/getImageOfSquareRootFunction.js +128 -0
- package/lib/exercises/math/functions/square/index.d.ts +1 -0
- package/lib/exercises/math/functions/square/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/square/index.js +1 -0
- package/lib/exercises/math/geometry/euclidian/pythagoreOrThales.d.ts.map +1 -1
- package/lib/exercises/math/geometry/euclidian/pythagoreOrThales.js +32 -2
- package/lib/exercises/math/index.d.ts +1 -0
- package/lib/exercises/math/index.d.ts.map +1 -1
- package/lib/exercises/math/index.js +1 -0
- package/lib/exercises/math/powers/decimalToScientific.d.ts.map +1 -1
- package/lib/exercises/math/powers/decimalToScientific.js +0 -1
- package/lib/exercises/math/powers/powersMixOperations.d.ts.map +1 -1
- package/lib/exercises/math/powers/powersMixOperations.js +0 -1
- package/lib/exercises/math/probaStat/ballsBasicProbas.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/ballsBasicProbas.js +1 -3
- package/lib/exercises/math/probaStat/stats1var/median.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/median.js +2 -11
- package/lib/exercises/math/probaStat/stats1var/medianList.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/medianList.js +2 -10
- package/lib/exercises/math/probaStat/stats1var/quartilesList.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/quartilesList.js +3 -9
- package/lib/exercises/math/python/index.d.ts +2 -0
- package/lib/exercises/math/python/index.d.ts.map +1 -1
- package/lib/exercises/math/python/index.js +2 -0
- package/lib/exercises/math/python/pyIfElseCondition.d.ts +8 -0
- package/lib/exercises/math/python/pyIfElseCondition.d.ts.map +1 -0
- package/lib/exercises/math/python/pyIfElseCondition.js +133 -0
- package/lib/exercises/math/python/variableType.d.ts +8 -0
- package/lib/exercises/math/python/variableType.d.ts.map +1 -0
- package/lib/exercises/math/python/variableType.js +118 -0
- package/lib/exercises/math/python/whileLoop.js +1 -1
- package/lib/exercises/math/sequences/arithmetic/arithmeticExplicitFormulaUsage.d.ts.map +1 -1
- package/lib/exercises/math/sequences/arithmetic/arithmeticExplicitFormulaUsage.js +1 -0
- package/lib/exercises/math/sequences/arithmetic/arithmeticFindReason.d.ts.map +1 -1
- package/lib/exercises/math/sequences/arithmetic/arithmeticFindReason.js +2 -1
- package/lib/exercises/math/sets/intervals/inequalityToInterval.d.ts.map +1 -1
- package/lib/exercises/math/sets/intervals/inequalityToInterval.js +21 -0
- package/lib/exercises/math/sets/intervals/intervalToInequality.d.ts.map +1 -1
- package/lib/exercises/math/sets/intervals/intervalToInequality.js +20 -0
- package/lib/exercises/math/sets/intervals/intervalsUnion.d.ts.map +1 -1
- package/lib/exercises/math/sets/intervals/intervalsUnion.js +19 -0
- package/lib/exercises/math/sets/setBelonging.d.ts.map +1 -1
- package/lib/exercises/math/sets/setBelonging.js +24 -0
- package/lib/exercises/pc/chemicalElements/weightPercent.d.ts.map +1 -1
- package/lib/exercises/pc/chemicalElements/weightPercent.js +0 -1
- package/lib/exercises/utils/getDistinctQuestions.d.ts.map +1 -1
- package/lib/exercises/utils/getDistinctQuestions.js +6 -0
- package/lib/index.d.ts +71 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/latexTester.d.ts.map +1 -1
- package/lib/latexTester.js +5 -2
- package/lib/math/numbers/decimals/decimal.d.ts +1 -1
- package/lib/math/numbers/decimals/decimal.d.ts.map +1 -1
- package/lib/math/numbers/decimals/decimal.js +5 -2
- package/lib/math/utils/stats/median.d.ts +2 -0
- package/lib/math/utils/stats/median.d.ts.map +1 -0
- package/lib/math/utils/stats/median.js +39 -0
- package/lib/playground.d.ts.map +1 -1
- package/lib/playground.js +5 -6
- package/lib/tests/pdfExo.test.d.ts.map +1 -1
- package/lib/tests/pdfExo.test.js +2 -2
- package/lib/tests/pdfs/mdCodeToLatex.d.ts.map +1 -1
- package/lib/tests/pdfs/mdCodeToLatex.js +10 -0
- package/lib/tests/pdfs/quizPdfPreambule.js +1 -1
- package/lib/tree/nodes/algebraicNode.d.ts +2 -0
- package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
- package/lib/tree/nodes/nodeConstructor.js +1 -1
- package/lib/tree/nodes/numbers/numberNode.js +2 -2
- package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/fractionNode.js +10 -4
- package/lib/tree/nodes/operators/powerNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/powerNode.js +4 -0
- package/package.json +1 -1
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { addValidProp, shuffleProps, GeneratorOptionType, GeneratorOptionTarget, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { RationalConstructor, } from "../../../../math/numbers/rationals/rational.js";
|
|
4
|
+
import { gcd } from "../../../../math/utils/arithmetic/gcd.js";
|
|
4
5
|
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
6
|
+
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
5
7
|
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
6
8
|
import { rationalParser } from "../../../../tree/parsers/rationalParser.js";
|
|
7
9
|
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
@@ -40,8 +42,144 @@ $$
|
|
|
40
42
|
${getStatementNode(identifiers).toTex()}
|
|
41
43
|
$$`;
|
|
42
44
|
};
|
|
43
|
-
|
|
44
|
-
|
|
45
|
+
const getHint = (identifiers, opts) => {
|
|
46
|
+
const { frac1, frac2 } = identifiers;
|
|
47
|
+
const sameDenom = frac1[1] === frac2[1];
|
|
48
|
+
if (sameDenom) {
|
|
49
|
+
return `Les fractions ont le même dénominateur : tu peux donc directement soustraire les numérateurs, puis simplifier le résultat.`;
|
|
50
|
+
}
|
|
51
|
+
return `Il faut tout d'abord mettre les fractions au même dénominateur. Ensuite, soustrait les numérateurs, puis simplifie le résultat obtenu.`;
|
|
52
|
+
};
|
|
53
|
+
const getCorrection = (identifiers, opts) => {
|
|
54
|
+
const { frac1, frac2 } = identifiers;
|
|
55
|
+
const firstFrac = frac(frac1[0], frac1[1]);
|
|
56
|
+
const secondFrac = frac(frac2[0], frac2[1]);
|
|
57
|
+
const statementTree = substract(firstFrac, secondFrac);
|
|
58
|
+
const sameDenom = frac1[1] === frac2[1];
|
|
59
|
+
const answer = getAnswer(identifiers);
|
|
60
|
+
if (sameDenom) {
|
|
61
|
+
const sum = frac(frac1[0] - frac2[0], frac1[1]);
|
|
62
|
+
const sumSimp = sum.simplify();
|
|
63
|
+
const isSimplifiable = sum.toTex() !== sumSimp.toTex();
|
|
64
|
+
return `Les fractions ont le même dénominateur, on peut donc soustraire les numérateurs :
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
$$
|
|
68
|
+
${statementTree.toTex()} = ${sum.toTex()}
|
|
69
|
+
$$
|
|
70
|
+
|
|
71
|
+
${isSimplifiable
|
|
72
|
+
? `On peut alors simplifier cette fraction :
|
|
73
|
+
|
|
74
|
+
$$
|
|
75
|
+
${sum.toTex()} = ${sumSimp.toTex()}
|
|
76
|
+
$$`
|
|
77
|
+
: "Cette fraction est déjà simplifiée."}`;
|
|
78
|
+
}
|
|
79
|
+
const pgcd = gcd(frac1[1], frac2[1]);
|
|
80
|
+
let technique = "";
|
|
81
|
+
let firstFracFinal = firstFrac;
|
|
82
|
+
let secondFracFinal = secondFrac;
|
|
83
|
+
if (pgcd === 1) {
|
|
84
|
+
const firstProduct = frac(multiply(frac1[0], frac2[1]), multiply(frac1[1], frac2[1]));
|
|
85
|
+
firstFracFinal = firstProduct.simplify({
|
|
86
|
+
forbidRationalSimplification: true,
|
|
87
|
+
});
|
|
88
|
+
const secondProduct = frac(multiply(frac2[0], frac1[1]), multiply(frac2[1], frac1[1]));
|
|
89
|
+
secondFracFinal = secondProduct.simplify({
|
|
90
|
+
forbidRationalSimplification: true,
|
|
91
|
+
});
|
|
92
|
+
technique = `on multiple le numérateur et le dénominateur de la première fraction par $${frac2[1]}$, et le numérateur et dénominateur de la deuxième fraction par $${frac1[1]}$ :
|
|
93
|
+
|
|
94
|
+
$$
|
|
95
|
+
${firstFrac.toTex()} = ${firstProduct.toTex({
|
|
96
|
+
forceNoSimplification: true,
|
|
97
|
+
})} = ${firstFracFinal.toTex()}
|
|
98
|
+
$$
|
|
99
|
+
|
|
100
|
+
$$
|
|
101
|
+
${secondFrac.toTex()} = ${secondProduct.toTex({
|
|
102
|
+
forceNoSimplification: true,
|
|
103
|
+
})} = ${secondFracFinal.toTex()}
|
|
104
|
+
$$
|
|
105
|
+
`;
|
|
106
|
+
}
|
|
107
|
+
else if (pgcd === frac1[1]) {
|
|
108
|
+
const coeff = frac2[1] / pgcd;
|
|
109
|
+
const product = frac(multiply(frac1[0], coeff), multiply(frac1[1], coeff));
|
|
110
|
+
firstFracFinal = product.simplify({
|
|
111
|
+
forbidRationalSimplification: true,
|
|
112
|
+
});
|
|
113
|
+
technique = `on multiple le numérateur et le dénominateur de la première fraction par $${coeff}$ :
|
|
114
|
+
|
|
115
|
+
$$
|
|
116
|
+
${firstFrac.toTex()} = ${product.toTex({
|
|
117
|
+
forceNoSimplification: true,
|
|
118
|
+
})} = ${firstFracFinal.toTex()}
|
|
119
|
+
$$`;
|
|
120
|
+
}
|
|
121
|
+
else if (pgcd === frac2[1]) {
|
|
122
|
+
const coeff = frac1[1] / pgcd;
|
|
123
|
+
const product = frac(multiply(frac2[0], coeff), multiply(frac2[1], coeff));
|
|
124
|
+
secondFracFinal = product.simplify({
|
|
125
|
+
forbidRationalSimplification: true,
|
|
126
|
+
});
|
|
127
|
+
technique = `on multiple le numérateur et le dénominateur de la deuxième fraction par $${coeff}$ :
|
|
128
|
+
|
|
129
|
+
$$
|
|
130
|
+
${secondFrac.toTex()} = ${product.toTex({
|
|
131
|
+
forceNoSimplification: true,
|
|
132
|
+
})} = ${secondFracFinal.toTex()}
|
|
133
|
+
$$`;
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
const coeff1 = frac2[1] / pgcd;
|
|
137
|
+
const coeff2 = frac1[1] / pgcd;
|
|
138
|
+
const product1 = frac(multiply(frac1[0], coeff1), multiply(frac1[1], coeff1));
|
|
139
|
+
const product2 = frac(multiply(frac2[0], coeff2), multiply(frac2[1], coeff2));
|
|
140
|
+
firstFracFinal = product1.simplify({
|
|
141
|
+
forbidRationalSimplification: true,
|
|
142
|
+
});
|
|
143
|
+
secondFracFinal = product2.simplify({
|
|
144
|
+
forbidRationalSimplification: true,
|
|
145
|
+
});
|
|
146
|
+
technique = `on multiple le numérateur et le dénominateur de la première fraction par $${coeff1}$, et le numérateur et dénominateur de la deuxième fraction par $${coeff2}$ :
|
|
147
|
+
|
|
148
|
+
$$
|
|
149
|
+
${firstFrac.toTex()} = ${product1.toTex({
|
|
150
|
+
forceNoSimplification: true,
|
|
151
|
+
})} = ${firstFracFinal.toTex()}
|
|
152
|
+
$$
|
|
153
|
+
|
|
154
|
+
$$
|
|
155
|
+
${secondFrac.toTex()} = ${product2.toTex({
|
|
156
|
+
forceNoSimplification: true,
|
|
157
|
+
})} = ${secondFracFinal.toTex()}
|
|
158
|
+
$$`;
|
|
159
|
+
}
|
|
160
|
+
const sumFinal = substract(firstFracFinal, secondFracFinal);
|
|
161
|
+
const subSumFinal = frac(substract(firstFracFinal.leftChild, secondFracFinal.leftChild), firstFracFinal.rightChild);
|
|
162
|
+
const finalNonSimp = subSumFinal.simplify({
|
|
163
|
+
forbidRationalSimplification: true,
|
|
164
|
+
});
|
|
165
|
+
const final = subSumFinal.simplify();
|
|
166
|
+
const isSimplifiable = finalNonSimp.toTex() !== final.toTex();
|
|
167
|
+
return `On commence par mettre les fractions au même dénominateur. Pour cela, ${technique}
|
|
168
|
+
|
|
169
|
+
On peut alors soustraire les deux fractions :
|
|
170
|
+
|
|
171
|
+
$$
|
|
172
|
+
${sumFinal.toTex()} = ${subSumFinal.toTex()} = ${finalNonSimp.toTex()}
|
|
173
|
+
$$
|
|
174
|
+
|
|
175
|
+
${isSimplifiable
|
|
176
|
+
? `On peut alors simplifier cette fraction :
|
|
177
|
+
|
|
178
|
+
$$
|
|
179
|
+
${finalNonSimp.toTex()} = ${final.toTex()}
|
|
180
|
+
$$`
|
|
181
|
+
: "Cette fraction est déjà simplifiée."}`;
|
|
182
|
+
};
|
|
45
183
|
const getKeys = (identifiers) => {
|
|
46
184
|
return [];
|
|
47
185
|
};
|
|
@@ -81,8 +219,8 @@ const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
|
81
219
|
keys: getKeys(identifiers),
|
|
82
220
|
answerFormat: "tex",
|
|
83
221
|
identifiers,
|
|
84
|
-
|
|
85
|
-
|
|
222
|
+
hint: getHint(identifiers),
|
|
223
|
+
correction: getCorrection(identifiers),
|
|
86
224
|
};
|
|
87
225
|
return question;
|
|
88
226
|
};
|
|
@@ -99,4 +237,5 @@ export const fractionsSubstraction = {
|
|
|
99
237
|
subject: "Mathématiques",
|
|
100
238
|
options,
|
|
101
239
|
getQuestionFromIdentifiers,
|
|
240
|
+
hasHintAndCorrection: true,
|
|
102
241
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fractionsSum.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionsSum.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"fractionsSum.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionsSum.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAgBrC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AA4SF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAevD,CAAC"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { GeneratorOptionTarget, GeneratorOptionType, addValidProp, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { Rational, RationalConstructor, } from "../../../../math/numbers/rationals/rational.js";
|
|
4
|
-
import {
|
|
4
|
+
import { gcd } from "../../../../math/utils/arithmetic/gcd.js";
|
|
5
|
+
import { add, AddNode } from "../../../../tree/nodes/operators/addNode.js";
|
|
6
|
+
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
7
|
+
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
5
8
|
import { rationalParser } from "../../../../tree/parsers/rationalParser.js";
|
|
6
9
|
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
7
10
|
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
@@ -27,10 +30,142 @@ const getAnswer = (identifiers, opts) => {
|
|
|
27
30
|
return answer;
|
|
28
31
|
};
|
|
29
32
|
const getHint = (identifiers, opts) => {
|
|
30
|
-
|
|
33
|
+
const { rational, rational2 } = identifiers;
|
|
34
|
+
const sameDenom = rational[1] === rational2[1];
|
|
35
|
+
if (sameDenom) {
|
|
36
|
+
return `Les fractions ont le même dénominateur : tu peux donc directement additionner les numérateurs, puis simplifier le résultat.`;
|
|
37
|
+
}
|
|
38
|
+
return `Il faut tout d'abord mettre les fractions au même dénominateur. Ensuite, additionne les numérateurs, puis simplifie le résultat obtenu.`;
|
|
31
39
|
};
|
|
32
40
|
const getCorrection = (identifiers, opts) => {
|
|
33
|
-
|
|
41
|
+
const { rational, rational2 } = identifiers;
|
|
42
|
+
const firstFrac = frac(rational[0], rational[1]);
|
|
43
|
+
const secondFrac = frac(rational2[0], rational2[1]);
|
|
44
|
+
const statementTree = add(firstFrac, secondFrac);
|
|
45
|
+
const sameDenom = rational[1] === rational2[1];
|
|
46
|
+
const answer = getAnswer(identifiers);
|
|
47
|
+
if (sameDenom) {
|
|
48
|
+
const sum = frac(rational[0] + rational2[0], rational[1]);
|
|
49
|
+
const sumSimp = sum.simplify();
|
|
50
|
+
const isSimplifiable = sum.toTex() !== sumSimp.toTex();
|
|
51
|
+
return `Les fractions ont le même dénominateur, on peut donc additionner les numérateurs :
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
$$
|
|
55
|
+
${statementTree.toTex()} = ${sum.toTex()}
|
|
56
|
+
$$
|
|
57
|
+
|
|
58
|
+
${isSimplifiable
|
|
59
|
+
? `On peut alors simplifier cette fraction :
|
|
60
|
+
|
|
61
|
+
$$
|
|
62
|
+
${sum.toTex()} = ${sumSimp.toTex()}
|
|
63
|
+
$$`
|
|
64
|
+
: "Cette fraction est déjà simplifiée."}`;
|
|
65
|
+
}
|
|
66
|
+
const pgcd = gcd(rational[1], rational2[1]);
|
|
67
|
+
let technique = "";
|
|
68
|
+
let firstFracFinal = firstFrac;
|
|
69
|
+
let secondFracFinal = secondFrac;
|
|
70
|
+
if (pgcd === 1) {
|
|
71
|
+
const firstProduct = frac(multiply(rational[0], rational2[1]), multiply(rational[1], rational2[1]));
|
|
72
|
+
firstFracFinal = firstProduct.simplify({
|
|
73
|
+
forbidRationalSimplification: true,
|
|
74
|
+
});
|
|
75
|
+
const secondProduct = frac(multiply(rational2[0], rational[1]), multiply(rational2[1], rational[1]));
|
|
76
|
+
secondFracFinal = secondProduct.simplify({
|
|
77
|
+
forbidRationalSimplification: true,
|
|
78
|
+
});
|
|
79
|
+
technique = `on multiple le numérateur et le dénominateur de la première fraction par $${rational2[1]}$, et le numérateur et dénominateur de la deuxième fraction par $${rational[1]}$ :
|
|
80
|
+
|
|
81
|
+
$$
|
|
82
|
+
${firstFrac.toTex()} = ${firstProduct.toTex({
|
|
83
|
+
forceNoSimplification: true,
|
|
84
|
+
})} = ${firstFracFinal.toTex()}
|
|
85
|
+
$$
|
|
86
|
+
|
|
87
|
+
$$
|
|
88
|
+
${secondFrac.toTex()} = ${secondProduct.toTex({
|
|
89
|
+
forceNoSimplification: true,
|
|
90
|
+
})} = ${secondFracFinal.toTex()}
|
|
91
|
+
$$
|
|
92
|
+
`;
|
|
93
|
+
}
|
|
94
|
+
else if (pgcd === rational[1]) {
|
|
95
|
+
const coeff = rational2[1] / pgcd;
|
|
96
|
+
const product = frac(multiply(rational[0], coeff), multiply(rational[1], coeff));
|
|
97
|
+
firstFracFinal = product.simplify({
|
|
98
|
+
forbidRationalSimplification: true,
|
|
99
|
+
});
|
|
100
|
+
technique = `on multiple le numérateur et le dénominateur de la première fraction par $${coeff}$ :
|
|
101
|
+
|
|
102
|
+
$$
|
|
103
|
+
${firstFrac.toTex()} = ${product.toTex({
|
|
104
|
+
forceNoSimplification: true,
|
|
105
|
+
})} = ${firstFracFinal.toTex()}
|
|
106
|
+
$$`;
|
|
107
|
+
}
|
|
108
|
+
else if (pgcd === rational2[1]) {
|
|
109
|
+
const coeff = rational[1] / pgcd;
|
|
110
|
+
const product = frac(multiply(rational2[0], coeff), multiply(rational2[1], coeff));
|
|
111
|
+
secondFracFinal = product.simplify({
|
|
112
|
+
forbidRationalSimplification: true,
|
|
113
|
+
});
|
|
114
|
+
technique = `on multiple le numérateur et le dénominateur de la deuxième fraction par $${coeff}$ :
|
|
115
|
+
|
|
116
|
+
$$
|
|
117
|
+
${secondFrac.toTex()} = ${product.toTex({
|
|
118
|
+
forceNoSimplification: true,
|
|
119
|
+
})} = ${secondFracFinal.toTex()}
|
|
120
|
+
$$`;
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
const coeff1 = rational2[1] / pgcd;
|
|
124
|
+
const coeff2 = rational[1] / pgcd;
|
|
125
|
+
const product1 = frac(multiply(rational[0], coeff1), multiply(rational[1], coeff1));
|
|
126
|
+
const product2 = frac(multiply(rational2[0], coeff2), multiply(rational2[1], coeff2));
|
|
127
|
+
firstFracFinal = product1.simplify({
|
|
128
|
+
forbidRationalSimplification: true,
|
|
129
|
+
});
|
|
130
|
+
secondFracFinal = product2.simplify({
|
|
131
|
+
forbidRationalSimplification: true,
|
|
132
|
+
});
|
|
133
|
+
technique = `on multiple le numérateur et le dénominateur de la première fraction par $${coeff1}$, et le numérateur et dénominateur de la deuxième fraction par $${coeff2}$ :
|
|
134
|
+
|
|
135
|
+
$$
|
|
136
|
+
${firstFrac.toTex()} = ${product1.toTex({
|
|
137
|
+
forceNoSimplification: true,
|
|
138
|
+
})} = ${firstFracFinal.toTex()}
|
|
139
|
+
$$
|
|
140
|
+
|
|
141
|
+
$$
|
|
142
|
+
${secondFrac.toTex()} = ${product2.toTex({
|
|
143
|
+
forceNoSimplification: true,
|
|
144
|
+
})} = ${secondFracFinal.toTex()}
|
|
145
|
+
$$`;
|
|
146
|
+
}
|
|
147
|
+
const sumFinal = add(firstFracFinal, secondFracFinal);
|
|
148
|
+
const subSumFinal = frac(add(firstFracFinal.leftChild, secondFracFinal.leftChild), firstFracFinal.rightChild);
|
|
149
|
+
const finalNonSimp = subSumFinal.simplify({
|
|
150
|
+
forbidRationalSimplification: true,
|
|
151
|
+
});
|
|
152
|
+
const final = subSumFinal.simplify();
|
|
153
|
+
const isSimplifiable = finalNonSimp.toTex() !== final.toTex();
|
|
154
|
+
return `On commence par mettre les fractions au même dénominateur. Pour cela, ${technique}
|
|
155
|
+
|
|
156
|
+
On peut alors additionner les deux fractions :
|
|
157
|
+
|
|
158
|
+
$$
|
|
159
|
+
${sumFinal.toTex()} = ${subSumFinal.toTex()} = ${finalNonSimp.toTex()}
|
|
160
|
+
$$
|
|
161
|
+
|
|
162
|
+
${isSimplifiable
|
|
163
|
+
? `On peut alors simplifier cette fraction :
|
|
164
|
+
|
|
165
|
+
$$
|
|
166
|
+
${finalNonSimp.toTex()} = ${final.toTex()}
|
|
167
|
+
$$`
|
|
168
|
+
: "Cette fraction est déjà simplifiée."}`;
|
|
34
169
|
};
|
|
35
170
|
const getStartStatement = (identifiers) => {
|
|
36
171
|
const { rational, rational2 } = identifiers;
|
|
@@ -47,6 +182,8 @@ const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
|
47
182
|
keys: [],
|
|
48
183
|
answerFormat: "tex",
|
|
49
184
|
identifiers,
|
|
185
|
+
hint: getHint(identifiers),
|
|
186
|
+
correction: getCorrection(identifiers),
|
|
50
187
|
};
|
|
51
188
|
return question;
|
|
52
189
|
};
|
|
@@ -112,4 +249,5 @@ export const fractionsSum = {
|
|
|
112
249
|
subject: "Mathématiques",
|
|
113
250
|
options,
|
|
114
251
|
getQuestionFromIdentifiers,
|
|
252
|
+
hasHintAndCorrection: true,
|
|
115
253
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iCAAiC,CAAC;AAChD,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,yCAAyC,CAAC;AACxD,cAAc,qCAAqC,CAAC;AACpD,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iCAAiC,CAAC;AAChD,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,yCAAyC,CAAC;AACxD,cAAc,qCAAqC,CAAC;AACpD,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oBAAoB,CAAC"}
|
|
@@ -27,7 +27,7 @@ const getAnswer = (identifiers) => {
|
|
|
27
27
|
const { num, denum, leadingPart } = identifiers;
|
|
28
28
|
const leadingPartDec = new Decimal(leadingPart);
|
|
29
29
|
const answer = new Rational(num, denum * 10 ** leadingPartDec.precision)
|
|
30
|
-
.add(leadingPartDec.toRational())
|
|
30
|
+
.add(leadingPartDec.toRational(true))
|
|
31
31
|
.toTree()
|
|
32
32
|
.toTex();
|
|
33
33
|
return answer;
|
|
@@ -70,7 +70,7 @@ const getPropositions = (n, { answer, num, denum, leadingPart }) => {
|
|
|
70
70
|
const increments = [-1, 1, 2];
|
|
71
71
|
for (const i of increments) {
|
|
72
72
|
tryToAddWrongProp(propositions, new Rational(num, denum * 10 ** (leadingPartDec.precision + i))
|
|
73
|
-
.add(leadingPartDec.toRational())
|
|
73
|
+
.add(leadingPartDec.toRational(true))
|
|
74
74
|
.toTree()
|
|
75
75
|
.toTex());
|
|
76
76
|
}
|
|
@@ -79,7 +79,7 @@ const getPropositions = (n, { answer, num, denum, leadingPart }) => {
|
|
|
79
79
|
const isAnswerValid = (ans, { denum, leadingPart, num }) => {
|
|
80
80
|
const leadingPartDec = new Decimal(leadingPart);
|
|
81
81
|
const answer = new Rational(num, denum * 10 ** leadingPartDec.precision)
|
|
82
|
-
.add(leadingPartDec.toRational())
|
|
82
|
+
.add(leadingPartDec.toRational(true))
|
|
83
83
|
.toTree();
|
|
84
84
|
const texs = answer.toAllValidTexs();
|
|
85
85
|
return texs.includes(ans);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"powerNotation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/powerNotation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,YAAY,EAAE,OAAO,CAAC;CACvB,CAAC;AAmIF,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,WAAW,CAiB/C,CAAC"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
4
|
+
import { add } from "../../../../tree/nodes/operators/addNode.js";
|
|
5
|
+
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
6
|
+
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
7
|
+
import { isPowerNode, power } from "../../../../tree/nodes/operators/powerNode.js";
|
|
8
|
+
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
9
|
+
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
10
|
+
import { coinFlip } from "../../../../utils/alea/coinFlip.js";
|
|
11
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
12
|
+
const getPropositions = (nn, { answer, ...identifiers }) => {
|
|
13
|
+
const propositions = [];
|
|
14
|
+
addValidProp(propositions, answer);
|
|
15
|
+
const { a, n } = identifiers;
|
|
16
|
+
// Soit 1/a^n
|
|
17
|
+
// (a+1)^n
|
|
18
|
+
tryToAddWrongProp(propositions, power(add(a, 1).simplify(), n).toTex());
|
|
19
|
+
// (a-1)^n
|
|
20
|
+
tryToAddWrongProp(propositions, power(substract(a, 1).simplify(), n).toTex());
|
|
21
|
+
// -a^n
|
|
22
|
+
tryToAddWrongProp(propositions, power(multiply(-1, a), n).toTex());
|
|
23
|
+
// -a^(-n)
|
|
24
|
+
tryToAddWrongProp(propositions, power(multiply(-1, a), multiply(-1, n)).toTex());
|
|
25
|
+
// a*-1^(-n)
|
|
26
|
+
tryToAddWrongProp(propositions, multiply(a, power(-1, multiply(-1, n))).toTex());
|
|
27
|
+
// n^a
|
|
28
|
+
tryToAddWrongProp(propositions, power(n, a).toTex());
|
|
29
|
+
// -n^a
|
|
30
|
+
tryToAddWrongProp(propositions, power(multiply(-1, n), a).toTex());
|
|
31
|
+
// n^(-a)
|
|
32
|
+
tryToAddWrongProp(propositions, power(n, multiply(-1, a)).toTex());
|
|
33
|
+
return shuffleProps(propositions, nn);
|
|
34
|
+
};
|
|
35
|
+
const getAnswer = (identifiers) => {
|
|
36
|
+
// (1/a^n) <=> a^(-n)
|
|
37
|
+
const { a, n } = identifiers;
|
|
38
|
+
return `${power(a, multiply(-1, n)).toTex()}`;
|
|
39
|
+
};
|
|
40
|
+
const getInstruction = (identifiers) => {
|
|
41
|
+
const { a, n, isSimplified } = identifiers;
|
|
42
|
+
const an = power(a, n);
|
|
43
|
+
const fraction = frac(1, isSimplified ? an.evaluate() : an);
|
|
44
|
+
return `Écrire $${fraction.toTex()}$ sous la forme $a^n$, avec $n \\in \\mathbb{Z}.$`;
|
|
45
|
+
};
|
|
46
|
+
const getHint = (identifiers) => {
|
|
47
|
+
const fracForm = frac(1, power("a", "n")).toTex();
|
|
48
|
+
return `On a :
|
|
49
|
+
|
|
50
|
+
$$
|
|
51
|
+
${fracForm} = ${power("a", multiply(-1, "n")).toTex()}
|
|
52
|
+
$$`;
|
|
53
|
+
};
|
|
54
|
+
const getCorrection = (identifiers) => {
|
|
55
|
+
const { a, n, isSimplified } = identifiers;
|
|
56
|
+
const fraction = frac(1, power(a, n));
|
|
57
|
+
const fracForm = frac(1, power("a", "n")).toTex();
|
|
58
|
+
return `On sait que :
|
|
59
|
+
|
|
60
|
+
$$
|
|
61
|
+
${fracForm} = ${power("a", multiply(-1, "n")).toTex()}
|
|
62
|
+
$$
|
|
63
|
+
|
|
64
|
+
Ici on a donc :
|
|
65
|
+
|
|
66
|
+
$$
|
|
67
|
+
${fraction.toTex()} = ${power(a, multiply(-1, n)).toTex()}
|
|
68
|
+
$$
|
|
69
|
+
|
|
70
|
+
avec $a = ${a}$ et $n = ${n}$${isSimplified
|
|
71
|
+
? `, sachant que $${power(a, n).evaluate()} = ${power(a, n).toTex()}$`
|
|
72
|
+
: ""}.`;
|
|
73
|
+
};
|
|
74
|
+
const getKeys = (identifiers) => {
|
|
75
|
+
return [];
|
|
76
|
+
};
|
|
77
|
+
const isAnswerValid = (ans, { answer, ...identifiers }) => {
|
|
78
|
+
const { a, n } = identifiers;
|
|
79
|
+
const node = parseAlgebraic(ans);
|
|
80
|
+
try {
|
|
81
|
+
return (isPowerNode(node) &&
|
|
82
|
+
node.simplify().equals(power(a, multiply(-1, n)).simplify()));
|
|
83
|
+
}
|
|
84
|
+
catch (err) {
|
|
85
|
+
return handleVEAError(err);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
const getPowerNotationQuestion = (ops) => {
|
|
89
|
+
const isSimplePower = (a, n) => {
|
|
90
|
+
return (n === 2 && a <= 11) || (n === 3 && a <= 3);
|
|
91
|
+
};
|
|
92
|
+
const a = randint(2, 12);
|
|
93
|
+
const n = randint(2, 5);
|
|
94
|
+
const isSimplified = isSimplePower(a, n) ? coinFlip() : false;
|
|
95
|
+
const identifiers = { a, n, isSimplified };
|
|
96
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
97
|
+
};
|
|
98
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
99
|
+
return {
|
|
100
|
+
answer: getAnswer(identifiers),
|
|
101
|
+
instruction: getInstruction(identifiers),
|
|
102
|
+
keys: getKeys(identifiers),
|
|
103
|
+
answerFormat: "tex",
|
|
104
|
+
identifiers,
|
|
105
|
+
hint: getHint(identifiers),
|
|
106
|
+
correction: getCorrection(identifiers),
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
export const powerNotation = {
|
|
110
|
+
id: "powerNotation",
|
|
111
|
+
label: "Écrire une fraction sous la forme $a^n$",
|
|
112
|
+
isSingleStep: true,
|
|
113
|
+
generator: (nb, opts) => getDistinctQuestions(() => getPowerNotationQuestion(opts), nb),
|
|
114
|
+
qcmTimer: 60,
|
|
115
|
+
freeTimer: 60,
|
|
116
|
+
getPropositions,
|
|
117
|
+
isAnswerValid,
|
|
118
|
+
subject: "Mathématiques",
|
|
119
|
+
getInstruction,
|
|
120
|
+
getHint,
|
|
121
|
+
getCorrection,
|
|
122
|
+
getAnswer,
|
|
123
|
+
getQuestionFromIdentifiers,
|
|
124
|
+
hasHintAndCorrection: true,
|
|
125
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proportionalityTable.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/proportionality/proportionalityTable.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"proportionalityTable.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/proportionality/proportionalityTable.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;CACrB,CAAC;AAwHF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAetD,CAAC"}
|
|
@@ -3,6 +3,8 @@ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQue
|
|
|
3
3
|
import { IntegerConstructor } from "../../../../math/numbers/integer/integer.js";
|
|
4
4
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
5
5
|
import { round } from "../../../../math/utils/round.js";
|
|
6
|
+
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
7
|
+
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
6
8
|
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
7
9
|
import { dollarize } from "../../../../utils/latex/dollarize.js";
|
|
8
10
|
import { mdTable } from "../../../../utils/markdown/mdTable.js";
|
|
@@ -54,10 +56,31 @@ const getProportionalityTable = () => {
|
|
|
54
56
|
return getQuestionFromIdentifiers(identifiers);
|
|
55
57
|
};
|
|
56
58
|
const getHint = () => {
|
|
57
|
-
return
|
|
59
|
+
return `Utilise un produit en croix : multiplie les deux valeurs qui sont sur la diagonale, puis divise par la troisième valeur.`;
|
|
58
60
|
};
|
|
59
|
-
const getCorrection = () => {
|
|
60
|
-
|
|
61
|
+
const getCorrection = (identifiers) => {
|
|
62
|
+
const { x1, x2, x3, x4, randQuation } = identifiers;
|
|
63
|
+
let cross;
|
|
64
|
+
switch (randQuation) {
|
|
65
|
+
case 0:
|
|
66
|
+
cross = frac(multiply(x2, x3), x4);
|
|
67
|
+
break;
|
|
68
|
+
case 1:
|
|
69
|
+
cross = frac(multiply(x1, x4), x3);
|
|
70
|
+
break;
|
|
71
|
+
case 2:
|
|
72
|
+
cross = frac(multiply(x1, x4), x2);
|
|
73
|
+
break;
|
|
74
|
+
case 3:
|
|
75
|
+
default:
|
|
76
|
+
cross = frac(multiply(x2, x3), x1);
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
return `On utilise un produit en croix :
|
|
80
|
+
|
|
81
|
+
$$
|
|
82
|
+
${cross.toTex()} = ${cross.simplify().toTex()}
|
|
83
|
+
$$`;
|
|
61
84
|
};
|
|
62
85
|
const getQuestionFromIdentifiers = (identifiers) => {
|
|
63
86
|
const question = {
|
|
@@ -69,8 +92,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
|
|
|
69
92
|
style: {
|
|
70
93
|
tableHasNoHeader: true,
|
|
71
94
|
},
|
|
72
|
-
|
|
73
|
-
|
|
95
|
+
hint: getHint(identifiers),
|
|
96
|
+
correction: getCorrection(identifiers),
|
|
74
97
|
};
|
|
75
98
|
return question;
|
|
76
99
|
};
|
|
@@ -99,4 +122,5 @@ export const proportionalityTable = {
|
|
|
99
122
|
getInstruction,
|
|
100
123
|
getQuestionFromIdentifiers,
|
|
101
124
|
getAnswer,
|
|
125
|
+
hasHintAndCorrection: true,
|
|
102
126
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"absoluteNumber.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/sign/absoluteNumber.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAQrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAsEF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAiBhD,CAAC"}
|