math-exercises 3.0.151 → 3.0.153
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 +7 -0
- package/lib/exercises/exercise.d.ts.map +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/index.d.ts +1 -1
- package/lib/exercises/math/calculLitteral/equation/index.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/index.js +1 -1
- package/lib/exercises/math/calculLitteral/equation/square/equationSimpleSquare.d.ts +10 -0
- package/lib/exercises/math/calculLitteral/equation/square/equationSimpleSquare.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/equation/square/equationSimpleSquare.js +183 -0
- package/lib/exercises/math/calculLitteral/equation/square/equationSquareWithSteps.d.ts +10 -0
- package/lib/exercises/math/calculLitteral/equation/square/equationSquareWithSteps.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/equation/square/equationSquareWithSteps.js +173 -0
- package/lib/exercises/math/calculLitteral/equation/square/index.d.ts +3 -0
- package/lib/exercises/math/calculLitteral/equation/square/index.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/equation/square/index.js +2 -0
- package/lib/exercises/math/dataRepresentations/histogram/histogramIsSameData.d.ts.map +1 -1
- package/lib/exercises/math/dataRepresentations/histogram/histogramIsSameData.js +7 -0
- 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/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/functions/sqrt/squareRootCalculation.d.ts.map +1 -1
- package/lib/exercises/math/functions/sqrt/squareRootCalculation.js +4 -2
- package/lib/exercises/math/geometry/euclidian/homothetyFactorFromPoints.d.ts +15 -0
- package/lib/exercises/math/geometry/euclidian/homothetyFactorFromPoints.d.ts.map +1 -0
- package/lib/exercises/math/geometry/euclidian/homothetyFactorFromPoints.js +301 -0
- package/lib/exercises/math/geometry/euclidian/index.d.ts +7 -0
- package/lib/exercises/math/geometry/euclidian/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/euclidian/index.js +7 -0
- package/lib/exercises/math/geometry/euclidian/pinPointFromAxialOrCentralSymmetry.d.ts +21 -0
- package/lib/exercises/math/geometry/euclidian/pinPointFromAxialOrCentralSymmetry.d.ts.map +1 -0
- package/lib/exercises/math/geometry/euclidian/pinPointFromAxialOrCentralSymmetry.js +406 -0
- package/lib/exercises/math/geometry/euclidian/pinPointFromRotation.d.ts +18 -0
- package/lib/exercises/math/geometry/euclidian/pinPointFromRotation.d.ts.map +1 -0
- package/lib/exercises/math/geometry/euclidian/pinPointFromRotation.js +315 -0
- package/lib/exercises/math/geometry/euclidian/pinPointFromTranslation.d.ts +20 -0
- package/lib/exercises/math/geometry/euclidian/pinPointFromTranslation.d.ts.map +1 -0
- package/lib/exercises/math/geometry/euclidian/pinPointFromTranslation.js +314 -0
- package/lib/exercises/math/geometry/euclidian/pinSegmentFromRotation.d.ts +18 -0
- package/lib/exercises/math/geometry/euclidian/pinSegmentFromRotation.d.ts.map +1 -0
- package/lib/exercises/math/geometry/euclidian/pinSegmentFromRotation.js +387 -0
- package/lib/exercises/math/geometry/euclidian/recognizeAngleFromRotation.d.ts +18 -0
- package/lib/exercises/math/geometry/euclidian/recognizeAngleFromRotation.d.ts.map +1 -0
- package/lib/exercises/math/geometry/euclidian/recognizeAngleFromRotation.js +309 -0
- package/lib/exercises/math/geometry/euclidian/recognizeHomothetyCenter.d.ts +17 -0
- package/lib/exercises/math/geometry/euclidian/recognizeHomothetyCenter.d.ts.map +1 -0
- package/lib/exercises/math/geometry/euclidian/recognizeHomothetyCenter.js +301 -0
- package/lib/exercises/math/geometry/euclidianConstructions/buildPointFromAxialSymetry.d.ts.map +1 -1
- package/lib/exercises/math/geometry/euclidianConstructions/buildPointFromAxialSymetry.js +22 -8
- package/lib/exercises/math/geometry/euclidianConstructions/buildPointFromCentralSymmetry.d.ts +11 -0
- package/lib/exercises/math/geometry/euclidianConstructions/buildPointFromCentralSymmetry.d.ts.map +1 -0
- package/lib/exercises/math/geometry/euclidianConstructions/buildPointFromCentralSymmetry.js +169 -0
- package/lib/exercises/math/geometry/euclidianConstructions/index.d.ts +2 -0
- package/lib/exercises/math/geometry/euclidianConstructions/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/euclidianConstructions/index.js +2 -0
- package/lib/exercises/math/geometry/euclidianConstructions/placeHomothetyCenter.d.ts +16 -0
- package/lib/exercises/math/geometry/euclidianConstructions/placeHomothetyCenter.d.ts.map +1 -0
- package/lib/exercises/math/geometry/euclidianConstructions/placeHomothetyCenter.js +309 -0
- package/lib/exercises/math/probaStat/basicProbas/calculateProbaFromProbaLaw.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/basicProbas/calculateProbaFromProbaLaw.js +7 -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 +2 -0
- package/lib/exercises/math/probaStat/basicProbas/index.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/basicProbas/index.js +2 -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/averageWithClasses.d.ts +9 -0
- package/lib/exercises/math/probaStat/stats1var/averageWithClasses.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/stats1var/averageWithClasses.js +140 -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/averageWithTableWithContext.d.ts +8 -0
- package/lib/exercises/math/probaStat/stats1var/averageWithTableWithContext.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/stats1var/averageWithTableWithContext.js +113 -0
- 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/index.d.ts +2 -0
- package/lib/exercises/math/probaStat/stats1var/index.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/index.js +2 -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/scratch/index.d.ts +3 -0
- package/lib/exercises/math/scratch/index.d.ts.map +1 -1
- package/lib/exercises/math/scratch/index.js +3 -0
- package/lib/exercises/math/scratch/scratchListElemAtIndex.d.ts +13 -0
- package/lib/exercises/math/scratch/scratchListElemAtIndex.d.ts.map +1 -0
- package/lib/exercises/math/scratch/scratchListElemAtIndex.js +189 -0
- package/lib/exercises/math/scratch/scratchListElemAtIndex2.d.ts +23 -0
- package/lib/exercises/math/scratch/scratchListElemAtIndex2.d.ts.map +1 -0
- package/lib/exercises/math/scratch/scratchListElemAtIndex2.js +207 -0
- package/lib/exercises/math/scratch/scratchListFilter.d.ts +13 -0
- package/lib/exercises/math/scratch/scratchListFilter.d.ts.map +1 -0
- package/lib/exercises/math/scratch/scratchListFilter.js +397 -0
- package/lib/exercises/math/spaceGeometry/basis/findSpacePointOnRectangularPrism.d.ts +14 -0
- package/lib/exercises/math/spaceGeometry/basis/findSpacePointOnRectangularPrism.d.ts.map +1 -0
- package/lib/exercises/math/spaceGeometry/basis/findSpacePointOnRectangularPrism.js +347 -0
- package/lib/exercises/math/spaceGeometry/basis/index.d.ts +1 -0
- package/lib/exercises/math/spaceGeometry/basis/index.d.ts.map +1 -1
- package/lib/exercises/math/spaceGeometry/basis/index.js +1 -0
- package/lib/exercises/math/spaceGeometry/index.d.ts +2 -0
- package/lib/exercises/math/spaceGeometry/index.d.ts.map +1 -1
- package/lib/exercises/math/spaceGeometry/index.js +2 -0
- package/lib/exercises/math/spaceGeometry/sections/areaOfConeSection.js +3 -3
- package/lib/exercises/math/spaceGeometry/solids/index.d.ts +3 -0
- package/lib/exercises/math/spaceGeometry/solids/index.d.ts.map +1 -0
- package/lib/exercises/math/spaceGeometry/solids/index.js +2 -0
- package/lib/exercises/math/spaceGeometry/solids/recognizeSolidFrom3D.d.ts +15 -0
- package/lib/exercises/math/spaceGeometry/solids/recognizeSolidFrom3D.d.ts.map +1 -0
- package/lib/exercises/math/spaceGeometry/solids/recognizeSolidFrom3D.js +440 -0
- package/lib/exercises/math/spaceGeometry/solids/recognizeSolidFromSolidPattern.d.ts +11 -0
- package/lib/exercises/math/spaceGeometry/solids/recognizeSolidFromSolidPattern.d.ts.map +1 -0
- package/lib/exercises/math/spaceGeometry/solids/recognizeSolidFromSolidPattern.js +1089 -0
- package/lib/exercises/math/spaceGeometry/sphere/index.d.ts +3 -0
- package/lib/exercises/math/spaceGeometry/sphere/index.d.ts.map +1 -0
- package/lib/exercises/math/spaceGeometry/sphere/index.js +2 -0
- package/lib/exercises/math/spaceGeometry/sphere/pickIsPointInSphereOrBall.d.ts +9 -0
- package/lib/exercises/math/spaceGeometry/sphere/pickIsPointInSphereOrBall.d.ts.map +1 -0
- package/lib/exercises/math/spaceGeometry/sphere/pickIsPointInSphereOrBall.js +127 -0
- package/lib/exercises/math/spaceGeometry/sphere/sphereLatLonReading.d.ts +14 -0
- package/lib/exercises/math/spaceGeometry/sphere/sphereLatLonReading.d.ts.map +1 -0
- package/lib/exercises/math/spaceGeometry/sphere/sphereLatLonReading.js +390 -0
- package/lib/geogebra/geogebraConstructor.d.ts +2 -0
- package/lib/geogebra/geogebraConstructor.d.ts.map +1 -1
- package/lib/geogebra/geogebraConstructor.js +6 -0
- package/lib/index.d.ts +198 -6
- package/lib/index.d.ts.map +1 -1
- package/lib/math/geometry/point.d.ts +6 -0
- package/lib/math/geometry/point.d.ts.map +1 -1
- package/lib/math/geometry/point.js +28 -0
- package/lib/tree/nodes/equations/equalNode.d.ts +1 -1
- package/lib/tree/nodes/equations/equalNode.d.ts.map +1 -1
- package/lib/tree/nodes/equations/equalNode.js +0 -1
- package/lib/tree/utilities/nodeSimplifier.d.ts +1 -1
- package/lib/utils/arrays/arrayZip.d.ts +2 -0
- package/lib/utils/arrays/arrayZip.d.ts.map +1 -0
- package/lib/utils/arrays/arrayZip.js +12 -0
- package/package.json +1 -1
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { addValidProp, tryToAddWrongProp, shuffleProps, propWhile, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
4
|
+
import { randfloat } from "../../../../math/utils/random/randfloat.js";
|
|
5
|
+
import { round } from "../../../../math/utils/round.js";
|
|
6
|
+
import { dollarize } from "../../../../utils/latex/dollarize.js";
|
|
7
|
+
import { mdTable } from "../../../../utils/markdown/mdTable.js";
|
|
8
|
+
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
9
|
+
const getPropositions = (n, { answer }) => {
|
|
10
|
+
const props = [];
|
|
11
|
+
addValidProp(props, answer);
|
|
12
|
+
propWhile(props, n, () => {
|
|
13
|
+
const numeric = answer.unfrenchify();
|
|
14
|
+
const offset = randfloat(-0.2, 0.2, 2);
|
|
15
|
+
const candidate = round(numeric + offset, 2).frenchify();
|
|
16
|
+
tryToAddWrongProp(props, candidate);
|
|
17
|
+
});
|
|
18
|
+
return shuffleProps(props, n);
|
|
19
|
+
};
|
|
20
|
+
const getAnswer = ({ pValues, missingIndex }) => {
|
|
21
|
+
return pValues[missingIndex].frenchify();
|
|
22
|
+
};
|
|
23
|
+
const getInstruction = ({ labels, pValues, missingIndex, }) => {
|
|
24
|
+
return `Un sac contient des jetons. Chaque jeton est rouge ou vert ou bleu. On tire un jeton au hasard et on regarde sa couleur.
|
|
25
|
+
|
|
26
|
+
On a les informations suivantes :
|
|
27
|
+
|
|
28
|
+
${mdTable([
|
|
29
|
+
["Issue", ...labels.map((l) => dollarize(l))],
|
|
30
|
+
[
|
|
31
|
+
"Probabilité",
|
|
32
|
+
...pValues.map((p, i) => i === missingIndex ? "..." : dollarize(p.frenchify())),
|
|
33
|
+
],
|
|
34
|
+
])}
|
|
35
|
+
|
|
36
|
+
Quelle est la probabilité manquante ?`;
|
|
37
|
+
};
|
|
38
|
+
const getHint = () => {
|
|
39
|
+
return `La somme des probabilités des issues élémentaires est égale à $1$.`;
|
|
40
|
+
};
|
|
41
|
+
const getCorrection = ({ labels, pValues, missingIndex, }) => {
|
|
42
|
+
const knownTerms = labels
|
|
43
|
+
.map((_l, i) => (i === missingIndex ? null : pValues[i].frenchify()))
|
|
44
|
+
.filter(Boolean)
|
|
45
|
+
.join("+");
|
|
46
|
+
const sumKnown = round(pValues.filter((_, i) => i !== missingIndex).reduce((s, v) => s + v, 0), 2);
|
|
47
|
+
const missing = round(1 - sumKnown, 2);
|
|
48
|
+
return `
|
|
49
|
+
On additionne les probabilités connues :
|
|
50
|
+
|
|
51
|
+
$$
|
|
52
|
+
${knownTerms} = ${sumKnown.frenchify()}
|
|
53
|
+
$$
|
|
54
|
+
|
|
55
|
+
Puisque la somme des probabilités des issues élémentaires vaut $1$, on peut en déduire la probabilité manquante :
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
$$
|
|
59
|
+
P(${labels[missingIndex]}) = 1 - ${sumKnown.frenchify()} = ${missing.frenchify()}
|
|
60
|
+
$$
|
|
61
|
+
`;
|
|
62
|
+
};
|
|
63
|
+
const getKeys = () => {
|
|
64
|
+
return [];
|
|
65
|
+
};
|
|
66
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
67
|
+
try {
|
|
68
|
+
const a = parseAlgebraic(ans);
|
|
69
|
+
const b = parseAlgebraic(answer);
|
|
70
|
+
return a.simplify().equals(b.simplify());
|
|
71
|
+
}
|
|
72
|
+
catch (err) {
|
|
73
|
+
return handleVEAError(err);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
const getMissingProbabilityValueMiddleSchoolQuestion = () => {
|
|
77
|
+
const labels = ["rouge", "vert", "bleu"];
|
|
78
|
+
const raw = labels.map(() => Math.random());
|
|
79
|
+
const total = raw.reduce((s, v) => s + v, 0);
|
|
80
|
+
const pValues = raw.map((v) => round(v / total, 2));
|
|
81
|
+
// ajustement pour que la somme fasse exactement 1
|
|
82
|
+
const sumRounded = pValues.reduce((s, v) => s + v, 0);
|
|
83
|
+
const diff = round(1 - sumRounded, 2);
|
|
84
|
+
pValues[pValues.length - 1] = round(pValues[pValues.length - 1] + diff, 2);
|
|
85
|
+
const missingIndex = Math.floor(Math.random() * labels.length);
|
|
86
|
+
return getQuestionFromIdentifiers({ labels, pValues, missingIndex });
|
|
87
|
+
};
|
|
88
|
+
const getQuestionFromIdentifiers = (identifiers) => ({
|
|
89
|
+
answer: getAnswer(identifiers),
|
|
90
|
+
instruction: getInstruction(identifiers),
|
|
91
|
+
keys: getKeys(identifiers),
|
|
92
|
+
answerFormat: "tex",
|
|
93
|
+
identifiers,
|
|
94
|
+
hint: getHint(identifiers),
|
|
95
|
+
correction: getCorrection(identifiers),
|
|
96
|
+
style: {
|
|
97
|
+
tableOptions: {
|
|
98
|
+
firstColumnIsHeader: true,
|
|
99
|
+
firstCellIsDivided: false,
|
|
100
|
+
firstRowIsHeader: false,
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
export const getMissingProbabilityValueMiddleSchool = {
|
|
105
|
+
id: "getMissingProbabilityValueMiddleSchool",
|
|
106
|
+
label: "Déterminer la probabilité manquante",
|
|
107
|
+
isSingleStep: true,
|
|
108
|
+
generator: (nb, opts) => getDistinctQuestions(() => getMissingProbabilityValueMiddleSchoolQuestion(opts), nb),
|
|
109
|
+
qcmTimer: 60,
|
|
110
|
+
freeTimer: 60,
|
|
111
|
+
getPropositions,
|
|
112
|
+
isAnswerValid,
|
|
113
|
+
subject: "Mathématiques",
|
|
114
|
+
getInstruction,
|
|
115
|
+
getHint,
|
|
116
|
+
getCorrection,
|
|
117
|
+
getAnswer,
|
|
118
|
+
getQuestionFromIdentifiers,
|
|
119
|
+
hasHintAndCorrection: true,
|
|
120
|
+
};
|
|
@@ -7,6 +7,8 @@ export * from "./mostLeastProbable.js";
|
|
|
7
7
|
export * from "./rouletteProbas.js";
|
|
8
8
|
export * from "./possibleValuesForProba.js";
|
|
9
9
|
export * from "./rangeBasicProbas.js";
|
|
10
|
+
export * from "./pickEquiprobableTo.js";
|
|
11
|
+
export * from "./getMissingProbabilityValueMiddleSchool.js";
|
|
10
12
|
export * from "./findEffectifFromProba.js";
|
|
11
13
|
export * from "./calculateProbaFromProbaLaw.js";
|
|
12
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/basicProbas/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kCAAkC,CAAC;AACjD,cAAc,iCAAiC,CAAC;AAChD,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iCAAiC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/basicProbas/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,kCAAkC,CAAC;AACjD,cAAc,iCAAiC,CAAC;AAChD,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,6CAA6C,CAAC;AAC5D,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iCAAiC,CAAC"}
|
|
@@ -7,5 +7,7 @@ export * from "./mostLeastProbable.js";
|
|
|
7
7
|
export * from "./rouletteProbas.js";
|
|
8
8
|
export * from "./possibleValuesForProba.js";
|
|
9
9
|
export * from "./rangeBasicProbas.js";
|
|
10
|
+
export * from "./pickEquiprobableTo.js";
|
|
11
|
+
export * from "./getMissingProbabilityValueMiddleSchool.js";
|
|
10
12
|
export * from "./findEffectifFromProba.js";
|
|
11
13
|
export * from "./calculateProbaFromProbaLaw.js";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
type WheelItem = {
|
|
3
|
+
value: number;
|
|
4
|
+
indexColor: number;
|
|
5
|
+
};
|
|
6
|
+
type Identifiers = {
|
|
7
|
+
arrItem: WheelItem[];
|
|
8
|
+
typeAsked: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const pickEquiprobableTo: Exercise<Identifiers>;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=pickEquiprobableTo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pickEquiprobableTo.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/basicProbas/pickEquiprobableTo.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAqKrC,KAAK,SAAS,GAAG;IACf,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAgIF,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,SAAS,EAAE,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AA2NF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAmBpD,CAAC"}
|
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { blueMain, colorWithOpacity, greenLight, orange, red, } from "../../../../geogebra/colors.js";
|
|
4
|
+
import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
|
|
5
|
+
import { Point } from "../../../../math/geometry/point.js";
|
|
6
|
+
import { Vector } from "../../../../math/geometry/vector.js";
|
|
7
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
8
|
+
import { round } from "../../../../math/utils/round.js";
|
|
9
|
+
import { PiNode } from "../../../../tree/nodes/numbers/piNode.js";
|
|
10
|
+
import { add } from "../../../../tree/nodes/operators/addNode.js";
|
|
11
|
+
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
12
|
+
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
13
|
+
import { random, randomMany } from "../../../../utils/alea/random.js";
|
|
14
|
+
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
15
|
+
import { mdTable } from "../../../../utils/markdown/mdTable.js";
|
|
16
|
+
const colors = [red, blueMain, greenLight, orange];
|
|
17
|
+
const colorNames = ["rouge", "bleu", "vert", "orange"];
|
|
18
|
+
const createVector = (from, to, name, precision = 5) => {
|
|
19
|
+
return new Vector(name, round(substract(to.x, from.x).evaluate(), precision).toTree(), round(substract(to.y, from.y).evaluate(), precision).toTree());
|
|
20
|
+
};
|
|
21
|
+
const createPoint = (x, y, name, precision = 5) => {
|
|
22
|
+
return new Point(name, round(x, precision), round(y, precision));
|
|
23
|
+
};
|
|
24
|
+
const rotatePoint = (target, angle, center, name, precision = 2) => {
|
|
25
|
+
const vSrc = createVector(center, target, "vSrc", precision);
|
|
26
|
+
const vRotated = vSrc.rotate(angle, "vRotated");
|
|
27
|
+
return createPoint(add(center.x, vRotated.x).evaluate(), add(center.y, vRotated.y).evaluate(), name, precision);
|
|
28
|
+
};
|
|
29
|
+
const createPointWithWeights = (arrPointAndWeight) => {
|
|
30
|
+
return arrPointAndWeight.reduce((acc, [p, w]) => {
|
|
31
|
+
return new Point("acc", acc.x.evaluate() + w * p.x.evaluate(), acc.y.evaluate() + w * p.y.evaluate());
|
|
32
|
+
}, new Point("O", 0, 0));
|
|
33
|
+
};
|
|
34
|
+
const probaWheelGGBCommands = (arrItem) => {
|
|
35
|
+
const radius = 12;
|
|
36
|
+
const point0 = new Point("O", 0, 0);
|
|
37
|
+
function createWheelItemGGBCommands(wheelItem, i, angleInDegreesSector) {
|
|
38
|
+
const angleInRadiansSector = (angleInDegreesSector * PiNode.evaluate()) / 180.0;
|
|
39
|
+
const point1Raw = new Point("P1", radius, 0);
|
|
40
|
+
const point2Raw = new Point("P2", radius * Math.cos(angleInRadiansSector), radius * Math.sin(angleInRadiansSector));
|
|
41
|
+
const angleInRadiansRotate = (2 * PiNode.evaluate() * (1.0 * i + 0.5)) / arrItem.length + //center wrt sector
|
|
42
|
+
(PiNode.evaluate() * 3.0) / 2.0; //put first sector on top
|
|
43
|
+
const [point1, point2] = [point1Raw, point2Raw].map((pointRaw) => {
|
|
44
|
+
return rotatePoint(pointRaw, -angleInRadiansRotate, point0, "rotated", 3);
|
|
45
|
+
});
|
|
46
|
+
const pointForLabel = createPointWithWeights([
|
|
47
|
+
[point0, 0.24],
|
|
48
|
+
[point1, 0.38],
|
|
49
|
+
[point2, 0.38],
|
|
50
|
+
]);
|
|
51
|
+
return [
|
|
52
|
+
//circular sector
|
|
53
|
+
`C_${i} = CircularSector(${point0.toMathString()}, ${point1.toMathString()}, ${point2.toMathString()})`,
|
|
54
|
+
`SetFixed(C_${i}, true, false)`,
|
|
55
|
+
`SetColor(C_${i}, "${colorWithOpacity(colors[wheelItem.indexColor], 80)}")`,
|
|
56
|
+
`SetLineThickness(C_${i}, 1)`,
|
|
57
|
+
//border
|
|
58
|
+
`Cb_${i} = CircularSector(${point0.toMathString()}, ${point1.toMathString()}, ${point2.toMathString()})`,
|
|
59
|
+
`SetFixed(Cb_${i}, true, false)`,
|
|
60
|
+
`SetColor(Cb_${i}, "#FF000000")`,
|
|
61
|
+
`SetLineThickness(Cb_${i}, 1)`,
|
|
62
|
+
//label
|
|
63
|
+
`L_${i} = Text("$\\large \\text{${wheelItem.value}}$", ${pointForLabel.toMathString()}, false, true, 0, 0)`,
|
|
64
|
+
`SetFixed(L_${i}, true, false)`,
|
|
65
|
+
];
|
|
66
|
+
}
|
|
67
|
+
return [
|
|
68
|
+
...arrItem.flatMap((wheelItem, i) => {
|
|
69
|
+
const angleInDegreesSector = 360.0 * (1.0 / arrItem.length);
|
|
70
|
+
const itemCommands = createWheelItemGGBCommands(wheelItem, i, angleInDegreesSector);
|
|
71
|
+
return [...itemCommands];
|
|
72
|
+
}),
|
|
73
|
+
//circle border
|
|
74
|
+
`C = Circle(${point0.toMathString()}, ${radius * 1.05})`,
|
|
75
|
+
`SetFixed(C, true, false)`,
|
|
76
|
+
//triangle
|
|
77
|
+
...(() => {
|
|
78
|
+
const pointTL = new Point("TL", -0.03 * radius, radius + 0.03 * radius);
|
|
79
|
+
const pointTR = new Point("TR", +0.03 * radius, radius + 0.03 * radius);
|
|
80
|
+
const pointB = new Point("TB", 0, radius - 0.03 * radius);
|
|
81
|
+
return [
|
|
82
|
+
`T = Polygon(${pointTL.toMathString()},${pointTR.toMathString()},${pointB.toMathString()})`,
|
|
83
|
+
`SetFilling(T, 1)`,
|
|
84
|
+
`SetColor(T, "#FF000000")`,
|
|
85
|
+
`SetFixed(T, true, false)`,
|
|
86
|
+
];
|
|
87
|
+
})(),
|
|
88
|
+
];
|
|
89
|
+
};
|
|
90
|
+
const getDictEventsAndProba = (arrItem) => {
|
|
91
|
+
const outDict = {};
|
|
92
|
+
const indexesColorsUsed = [
|
|
93
|
+
...new Set(arrItem.map((wheelItem) => wheelItem.indexColor)),
|
|
94
|
+
];
|
|
95
|
+
//couleur
|
|
96
|
+
{
|
|
97
|
+
const dictColor = indexesColorsUsed.reduce((acc, i) => {
|
|
98
|
+
const nbIssues = arrItem.filter((itemX) => itemX.indexColor === i).length;
|
|
99
|
+
const nodeProba = frac(nbIssues, arrItem.length);
|
|
100
|
+
acc[i] = nodeProba;
|
|
101
|
+
return acc;
|
|
102
|
+
}, {});
|
|
103
|
+
outDict["couleur"] = dictColor;
|
|
104
|
+
}
|
|
105
|
+
const valuesUsed = [...new Set(arrItem.map((wheelItem) => wheelItem.value))];
|
|
106
|
+
//numéro
|
|
107
|
+
{
|
|
108
|
+
const dictValue = valuesUsed.reduce((acc, i) => {
|
|
109
|
+
const nbIssues = arrItem.filter((itemX) => itemX.value === i).length;
|
|
110
|
+
const nodeProba = frac(nbIssues, arrItem.length);
|
|
111
|
+
acc[i] = nodeProba;
|
|
112
|
+
return acc;
|
|
113
|
+
}, {});
|
|
114
|
+
outDict["numéro"] = dictValue;
|
|
115
|
+
}
|
|
116
|
+
//parité
|
|
117
|
+
{
|
|
118
|
+
const dictColor = [0, 1].reduce((acc, i) => {
|
|
119
|
+
const nbIssues = arrItem.filter((itemX) => itemX.value % 2 === i).length;
|
|
120
|
+
const nodeProba = frac(nbIssues, arrItem.length);
|
|
121
|
+
acc[i] = nodeProba;
|
|
122
|
+
return acc;
|
|
123
|
+
}, {});
|
|
124
|
+
outDict["parité"] = dictColor;
|
|
125
|
+
}
|
|
126
|
+
return outDict;
|
|
127
|
+
};
|
|
128
|
+
const getStrEvent = (typeAsked, indexEvent) => {
|
|
129
|
+
switch (typeAsked) {
|
|
130
|
+
case "couleur":
|
|
131
|
+
return `Le secteur obtenu est ${colorNames[indexEvent]}`;
|
|
132
|
+
case "numéro":
|
|
133
|
+
return `Le secteur obtenu a pour numéro $${indexEvent.frenchify()}$`;
|
|
134
|
+
case "parité":
|
|
135
|
+
return `Le secteur obtenu a un numéro ${indexEvent === 0 ? "pair" : "impair"}`;
|
|
136
|
+
default:
|
|
137
|
+
throw new Error("Unsupported typeAsked: " + typeAsked);
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
const getIndexEvent = (wheelItem, typeAsked) => {
|
|
141
|
+
switch (typeAsked) {
|
|
142
|
+
case "couleur":
|
|
143
|
+
return wheelItem.indexColor;
|
|
144
|
+
case "numéro":
|
|
145
|
+
return wheelItem.value;
|
|
146
|
+
case "parité":
|
|
147
|
+
return wheelItem.value % 2;
|
|
148
|
+
default:
|
|
149
|
+
throw new Error("Unsupported typeAsked: " + typeAsked);
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
const getValidInvalidPools = (identifiers) => {
|
|
153
|
+
const { arrItem, typeAsked } = identifiers;
|
|
154
|
+
const dictEventsAndProba = getDictEventsAndProba(arrItem);
|
|
155
|
+
const wheelItemAsked = arrItem[0];
|
|
156
|
+
const indexAsked = getIndexEvent(wheelItemAsked, typeAsked);
|
|
157
|
+
const nodeProbaAsked = dictEventsAndProba[typeAsked][indexAsked].simplify();
|
|
158
|
+
const arrOtherEventAndProba = Object.entries(dictEventsAndProba).reduce((acc, [typeEvent, dictProba]) => {
|
|
159
|
+
acc.push(...Object.entries(dictProba).flatMap(([s, nodeProba]) => {
|
|
160
|
+
const indexEvent = +s;
|
|
161
|
+
if (typeEvent === typeAsked && indexEvent === indexAsked) {
|
|
162
|
+
return [];
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
return [{ typeEvent, indexEvent, nodeProba }];
|
|
166
|
+
}
|
|
167
|
+
}));
|
|
168
|
+
return acc;
|
|
169
|
+
}, []);
|
|
170
|
+
const [validPool, invalidPool] = arrOtherEventAndProba.reduce((acc, miniDict) => {
|
|
171
|
+
const isSameAsProbaAsked = substract(miniDict.nodeProba.simplify(), nodeProbaAsked)
|
|
172
|
+
.simplify()
|
|
173
|
+
.evaluate() === 0;
|
|
174
|
+
acc[isSameAsProbaAsked ? 0 : 1].push(miniDict);
|
|
175
|
+
return acc;
|
|
176
|
+
}, [[], []]);
|
|
177
|
+
return [validPool, invalidPool];
|
|
178
|
+
};
|
|
179
|
+
const getInstruction = (identifiers) => {
|
|
180
|
+
const { arrItem, typeAsked } = identifiers;
|
|
181
|
+
const wheelItemAsked = arrItem[0];
|
|
182
|
+
return `On fait tourner la roue ci-dessous, dont les $${arrItem.length}$ secteurs ont la même aire.
|
|
183
|
+
|
|
184
|
+
On réalise l'événement "${getStrEvent(typeAsked, getIndexEvent(wheelItemAsked, typeAsked))}".
|
|
185
|
+
|
|
186
|
+
Parmi les évènements proposés, lesquels sont équiprobables à l'évènement réalisé ?`;
|
|
187
|
+
};
|
|
188
|
+
const getGGBOptions = (identifiers) => {
|
|
189
|
+
const { arrItem } = identifiers;
|
|
190
|
+
const ggb = new GeogebraConstructor({
|
|
191
|
+
commands: [...probaWheelGGBCommands(arrItem)],
|
|
192
|
+
hideAxes: true,
|
|
193
|
+
hideGrid: true,
|
|
194
|
+
forbidShiftDragZoom: true,
|
|
195
|
+
});
|
|
196
|
+
return ggb.getOptions({
|
|
197
|
+
coords: [-15, 15, -15, 15],
|
|
198
|
+
});
|
|
199
|
+
};
|
|
200
|
+
const getHint = () => {
|
|
201
|
+
return `Compte le nombre d'issues réalisent chaque évènement et cherche lesquels sont égaux entre eux.`;
|
|
202
|
+
};
|
|
203
|
+
const getCorrection = (identifiers) => {
|
|
204
|
+
const { arrItem, typeAsked } = identifiers;
|
|
205
|
+
const wheelItemAsked = arrItem[0];
|
|
206
|
+
const dictEventsAndProba = getDictEventsAndProba(arrItem);
|
|
207
|
+
const indexAsked = getIndexEvent(wheelItemAsked, typeAsked);
|
|
208
|
+
const nodeProbaAsked = dictEventsAndProba[typeAsked][indexAsked];
|
|
209
|
+
const [validPool] = getValidInvalidPools(identifiers);
|
|
210
|
+
return `Pour cette roue de $${arrItem.length}$ secteurs, voici quelques événèments réalisables avec leur probabilité :
|
|
211
|
+
|
|
212
|
+
${mdTable([
|
|
213
|
+
["Évènement", "Probabilité"],
|
|
214
|
+
["", ""],
|
|
215
|
+
...Object.entries(dictEventsAndProba["couleur"]).map(([s, nodeProba]) => {
|
|
216
|
+
const indexEvent = +s;
|
|
217
|
+
return [getStrEvent("couleur", indexEvent), `$${nodeProba.toTex()}$`];
|
|
218
|
+
}),
|
|
219
|
+
["", ""],
|
|
220
|
+
...Object.entries(dictEventsAndProba["numéro"]).map(([s, nodeProba]) => {
|
|
221
|
+
const indexEvent = +s;
|
|
222
|
+
return [getStrEvent("numéro", indexEvent), `$${nodeProba.toTex()}$`];
|
|
223
|
+
}),
|
|
224
|
+
["", ""],
|
|
225
|
+
...Object.entries(dictEventsAndProba["parité"]).map(([s, nodeProba]) => {
|
|
226
|
+
const indexEvent = +s;
|
|
227
|
+
return [getStrEvent("parité", indexEvent), `$${nodeProba.toTex()}$`];
|
|
228
|
+
}),
|
|
229
|
+
["", ""],
|
|
230
|
+
])}
|
|
231
|
+
|
|
232
|
+
L'évènement "${getStrEvent(typeAsked, getIndexEvent(wheelItemAsked, typeAsked))}" a pour probabilité $${nodeProbaAsked.toTex()}$.
|
|
233
|
+
|
|
234
|
+
Voici les autres évènements du tableau ayant pour probabilité $${nodeProbaAsked.toTex()}$ :
|
|
235
|
+
|
|
236
|
+
${validPool
|
|
237
|
+
.map(({ typeEvent, indexEvent }) => {
|
|
238
|
+
return getStrEvent(typeEvent, indexEvent);
|
|
239
|
+
})
|
|
240
|
+
.map((str) => `- ${str}`).join(`
|
|
241
|
+
`)}
|
|
242
|
+
|
|
243
|
+
`;
|
|
244
|
+
};
|
|
245
|
+
const getPropositions = (n, { answer, ...identifiers }) => {
|
|
246
|
+
const propositions = [];
|
|
247
|
+
const [validPool, invalidPool] = getValidInvalidPools(identifiers);
|
|
248
|
+
const nbValid = randint(1, validPool.length);
|
|
249
|
+
shuffle(validPool)
|
|
250
|
+
.slice(0, nbValid)
|
|
251
|
+
.forEach((miniDict) => {
|
|
252
|
+
const strEvent = getStrEvent(miniDict.typeEvent, miniDict.indexEvent);
|
|
253
|
+
addValidProp(propositions, strEvent, "raw");
|
|
254
|
+
});
|
|
255
|
+
const nbInvalid = n - nbValid;
|
|
256
|
+
shuffle(invalidPool)
|
|
257
|
+
.slice(0, nbInvalid)
|
|
258
|
+
.forEach((miniDict) => {
|
|
259
|
+
const strEvent = getStrEvent(miniDict.typeEvent, miniDict.indexEvent);
|
|
260
|
+
tryToAddWrongProp(propositions, strEvent, "raw");
|
|
261
|
+
});
|
|
262
|
+
return shuffleProps(propositions, n);
|
|
263
|
+
};
|
|
264
|
+
const getPickEquiprobableToQuestion = () => {
|
|
265
|
+
const typeAsked = random(["couleur", "numéro", "parité"]);
|
|
266
|
+
const nbWheelItems = randint(5, 11);
|
|
267
|
+
function createRandomArrItem(nbWheelItems) {
|
|
268
|
+
function* genFuncWheelItemValue() {
|
|
269
|
+
const nbDifferent = randint(3, nbWheelItems);
|
|
270
|
+
const arrValue = randomMany([...Array(10).keys()], nbDifferent);
|
|
271
|
+
yield* shuffle([...arrValue]);
|
|
272
|
+
while (true) {
|
|
273
|
+
yield random(arrValue);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
const generateWheelItemValue = genFuncWheelItemValue();
|
|
277
|
+
function* genFuncWheelItemColor() {
|
|
278
|
+
const arrColor = [...Array(colors.length).keys()];
|
|
279
|
+
yield* shuffle([...arrColor]);
|
|
280
|
+
while (true) {
|
|
281
|
+
yield random(arrColor);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
const generateWheelItemColor = genFuncWheelItemColor();
|
|
285
|
+
const arrItem = [...Array(nbWheelItems).keys()].map(() => {
|
|
286
|
+
return {
|
|
287
|
+
value: generateWheelItemValue.next().value,
|
|
288
|
+
indexColor: generateWheelItemColor.next().value,
|
|
289
|
+
};
|
|
290
|
+
});
|
|
291
|
+
return arrItem;
|
|
292
|
+
}
|
|
293
|
+
let identifiers;
|
|
294
|
+
let counter = -1;
|
|
295
|
+
let isValid = false;
|
|
296
|
+
while (!isValid && counter < 100) {
|
|
297
|
+
counter++;
|
|
298
|
+
const arrItem = createRandomArrItem(nbWheelItems);
|
|
299
|
+
const identifiersCandidate = {
|
|
300
|
+
arrItem,
|
|
301
|
+
typeAsked,
|
|
302
|
+
};
|
|
303
|
+
const [validPool] = getValidInvalidPools(identifiersCandidate);
|
|
304
|
+
isValid = validPool.length > 0;
|
|
305
|
+
if (isValid) {
|
|
306
|
+
identifiers = identifiersCandidate;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
if (!isValid) {
|
|
310
|
+
identifiers = {
|
|
311
|
+
arrItem: [
|
|
312
|
+
{
|
|
313
|
+
value: 0,
|
|
314
|
+
indexColor: 0,
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
value: 1,
|
|
318
|
+
indexColor: 0,
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
value: 2,
|
|
322
|
+
indexColor: 0,
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
value: 3,
|
|
326
|
+
indexColor: 1,
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
value: 4,
|
|
330
|
+
indexColor: 0,
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
value: 5,
|
|
334
|
+
indexColor: 1,
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
value: 6,
|
|
338
|
+
indexColor: 2,
|
|
339
|
+
},
|
|
340
|
+
],
|
|
341
|
+
typeAsked: "numéro",
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
345
|
+
};
|
|
346
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
347
|
+
return {
|
|
348
|
+
instruction: getInstruction(identifiers),
|
|
349
|
+
ggbOptions: getGGBOptions(identifiers),
|
|
350
|
+
answerFormat: "tex",
|
|
351
|
+
identifiers,
|
|
352
|
+
hint: getHint(identifiers),
|
|
353
|
+
correction: getCorrection(identifiers),
|
|
354
|
+
};
|
|
355
|
+
};
|
|
356
|
+
export const pickEquiprobableTo = {
|
|
357
|
+
id: "pickEquiprobableTo",
|
|
358
|
+
connector: "=",
|
|
359
|
+
label: "Déterminer les situations équiprobables",
|
|
360
|
+
isSingleStep: true,
|
|
361
|
+
generator: (nb, opts) => getDistinctQuestions(() => getPickEquiprobableToQuestion(opts), nb),
|
|
362
|
+
qcmTimer: 60,
|
|
363
|
+
freeTimer: 60,
|
|
364
|
+
getPropositions,
|
|
365
|
+
subject: "Mathématiques",
|
|
366
|
+
getInstruction,
|
|
367
|
+
getHint,
|
|
368
|
+
getCorrection,
|
|
369
|
+
getQuestionFromIdentifiers,
|
|
370
|
+
hasHintAndCorrection: true,
|
|
371
|
+
answerType: "QCM",
|
|
372
|
+
isQCM: true,
|
|
373
|
+
hasGeogebra: true,
|
|
374
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"probaFromTableNoContext.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/probaFromTableNoContext.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAarC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;
|
|
1
|
+
{"version":3,"file":"probaFromTableNoContext.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/probaFromTableNoContext.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAarC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAkUF,KAAK,OAAO,GAAG;IAEb,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B,CAAC;AA+BF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAgBlE,CAAC"}
|
|
@@ -226,6 +226,13 @@ const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
|
226
226
|
identifiers,
|
|
227
227
|
hint: getHint(identifiers, opts),
|
|
228
228
|
correction: getCorrection(identifiers, opts),
|
|
229
|
+
style: {
|
|
230
|
+
tableOptions: {
|
|
231
|
+
firstColumnIsHeader: true,
|
|
232
|
+
firstCellIsDivided: false,
|
|
233
|
+
firstRowIsHeader: true,
|
|
234
|
+
},
|
|
235
|
+
},
|
|
229
236
|
};
|
|
230
237
|
return question;
|
|
231
238
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"probaFromTableWithContext.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/probaFromTableWithContext.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAmBT,MAAM,6BAA6B,CAAC;AAerC,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE;QACN,WAAW,EAAE,MAAM,CAAC;QACpB,uBAAuB,EAAE,MAAM,CAAC;QAChC,uBAAuB,EAAE,MAAM,CAAC;QAChC,mCAAmC,EAAE,MAAM,CAAC;KAC7C,CAAC;IACF,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B,CAAC;
|
|
1
|
+
{"version":3,"file":"probaFromTableWithContext.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/probaFromTableWithContext.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAmBT,MAAM,6BAA6B,CAAC;AAerC,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE;QACN,WAAW,EAAE,MAAM,CAAC;QACpB,uBAAuB,EAAE,MAAM,CAAC;QAChC,uBAAuB,EAAE,MAAM,CAAC;QAChC,mCAAmC,EAAE,MAAM,CAAC;KAC7C,CAAC;IACF,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B,CAAC;AA4pBF,KAAK,OAAO,GAAG;IACb,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B,CAAC;AAsBF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAiBpE,CAAC"}
|
|
@@ -329,6 +329,13 @@ const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
|
329
329
|
hint: getHint(identifiers),
|
|
330
330
|
correction: getCorrection(identifiers),
|
|
331
331
|
options: opts,
|
|
332
|
+
style: {
|
|
333
|
+
tableOptions: {
|
|
334
|
+
firstColumnIsHeader: true,
|
|
335
|
+
firstCellIsDivided: false,
|
|
336
|
+
firstRowIsHeader: true,
|
|
337
|
+
},
|
|
338
|
+
},
|
|
332
339
|
};
|
|
333
340
|
return question;
|
|
334
341
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
bounds: number[];
|
|
4
|
+
situation: number;
|
|
5
|
+
effectifs: number[];
|
|
6
|
+
};
|
|
7
|
+
export declare const averageWithClasses: Exercise<Identifiers>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=averageWithClasses.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"averageWithClasses.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats1var/averageWithClasses.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAgBrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAqIF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAkBpD,CAAC"}
|