math-exercises 3.0.150 → 3.0.152
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 +5 -0
- package/lib/exercises/exercise.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/primeNumbersAffirmations.js +1 -1
- package/lib/exercises/math/calcul/fractions/fractionToPercentToDecimal.d.ts +5 -1
- package/lib/exercises/math/calcul/fractions/fractionToPercentToDecimal.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionToPercentToDecimal.js +92 -38
- package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.d.ts.map +1 -1
- package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.js +5 -1
- package/lib/exercises/math/calcul/proportionality/isTableProportional.d.ts.map +1 -1
- package/lib/exercises/math/calcul/proportionality/isTableProportional.js +7 -1
- package/lib/exercises/math/calcul/proportionality/isTableProportionalNonInteger.d.ts.map +1 -1
- package/lib/exercises/math/calcul/proportionality/isTableProportionalNonInteger.js +5 -1
- package/lib/exercises/math/calcul/proportionality/proportionalityTable.d.ts.map +1 -1
- package/lib/exercises/math/calcul/proportionality/proportionalityTable.js +5 -1
- package/lib/exercises/math/calcul/proportionality/proportionalityTableCoefficient.d.ts.map +1 -1
- package/lib/exercises/math/calcul/proportionality/proportionalityTableCoefficient.js +8 -2
- package/lib/exercises/math/calculLitteral/equation/equa1.d.ts +4 -1
- package/lib/exercises/math/calculLitteral/equation/equa1.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equa1.js +27 -7
- package/lib/exercises/math/calculLitteral/equation/equa2.d.ts +1 -0
- package/lib/exercises/math/calculLitteral/equation/equa2.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equa2.js +18 -1
- package/lib/exercises/math/calculLitteral/equation/equa3.d.ts +4 -1
- package/lib/exercises/math/calculLitteral/equation/equa3.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equa3.js +26 -6
- package/lib/exercises/math/calculLitteral/equation/equa4.d.ts +4 -1
- package/lib/exercises/math/calculLitteral/equation/equa4.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equa4.js +27 -7
- package/lib/exercises/math/calculLitteral/equation/firstDegree/equa1.d.ts +14 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/equa1.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/equa1.js +129 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/equa2.d.ts +18 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/equa2.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/equa2.js +167 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/equa3.d.ts +15 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/equa3.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/equa3.js +129 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/equa4.d.ts +16 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/equa4.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/equa4.js +124 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType1.d.ts +9 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType1.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType1.js +107 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType2.d.ts +10 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType2.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType2.js +108 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType3.d.ts +11 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType3.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType3.js +104 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/index.d.ts +8 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/index.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/index.js +7 -0
- package/lib/exercises/math/calculLitteral/equation/index.d.ts +1 -7
- package/lib/exercises/math/calculLitteral/equation/index.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/index.js +1 -7
- package/lib/exercises/math/dataRepresentations/histogram/etendueHistogram.d.ts +8 -0
- package/lib/exercises/math/dataRepresentations/histogram/etendueHistogram.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/histogram/etendueHistogram.js +175 -0
- package/lib/exercises/math/dataRepresentations/histogram/histogramCommenting.d.ts +9 -0
- package/lib/exercises/math/dataRepresentations/histogram/histogramCommenting.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/histogram/histogramCommenting.js +250 -0
- package/lib/exercises/math/dataRepresentations/histogram/histogramFillDataTableFromHistogramData.d.ts +9 -0
- package/lib/exercises/math/dataRepresentations/histogram/histogramFillDataTableFromHistogramData.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/histogram/histogramFillDataTableFromHistogramData.js +173 -0
- package/lib/exercises/math/dataRepresentations/histogram/histogramIsSameData.d.ts +14 -0
- package/lib/exercises/math/dataRepresentations/histogram/histogramIsSameData.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/histogram/histogramIsSameData.js +239 -0
- package/lib/exercises/math/dataRepresentations/histogram/histogramReading.d.ts +9 -0
- package/lib/exercises/math/dataRepresentations/histogram/histogramReading.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/histogram/histogramReading.js +163 -0
- package/lib/exercises/math/dataRepresentations/histogram/index.d.ts +6 -0
- package/lib/exercises/math/dataRepresentations/histogram/index.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/histogram/index.js +5 -0
- package/lib/exercises/math/dataRepresentations/index.d.ts +1 -1
- package/lib/exercises/math/dataRepresentations/index.d.ts.map +1 -1
- package/lib/exercises/math/dataRepresentations/index.js +1 -1
- package/lib/exercises/math/dataRepresentations/tableReading.d.ts.map +1 -1
- package/lib/exercises/math/dataRepresentations/tableReading.js +7 -0
- package/lib/exercises/math/functions/affines/affineAdjustment.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/affineAdjustment.js +7 -1
- package/lib/exercises/math/functions/affines/affineAdjustmentComplete.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/affineAdjustmentComplete.js +7 -1
- package/lib/exercises/math/functions/affines/affineAdjustmentRsquared.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/affineAdjustmentRsquared.js +7 -1
- package/lib/exercises/math/functions/affines/leadingCoeffAndOriginOrdinate.d.ts +4 -1
- package/lib/exercises/math/functions/affines/leadingCoeffAndOriginOrdinate.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/leadingCoeffAndOriginOrdinate.js +19 -4
- package/lib/exercises/math/functions/affines/leadingCoefficient.d.ts +1 -0
- package/lib/exercises/math/functions/affines/leadingCoefficient.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/leadingCoefficient.js +13 -1
- package/lib/exercises/math/functions/affines/recognizeAffineGraph.d.ts +4 -1
- package/lib/exercises/math/functions/affines/recognizeAffineGraph.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/recognizeAffineGraph.js +19 -4
- package/lib/exercises/math/functions/basics/inverseImageFunctionTable.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/inverseImageFunctionTable.js +7 -1
- package/lib/exercises/math/functions/basics/placePointsFromValueTable.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/placePointsFromValueTable.js +7 -0
- package/lib/exercises/math/geometry/euclidian/pythagoreOrThales.d.ts +4 -1
- package/lib/exercises/math/geometry/euclidian/pythagoreOrThales.d.ts.map +1 -1
- package/lib/exercises/math/geometry/euclidian/pythagoreOrThales.js +18 -3
- package/lib/exercises/math/geometry/triangles/index.d.ts +1 -0
- package/lib/exercises/math/geometry/triangles/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/triangles/index.js +1 -0
- package/lib/exercises/math/geometry/triangles/similar/index.d.ts +4 -0
- package/lib/exercises/math/geometry/triangles/similar/index.d.ts.map +1 -0
- package/lib/exercises/math/geometry/triangles/similar/index.js +3 -0
- package/lib/exercises/math/geometry/triangles/similar/isSimilarTrianglesWithAngles.d.ts +10 -0
- package/lib/exercises/math/geometry/triangles/similar/isSimilarTrianglesWithAngles.d.ts.map +1 -0
- package/lib/exercises/math/geometry/triangles/similar/isSimilarTrianglesWithAngles.js +122 -0
- package/lib/exercises/math/geometry/triangles/similar/isSimilarTrianglesWrtSideLengths.d.ts +15 -0
- package/lib/exercises/math/geometry/triangles/similar/isSimilarTrianglesWrtSideLengths.d.ts.map +1 -0
- package/lib/exercises/math/geometry/triangles/similar/isSimilarTrianglesWrtSideLengths.js +351 -0
- package/lib/exercises/math/geometry/triangles/similar/placeSegmentsOfSimilarTriangle.d.ts +11 -0
- package/lib/exercises/math/geometry/triangles/similar/placeSegmentsOfSimilarTriangle.d.ts.map +1 -0
- package/lib/exercises/math/geometry/triangles/similar/placeSegmentsOfSimilarTriangle.js +311 -0
- package/lib/exercises/math/probaStat/basicProbas/calculateProbaFromProbaLaw.d.ts +10 -0
- package/lib/exercises/math/probaStat/basicProbas/calculateProbaFromProbaLaw.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/basicProbas/calculateProbaFromProbaLaw.js +135 -0
- package/lib/exercises/math/probaStat/basicProbas/findEffectifFromProba.d.ts +9 -0
- package/lib/exercises/math/probaStat/basicProbas/findEffectifFromProba.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/basicProbas/findEffectifFromProba.js +109 -0
- package/lib/exercises/math/probaStat/basicProbas/getMissingProbabilityValue.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/basicProbas/getMissingProbabilityValue.js +7 -0
- package/lib/exercises/math/probaStat/basicProbas/getMissingProbabilityValueMiddleSchool.d.ts +9 -0
- package/lib/exercises/math/probaStat/basicProbas/getMissingProbabilityValueMiddleSchool.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/basicProbas/getMissingProbabilityValueMiddleSchool.js +120 -0
- package/lib/exercises/math/probaStat/basicProbas/index.d.ts +4 -0
- package/lib/exercises/math/probaStat/basicProbas/index.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/basicProbas/index.js +4 -0
- package/lib/exercises/math/probaStat/basicProbas/pickEquiprobableTo.d.ts +12 -0
- package/lib/exercises/math/probaStat/basicProbas/pickEquiprobableTo.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/basicProbas/pickEquiprobableTo.js +374 -0
- package/lib/exercises/math/probaStat/probaFromTableNoContext.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/probaFromTableNoContext.js +7 -0
- package/lib/exercises/math/probaStat/probaFromTableWithContext.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/probaFromTableWithContext.js +7 -0
- package/lib/exercises/math/probaStat/stats1var/averageWithTable.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/averageWithTable.js +7 -1
- package/lib/exercises/math/probaStat/stats1var/calculateMeanFromFrequencies.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/calculateMeanFromFrequencies.js +7 -0
- package/lib/exercises/math/probaStat/stats1var/cumulativeSum.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/cumulativeSum.js +7 -0
- package/lib/exercises/math/probaStat/stats1var/etendueTable.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/etendueTable.js +7 -1
- package/lib/exercises/math/probaStat/stats1var/getQuartileProportionQuestion.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/getQuartileProportionQuestion.js +7 -0
- package/lib/exercises/math/probaStat/stats1var/interquartilesTable.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/interquartilesTable.js +5 -1
- package/lib/exercises/math/probaStat/stats1var/marginalAndConditionalFrequency.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/marginalAndConditionalFrequency.js +7 -0
- package/lib/exercises/math/probaStat/stats1var/medianWithList.d.ts +2 -0
- package/lib/exercises/math/probaStat/stats1var/medianWithList.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/medianWithList.js +67 -14
- package/lib/exercises/math/probaStat/stats1var/medianWithTable.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/medianWithTable.js +7 -1
- package/lib/exercises/math/probaStat/stats1var/quartiles.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/quartiles.js +7 -1
- package/lib/exercises/math/probaStat/stats1var/standardDeviationTable.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/standardDeviationTable.js +5 -1
- package/lib/exercises/math/probaStat/stats1var/varianceTable.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/varianceTable.js +5 -1
- package/lib/exercises/math/probaStat/stats2var/averagePoint.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats2var/averagePoint.js +7 -1
- package/lib/exercises/math/probaStat/twoStepExperiments/headsOrTailsTwiceOutcomes.d.ts +7 -0
- package/lib/exercises/math/probaStat/twoStepExperiments/headsOrTailsTwiceOutcomes.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/twoStepExperiments/headsOrTailsTwiceOutcomes.js +171 -0
- package/lib/exercises/math/probaStat/twoStepExperiments/headsOrTailsTwiceProbas.d.ts +7 -0
- package/lib/exercises/math/probaStat/twoStepExperiments/headsOrTailsTwiceProbas.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/twoStepExperiments/headsOrTailsTwiceProbas.js +155 -0
- package/lib/exercises/math/probaStat/twoStepExperiments/index.d.ts +3 -0
- package/lib/exercises/math/probaStat/twoStepExperiments/index.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/twoStepExperiments/index.js +3 -0
- package/lib/exercises/math/probaStat/twoStepExperiments/numberPoolTwiceProbas.d.ts +7 -0
- package/lib/exercises/math/probaStat/twoStepExperiments/numberPoolTwiceProbas.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/twoStepExperiments/numberPoolTwiceProbas.js +189 -0
- package/lib/exercises/math/spaceGeometry/index.d.ts +1 -0
- package/lib/exercises/math/spaceGeometry/index.d.ts.map +1 -1
- package/lib/exercises/math/spaceGeometry/index.js +1 -0
- package/lib/exercises/math/spaceGeometry/sections/areaOfConeSection.d.ts +14 -0
- package/lib/exercises/math/spaceGeometry/sections/areaOfConeSection.d.ts.map +1 -0
- package/lib/exercises/math/spaceGeometry/sections/areaOfConeSection.js +439 -0
- package/lib/exercises/math/spaceGeometry/sections/areaOfCylinderSection.d.ts +14 -0
- package/lib/exercises/math/spaceGeometry/sections/areaOfCylinderSection.d.ts.map +1 -0
- package/lib/exercises/math/spaceGeometry/sections/areaOfCylinderSection.js +548 -0
- package/lib/exercises/math/spaceGeometry/sections/areaOfRectangularPrismSection.d.ts +11 -0
- package/lib/exercises/math/spaceGeometry/sections/areaOfRectangularPrismSection.d.ts.map +1 -0
- package/lib/exercises/math/spaceGeometry/sections/areaOfRectangularPrismSection.js +360 -0
- package/lib/exercises/math/spaceGeometry/sections/areaOfSphereSection.d.ts +9 -0
- package/lib/exercises/math/spaceGeometry/sections/areaOfSphereSection.d.ts.map +1 -0
- package/lib/exercises/math/spaceGeometry/sections/areaOfSphereSection.js +272 -0
- package/lib/exercises/math/spaceGeometry/sections/index.d.ts +9 -0
- package/lib/exercises/math/spaceGeometry/sections/index.d.ts.map +1 -0
- package/lib/exercises/math/spaceGeometry/sections/index.js +8 -0
- package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfCone.d.ts +11 -0
- package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfCone.d.ts.map +1 -0
- package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfCone.js +266 -0
- package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfCylinder.d.ts +11 -0
- package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfCylinder.d.ts.map +1 -0
- package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfCylinder.js +236 -0
- package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfRectangularPrism.d.ts +7 -0
- package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfRectangularPrism.d.ts.map +1 -0
- package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfRectangularPrism.js +92 -0
- package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfSphereOrBall.d.ts +9 -0
- package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfSphereOrBall.d.ts.map +1 -0
- package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfSphereOrBall.js +236 -0
- package/lib/exercises/pc/mathExosInPC.d.ts +4 -4
- package/lib/exercises/pc/mathExosInPC.d.ts.map +1 -1
- package/lib/exercises/pc/mathExosInPC.js +4 -4
- package/lib/index.d.ts +173 -45
- package/lib/index.d.ts.map +1 -1
- package/lib/math/geometry/spacePoint.d.ts +10 -0
- package/lib/math/geometry/spacePoint.d.ts.map +1 -1
- package/lib/math/geometry/spacePoint.js +13 -0
- package/lib/tree/nodes/operators/substractNode.d.ts +1 -0
- package/lib/tree/nodes/operators/substractNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/substractNode.js +6 -0
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
2
2
|
import { median } from "../../../../math/utils/stats/median.js";
|
|
3
3
|
import { random } from "../../../../utils/alea/random.js";
|
|
4
|
+
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
4
5
|
import { GeneratorOptionTarget, GeneratorOptionType, addValidProp, propWhile, shuffleProps, tryToAddWrongProp, } from "../../../exercise.js";
|
|
5
6
|
import { getDistinctQuestions } from "../../../utils/getDistinctQuestions.js";
|
|
6
7
|
const getInstruction = (identifiers) => {
|
|
@@ -15,16 +16,37 @@ Déterminer la médiane de cette liste de valeurs.`;
|
|
|
15
16
|
};
|
|
16
17
|
const getAnswer = (identifiers) => {
|
|
17
18
|
const { sortedValues } = identifiers;
|
|
18
|
-
return median(sortedValues).frenchify();
|
|
19
|
+
return median([...sortedValues].sort((a, b) => a - b)).frenchify();
|
|
19
20
|
};
|
|
20
|
-
const getHint = () => {
|
|
21
|
-
return `La médiane est la valeur centrale de la série : il y a autant de valeur inférieures à la médiane que de valeurs supérieures à la médiane
|
|
21
|
+
const getHint = (_, opts) => {
|
|
22
|
+
return `La médiane est la valeur centrale de la série : il y a autant de valeur inférieures à la médiane que de valeurs supérieures à la médiane.
|
|
23
|
+
|
|
24
|
+
${opts?.isOrdered
|
|
25
|
+
? "Les valeurs sont déjà rangées par ordre croissant."
|
|
26
|
+
: "Commence par ranger les valeurs dans l'ordre croissant."}`;
|
|
22
27
|
};
|
|
23
|
-
const getCorrection = (identifiers) => {
|
|
28
|
+
const getCorrection = (identifiers, opts) => {
|
|
24
29
|
const { sortedValues } = identifiers;
|
|
25
30
|
const total = sortedValues.length;
|
|
26
31
|
const rank = total / 2;
|
|
27
|
-
return
|
|
32
|
+
return `${(() => {
|
|
33
|
+
if (!opts?.isOrdered) {
|
|
34
|
+
const sorted = sortedValues.sort((a, b) => a - b);
|
|
35
|
+
return `On range les valeurs de la liste par ordre croissant :
|
|
36
|
+
|
|
37
|
+
$$
|
|
38
|
+
${sorted.join(";\\ ")}
|
|
39
|
+
$$
|
|
40
|
+
|
|
41
|
+
`;
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
return `Les valeurs de la liste sont rangées dans l'ordre croissant.
|
|
45
|
+
`;
|
|
46
|
+
}
|
|
47
|
+
})()}
|
|
48
|
+
|
|
49
|
+
Il y a $${total}$ valeurs dans la liste.
|
|
28
50
|
|
|
29
51
|
Puisque $\\frac{${total}}{2} = ${rank.frenchify()}$, la médiane est ${rank % 1 === 0
|
|
30
52
|
? `entre la $${rank}$ème et la $${rank + 1}$ème valeur.`
|
|
@@ -45,16 +67,33 @@ const isAnswerValid = (ans, { answer }) => {
|
|
|
45
67
|
return ans === answer;
|
|
46
68
|
};
|
|
47
69
|
const getMedianList = (optsIn) => {
|
|
48
|
-
const arrayedOptions = optsIn
|
|
70
|
+
const arrayedOptions = optsIn;
|
|
49
71
|
const opts = {
|
|
50
|
-
nbValues: random(arrayedOptions.nbValues),
|
|
72
|
+
nbValues: random(arrayedOptions.nbValues ?? optsDefault.nbValues),
|
|
73
|
+
isOrdered: optsIn?.isOrdered ?? true,
|
|
51
74
|
};
|
|
52
|
-
const randomValues = [];
|
|
53
75
|
const length = Number(opts.nbValues);
|
|
54
|
-
|
|
55
|
-
randomValues.push(randint(1, 20));
|
|
76
|
+
const randomValues = [...Array(length).keys()].map(() => randint(1, 20));
|
|
56
77
|
const sortedValues = randomValues.sort((a, b) => a - b);
|
|
57
|
-
|
|
78
|
+
let values;
|
|
79
|
+
if (opts.isOrdered) {
|
|
80
|
+
values = sortedValues;
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
//ensure unordered
|
|
84
|
+
let counter = -1;
|
|
85
|
+
let isValid = false;
|
|
86
|
+
while (!isValid && counter < 100) {
|
|
87
|
+
counter++;
|
|
88
|
+
values = shuffle(randomValues);
|
|
89
|
+
isValid = !randomValues.every((v, i) => v === sortedValues[i]);
|
|
90
|
+
}
|
|
91
|
+
if (!isValid) {
|
|
92
|
+
const randomValuesDesperateCall = [...Array(length).keys()].map(() => randint(1, 20));
|
|
93
|
+
values = randomValuesDesperateCall;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
const identifiers = { sortedValues: values };
|
|
58
97
|
return getQuestionFromIdentifiers(identifiers);
|
|
59
98
|
};
|
|
60
99
|
const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
@@ -64,8 +103,8 @@ const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
|
64
103
|
keys: [],
|
|
65
104
|
answerFormat: "tex",
|
|
66
105
|
identifiers,
|
|
67
|
-
hint: getHint(identifiers),
|
|
68
|
-
correction: getCorrection(identifiers),
|
|
106
|
+
hint: getHint(identifiers, opts),
|
|
107
|
+
correction: getCorrection(identifiers, opts),
|
|
69
108
|
options: opts,
|
|
70
109
|
};
|
|
71
110
|
return question;
|
|
@@ -88,7 +127,7 @@ export const medianWithList = {
|
|
|
88
127
|
connector: "=",
|
|
89
128
|
label: "Calcul de la médiane d'une liste de valeurs",
|
|
90
129
|
isSingleStep: false,
|
|
91
|
-
generator: (nb, opts) => getDistinctQuestions(() => getMedianList(opts), nb),
|
|
130
|
+
generator: (nb, opts) => getDistinctQuestions(() => getMedianList(Object.assign({}, opts, { isOrdered: true })), nb),
|
|
92
131
|
options,
|
|
93
132
|
qcmTimer: 60,
|
|
94
133
|
freeTimer: 60,
|
|
@@ -98,3 +137,17 @@ export const medianWithList = {
|
|
|
98
137
|
getQuestionFromIdentifiers,
|
|
99
138
|
hasHintAndCorrection: true,
|
|
100
139
|
};
|
|
140
|
+
export const medianWithListUnorderedVariant = {
|
|
141
|
+
id: "medianWithListUnorderedVariant",
|
|
142
|
+
connector: "=",
|
|
143
|
+
label: "Calcul de la médiane d'une liste de valeurs non ordonnée",
|
|
144
|
+
isSingleStep: false,
|
|
145
|
+
generator: (nb, opts) => getDistinctQuestions(() => getMedianList(Object.assign({}, opts, { isOrdered: false })), nb),
|
|
146
|
+
qcmTimer: 60,
|
|
147
|
+
freeTimer: 60,
|
|
148
|
+
getPropositions,
|
|
149
|
+
isAnswerValid,
|
|
150
|
+
subject: "Mathématiques",
|
|
151
|
+
getQuestionFromIdentifiers,
|
|
152
|
+
hasHintAndCorrection: true,
|
|
153
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"medianWithTable.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats1var/medianWithTable.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,QAAQ,EAcT,MAAM,sBAAsB,CAAC;AAG9B,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC5B,CAAC;
|
|
1
|
+
{"version":3,"file":"medianWithTable.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats1var/medianWithTable.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,QAAQ,EAcT,MAAM,sBAAsB,CAAC;AAG9B,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC5B,CAAC;AAiIF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAajD,CAAC"}
|
|
@@ -79,7 +79,13 @@ const getQuestionFromIdentifiers = (identifiers) => {
|
|
|
79
79
|
keys: [],
|
|
80
80
|
answerFormat: "tex",
|
|
81
81
|
identifiers,
|
|
82
|
-
style: {
|
|
82
|
+
style: {
|
|
83
|
+
tableOptions: {
|
|
84
|
+
firstColumnIsHeader: true,
|
|
85
|
+
firstCellIsDivided: false,
|
|
86
|
+
firstRowIsHeader: false,
|
|
87
|
+
},
|
|
88
|
+
},
|
|
83
89
|
hint: getHint(identifiers),
|
|
84
90
|
correction: getCorrection(identifiers),
|
|
85
91
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quartiles.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats1var/quartiles.ts"],"names":[],"mappings":"AAYA,OAAO,EACL,QAAQ,EAcT,MAAM,sBAAsB,CAAC;AAG9B,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;
|
|
1
|
+
{"version":3,"file":"quartiles.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats1var/quartiles.ts"],"names":[],"mappings":"AAYA,OAAO,EACL,QAAQ,EAcT,MAAM,sBAAsB,CAAC;AAG9B,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAsIF,eAAO,MAAM,SAAS,EAAE,QAAQ,CAAC,WAAW,CAc3C,CAAC"}
|
|
@@ -86,7 +86,13 @@ const getQuestionFromIdentifiers = (identifiers) => {
|
|
|
86
86
|
keys: [],
|
|
87
87
|
answerFormat: "tex",
|
|
88
88
|
identifiers,
|
|
89
|
-
style: {
|
|
89
|
+
style: {
|
|
90
|
+
tableOptions: {
|
|
91
|
+
firstColumnIsHeader: true,
|
|
92
|
+
firstCellIsDivided: false,
|
|
93
|
+
firstRowIsHeader: false,
|
|
94
|
+
},
|
|
95
|
+
},
|
|
90
96
|
hint: getHint(identifiers),
|
|
91
97
|
correction: getCorrection(identifiers),
|
|
92
98
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standardDeviationTable.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats1var/standardDeviationTable.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAarC,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;
|
|
1
|
+
{"version":3,"file":"standardDeviationTable.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats1var/standardDeviationTable.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAarC,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAsJF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAexD,CAAC"}
|
|
@@ -123,7 +123,11 @@ const getQuestionFromIdentifiers = (identifiers) => {
|
|
|
123
123
|
hint: getHint(identifiers),
|
|
124
124
|
correction: getCorrection(identifiers),
|
|
125
125
|
style: {
|
|
126
|
-
|
|
126
|
+
tableOptions: {
|
|
127
|
+
firstColumnIsHeader: true,
|
|
128
|
+
firstCellIsDivided: false,
|
|
129
|
+
firstRowIsHeader: false,
|
|
130
|
+
},
|
|
127
131
|
},
|
|
128
132
|
};
|
|
129
133
|
return question;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"varianceTable.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats1var/varianceTable.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;
|
|
1
|
+
{"version":3,"file":"varianceTable.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats1var/varianceTable.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAmIF,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,WAAW,CAc/C,CAAC"}
|
|
@@ -112,7 +112,11 @@ const getQuestionFromIdentifiers = (identifiers) => {
|
|
|
112
112
|
hint: getHint(identifiers),
|
|
113
113
|
correction: getCorrection(identifiers),
|
|
114
114
|
style: {
|
|
115
|
-
|
|
115
|
+
tableOptions: {
|
|
116
|
+
firstColumnIsHeader: true,
|
|
117
|
+
firstCellIsDivided: false,
|
|
118
|
+
firstRowIsHeader: false,
|
|
119
|
+
},
|
|
116
120
|
},
|
|
117
121
|
};
|
|
118
122
|
return question;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"averagePoint.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats2var/averagePoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;
|
|
1
|
+
{"version":3,"file":"averagePoint.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats2var/averagePoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAyEF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,CAa9C,CAAC"}
|
|
@@ -41,7 +41,13 @@ const getQuestionFromIdentifiers = (identifiers) => {
|
|
|
41
41
|
keys: ["semicolon"],
|
|
42
42
|
answerFormat: "tex",
|
|
43
43
|
identifiers,
|
|
44
|
-
style: {
|
|
44
|
+
style: {
|
|
45
|
+
tableOptions: {
|
|
46
|
+
firstColumnIsHeader: true,
|
|
47
|
+
firstCellIsDivided: false,
|
|
48
|
+
firstRowIsHeader: false,
|
|
49
|
+
},
|
|
50
|
+
},
|
|
45
51
|
};
|
|
46
52
|
return question;
|
|
47
53
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"headsOrTailsTwiceOutcomes.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/twoStepExperiments/headsOrTailsTwiceOutcomes.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,sBAAsB,CAAC;AAS9B,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AA+MF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAa3D,CAAC"}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../exercise.js";
|
|
2
|
+
import { getCartesiansProducts } from "../../../../utils/arrays/cartesianProducts.js";
|
|
3
|
+
import { mdTable } from "../../../../utils/markdown/mdTable.js";
|
|
4
|
+
import { random } from "../../../../utils/alea/random.js";
|
|
5
|
+
function highlighted(str) {
|
|
6
|
+
return `{ \\color{green} ${str} }`;
|
|
7
|
+
}
|
|
8
|
+
const arrStrOutcomeSmall = [`P`, `F`];
|
|
9
|
+
const getInstruction = (identifiers) => {
|
|
10
|
+
const { arrIndex } = identifiers;
|
|
11
|
+
const strRand = arrIndex.join("");
|
|
12
|
+
return `On tire deux fois à pile ou face avec une pièce de monnaie.
|
|
13
|
+
On note les issues de cette expérience aléatoire dans le tableau ci-dessous.
|
|
14
|
+
|
|
15
|
+
${(() => {
|
|
16
|
+
switch (strRand) {
|
|
17
|
+
case "00":
|
|
18
|
+
{
|
|
19
|
+
return random([
|
|
20
|
+
`${mdTable([
|
|
21
|
+
["\\text{}", "\\text{Lancer 2 :} P", "\\text{Lancer 2 :} F"],
|
|
22
|
+
["\\text{Lancer 1 : } P", "\\text{...}", "(P,F)"],
|
|
23
|
+
["\\text{Lancer 1 : } F", "\\text{}", "\\text{}"],
|
|
24
|
+
], true)}`,
|
|
25
|
+
`${mdTable([
|
|
26
|
+
["\\text{}", "\\text{Lancer 2 :} P", "\\text{Lancer 2 :} F"],
|
|
27
|
+
["\\text{Lancer 1 : } P", "\\text{...}", "\\text{}"],
|
|
28
|
+
["\\text{Lancer 1 : } F", "(F,P)", "\\text{}"],
|
|
29
|
+
], true)}`,
|
|
30
|
+
]);
|
|
31
|
+
}
|
|
32
|
+
break;
|
|
33
|
+
case "01":
|
|
34
|
+
{
|
|
35
|
+
return random([
|
|
36
|
+
`${mdTable([
|
|
37
|
+
["\\text{}", "\\text{Lancer 2 :} P", "\\text{Lancer 2 :} F"],
|
|
38
|
+
["\\text{Lancer 1 : } P", "(P,P)", "\\text{...}"],
|
|
39
|
+
["\\text{Lancer 1 : } F", "\\text{}", "\\text{}"],
|
|
40
|
+
], true)}`,
|
|
41
|
+
`${mdTable([
|
|
42
|
+
["\\text{}", "\\text{Lancer 2 :} P", "\\text{Lancer 2 :} F"],
|
|
43
|
+
["\\text{Lancer 1 : } P", "\\text{}", "\\text{...}"],
|
|
44
|
+
["\\text{Lancer 1 : } F", "\\text{}", "(F,F)"],
|
|
45
|
+
], true)}`,
|
|
46
|
+
]);
|
|
47
|
+
}
|
|
48
|
+
break;
|
|
49
|
+
case "10":
|
|
50
|
+
{
|
|
51
|
+
return random([
|
|
52
|
+
`${mdTable([
|
|
53
|
+
["\\text{}", "\\text{Lancer 2 :} P", "\\text{Lancer 2 :} F"],
|
|
54
|
+
["\\text{Lancer 1 : } P", "(P,P)", "\\text{}"],
|
|
55
|
+
["\\text{Lancer 1 : } F", "\\text{...}", "\\text{}"],
|
|
56
|
+
], true)}`,
|
|
57
|
+
`${mdTable([
|
|
58
|
+
["\\text{}", "\\text{Lancer 2 :} P", "\\text{Lancer 2 :} F"],
|
|
59
|
+
["\\text{Lancer 1 : } P", "\\text{}", "\\text{}"],
|
|
60
|
+
["\\text{Lancer 1 : } F", "\\text{...}", "(F,F)"],
|
|
61
|
+
], true)}`,
|
|
62
|
+
]);
|
|
63
|
+
}
|
|
64
|
+
break;
|
|
65
|
+
case "11":
|
|
66
|
+
{
|
|
67
|
+
return random([
|
|
68
|
+
`${mdTable([
|
|
69
|
+
["\\text{}", "\\text{Lancer 2 :} P", "\\text{Lancer 2 :} F"],
|
|
70
|
+
["\\text{Lancer 1 : } P", "\\text{}", "(P,F)"],
|
|
71
|
+
["\\text{Lancer 1 : } F", "\\text{}", "\\text{...}"],
|
|
72
|
+
], true)}`,
|
|
73
|
+
`${mdTable([
|
|
74
|
+
["\\text{}", "\\text{Lancer 2 :} P", "\\text{Lancer 2 :} F"],
|
|
75
|
+
["\\text{Lancer 1 : } P", "\\text{}", "\\text{}"],
|
|
76
|
+
["\\text{Lancer 1 : } F", "(F,P)", "\\text{...}"],
|
|
77
|
+
], true)}`,
|
|
78
|
+
]);
|
|
79
|
+
}
|
|
80
|
+
break;
|
|
81
|
+
default:
|
|
82
|
+
throw new Error("Unsupported strRand: " + strRand);
|
|
83
|
+
}
|
|
84
|
+
})()}
|
|
85
|
+
|
|
86
|
+
Que doit-on écrire dans la case avec "..." ?`;
|
|
87
|
+
};
|
|
88
|
+
const getAnswer = (identifiers) => {
|
|
89
|
+
const { arrIndex } = identifiers;
|
|
90
|
+
return `\\left(${arrIndex
|
|
91
|
+
.map((v) => arrStrOutcomeSmall[v])
|
|
92
|
+
.join(";")}\\right)`;
|
|
93
|
+
};
|
|
94
|
+
const getHint = () => {
|
|
95
|
+
return `Inspire toi de l'élément déjà écrit dans le tableau. Regarde sa ligne et sa colonne.`;
|
|
96
|
+
};
|
|
97
|
+
const getCorrection = (identifiers) => {
|
|
98
|
+
const { arrIndex } = identifiers;
|
|
99
|
+
const arrOutcome = getCartesiansProducts([
|
|
100
|
+
[0, 1],
|
|
101
|
+
[0, 1],
|
|
102
|
+
]);
|
|
103
|
+
const arrStr = arrOutcome.map(([v1, v2]) => {
|
|
104
|
+
const strEventSmall = `(${arrStrOutcomeSmall[v1]};${arrStrOutcomeSmall[v2]})`;
|
|
105
|
+
return v1 === arrIndex[0] && v2 === arrIndex[1]
|
|
106
|
+
? highlighted(strEventSmall)
|
|
107
|
+
: strEventSmall;
|
|
108
|
+
});
|
|
109
|
+
return `Dans le tableau ci-dessous,
|
|
110
|
+
le premier élément dans la parenthèse désigne le résultat du premier lancer
|
|
111
|
+
et le deuxième élémént le résultat du deuxième lancer.
|
|
112
|
+
|
|
113
|
+
$P$ désigne $Pile$ et $F$ désigne $Face$.
|
|
114
|
+
|
|
115
|
+
${mdTable([
|
|
116
|
+
["\\text{}", "\\text{Lancer 2 :} P", "\\text{Lancer 2 :} F"],
|
|
117
|
+
["\\text{Lancer 1 : } P", arrStr[0], arrStr[2]],
|
|
118
|
+
["\\text{Lancer 1 : } F", arrStr[1], arrStr[3]],
|
|
119
|
+
], true)}
|
|
120
|
+
`;
|
|
121
|
+
};
|
|
122
|
+
const getPropositions = (n, { answer }) => {
|
|
123
|
+
const propositions = [];
|
|
124
|
+
addValidProp(propositions, answer);
|
|
125
|
+
const arrOutcome = getCartesiansProducts([
|
|
126
|
+
[0, 1],
|
|
127
|
+
[0, 1],
|
|
128
|
+
]);
|
|
129
|
+
const arrStr = arrOutcome.map(([v1, v2]) => `(${arrStrOutcomeSmall[v1]};${arrStrOutcomeSmall[v2]})`);
|
|
130
|
+
arrStr.forEach((str) => {
|
|
131
|
+
tryToAddWrongProp(propositions, str);
|
|
132
|
+
});
|
|
133
|
+
return shuffleProps(propositions, n);
|
|
134
|
+
};
|
|
135
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
136
|
+
return ans === answer;
|
|
137
|
+
};
|
|
138
|
+
const getHeadsOrTailsTwiceOutcomesQuestion = () => {
|
|
139
|
+
const arrOutcome = getCartesiansProducts([
|
|
140
|
+
[0, 1],
|
|
141
|
+
[0, 1],
|
|
142
|
+
]);
|
|
143
|
+
const arrIndex = random(arrOutcome);
|
|
144
|
+
const identifiers = { arrIndex };
|
|
145
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
146
|
+
};
|
|
147
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
148
|
+
const question = {
|
|
149
|
+
instruction: getInstruction(identifiers),
|
|
150
|
+
answer: getAnswer(identifiers),
|
|
151
|
+
keys: ["F", "P", "semicolon"],
|
|
152
|
+
answerFormat: "tex",
|
|
153
|
+
identifiers,
|
|
154
|
+
hint: getHint(identifiers),
|
|
155
|
+
correction: getCorrection(identifiers),
|
|
156
|
+
};
|
|
157
|
+
return question;
|
|
158
|
+
};
|
|
159
|
+
export const headsOrTailsTwiceOutcomes = {
|
|
160
|
+
id: "headsOrTailsTwiceOutcomes",
|
|
161
|
+
label: "Désigner une issue dans une expérience aléatoire à deux épreuves",
|
|
162
|
+
isSingleStep: true,
|
|
163
|
+
generator: (nb) => [...Array(nb).keys()].map(() => getHeadsOrTailsTwiceOutcomesQuestion()),
|
|
164
|
+
qcmTimer: 60,
|
|
165
|
+
freeTimer: 60,
|
|
166
|
+
getPropositions,
|
|
167
|
+
isAnswerValid,
|
|
168
|
+
subject: "Mathématiques",
|
|
169
|
+
hasHintAndCorrection: true,
|
|
170
|
+
getQuestionFromIdentifiers,
|
|
171
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"headsOrTailsTwiceProbas.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/twoStepExperiments/headsOrTailsTwiceProbas.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EAcT,MAAM,sBAAsB,CAAC;AAY9B,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAuLF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAczD,CAAC"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
2
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../exercise.js";
|
|
3
|
+
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
4
|
+
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
5
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
6
|
+
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
7
|
+
import { getCartesiansProducts } from "../../../../utils/arrays/cartesianProducts.js";
|
|
8
|
+
import { mdTable } from "../../../../utils/markdown/mdTable.js";
|
|
9
|
+
function highlighted(str) {
|
|
10
|
+
return `{ \\color{green} ${str} }`;
|
|
11
|
+
}
|
|
12
|
+
const arrStrOutcome = [`Pile`, `Face`];
|
|
13
|
+
const events = [
|
|
14
|
+
//elem
|
|
15
|
+
...getCartesiansProducts([
|
|
16
|
+
[0, 1],
|
|
17
|
+
[0, 1],
|
|
18
|
+
]).flatMap(([i1, i2]) => {
|
|
19
|
+
return {
|
|
20
|
+
str: `On obtient $${arrStrOutcome[i1]}$ puis $${arrStrOutcome[i2]}$`,
|
|
21
|
+
isRealizingEvent: (v1, v2) => v1 === i1 && v2 === i2,
|
|
22
|
+
};
|
|
23
|
+
}),
|
|
24
|
+
//at least one
|
|
25
|
+
...[0, 1].map((i) => {
|
|
26
|
+
return {
|
|
27
|
+
str: `On obtient au moins un $${arrStrOutcome[i]}$`,
|
|
28
|
+
isRealizingEvent: (v1, v2) => v1 === i || v2 === i,
|
|
29
|
+
};
|
|
30
|
+
}),
|
|
31
|
+
//none
|
|
32
|
+
...[0, 1].map((i) => {
|
|
33
|
+
return {
|
|
34
|
+
str: `On obtient aucun $${arrStrOutcome[i]}$`,
|
|
35
|
+
isRealizingEvent: (v1, v2) => v1 !== i && v2 !== i,
|
|
36
|
+
};
|
|
37
|
+
}),
|
|
38
|
+
//exactly one
|
|
39
|
+
...[0, 1].map((i) => {
|
|
40
|
+
return {
|
|
41
|
+
str: `On obtient exactement un $${arrStrOutcome[i]}$`,
|
|
42
|
+
isRealizingEvent: (v1, v2) => (v1 === i && v2 !== i) || (v1 !== i && v2 === i),
|
|
43
|
+
};
|
|
44
|
+
}),
|
|
45
|
+
];
|
|
46
|
+
const getInstruction = (identifiers) => {
|
|
47
|
+
const { indexEvent } = identifiers;
|
|
48
|
+
const event = events[indexEvent];
|
|
49
|
+
return `On tire deux fois à pile ou face avec une pièce de monnaie.
|
|
50
|
+
Quelle est la probabilité de l'évènement "${event.str}" ?`;
|
|
51
|
+
};
|
|
52
|
+
const getAnswerNode = (identifiers) => {
|
|
53
|
+
const { indexEvent } = identifiers;
|
|
54
|
+
const event = events[indexEvent];
|
|
55
|
+
const arrOutcome = getCartesiansProducts([
|
|
56
|
+
[0, 1],
|
|
57
|
+
[0, 1],
|
|
58
|
+
]);
|
|
59
|
+
const arrRealized = arrOutcome.filter(([v1, v2]) => event.isRealizingEvent(v1, v2));
|
|
60
|
+
return frac(arrRealized.length, arrOutcome.length);
|
|
61
|
+
};
|
|
62
|
+
const getAnswer = (identifiers) => {
|
|
63
|
+
return getAnswerNode(identifiers).simplify().toTex();
|
|
64
|
+
};
|
|
65
|
+
const getHint = () => {
|
|
66
|
+
return `Tu peux dresser un tableau à deux entrées avec les différentes issues et compter combien réalisent l'évènement demandé.`;
|
|
67
|
+
};
|
|
68
|
+
const getCorrection = (identifiers) => {
|
|
69
|
+
const { indexEvent } = identifiers;
|
|
70
|
+
const event = events[indexEvent];
|
|
71
|
+
const fractionNode = getAnswerNode(identifiers);
|
|
72
|
+
const nbRealized = fractionNode.leftChild.evaluate();
|
|
73
|
+
const nbOutcomes = fractionNode.rightChild.evaluate();
|
|
74
|
+
const arrOutcome = getCartesiansProducts([
|
|
75
|
+
[0, 1],
|
|
76
|
+
[0, 1],
|
|
77
|
+
]);
|
|
78
|
+
const arrStr = arrOutcome.map(([v1, v2]) => {
|
|
79
|
+
const arrStrOutcomeSmall = arrStrOutcome.map((str) => str[0]);
|
|
80
|
+
const strEventSmall = `(${arrStrOutcomeSmall[v1]};${arrStrOutcomeSmall[v2]})`;
|
|
81
|
+
return event.isRealizingEvent(v1, v2)
|
|
82
|
+
? highlighted(strEventSmall)
|
|
83
|
+
: strEventSmall;
|
|
84
|
+
});
|
|
85
|
+
return `Dans le tableau ci-dessous, on a indiqué en vert les issues qui réalisent l'évènement "${event.str}" :
|
|
86
|
+
|
|
87
|
+
${mdTable([
|
|
88
|
+
["\\text{}", "\\text{Lancer 2 :} P", "\\text{Lancer 2 :} F"],
|
|
89
|
+
["\\text{Lancer 1 : } P", arrStr[0], arrStr[2]],
|
|
90
|
+
["\\text{Lancer 1 : } F", arrStr[1], arrStr[3]],
|
|
91
|
+
], true)}
|
|
92
|
+
|
|
93
|
+
Sur les $${nbOutcomes.frenchify()}$ issues possibles, ${nbRealized === 1 ? "une seule réalise" : `$${nbRealized}$ réalisent`} l'évènement "${event.str}".
|
|
94
|
+
|
|
95
|
+
La probabilité de l'évènement "${event.str}" est donc $${fractionNode.toTex()}$.
|
|
96
|
+
`;
|
|
97
|
+
};
|
|
98
|
+
const getPropositions = (n, { answer, ...identifiers }) => {
|
|
99
|
+
const propositions = [];
|
|
100
|
+
addValidProp(propositions, answer);
|
|
101
|
+
[...Array(events.length).keys()].map((indexEvent) => {
|
|
102
|
+
const identifiersWrong = Object.assign({}, identifiers, { indexEvent });
|
|
103
|
+
const tex = getAnswer(identifiersWrong);
|
|
104
|
+
tryToAddWrongProp(propositions, tex);
|
|
105
|
+
});
|
|
106
|
+
//P=0 and P=1
|
|
107
|
+
[0, 1]
|
|
108
|
+
.map((i) => i.toTree())
|
|
109
|
+
.map((nodeProba) => {
|
|
110
|
+
tryToAddWrongProp(propositions, nodeProba.toTex());
|
|
111
|
+
});
|
|
112
|
+
return shuffleProps(propositions, n);
|
|
113
|
+
};
|
|
114
|
+
const isAnswerValid = (ans, { answer, ...identifiers }) => {
|
|
115
|
+
try {
|
|
116
|
+
const nodeAns = parseAlgebraic(ans);
|
|
117
|
+
const nodeAnswer = getAnswerNode(identifiers);
|
|
118
|
+
return (substract(nodeAns.simplify(), nodeAnswer.simplify())
|
|
119
|
+
.simplify()
|
|
120
|
+
.evaluate() === 0);
|
|
121
|
+
}
|
|
122
|
+
catch (err) {
|
|
123
|
+
return handleVEAError(err);
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
const getHeadsOrTailsTwiceProbasQuestion = () => {
|
|
127
|
+
const indexEvent = randint(0, events.length);
|
|
128
|
+
const identifiers = { indexEvent };
|
|
129
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
130
|
+
};
|
|
131
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
132
|
+
const question = {
|
|
133
|
+
instruction: getInstruction(identifiers),
|
|
134
|
+
answer: getAnswer(identifiers),
|
|
135
|
+
keys: [],
|
|
136
|
+
answerFormat: "tex",
|
|
137
|
+
identifiers,
|
|
138
|
+
hint: getHint(identifiers),
|
|
139
|
+
correction: getCorrection(identifiers),
|
|
140
|
+
};
|
|
141
|
+
return question;
|
|
142
|
+
};
|
|
143
|
+
export const headsOrTailsTwiceProbas = {
|
|
144
|
+
id: "headsOrTailsTwiceProbas",
|
|
145
|
+
label: "Calculer la probabilité d'un évènement dans une expérience à deux épreuves (Pile ou Face)",
|
|
146
|
+
isSingleStep: true,
|
|
147
|
+
generator: (nb) => [...Array(nb).keys()].map(() => getHeadsOrTailsTwiceProbasQuestion()),
|
|
148
|
+
qcmTimer: 60,
|
|
149
|
+
freeTimer: 60,
|
|
150
|
+
getPropositions,
|
|
151
|
+
isAnswerValid,
|
|
152
|
+
subject: "Mathématiques",
|
|
153
|
+
hasHintAndCorrection: true,
|
|
154
|
+
getQuestionFromIdentifiers,
|
|
155
|
+
};
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
export * from "./countIssuesTwoStepExperiment.js";
|
|
2
2
|
export * from "./twoStepExperimentProbas.js";
|
|
3
|
+
export * from "./headsOrTailsTwiceProbas.js";
|
|
4
|
+
export * from "./headsOrTailsTwiceOutcomes.js";
|
|
5
|
+
export * from "./numberPoolTwiceProbas.js";
|
|
3
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/twoStepExperiments/index.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC;AAClD,cAAc,8BAA8B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/twoStepExperiments/index.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC;AAClD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"numberPoolTwiceProbas.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/twoStepExperiments/numberPoolTwiceProbas.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,sBAAsB,CAAC;AAiB9B,KAAK,WAAW,GAAG;IAEjB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AA6NF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,CAcvD,CAAC"}
|