math-exercises 3.0.55 → 3.0.57
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/math/calcul/arithmetics/index.d.ts +1 -0
- package/lib/exercises/math/calcul/arithmetics/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/index.js +1 -0
- package/lib/exercises/math/calcul/arithmetics/ppcmCalcul.d.ts +8 -0
- package/lib/exercises/math/calcul/arithmetics/ppcmCalcul.d.ts.map +1 -0
- package/lib/exercises/math/calcul/arithmetics/ppcmCalcul.js +87 -0
- package/lib/exercises/math/calcul/proportionality/proportionalityTable.d.ts.map +1 -1
- package/lib/exercises/math/calcul/proportionality/proportionalityTable.js +2 -2
- package/lib/exercises/math/calculLitteral/equation/binomialsTrinomialsProposedSolutions.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/binomialsTrinomialsProposedSolutions.js +7 -1
- package/lib/exercises/math/calculLitteral/equation/choseOperationToSolveEquation.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/choseOperationToSolveEquation.js +65 -13
- package/lib/exercises/math/calculLitteral/factorisation/factoType1Exercise.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/factorisation/factoType1Exercise.js +43 -0
- package/lib/exercises/math/calculLitteral/systems/basicNiceValuesSystemResolution.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/systems/basicNiceValuesSystemResolution.js +23 -0
- package/lib/exercises/math/calculLitteral/systems/basicSystemResolution.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/systems/basicSystemResolution.js +23 -0
- package/lib/exercises/math/calculLitteral/systems/verifySystemSolution.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/systems/verifySystemSolution.js +49 -0
- package/lib/exercises/math/conversion/capacityConversion.d.ts.map +1 -1
- package/lib/exercises/math/conversion/capacityConversion.js +68 -12
- package/lib/exercises/math/conversion/hoursToDecimal.d.ts.map +1 -1
- package/lib/exercises/math/conversion/hoursToDecimal.js +73 -15
- package/lib/exercises/math/conversion/lengthConversion.d.ts.map +1 -1
- package/lib/exercises/math/conversion/lengthConversion.js +55 -6
- package/lib/exercises/math/conversion/massConversion.d.ts.map +1 -1
- package/lib/exercises/math/conversion/massConversion.js +72 -16
- package/lib/exercises/math/conversion/volumeConversion.d.ts.map +1 -1
- package/lib/exercises/math/conversion/volumeConversion.js +72 -12
- package/lib/exercises/math/functions/affines/signFunction.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/signFunction.js +23 -11
- package/lib/exercises/math/functions/basics/imageFunctionGeogebra.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/imageFunctionGeogebra.js +16 -0
- package/lib/exercises/math/geometry/areas/triangleArea.d.ts.map +1 -1
- package/lib/exercises/math/geometry/areas/triangleArea.js +34 -2
- package/lib/exercises/math/geometry/areas/triangleAreaV2.d.ts.map +1 -1
- package/lib/exercises/math/geometry/areas/triangleAreaV2.js +54 -8
- package/lib/exercises/math/geometry/cartesian/cartesianEquationOfLine.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/cartesianEquationOfLine.js +12 -5
- package/lib/exercises/math/geometry/cartesian/readAbscissOnLine.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/readAbscissOnLine.js +29 -1
- package/lib/exercises/math/geometry/cartesian/readAbscissOnSemiLine.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/readAbscissOnSemiLine.js +25 -1
- package/lib/exercises/math/geometry/lines/cartesianEquationToReduced.d.ts.map +1 -1
- package/lib/exercises/math/geometry/lines/cartesianEquationToReduced.js +68 -29
- package/lib/exercises/math/geometry/lines/cartesianEquationsIntersection.d.ts.map +1 -1
- package/lib/exercises/math/geometry/lines/cartesianEquationsIntersection.js +56 -4
- package/lib/exercises/math/geometry/lines/directorVectorFromAnother.d.ts.map +1 -1
- package/lib/exercises/math/geometry/lines/directorVectorFromAnother.js +1 -0
- package/lib/exercises/math/geometry/lines/drawLineFromCartesianEquation.d.ts.map +1 -1
- package/lib/exercises/math/geometry/lines/drawLineFromCartesianEquation.js +71 -25
- package/lib/exercises/math/geometry/lines/index.d.ts +1 -0
- package/lib/exercises/math/geometry/lines/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/lines/index.js +1 -0
- package/lib/exercises/math/geometry/vectors/findCoordForAligment.d.ts +6 -0
- package/lib/exercises/math/geometry/vectors/findCoordForAligment.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/findCoordForAligment.js +161 -92
- package/lib/exercises/math/geometry/vectors/index.d.ts +1 -0
- package/lib/exercises/math/geometry/vectors/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/index.js +1 -0
- package/lib/exercises/math/geometry/volumes/coneVolume.d.ts.map +1 -1
- package/lib/exercises/math/geometry/volumes/coneVolume.js +68 -6
- package/lib/exercises/math/geometry/volumes/parallelepipedVolume.d.ts.map +1 -1
- package/lib/exercises/math/geometry/volumes/parallelepipedVolume.js +55 -11
- package/lib/exercises/math/geometry/volumes/sphereVolume.d.ts.map +1 -1
- package/lib/exercises/math/geometry/volumes/sphereVolume.js +31 -3
- package/lib/exercises/math/geometry/volumes/volumeOfCube.d.ts.map +1 -1
- package/lib/exercises/math/geometry/volumes/volumeOfCube.js +46 -18
- package/lib/exercises/math/geometry/volumes/volumeOfPyramidWithSquareOrRectBase.d.ts.map +1 -1
- package/lib/exercises/math/geometry/volumes/volumeOfPyramidWithSquareOrRectBase.js +114 -63
- package/lib/exercises/math/geometry/volumes/volumeOfPyramidWithTriangleBase.d.ts.map +1 -1
- package/lib/exercises/math/geometry/volumes/volumeOfPyramidWithTriangleBase.js +102 -64
- package/lib/exercises/math/geometry/volumes/volumeOfPyramidWithTriangleRectBase.d.ts.map +1 -1
- package/lib/exercises/math/geometry/volumes/volumeOfPyramidWithTriangleRectBase.js +99 -53
- package/lib/exercises/math/limits/polynomLimit.d.ts +1 -1
- package/lib/exercises/math/limits/polynomLimit.d.ts.map +1 -1
- package/lib/exercises/math/limits/polynomLimit.js +28 -9
- package/lib/exercises/math/limits/polynomLimitNoFI.d.ts +1 -1
- package/lib/exercises/math/limits/polynomLimitNoFI.d.ts.map +1 -1
- package/lib/exercises/math/limits/polynomLimitNoFI.js +29 -10
- package/lib/exercises/math/powers/calculateNegativePower.d.ts.map +1 -1
- package/lib/exercises/math/powers/calculateNegativePower.js +59 -16
- package/lib/exercises/math/powers/decimalToScientific.d.ts.map +1 -1
- package/lib/exercises/math/powers/decimalToScientific.js +55 -11
- package/lib/exercises/math/powers/index.d.ts +1 -0
- package/lib/exercises/math/powers/index.d.ts.map +1 -1
- package/lib/exercises/math/powers/index.js +1 -0
- package/lib/exercises/math/powers/powersDivision.d.ts +5 -2
- package/lib/exercises/math/powers/powersDivision.d.ts.map +1 -1
- package/lib/exercises/math/powers/powersDivision.js +68 -53
- package/lib/exercises/math/powers/powersMixOperations.d.ts +1 -0
- package/lib/exercises/math/powers/powersMixOperations.d.ts.map +1 -1
- package/lib/exercises/math/powers/powersMixOperations.js +88 -17
- package/lib/exercises/math/powers/powersOfTenMixOperations.d.ts +10 -0
- package/lib/exercises/math/powers/powersOfTenMixOperations.d.ts.map +1 -0
- package/lib/exercises/math/powers/powersOfTenMixOperations.js +129 -0
- package/lib/exercises/math/powers/powersOfTenToDecimal.d.ts.map +1 -1
- package/lib/exercises/math/powers/powersOfTenToDecimal.js +32 -3
- package/lib/exercises/math/powers/powersProduct.d.ts.map +1 -1
- package/lib/exercises/math/powers/powersProduct.js +1 -0
- package/lib/exercises/math/powers/scientificToDecimal.d.ts.map +1 -1
- package/lib/exercises/math/powers/scientificToDecimal.js +50 -10
- package/lib/exercises/math/primitive/polynomialPrimitive.d.ts.map +1 -1
- package/lib/exercises/math/primitive/polynomialPrimitive.js +1 -0
- package/lib/exercises/math/sequences/geometric/geometricFirstTermsGeneralSum.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/geometricFirstTermsGeneralSum.js +50 -3
- package/lib/exercises/math/sequences/geometric/geometricFirstTermsSum.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/geometricFirstTermsSum.js +32 -0
- package/lib/exercises/math/trigonometry/remarkableValues.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/remarkableValues.js +8 -0
- package/lib/exercises/math/trigonometry/trigonometry.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/trigonometry.js +67 -1
- package/lib/exercises/math/trigonometry/trigonometryAngleCalcul.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/trigonometryAngleCalcul.js +89 -0
- package/lib/index.d.ts +22 -4
- package/lib/index.d.ts.map +1 -1
- package/lib/math/geometry/angle.d.ts.map +1 -1
- package/lib/math/geometry/angle.js +0 -5
- package/lib/math/geometry/vector.d.ts +3 -0
- package/lib/math/geometry/vector.d.ts.map +1 -1
- package/lib/math/geometry/vector.js +25 -0
- package/lib/math/numbers/decimals/decimal.d.ts +1 -0
- package/lib/math/numbers/decimals/decimal.d.ts.map +1 -1
- package/lib/math/numbers/decimals/decimal.js +2 -0
- package/lib/math/systems/generalSystem.d.ts +6 -1
- package/lib/math/systems/generalSystem.d.ts.map +1 -1
- package/lib/math/systems/generalSystem.js +137 -0
- package/lib/math/utils/arithmetic/lcm.d.ts +2 -0
- package/lib/math/utils/arithmetic/lcm.d.ts.map +1 -0
- package/lib/math/utils/arithmetic/lcm.js +5 -0
- package/lib/playground.d.ts.map +1 -1
- package/lib/playground.js +1 -3
- package/lib/tree/nodes/algebraicNode.d.ts +1 -0
- package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
- package/lib/tree/nodes/equations/equalNode.d.ts +7 -1
- package/lib/tree/nodes/equations/equalNode.d.ts.map +1 -1
- package/lib/tree/nodes/equations/equalNode.js +17 -9
- package/lib/tree/nodes/operators/addNode.js +1 -1
- package/lib/tree/nodes/operators/fractionNode.d.ts +2 -2
- package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/fractionNode.js +37 -17
- package/lib/tree/nodes/operators/powerNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/powerNode.js +5 -0
- package/lib/tree/nodes/sets/intervalNode.d.ts.map +1 -1
- package/lib/tree/nodes/sets/intervalNode.js +3 -1
- package/package.json +1 -1
|
@@ -3,28 +3,88 @@ import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuesti
|
|
|
3
3
|
import { DecimalConstructor, } from "../../../math/numbers/decimals/decimal.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 { coinFlip } from "../../../utils/alea/coinFlip.js";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const dec
|
|
10
|
-
const hours = Math.floor(dec
|
|
11
|
-
const mins = round((dec
|
|
12
|
-
const decTex = dec.
|
|
9
|
+
import { approxOrEqual } from "../../../utils/latex/approxOrEqual.js";
|
|
10
|
+
const getInstruction = (identifiers) => {
|
|
11
|
+
const { dec, isDecimalToHours } = identifiers;
|
|
12
|
+
const hours = Math.floor(dec);
|
|
13
|
+
const mins = round((dec - hours) * 100 * 0.6, 0);
|
|
14
|
+
const decTex = dec.frenchify();
|
|
13
15
|
const durationTex = isDecimalToHours
|
|
14
|
-
? decTex + "\\
|
|
15
|
-
: `${hours}\\
|
|
16
|
+
? decTex + "\\ \\textrm{h}"
|
|
17
|
+
: `${hours}\\ \\textrm{h}\\ ${mins}\\ \\textrm{min}`;
|
|
18
|
+
return `Convertir la durée suivante en ${isDecimalToHours ? "heures et minutes" : "$\\ \\textrm{h}$ (nombre décimal)"} :
|
|
19
|
+
|
|
20
|
+
$$
|
|
21
|
+
${durationTex}
|
|
22
|
+
$$
|
|
23
|
+
|
|
24
|
+
Arrondir ${isDecimalToHours ? "à la minute près" : "au centième près"}.`;
|
|
25
|
+
};
|
|
26
|
+
const getAnswer = (identifiers) => {
|
|
27
|
+
const { dec, isDecimalToHours } = identifiers;
|
|
28
|
+
const hours = Math.floor(dec);
|
|
29
|
+
const mins = round((dec - hours) * 100 * 0.6, 0);
|
|
16
30
|
const answer = isDecimalToHours
|
|
17
31
|
? `${hours}\\text{h}${mins}\\text{min}`
|
|
18
32
|
: `${hours},${round((mins / 60) * 100, 0)}\\text{h}`;
|
|
33
|
+
return answer;
|
|
34
|
+
};
|
|
35
|
+
const getHint = (identifiers) => {
|
|
36
|
+
const { dec, isDecimalToHours } = identifiers;
|
|
37
|
+
const hours = Math.floor(dec);
|
|
38
|
+
const mins = round((dec - hours) * 100 * 0.6, 0);
|
|
39
|
+
if (isDecimalToHours) {
|
|
40
|
+
return `Dans $1\\ \\text{h}$, il y a $60$ minutes. Un calcul de proportionnalité permet donc de déterminer combien y a-t-il de minutes dans $${dec.frenchify()} \\text{h}$.`;
|
|
41
|
+
}
|
|
42
|
+
return `$60$ minutes correspondent à $1 \\ \\text{h}$. Un calcul de proportionnalité permet donc de convertir $${mins} \\ \\text{min}$ en heures.`;
|
|
43
|
+
};
|
|
44
|
+
const getCorrection = (identifiers) => {
|
|
45
|
+
const { dec, isDecimalToHours } = identifiers;
|
|
46
|
+
const hours = Math.floor(dec);
|
|
47
|
+
const mins = round((dec - hours) * 100 * 0.6, 0);
|
|
48
|
+
const fracDec = round(dec - Math.floor(dec), 2);
|
|
49
|
+
if (isDecimalToHours) {
|
|
50
|
+
return `Dans $1\\ \\text{h}$, il y a $60$ minutes. Un calcul de proportionnalité permet donc de déterminer combien y a-t-il de minutes dans $${fracDec.frenchify()} \\text{h}$ :
|
|
51
|
+
|
|
52
|
+
$$
|
|
53
|
+
${multiply(fracDec, 60).toTex()} ${approxOrEqual(fracDec * 60, 0).join("")}
|
|
54
|
+
$$
|
|
55
|
+
|
|
56
|
+
$${dec.frenchify()}\\ \\text{h}$ correspond donc à $${getAnswer(identifiers)}$.`;
|
|
57
|
+
}
|
|
58
|
+
return `$60$ minutes correspondent à $1 \\ \\text{h}$. Un calcul de proportionnalité permet donc de convertir $${mins} \\ \\text{min}$ en heures :
|
|
59
|
+
|
|
60
|
+
$$
|
|
61
|
+
${frac(mins, 60).toTex()} ${approxOrEqual(mins / 60, 2).join("")}
|
|
62
|
+
$$
|
|
63
|
+
|
|
64
|
+
Le résultat attendu est donc :
|
|
65
|
+
|
|
66
|
+
$$
|
|
67
|
+
${getAnswer(identifiers)}
|
|
68
|
+
$$`;
|
|
69
|
+
};
|
|
70
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
19
71
|
const question = {
|
|
20
|
-
answer,
|
|
21
|
-
instruction:
|
|
72
|
+
answer: getAnswer(identifiers),
|
|
73
|
+
instruction: getInstruction(identifiers),
|
|
22
74
|
keys: ["hours", "minutes"],
|
|
23
75
|
answerFormat: "tex",
|
|
24
|
-
identifiers
|
|
76
|
+
identifiers,
|
|
77
|
+
hint: getHint(identifiers),
|
|
78
|
+
correction: getCorrection(identifiers),
|
|
25
79
|
};
|
|
26
80
|
return question;
|
|
27
81
|
};
|
|
82
|
+
const getHoursToDecimalQuestion = () => {
|
|
83
|
+
const isDecimalToHours = coinFlip();
|
|
84
|
+
const dec = DecimalConstructor.random(0, 3, 2);
|
|
85
|
+
const identifiers = { isDecimalToHours, dec: dec.value };
|
|
86
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
87
|
+
};
|
|
28
88
|
const getPropositions = (n, { answer, isDecimalToHours, dec }) => {
|
|
29
89
|
const propositions = [];
|
|
30
90
|
addValidProp(propositions, answer);
|
|
@@ -49,8 +109,6 @@ const getPropositions = (n, { answer, isDecimalToHours, dec }) => {
|
|
|
49
109
|
const isAnswerValid = (ans, { answer, isDecimalToHours, dec }) => {
|
|
50
110
|
if (isDecimalToHours)
|
|
51
111
|
return ans === answer;
|
|
52
|
-
// const hours = Math.floor(dec);
|
|
53
|
-
// const mins = round((dec - hours) * 100 * 0.6, 0);
|
|
54
112
|
const texs = [answer, answer.replace("\\text{h}", "")];
|
|
55
113
|
return texs.includes(ans);
|
|
56
114
|
};
|
|
@@ -58,13 +116,13 @@ export const hoursToDecimal = {
|
|
|
58
116
|
id: "hoursToDecimal",
|
|
59
117
|
connector: "=",
|
|
60
118
|
label: "Convertir une durée en nombre décimal et inversement",
|
|
61
|
-
levels: ["2nde", "2ndPro", "3ème"],
|
|
62
119
|
isSingleStep: true,
|
|
63
|
-
sections: ["Conversions"],
|
|
64
120
|
generator: (nb) => getDistinctQuestions(getHoursToDecimalQuestion, nb),
|
|
65
121
|
qcmTimer: 60,
|
|
66
122
|
freeTimer: 60,
|
|
67
123
|
getPropositions,
|
|
68
124
|
isAnswerValid,
|
|
69
125
|
subject: "Mathématiques",
|
|
126
|
+
getQuestionFromIdentifiers,
|
|
127
|
+
hasHintAndCorrection: true,
|
|
70
128
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lengthConversion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/lengthConversion.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lengthConversion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/lengthConversion.ts"],"names":[],"mappings":"AAcA,OAAO,EACL,QAAQ,EAgBT,MAAM,mBAAmB,CAAC;AAG3B,KAAK,WAAW,GAAG;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,0BAA0B,EAAE,MAAM,CAAC;IACnC,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AACF,KAAK,OAAO,GAAG;IACb,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AA2KF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAkB3D,CAAC"}
|
|
@@ -3,9 +3,12 @@ import { Decimal, DecimalConstructor, } from "../../../math/numbers/decimals/dec
|
|
|
3
3
|
import { randint } from "../../../math/utils/random/randint.js";
|
|
4
4
|
import { Measure } from "../../../pc/measure/measure.js";
|
|
5
5
|
import { DistanceUnit } from "../../../pc/units/distanceUnits.js";
|
|
6
|
+
import { frac } from "../../../tree/nodes/operators/fractionNode.js";
|
|
7
|
+
import { multiply } from "../../../tree/nodes/operators/multiplyNode.js";
|
|
6
8
|
import { random } from "../../../utils/alea/random.js";
|
|
7
9
|
import { shuffle } from "../../../utils/alea/shuffle.js";
|
|
8
10
|
import { doWhile } from "../../../utils/doWhile.js";
|
|
11
|
+
import { alignTex } from "../../../utils/latex/alignTex.js";
|
|
9
12
|
import { GeneratorOptionTarget, GeneratorOptionType, addValidProp, tryToAddWrongProp, } from "../../exercise.js";
|
|
10
13
|
import { getDistinctQuestions } from "../../utils/getDistinctQuestions.js";
|
|
11
14
|
const units = ["mm", "cm", "dm", "m", "dam", "hm", "km"];
|
|
@@ -18,11 +21,50 @@ const unitsObj = [
|
|
|
18
21
|
DistanceUnit.hm,
|
|
19
22
|
DistanceUnit.km,
|
|
20
23
|
];
|
|
24
|
+
const getHint = (identifiers) => {
|
|
25
|
+
const { randomUnitIndex, randomUnitInstructionIndex } = identifiers;
|
|
26
|
+
const unit = units[randomUnitIndex];
|
|
27
|
+
const target = units[randomUnitInstructionIndex];
|
|
28
|
+
const space = randomUnitIndex - randomUnitInstructionIndex;
|
|
29
|
+
return `On rappelle que :
|
|
30
|
+
|
|
31
|
+
$$
|
|
32
|
+
1 \\ \\textrm{${unit}} = ${space > 0 ? Math.pow(10, space) : frac(1, Math.pow(10, -space)).toTex()} \\ \\textrm{${target}}
|
|
33
|
+
$$`;
|
|
34
|
+
};
|
|
35
|
+
const getCorrection = (identifiers) => {
|
|
36
|
+
const { randomLength, randomUnitIndex, randomUnitInstructionIndex } = identifiers;
|
|
37
|
+
const unit = units[randomUnitIndex];
|
|
38
|
+
const target = units[randomUnitInstructionIndex];
|
|
39
|
+
const space = randomUnitIndex - randomUnitInstructionIndex;
|
|
40
|
+
const coeff = space > 0 ? Math.pow(10, space).toTree() : frac(1, Math.pow(10, -space));
|
|
41
|
+
return `On sait que :
|
|
42
|
+
|
|
43
|
+
$$
|
|
44
|
+
1 \\ \\textrm{${unit}} = ${coeff.toTex()} \\ \\textrm{${target}}
|
|
45
|
+
$$
|
|
46
|
+
|
|
47
|
+
Il suffit alors de multiplier $${randomLength.frenchify()}$ par $${coeff.toTex()}$ :
|
|
48
|
+
|
|
49
|
+
${alignTex([
|
|
50
|
+
[
|
|
51
|
+
`${randomLength.frenchify()} \\textrm{${unit}} `,
|
|
52
|
+
"=",
|
|
53
|
+
`${multiply(coeff, randomLength).toTex()}\\ \\textrm{${target}}`,
|
|
54
|
+
],
|
|
55
|
+
["", "=", `${getAnswer(identifiers)}\\ \\textrm{${target}}`],
|
|
56
|
+
])}
|
|
57
|
+
`;
|
|
58
|
+
};
|
|
21
59
|
const getInstruction = (identifiers, options) => {
|
|
22
60
|
const measure = new Measure(identifiers.randomLength, 0, unitsObj[identifiers.randomUnitIndex]);
|
|
23
|
-
return `Compléter :
|
|
61
|
+
return `Compléter :
|
|
62
|
+
|
|
63
|
+
$$
|
|
64
|
+
${measure.toTex({
|
|
24
65
|
notScientific: true,
|
|
25
|
-
})} = \\ldots ${unitsObj[identifiers.randomUnitInstructionIndex].toTex()}
|
|
66
|
+
})} = \\ldots ${unitsObj[identifiers.randomUnitInstructionIndex].toTex()}
|
|
67
|
+
$$`;
|
|
26
68
|
};
|
|
27
69
|
const getAnswer = (identifiers, options) => {
|
|
28
70
|
const measure = new Measure(identifiers.randomLength, 0, unitsObj[identifiers.randomUnitIndex]);
|
|
@@ -31,12 +73,12 @@ const getAnswer = (identifiers, options) => {
|
|
|
31
73
|
.toTex({ notScientific: true, hideUnit: true });
|
|
32
74
|
return answer;
|
|
33
75
|
};
|
|
34
|
-
const getLengthConversion = (
|
|
76
|
+
const getLengthConversion = (opts) => {
|
|
35
77
|
// if (options && !validateOptions(options).valid)
|
|
36
78
|
// throw Error("options invalides, gen lengthConversion");
|
|
37
79
|
const availableUnitsIndexes = units
|
|
38
80
|
.map((e, i) => i)
|
|
39
|
-
.filter((i) => !
|
|
81
|
+
.filter((i) => !opts?.units?.length || opts.units.includes(units[i]));
|
|
40
82
|
const randomUnitIndex = random(availableUnitsIndexes);
|
|
41
83
|
const randomUnitInstructionIndex = random(availableUnitsIndexes, [
|
|
42
84
|
randomUnitIndex,
|
|
@@ -47,12 +89,17 @@ const getLengthConversion = (options) => {
|
|
|
47
89
|
randomUnitIndex,
|
|
48
90
|
randomUnitInstructionIndex,
|
|
49
91
|
};
|
|
92
|
+
return getQuestionFromIdentifiers(identifiers, opts);
|
|
93
|
+
};
|
|
94
|
+
const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
50
95
|
const question = {
|
|
51
|
-
instruction: getInstruction(identifiers,
|
|
52
|
-
answer: getAnswer(identifiers,
|
|
96
|
+
instruction: getInstruction(identifiers, opts),
|
|
97
|
+
answer: getAnswer(identifiers, opts),
|
|
53
98
|
keys: [],
|
|
54
99
|
answerFormat: "tex",
|
|
55
100
|
identifiers,
|
|
101
|
+
hint: getHint(identifiers),
|
|
102
|
+
correction: getCorrection(identifiers),
|
|
56
103
|
};
|
|
57
104
|
return question;
|
|
58
105
|
};
|
|
@@ -107,4 +154,6 @@ export const lengthConversion = {
|
|
|
107
154
|
getInstruction,
|
|
108
155
|
options,
|
|
109
156
|
validateOptions,
|
|
157
|
+
hasHintAndCorrection: true,
|
|
158
|
+
getQuestionFromIdentifiers,
|
|
110
159
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"massConversion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/massConversion.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"massConversion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/massConversion.ts"],"names":[],"mappings":"AAYA,OAAO,EACL,QAAQ,EAaT,MAAM,mBAAmB,CAAC;AAG3B,KAAK,WAAW,GAAG;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,0BAA0B,EAAE,MAAM,CAAC;IACnC,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AA6HF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAahD,CAAC"}
|
|
@@ -1,31 +1,87 @@
|
|
|
1
1
|
import { Decimal, DecimalConstructor, } from "../../../math/numbers/decimals/decimal.js";
|
|
2
2
|
import { randint } from "../../../math/utils/random/randint.js";
|
|
3
|
+
import { frac } from "../../../tree/nodes/operators/fractionNode.js";
|
|
4
|
+
import { multiply } from "../../../tree/nodes/operators/multiplyNode.js";
|
|
3
5
|
import { numberParser } from "../../../tree/parsers/numberParser.js";
|
|
4
6
|
import { shuffle } from "../../../utils/alea/shuffle.js";
|
|
5
7
|
import { doWhile } from "../../../utils/doWhile.js";
|
|
8
|
+
import { alignTex } from "../../../utils/latex/alignTex.js";
|
|
6
9
|
import { addValidProp, tryToAddWrongProp, } from "../../exercise.js";
|
|
7
10
|
import { getDistinctQuestions } from "../../utils/getDistinctQuestions.js";
|
|
8
11
|
const units = ["mg", "cg", "dg", "g", "dag", "hg", "kg"];
|
|
9
|
-
const
|
|
10
|
-
const randomUnitIndex =
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
12
|
+
const getHint = (identifiers) => {
|
|
13
|
+
const { randomUnitIndex, randomUnitInstructionIndex } = identifiers;
|
|
14
|
+
const unit = units[randomUnitIndex];
|
|
15
|
+
const target = units[randomUnitInstructionIndex];
|
|
16
|
+
const space = randomUnitIndex - randomUnitInstructionIndex;
|
|
17
|
+
return `On rappelle que :
|
|
18
|
+
|
|
19
|
+
$$
|
|
20
|
+
1 \\ \\textrm{${unit}} = ${space > 0 ? Math.pow(10, space) : frac(1, Math.pow(10, -space)).toTex()} \\ \\textrm{${target}}
|
|
21
|
+
$$`;
|
|
22
|
+
};
|
|
23
|
+
const getCorrection = (identifiers) => {
|
|
24
|
+
const { randomMass, randomUnitIndex, randomUnitInstructionIndex } = identifiers;
|
|
25
|
+
const unit = units[randomUnitIndex];
|
|
26
|
+
const target = units[randomUnitInstructionIndex];
|
|
27
|
+
const space = randomUnitIndex - randomUnitInstructionIndex;
|
|
28
|
+
const coeff = space > 0 ? Math.pow(10, space).toTree() : frac(1, Math.pow(10, -space));
|
|
29
|
+
return `On sait que :
|
|
30
|
+
|
|
31
|
+
$$
|
|
32
|
+
1 \\ \\textrm{${unit}} = ${coeff.toTex()} \\ \\textrm{${target}}
|
|
33
|
+
$$
|
|
34
|
+
|
|
35
|
+
Il suffit alors de multiplier $${randomMass.frenchify()}$ par $${coeff.toTex()}$ :
|
|
36
|
+
|
|
37
|
+
${alignTex([
|
|
38
|
+
[
|
|
39
|
+
`${randomMass.frenchify()} \\textrm{${unit}} `,
|
|
40
|
+
"=",
|
|
41
|
+
`${multiply(coeff, randomMass).toTex()}\\ \\textrm{${target}}`,
|
|
42
|
+
],
|
|
43
|
+
["", "=", `${getAnswer(identifiers)}\\ \\textrm{${target}}`],
|
|
44
|
+
])}
|
|
45
|
+
`;
|
|
46
|
+
};
|
|
47
|
+
const getInstruction = (identifiers) => {
|
|
48
|
+
const { randomMass, randomUnitIndex, randomUnitInstructionIndex } = identifiers;
|
|
49
|
+
return `Compléter :
|
|
50
|
+
|
|
51
|
+
$$
|
|
52
|
+
${randomMass.frenchify()} \\textrm{${units[randomUnitIndex]}} = \\ldots \\textrm{${units[randomUnitInstructionIndex]}}
|
|
53
|
+
$$`;
|
|
54
|
+
};
|
|
55
|
+
const getAnswer = (identifiers) => {
|
|
56
|
+
const { randomMass, randomUnitIndex, randomUnitInstructionIndex } = identifiers;
|
|
57
|
+
const answer = new Decimal(randomMass)
|
|
58
|
+
.multiplyByPowerOfTen(randomUnitIndex - randomUnitInstructionIndex)
|
|
59
|
+
.value.frenchify();
|
|
60
|
+
return answer;
|
|
61
|
+
};
|
|
62
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
14
63
|
const question = {
|
|
15
|
-
instruction:
|
|
16
|
-
|
|
17
|
-
.replace(".", ",")} \\textrm{${units[randomUnitIndex]}} = \\ldots \\textrm{${units[randomUnitInstructionIndex]}}$`,
|
|
18
|
-
answer,
|
|
64
|
+
instruction: getInstruction(identifiers),
|
|
65
|
+
answer: getAnswer(identifiers),
|
|
19
66
|
keys: [],
|
|
20
67
|
answerFormat: "tex",
|
|
21
|
-
identifiers
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
randomUnitInstructionIndex,
|
|
25
|
-
},
|
|
68
|
+
identifiers,
|
|
69
|
+
hint: getHint(identifiers),
|
|
70
|
+
correction: getCorrection(identifiers),
|
|
26
71
|
};
|
|
27
72
|
return question;
|
|
28
73
|
};
|
|
74
|
+
const getMassConversion = () => {
|
|
75
|
+
const randomUnitIndex = randint(0, 7);
|
|
76
|
+
const randomUnitInstructionIndex = randint(0, 7, [randomUnitIndex]);
|
|
77
|
+
const randomMass = doWhile(() => DecimalConstructor.random(0, 1000, randint(0, 4)), (x) => x.value === 0);
|
|
78
|
+
const identifiers = {
|
|
79
|
+
randomMass: randomMass.value,
|
|
80
|
+
randomUnitIndex,
|
|
81
|
+
randomUnitInstructionIndex,
|
|
82
|
+
};
|
|
83
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
84
|
+
};
|
|
29
85
|
const getPropositions = (n, { answer, randomMass, randomUnitIndex, randomUnitInstructionIndex }) => {
|
|
30
86
|
const propositions = [];
|
|
31
87
|
addValidProp(propositions, answer);
|
|
@@ -49,8 +105,6 @@ export const massConversion = {
|
|
|
49
105
|
id: "massConversion",
|
|
50
106
|
connector: "=",
|
|
51
107
|
label: "Conversion de masses",
|
|
52
|
-
levels: ["6ème", "5ème", "CAP", "2ndPro"],
|
|
53
|
-
sections: ["Conversions"],
|
|
54
108
|
isSingleStep: true,
|
|
55
109
|
generator: (nb) => getDistinctQuestions(getMassConversion, nb),
|
|
56
110
|
getPropositions,
|
|
@@ -58,4 +112,6 @@ export const massConversion = {
|
|
|
58
112
|
qcmTimer: 60,
|
|
59
113
|
freeTimer: 60,
|
|
60
114
|
subject: "Mathématiques",
|
|
115
|
+
getQuestionFromIdentifiers,
|
|
116
|
+
hasHintAndCorrection: true,
|
|
61
117
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"volumeConversion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/volumeConversion.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"volumeConversion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/volumeConversion.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,QAAQ,EAaT,MAAM,mBAAmB,CAAC;AAE3B,KAAK,WAAW,GAAG;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,0BAA0B,EAAE,MAAM,CAAC;IACnC,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAgIF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAclD,CAAC"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { Decimal, DecimalConstructor, } from "../../../math/numbers/decimals/decimal.js";
|
|
2
2
|
import { randint } from "../../../math/utils/random/randint.js";
|
|
3
|
+
import { frac } from "../../../tree/nodes/operators/fractionNode.js";
|
|
4
|
+
import { multiply } from "../../../tree/nodes/operators/multiplyNode.js";
|
|
3
5
|
import { shuffle } from "../../../utils/alea/shuffle.js";
|
|
4
6
|
import { doWhile } from "../../../utils/doWhile.js";
|
|
7
|
+
import { alignTex } from "../../../utils/latex/alignTex.js";
|
|
5
8
|
import { addValidProp, tryToAddWrongProp, } from "../../exercise.js";
|
|
6
9
|
import { getDistinctQuestions } from "../../utils/getDistinctQuestions.js";
|
|
7
10
|
const units = ["mm", "cm", "dm", "m", "dam", "hm", "km"];
|
|
@@ -9,19 +12,76 @@ const getVolumeConversion = () => {
|
|
|
9
12
|
const randomUnitIndex = randint(0, 7);
|
|
10
13
|
const randomUnitInstructionIndex = randint(Math.max(0, randomUnitIndex - 2), Math.min(7, randomUnitIndex + 3), [randomUnitIndex]);
|
|
11
14
|
const randomVolume = doWhile(() => DecimalConstructor.random(0, 1000, randint(0, 4)), (x) => x.value === 0);
|
|
12
|
-
const
|
|
15
|
+
const identifiers = {
|
|
16
|
+
randomUnitIndex,
|
|
17
|
+
randomUnitInstructionIndex,
|
|
18
|
+
randomVolume: randomVolume.value,
|
|
19
|
+
};
|
|
20
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
21
|
+
};
|
|
22
|
+
const getInstruction = (identifiers) => {
|
|
23
|
+
const { randomUnitIndex, randomUnitInstructionIndex, randomVolume } = identifiers;
|
|
24
|
+
return `Compléter :
|
|
25
|
+
|
|
26
|
+
$$
|
|
27
|
+
${randomVolume.frenchify()} \\textrm{${units[randomUnitIndex]}}^3 = \\ldots \\textrm{${units[randomUnitInstructionIndex]}}^3
|
|
28
|
+
$$`;
|
|
29
|
+
};
|
|
30
|
+
const getAnswer = (identifiers) => {
|
|
31
|
+
const { randomUnitIndex, randomUnitInstructionIndex, randomVolume } = identifiers;
|
|
32
|
+
const answer = new Decimal(randomVolume)
|
|
33
|
+
.multiplyByPowerOfTen(3 * (randomUnitIndex - randomUnitInstructionIndex))
|
|
34
|
+
.value.frenchify();
|
|
35
|
+
return answer;
|
|
36
|
+
};
|
|
37
|
+
const getHint = (identifiers) => {
|
|
38
|
+
const { randomUnitIndex, randomUnitInstructionIndex } = identifiers;
|
|
39
|
+
const unit = units[randomUnitIndex];
|
|
40
|
+
const target = units[randomUnitInstructionIndex];
|
|
41
|
+
const space = randomUnitIndex - randomUnitInstructionIndex;
|
|
42
|
+
return `On rappelle que :
|
|
43
|
+
|
|
44
|
+
$$
|
|
45
|
+
1 \\ \\textrm{${unit}}^3 = ${space > 0
|
|
46
|
+
? Math.pow(10, space * 3)
|
|
47
|
+
: frac(1, Math.pow(10, -(space * 3))).toTex()} \\ \\textrm{${target}}^3
|
|
48
|
+
$$`;
|
|
49
|
+
};
|
|
50
|
+
const getCorrection = (identifiers) => {
|
|
51
|
+
const { randomVolume, randomUnitIndex, randomUnitInstructionIndex } = identifiers;
|
|
52
|
+
const unit = units[randomUnitIndex];
|
|
53
|
+
const target = units[randomUnitInstructionIndex];
|
|
54
|
+
const space = randomUnitIndex - randomUnitInstructionIndex;
|
|
55
|
+
const coeff = space > 0
|
|
56
|
+
? Math.pow(10, space * 3).toTree()
|
|
57
|
+
: frac(1, Math.pow(10, -(space * 3)));
|
|
58
|
+
return `On sait que :
|
|
59
|
+
|
|
60
|
+
$$
|
|
61
|
+
1 \\ \\textrm{${unit}}^3 = ${coeff.toTex()} \\ \\textrm{${target}}^3
|
|
62
|
+
$$
|
|
63
|
+
|
|
64
|
+
Il suffit alors de multiplier $${randomVolume.frenchify()}$ par $${coeff.toTex()}$ :
|
|
65
|
+
|
|
66
|
+
${alignTex([
|
|
67
|
+
[
|
|
68
|
+
`${randomVolume.frenchify()} \\textrm{${unit}}^3 `,
|
|
69
|
+
"=",
|
|
70
|
+
`${multiply(coeff, randomVolume).toTex()}\\ \\textrm{${target}}^3`,
|
|
71
|
+
],
|
|
72
|
+
["", "=", `${getAnswer(identifiers)}\\ \\textrm{${target}}^3`],
|
|
73
|
+
])}
|
|
74
|
+
`;
|
|
75
|
+
};
|
|
76
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
13
77
|
const question = {
|
|
14
|
-
instruction:
|
|
15
|
-
|
|
16
|
-
.replace(".", ",")} \\textrm{${units[randomUnitIndex]}}^3 = \\ldots \\textrm{${units[randomUnitInstructionIndex]}}^3$`,
|
|
17
|
-
answer,
|
|
78
|
+
instruction: getInstruction(identifiers),
|
|
79
|
+
answer: getAnswer(identifiers),
|
|
18
80
|
keys: [],
|
|
19
81
|
answerFormat: "tex",
|
|
20
|
-
identifiers
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
randomVolume: randomVolume.value,
|
|
24
|
-
},
|
|
82
|
+
identifiers,
|
|
83
|
+
hint: getHint(identifiers),
|
|
84
|
+
correction: getCorrection(identifiers),
|
|
25
85
|
};
|
|
26
86
|
return question;
|
|
27
87
|
};
|
|
@@ -45,8 +105,6 @@ export const volumeConversion = {
|
|
|
45
105
|
id: "volumeConversion",
|
|
46
106
|
connector: "=",
|
|
47
107
|
label: "Conversion de volumes",
|
|
48
|
-
levels: ["6ème", "5ème", "CAP", "2ndPro"],
|
|
49
|
-
sections: ["Conversions"],
|
|
50
108
|
isSingleStep: true,
|
|
51
109
|
generator: (nb) => getDistinctQuestions(getVolumeConversion, nb),
|
|
52
110
|
getPropositions,
|
|
@@ -54,4 +112,6 @@ export const volumeConversion = {
|
|
|
54
112
|
qcmTimer: 60,
|
|
55
113
|
freeTimer: 60,
|
|
56
114
|
subject: "Mathématiques",
|
|
115
|
+
getQuestionFromIdentifiers,
|
|
116
|
+
hasHintAndCorrection: true,
|
|
57
117
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signFunction.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/signFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"signFunction.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/signFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAoBrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,cAAc,EAAE,OAAO,CAAC;CACzB,CAAC;AA2IF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,CAqB9C,CAAC"}
|
|
@@ -8,7 +8,7 @@ import { firstDegreeInequationResolutionTex } from "../../../../tree/nodes/inequ
|
|
|
8
8
|
import { MinusInfinityNode, PlusInfinityNode, } from "../../../../tree/nodes/numbers/infiniteNode.js";
|
|
9
9
|
import { ClosureType } from "../../../../tree/nodes/sets/closure.js";
|
|
10
10
|
import { IntervalNode } from "../../../../tree/nodes/sets/intervalNode.js";
|
|
11
|
-
import {
|
|
11
|
+
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
12
12
|
import { coinFlip } from "../../../../utils/alea/coinFlip.js";
|
|
13
13
|
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
14
14
|
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
@@ -51,10 +51,11 @@ $$
|
|
|
51
51
|
|
|
52
52
|
Sur quel intervalle $f$ est-elle ${identifiers.askingPositive ? "positive" : "négative"} ?`;
|
|
53
53
|
};
|
|
54
|
-
const
|
|
54
|
+
const getAnswerNode = (identifiers) => {
|
|
55
|
+
const { a, b, askingPositive } = identifiers;
|
|
55
56
|
const root = new Rational(-b, a).simplify().toTree();
|
|
56
|
-
const toRightInfInterval = new IntervalNode(root, PlusInfinityNode, ClosureType.FO)
|
|
57
|
-
const toLeftInfInteral = new IntervalNode(MinusInfinityNode, root, ClosureType.OF)
|
|
57
|
+
const toRightInfInterval = new IntervalNode(root, PlusInfinityNode, ClosureType.FO);
|
|
58
|
+
const toLeftInfInteral = new IntervalNode(MinusInfinityNode, root, ClosureType.OF);
|
|
58
59
|
if (askingPositive) {
|
|
59
60
|
return a > 0 ? toRightInfInterval : toLeftInfInteral;
|
|
60
61
|
}
|
|
@@ -62,6 +63,9 @@ const getAnswer = ({ a, b, askingPositive }) => {
|
|
|
62
63
|
return a > 0 ? toLeftInfInteral : toRightInfInterval;
|
|
63
64
|
}
|
|
64
65
|
};
|
|
66
|
+
const getAnswer = (identifiers) => {
|
|
67
|
+
return getAnswerNode(identifiers).toTex();
|
|
68
|
+
};
|
|
65
69
|
const getSignFunction = () => {
|
|
66
70
|
const a = randint(-9, 10, [0]);
|
|
67
71
|
const b = randint(-9, 10);
|
|
@@ -92,15 +96,23 @@ const getPropositions = (n, { answer }) => {
|
|
|
92
96
|
}
|
|
93
97
|
return shuffle(propositions);
|
|
94
98
|
};
|
|
95
|
-
const isAnswerValid = (ans, { answer,
|
|
99
|
+
const isAnswerValid = (ans, { answer, ...identifiers }) => {
|
|
96
100
|
try {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
101
|
+
//? on accepte les réponses peu importe le sens des crochets, meme pour l'infini
|
|
102
|
+
const formated = ans
|
|
103
|
+
.replaceAll("]", "")
|
|
104
|
+
.replaceAll("[", "")
|
|
105
|
+
.replaceAll("\\ ", "");
|
|
106
|
+
const splitted = formated.includes(";")
|
|
107
|
+
? formated.split(";")
|
|
108
|
+
: formated.split(",");
|
|
109
|
+
if (splitted.length !== 2)
|
|
102
110
|
return false;
|
|
103
|
-
|
|
111
|
+
const a = parseAlgebraic(splitted[0]);
|
|
112
|
+
const b = parseAlgebraic(splitted[1]);
|
|
113
|
+
const intAnswer = getAnswerNode(identifiers);
|
|
114
|
+
return (a.simplify().toTex() === intAnswer.a.toTex() &&
|
|
115
|
+
b.simplify().toTex() === intAnswer.b.toTex());
|
|
104
116
|
}
|
|
105
117
|
catch (err) {
|
|
106
118
|
return handleVEAError(err);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imageFunctionGeogebra.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/imageFunctionGeogebra.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"imageFunctionGeogebra.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/imageFunctionGeogebra.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAoBT,MAAM,6BAA6B,CAAC;AAyBrC,KAAK,WAAW,GAAG;IACjB,cAAc;IAMd,UAAU;IAMV,UAAU;IACV,YAAY,EAAE,MAAM,CAAC;IACrB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,EAAE,EAAE,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AA4TF,KAAK,OAAO,GAAG;IACb,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AACF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAsBhE,CAAC"}
|
|
@@ -69,6 +69,19 @@ const getAnswer = (identifiers) => {
|
|
|
69
69
|
return "\\text{Aucun}";
|
|
70
70
|
return y.frenchify();
|
|
71
71
|
};
|
|
72
|
+
const getHint = (identifiers) => {
|
|
73
|
+
return `L'image d'un nombre $x$ par $f$ est l'ordonnée du point de la courbe de $f$ dont l'abscisse est $x$.`;
|
|
74
|
+
};
|
|
75
|
+
const getCorrection = (identifiers) => {
|
|
76
|
+
const { x, y } = identifiers;
|
|
77
|
+
return `On cherche le point sur la courbe de $f$ qui a pour abscisse $${x}$.
|
|
78
|
+
|
|
79
|
+
${y === undefined
|
|
80
|
+
? `On voit qu'il n'y a pas de tel point. On en conclut que l'image de $x$ par $f$ n'existe pas.`
|
|
81
|
+
: `On voit que c'est le point de coordonnées $\\left(${x};${y}\\right)$.
|
|
82
|
+
|
|
83
|
+
On en conclut que l'image de $${x}$ par $f$ est $${y}$.`}`;
|
|
84
|
+
};
|
|
72
85
|
const getGGBOptions = (identifiers) => {
|
|
73
86
|
const { functionType, otherPoints, wrongY, x, y, functionCommand } = identifiers;
|
|
74
87
|
const allPoints = [...otherPoints];
|
|
@@ -180,6 +193,8 @@ const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
|
180
193
|
ggbOptions: getGGBOptions(identifiers, opts),
|
|
181
194
|
answerFormat: "tex",
|
|
182
195
|
identifiers,
|
|
196
|
+
hint: getHint(identifiers),
|
|
197
|
+
correction: getCorrection(identifiers),
|
|
183
198
|
};
|
|
184
199
|
return question;
|
|
185
200
|
};
|
|
@@ -298,4 +313,5 @@ export const imageFunctionGeogebra = {
|
|
|
298
313
|
getQuestionFromIdentifiers,
|
|
299
314
|
getKeys,
|
|
300
315
|
getStartStatement,
|
|
316
|
+
hasHintAndCorrection: true,
|
|
301
317
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"triangleArea.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/areas/triangleArea.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"triangleArea.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/areas/triangleArea.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EAGL,mBAAmB,EACpB,MAAM,2CAA2C,CAAC;AAOnD,OAAO,EAGL,kBAAkB,EACnB,MAAM,gCAAgC,CAAC;AAOxC,KAAK,WAAW,GAAG;IACjB,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,iBAAiB,EAAE,kBAAkB,CAAC;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAiJF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,CAiB9C,CAAC"}
|