math-exercises 3.0.172 → 3.0.174
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/functions/trinoms/devForm/variationsFromAlgebricForm.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/devForm/variationsFromAlgebricForm.js +12 -0
- package/lib/exercises/math/functions/trinoms/parabole/index.d.ts +2 -0
- package/lib/exercises/math/functions/trinoms/parabole/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/parabole/index.js +2 -0
- package/lib/exercises/math/functions/trinoms/parabole/parabolaVarTable.d.ts +8 -0
- package/lib/exercises/math/functions/trinoms/parabole/parabolaVarTable.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/parabole/parabolaVarTable.js +106 -0
- package/lib/exercises/math/functions/trinoms/parabole/paraboleSolveGraphEquation.d.ts +14 -0
- package/lib/exercises/math/functions/trinoms/parabole/paraboleSolveGraphEquation.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/parabole/paraboleSolveGraphEquation.js +186 -0
- package/lib/exercises/math/functions/trinoms/roots/rootsFromDevForm.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/roots/rootsFromDevForm.js +0 -1
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/extremumTypeFromAlgebricForm.d.ts +6 -2
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/extremumTypeFromAlgebricForm.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/extremumTypeFromAlgebricForm.js +98 -13
- 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/lines/readLineNormalVectorOnGraph.d.ts +13 -0
- package/lib/exercises/math/geometry/lines/readLineNormalVectorOnGraph.d.ts.map +1 -0
- package/lib/exercises/math/geometry/lines/readLineNormalVectorOnGraph.js +195 -0
- package/lib/exercises/math/probaStat/randomVariable/index.d.ts +1 -0
- package/lib/exercises/math/probaStat/randomVariable/index.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/randomVariable/index.js +1 -0
- package/lib/exercises/math/probaStat/randomVariable/missingValueInRandomVariableProbabilityLaw.d.ts +9 -0
- package/lib/exercises/math/probaStat/randomVariable/missingValueInRandomVariableProbabilityLaw.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/missingValueInRandomVariableProbabilityLaw.js +119 -0
- package/lib/exercises/math/probaStat/trees/buildTreeFromSituation.d.ts +2 -0
- package/lib/exercises/math/probaStat/trees/buildTreeFromSituation.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/trees/buildTreeFromSituation.js +68 -0
- package/lib/exercises/math/probaStat/trees/fillProbaTreeWithComplementaryProbabilities.d.ts +15 -0
- package/lib/exercises/math/probaStat/trees/fillProbaTreeWithComplementaryProbabilities.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/trees/fillProbaTreeWithComplementaryProbabilities.js +206 -0
- package/lib/exercises/math/probaStat/trees/probaTreeSituations.d.ts +2 -0
- package/lib/exercises/math/probaStat/trees/probaTreeSituations.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/trees/probaTreeSituations.js +108 -0
- package/lib/exercises/math/probaStat/trees/probabilityTree.d.ts +25 -0
- package/lib/exercises/math/probaStat/trees/probabilityTree.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/trees/probabilityTree.js +625 -0
- package/lib/exercises/math/probaStat/trees/treeInAnswer.d.ts +9 -0
- package/lib/exercises/math/probaStat/trees/treeInAnswer.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/trees/treeInAnswer.js +107 -0
- package/lib/exercises/math/python/sequences/index.d.ts +8 -0
- package/lib/exercises/math/python/sequences/index.d.ts.map +1 -0
- package/lib/exercises/math/python/sequences/index.js +7 -0
- package/lib/exercises/math/python/sequences/pySequenceFactorialInstructionFalseOneOut.d.ts +11 -0
- package/lib/exercises/math/python/sequences/pySequenceFactorialInstructionFalseOneOut.d.ts.map +1 -0
- package/lib/exercises/math/python/sequences/pySequenceFactorialInstructionFalseOneOut.js +274 -0
- package/lib/exercises/math/python/sequences/pySequenceFirstTermsListInstructionCompletion.d.ts +12 -0
- package/lib/exercises/math/python/sequences/pySequenceFirstTermsListInstructionCompletion.d.ts.map +1 -0
- package/lib/exercises/math/python/sequences/pySequenceFirstTermsListInstructionCompletion.js +368 -0
- package/lib/exercises/math/python/sequences/pySequenceFirstTermsSumInstructionCompletion.d.ts +13 -0
- package/lib/exercises/math/python/sequences/pySequenceFirstTermsSumInstructionCompletion.d.ts.map +1 -0
- package/lib/exercises/math/python/sequences/pySequenceFirstTermsSumInstructionCompletion.js +254 -0
- package/lib/exercises/math/python/sequences/pySequenceProgramReading.d.ts +14 -0
- package/lib/exercises/math/python/sequences/pySequenceProgramReading.d.ts.map +1 -0
- package/lib/exercises/math/python/sequences/pySequenceProgramReading.js +365 -0
- package/lib/exercises/math/python/sequences/pySequenceTermForLoopInstructionCompletion.d.ts +11 -0
- package/lib/exercises/math/python/sequences/pySequenceTermForLoopInstructionCompletion.d.ts.map +1 -0
- package/lib/exercises/math/python/sequences/pySequenceTermForLoopInstructionCompletion.js +298 -0
- package/lib/exercises/math/python/sequences/pySequenceTermFromFunctionCallInstructionCompletion.d.ts +12 -0
- package/lib/exercises/math/python/sequences/pySequenceTermFromFunctionCallInstructionCompletion.d.ts.map +1 -0
- package/lib/exercises/math/python/sequences/pySequenceTermFromFunctionCallInstructionCompletion.js +408 -0
- package/lib/exercises/math/python/sequences/pySequenceThresholdInstructionCompletion.d.ts +17 -0
- package/lib/exercises/math/python/sequences/pySequenceThresholdInstructionCompletion.d.ts.map +1 -0
- package/lib/exercises/math/python/sequences/pySequenceThresholdInstructionCompletion.js +498 -0
- package/lib/exercises/math/sequences/arithmetic/arithmeticFindExplicitFormulaFromTwoTerms.d.ts +12 -0
- package/lib/exercises/math/sequences/arithmetic/arithmeticFindExplicitFormulaFromTwoTerms.d.ts.map +1 -0
- package/lib/exercises/math/sequences/arithmetic/arithmeticFindExplicitFormulaFromTwoTerms.js +191 -0
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindExplicitFormulaFromSituation.d.ts +14 -0
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindExplicitFormulaFromSituation.d.ts.map +1 -0
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindExplicitFormulaFromSituation.js +153 -0
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRankFromSituation.d.ts +15 -0
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRankFromSituation.d.ts.map +1 -0
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRankFromSituation.js +184 -0
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRecurrenceFormulaFromSituation.d.ts +14 -0
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRecurrenceFormulaFromSituation.d.ts.map +1 -0
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRecurrenceFormulaFromSituation.js +210 -0
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindTermFromSituation.d.ts +15 -0
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindTermFromSituation.d.ts.map +1 -0
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindTermFromSituation.js +161 -0
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindThresholdFromSituation.d.ts +17 -0
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindThresholdFromSituation.d.ts.map +1 -0
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindThresholdFromSituation.js +188 -0
- package/lib/exercises/math/sequences/arithmetic/situations/index.d.ts +6 -0
- package/lib/exercises/math/sequences/arithmetic/situations/index.d.ts.map +1 -0
- package/lib/exercises/math/sequences/arithmetic/situations/index.js +5 -0
- package/lib/exercises/math/sequences/arithmetic/sum/arithmeticComputeSumWithDots.d.ts +15 -0
- package/lib/exercises/math/sequences/arithmetic/sum/arithmeticComputeSumWithDots.d.ts.map +1 -0
- package/lib/exercises/math/sequences/arithmetic/sum/arithmeticComputeSumWithDots.js +233 -0
- package/lib/exercises/math/sequences/arithmetic/sum/arithmeticFirstTermsSum.d.ts +13 -0
- package/lib/exercises/math/sequences/arithmetic/sum/arithmeticFirstTermsSum.d.ts.map +1 -0
- package/lib/exercises/math/sequences/arithmetic/sum/arithmeticFirstTermsSum.js +111 -0
- package/lib/exercises/math/sequences/arithmetic/sum/arithmeticFirstTermsSumThreshold.d.ts +13 -0
- package/lib/exercises/math/sequences/arithmetic/sum/arithmeticFirstTermsSumThreshold.d.ts.map +1 -0
- package/lib/exercises/math/sequences/arithmetic/sum/arithmeticFirstTermsSumThreshold.js +216 -0
- package/lib/exercises/math/sequences/arithmetic/sum/firstIntegersSum.d.ts +7 -0
- package/lib/exercises/math/sequences/arithmetic/sum/firstIntegersSum.d.ts.map +1 -0
- package/lib/exercises/math/sequences/arithmetic/sum/firstIntegersSum.js +94 -0
- package/lib/exercises/math/sequences/arithmetic/sum/index.d.ts +5 -0
- package/lib/exercises/math/sequences/arithmetic/sum/index.d.ts.map +1 -0
- package/lib/exercises/math/sequences/arithmetic/sum/index.js +4 -0
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormula.js +1 -1
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFirstRankOne.js +1 -1
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFirstTermRandom.d.ts +4 -1
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFirstTermRandom.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFirstTermRandom.js +66 -24
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoTerms.d.ts +14 -0
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoTerms.d.ts.map +1 -0
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoTerms.js +301 -0
- package/lib/exercises/math/sequences/geometric/geometricFindRandomTermFromTwoTerms.d.ts +15 -0
- package/lib/exercises/math/sequences/geometric/geometricFindRandomTermFromTwoTerms.d.ts.map +1 -0
- package/lib/exercises/math/sequences/geometric/geometricFindRandomTermFromTwoTerms.js +260 -0
- package/lib/exercises/math/sequences/geometric/situations/geometricFindExplicitFormulaFromSituation.d.ts +14 -0
- package/lib/exercises/math/sequences/geometric/situations/geometricFindExplicitFormulaFromSituation.d.ts.map +1 -0
- package/lib/exercises/math/sequences/geometric/situations/geometricFindExplicitFormulaFromSituation.js +186 -0
- package/lib/exercises/math/sequences/geometric/situations/geometricFindRankFromSituation.d.ts +15 -0
- package/lib/exercises/math/sequences/geometric/situations/geometricFindRankFromSituation.d.ts.map +1 -0
- package/lib/exercises/math/sequences/geometric/situations/geometricFindRankFromSituation.js +142 -0
- package/lib/exercises/math/sequences/geometric/situations/geometricFindRecurrenceFormulaFromSituation.d.ts +14 -0
- package/lib/exercises/math/sequences/geometric/situations/geometricFindRecurrenceFormulaFromSituation.d.ts.map +1 -0
- package/lib/exercises/math/sequences/geometric/situations/geometricFindRecurrenceFormulaFromSituation.js +205 -0
- package/lib/exercises/math/sequences/geometric/situations/geometricFindTermFromSituation.d.ts +15 -0
- package/lib/exercises/math/sequences/geometric/situations/geometricFindTermFromSituation.d.ts.map +1 -0
- package/lib/exercises/math/sequences/geometric/situations/geometricFindTermFromSituation.js +208 -0
- package/lib/exercises/math/sequences/geometric/situations/geometricFindThresholdFromSituation.d.ts +17 -0
- package/lib/exercises/math/sequences/geometric/situations/geometricFindThresholdFromSituation.d.ts.map +1 -0
- package/lib/exercises/math/sequences/geometric/situations/geometricFindThresholdFromSituation.js +152 -0
- package/lib/exercises/math/sequences/geometric/situations/index.d.ts +4 -0
- package/lib/exercises/math/sequences/geometric/situations/index.d.ts.map +1 -0
- package/lib/exercises/math/sequences/geometric/situations/index.js +5 -0
- package/lib/exercises/math/sequences/geometric/sum/geometricComputeSumWithDots.d.ts +15 -0
- package/lib/exercises/math/sequences/geometric/sum/geometricComputeSumWithDots.d.ts.map +1 -0
- package/lib/exercises/math/sequences/geometric/sum/geometricComputeSumWithDots.js +248 -0
- package/lib/exercises/math/sequences/geometric/sum/geometricFirstTermsGeneralSum.d.ts +14 -0
- package/lib/exercises/math/sequences/geometric/sum/geometricFirstTermsGeneralSum.d.ts.map +1 -0
- package/lib/exercises/math/sequences/geometric/sum/geometricFirstTermsGeneralSum.js +126 -0
- package/lib/exercises/math/sequences/geometric/sum/geometricFirstTermsSum.d.ts +8 -0
- package/lib/exercises/math/sequences/geometric/sum/geometricFirstTermsSum.d.ts.map +1 -0
- package/lib/exercises/math/sequences/geometric/sum/geometricFirstTermsSum.js +91 -0
- package/lib/exercises/math/sequences/geometric/sum/index.d.ts +4 -0
- package/lib/exercises/math/sequences/geometric/sum/index.d.ts.map +1 -0
- package/lib/exercises/math/sequences/geometric/sum/index.js +3 -0
- package/lib/exercises/math/sequences/seqArithmGeom/index.d.ts +2 -0
- package/lib/exercises/math/sequences/seqArithmGeom/index.d.ts.map +1 -0
- package/lib/exercises/math/sequences/seqArithmGeom/index.js +1 -0
- package/lib/exercises/math/sequences/seqArithmGeom/seqArithmGeomRecurrenceFormulaUsage.d.ts +14 -0
- package/lib/exercises/math/sequences/seqArithmGeom/seqArithmGeomRecurrenceFormulaUsage.d.ts.map +1 -0
- package/lib/exercises/math/sequences/seqArithmGeom/seqArithmGeomRecurrenceFormulaUsage.js +202 -0
- package/lib/exercises/math/trigonometry/circle/index.d.ts +1 -0
- package/lib/exercises/math/trigonometry/circle/index.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/circle/index.js +1 -0
- package/lib/exercises/math/trigonometry/circle/selectQuadrantOnTrigoCircle.d.ts +2 -0
- package/lib/exercises/math/trigonometry/circle/selectQuadrantOnTrigoCircle.d.ts.map +1 -0
- package/lib/exercises/math/trigonometry/circle/selectQuadrantOnTrigoCircle.js +94 -0
- package/lib/exercises/math/trigonometry/circle/trigoFunctionsFundamentalEquation.d.ts +10 -0
- package/lib/exercises/math/trigonometry/circle/trigoFunctionsFundamentalEquation.d.ts.map +1 -0
- package/lib/exercises/math/trigonometry/circle/trigoFunctionsFundamentalEquation.js +223 -0
- package/lib/exercises/math/trigonometry/functions/basicEquationCos.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/functions/basicEquationCos.js +2 -1
- package/lib/exercises/math/trigonometry/functions/cosInequationMainInterval.d.ts +10 -0
- package/lib/exercises/math/trigonometry/functions/cosInequationMainInterval.d.ts.map +1 -0
- package/lib/exercises/math/trigonometry/functions/cosInequationMainInterval.js +208 -0
- package/lib/exercises/math/trigonometry/functions/equationSinOnRandomInterval.d.ts +0 -6
- package/lib/exercises/math/trigonometry/functions/equationSinOnRandomInterval.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/functions/equationSinOnRandomInterval.js +162 -99
- package/lib/exercises/math/trigonometry/functions/index.d.ts +3 -0
- package/lib/exercises/math/trigonometry/functions/index.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/functions/index.js +3 -0
- package/lib/exercises/math/trigonometry/functions/readPeriodicityOnFunctionGraph.d.ts +12 -0
- package/lib/exercises/math/trigonometry/functions/readPeriodicityOnFunctionGraph.d.ts.map +1 -0
- package/lib/exercises/math/trigonometry/functions/readPeriodicityOnFunctionGraph.js +159 -0
- package/lib/exercises/math/trigonometry/functions/sinInequationMainInterval.d.ts +10 -0
- package/lib/exercises/math/trigonometry/functions/sinInequationMainInterval.d.ts.map +1 -0
- package/lib/exercises/math/trigonometry/functions/sinInequationMainInterval.js +224 -0
- package/lib/exercises/math/trigonometry/trigoFundamentalEquation.js +1 -1
- package/lib/exercises/options/optionFirstTermRankOne.d.ts +16 -0
- package/lib/exercises/options/optionFirstTermRankOne.d.ts.map +1 -0
- package/lib/exercises/options/optionFirstTermRankOne.js +17 -0
- package/lib/exercises/options/optionIsUsePythonDef.d.ts +16 -0
- package/lib/exercises/options/optionIsUsePythonDef.d.ts.map +1 -0
- package/lib/exercises/options/optionIsUsePythonDef.js +17 -0
- package/lib/exercises/options/optionIsWithSuperfluousData.d.ts +16 -0
- package/lib/exercises/options/optionIsWithSuperfluousData.d.ts.map +1 -0
- package/lib/exercises/options/optionIsWithSuperfluousData.js +17 -0
- package/lib/exercises/utils/geogebra/toGGBCommandsProps.d.ts +1 -0
- package/lib/exercises/utils/geogebra/toGGBCommandsProps.d.ts.map +1 -1
- package/lib/exercises/vea/colinearVectorVEA.d.ts +2 -0
- package/lib/exercises/vea/colinearVectorVEA.d.ts.map +1 -0
- package/lib/exercises/vea/colinearVectorVEA.js +11 -0
- package/lib/exercises/vea/treeTableVEA.d.ts +2 -0
- package/lib/exercises/vea/treeTableVEA.d.ts.map +1 -0
- package/lib/exercises/vea/treeTableVEA.js +7 -0
- package/lib/exercises/vea/varLineVEA.d.ts.map +1 -1
- package/lib/exercises/vea/varLineVEA.js +5 -2
- package/lib/index.d.ts +44 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/math/geometry/line.d.ts +1 -1
- package/lib/math/geometry/line.d.ts.map +1 -1
- package/lib/math/geometry/line.js +3 -3
- package/lib/math/geometry/point.d.ts +1 -1
- package/lib/math/geometry/point.d.ts.map +1 -1
- package/lib/math/geometry/point.js +4 -1
- package/lib/math/utils/sequences/situations/seqArithmeticSituations.d.ts +53 -0
- package/lib/math/utils/sequences/situations/seqArithmeticSituations.d.ts.map +1 -0
- package/lib/math/utils/sequences/situations/seqArithmeticSituations.js +1928 -0
- package/lib/math/utils/sequences/situations/seqArithmeticUtils.d.ts +15 -0
- package/lib/math/utils/sequences/situations/seqArithmeticUtils.d.ts.map +1 -0
- package/lib/math/utils/sequences/situations/seqArithmeticUtils.js +136 -0
- package/lib/math/utils/sequences/situations/seqGeometricSituations.d.ts +42 -0
- package/lib/math/utils/sequences/situations/seqGeometricSituations.d.ts.map +1 -0
- package/lib/math/utils/sequences/situations/seqGeometricSituations.js +932 -0
- package/lib/math/utils/sequences/situations/seqGeometricUtils.d.ts +12 -0
- package/lib/math/utils/sequences/situations/seqGeometricUtils.d.ts.map +1 -0
- package/lib/math/utils/sequences/situations/seqGeometricUtils.js +90 -0
- package/lib/tests/exosTest.d.ts.map +1 -1
- package/lib/tests/exosTest.js +0 -2
- package/lib/tree/nodes/inequations/inequationNode.d.ts +1 -0
- package/lib/tree/nodes/inequations/inequationNode.d.ts.map +1 -1
- package/lib/tree/nodes/inequations/inequationNode.js +16 -0
- package/lib/tree/nodes/operators/binomialCoefficientNode.d.ts +3 -3
- package/lib/tree/nodes/operators/binomialCoefficientNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/binomialCoefficientNode.js +6 -3
- package/lib/tree/parsers/vectorParser.d.ts.map +1 -1
- package/lib/tree/parsers/vectorParser.js +8 -0
- package/lib/utils/latex/poundify.d.ts +2 -0
- package/lib/utils/latex/poundify.d.ts.map +1 -0
- package/lib/utils/latex/poundify.js +3 -0
- package/package.json +1 -1
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, GeneratorOptionType, GeneratorOptionTarget, propWhile, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { colinearVectorVEA } from "../../../../exercises/vea/colinearVectorVEA.js";
|
|
4
|
+
import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
|
|
5
|
+
import { Line } from "../../../../math/geometry/line.js";
|
|
6
|
+
import { PointConstructor, } from "../../../../math/geometry/point.js";
|
|
7
|
+
import { Vector, VectorConstructor } from "../../../../math/geometry/vector.js";
|
|
8
|
+
import { RationalConstructor } from "../../../../math/numbers/rationals/rational.js";
|
|
9
|
+
import { opposite } from "../../../../tree/nodes/functions/oppositeNode.js";
|
|
10
|
+
import { vectorParser } from "../../../../tree/parsers/vectorParser.js";
|
|
11
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
12
|
+
const getPropositions = (n, { answer }) => {
|
|
13
|
+
const propositions = [];
|
|
14
|
+
addValidProp(propositions, answer);
|
|
15
|
+
propWhile(propositions, n, () => {
|
|
16
|
+
const vec = VectorConstructor.random("v");
|
|
17
|
+
const sol = vectorParser(answer);
|
|
18
|
+
if (!sol)
|
|
19
|
+
throw new Error("answer malformed in readLineNormalVectorOnGraph");
|
|
20
|
+
if (vec.isColinear(sol))
|
|
21
|
+
return;
|
|
22
|
+
tryToAddWrongProp(propositions, vec.toBinomCoords().toTex());
|
|
23
|
+
});
|
|
24
|
+
return shuffleProps(propositions, n);
|
|
25
|
+
};
|
|
26
|
+
const getAnswer = (identifiers) => {
|
|
27
|
+
const { point1Ids, point2Ids, point3Ids } = identifiers;
|
|
28
|
+
const point1 = PointConstructor.fromIdentifiers(point1Ids);
|
|
29
|
+
const point2 = PointConstructor.fromIdentifiers(point2Ids);
|
|
30
|
+
if (point3Ids) {
|
|
31
|
+
//perp tracée
|
|
32
|
+
const point3 = PointConstructor.fromIdentifiers(point3Ids);
|
|
33
|
+
const vector = VectorConstructor.fromPoints(point2, point3);
|
|
34
|
+
return vector.simplify().toBinomCoords().toTex();
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
const vector = VectorConstructor.fromPoints(point1, point2);
|
|
38
|
+
const normal = vector.getOrthogonal();
|
|
39
|
+
return normal.toBinomCoords().toTex();
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
const getInstruction = (_identifiers, opts) => {
|
|
43
|
+
if (opts?.withoutPerp) {
|
|
44
|
+
return `Ci-dessous est tracée une droite $d$.
|
|
45
|
+
|
|
46
|
+
Déterminer graphiquement les coordonnées d'un vecteur normal à $d$.`;
|
|
47
|
+
}
|
|
48
|
+
return `Ci-dessous sont tracées deux droites perpendiculaires $d$ et $d'$.
|
|
49
|
+
|
|
50
|
+
Déterminer graphiquement les coordonnées d'un vecteur normal à $d$.`;
|
|
51
|
+
};
|
|
52
|
+
const getHint = (_identifiers, opts) => {
|
|
53
|
+
if (opts?.withoutPerp) {
|
|
54
|
+
const u = new Vector("u", "a".toTree(), "b".toTree());
|
|
55
|
+
const v = new Vector("v", opposite("b"), "a".toTree());
|
|
56
|
+
return `Détermine un vecteur directeur de $d$. Puis, utilise la propriété suivante : si $${u.toTexWithBinomCoords()}$ est un vecteur directeur de $d$, alors $${v.toTexWithBinomCoords()}$ est un vecteur normal à $d$.`;
|
|
57
|
+
}
|
|
58
|
+
return `Un vecteur normal d'une droite est un vecteur qui est orthogonal à un vecteur directeur de cette droite.
|
|
59
|
+
|
|
60
|
+
Ici, un vecteur normal à $d$ est donc également un vecteur directeur de $d'$.`;
|
|
61
|
+
};
|
|
62
|
+
const getCorrection = (identifiers) => {
|
|
63
|
+
const { point1Ids, point2Ids, point3Ids } = identifiers;
|
|
64
|
+
const point1 = PointConstructor.fromIdentifiers(point1Ids);
|
|
65
|
+
const point2 = PointConstructor.fromIdentifiers(point2Ids);
|
|
66
|
+
if (point3Ids) {
|
|
67
|
+
const point3 = PointConstructor.fromIdentifiers(point3Ids);
|
|
68
|
+
return `Un vecteur normal à la droite $d$ est un vecteur directeur de la droite $d'$.
|
|
69
|
+
|
|
70
|
+
On lit donc graphiquement un vecteur directeur de $d'$.
|
|
71
|
+
|
|
72
|
+
Cette droite passe par les points de coordonnées $${point2.toCoords()}$ et $${point3.toCoords()}$. Un vecteur directeur de $d'$ est donc :
|
|
73
|
+
|
|
74
|
+
$$
|
|
75
|
+
${VectorConstructor.fromPoints(point2, point3).toBinomCoords().toTex()}
|
|
76
|
+
$$
|
|
77
|
+
|
|
78
|
+
C'est un vecteur normal à $d$.`;
|
|
79
|
+
}
|
|
80
|
+
const u = new Vector("u", "a".toTree(), "b".toTree());
|
|
81
|
+
const v = new Vector("v", opposite("b"), "a".toTree());
|
|
82
|
+
return `La droite $d$ passe par les points de coordonnées $${point1.toCoords()}$ et $${point2.toCoords()}$. Un vecteur directeur de $d$ est donc :
|
|
83
|
+
|
|
84
|
+
$$
|
|
85
|
+
${VectorConstructor.fromPoints(point1, point2).toBinomCoords().toTex()}
|
|
86
|
+
$$
|
|
87
|
+
|
|
88
|
+
On sait que si $${u.toTexWithBinomCoords()}$ est un vecteur directeur de $d$, alors $${v.toTexWithBinomCoords()}$ est un vecteur normal à $d$.
|
|
89
|
+
|
|
90
|
+
Ici, les coordonnées d'un vecteur normal à $d$ sont donc :
|
|
91
|
+
|
|
92
|
+
$$
|
|
93
|
+
${getAnswer(identifiers)}
|
|
94
|
+
$$`;
|
|
95
|
+
};
|
|
96
|
+
const getGGBOptions = (identifiers) => {
|
|
97
|
+
const { point1Ids, point2Ids, point3Ids } = identifiers;
|
|
98
|
+
const point1 = PointConstructor.fromIdentifiers(point1Ids);
|
|
99
|
+
const point2 = PointConstructor.fromIdentifiers(point2Ids);
|
|
100
|
+
const line = new Line(point1, point2, "d");
|
|
101
|
+
const ggb = new GeogebraConstructor({
|
|
102
|
+
commands: line.toGGBCommands(true, {
|
|
103
|
+
isFixed: true,
|
|
104
|
+
isSelectionnable: false,
|
|
105
|
+
showLabel: true,
|
|
106
|
+
showUnderlyingPoints: false,
|
|
107
|
+
}),
|
|
108
|
+
});
|
|
109
|
+
if (point3Ids) {
|
|
110
|
+
const point3 = PointConstructor.fromIdentifiers(point3Ids);
|
|
111
|
+
ggb.commands?.push(`d' = PerpendicularLine(${point2.name}, d)`);
|
|
112
|
+
ggb.commands?.push(`alpha = Angle(d,d')`);
|
|
113
|
+
ggb.commands?.push(`ShowLabel(d', true)`);
|
|
114
|
+
ggb.commands?.push(`ShowLabel(alpha, false)`);
|
|
115
|
+
return ggb.getOptions({
|
|
116
|
+
coords: ggb.getCoordsForPoints([point1, point2, point3]),
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
return ggb.getOptions({
|
|
121
|
+
coords: ggb.getCoordsForPoints([point1, point2]),
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
const getKeys = () => {
|
|
126
|
+
return ["binom", "semicolon"];
|
|
127
|
+
};
|
|
128
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
129
|
+
try {
|
|
130
|
+
return colinearVectorVEA(ans, answer);
|
|
131
|
+
}
|
|
132
|
+
catch (err) {
|
|
133
|
+
return handleVEAError(err);
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
const getReadLineNormalVectorOnGraphQuestion = (opts) => {
|
|
137
|
+
const point1 = PointConstructor.random("A");
|
|
138
|
+
const ratio = RationalConstructor.randomIrreductibleWithSign(6);
|
|
139
|
+
const translation = new Vector("u", ratio.num.toTree(), ratio.denum.toTree());
|
|
140
|
+
const point2 = translation.getEndPoint(point1);
|
|
141
|
+
let point3;
|
|
142
|
+
if (!opts?.withoutPerp) {
|
|
143
|
+
const vector = VectorConstructor.fromPoints(point1, point2);
|
|
144
|
+
const normal = vector.getOrthogonal();
|
|
145
|
+
point3 = normal.getEndPoint(point2);
|
|
146
|
+
}
|
|
147
|
+
const identifiers = {
|
|
148
|
+
point1Ids: point1.toIdentifiers(),
|
|
149
|
+
point2Ids: point2.toIdentifiers(),
|
|
150
|
+
point3Ids: point3?.toIdentifiers(),
|
|
151
|
+
};
|
|
152
|
+
return getQuestionFromIdentifiers(identifiers, opts);
|
|
153
|
+
};
|
|
154
|
+
const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
155
|
+
return {
|
|
156
|
+
answer: getAnswer(identifiers, opts),
|
|
157
|
+
instruction: getInstruction(identifiers, opts),
|
|
158
|
+
keys: getKeys(identifiers, opts),
|
|
159
|
+
answerFormat: "tex",
|
|
160
|
+
identifiers,
|
|
161
|
+
hint: getHint(identifiers, opts),
|
|
162
|
+
correction: getCorrection(identifiers, opts),
|
|
163
|
+
ggbOptions: getGGBOptions(identifiers, opts),
|
|
164
|
+
};
|
|
165
|
+
};
|
|
166
|
+
const options = [
|
|
167
|
+
{
|
|
168
|
+
id: "withoutPerp",
|
|
169
|
+
label: "Ne pas tracer de droite perpendiculaire",
|
|
170
|
+
type: GeneratorOptionType.checkbox,
|
|
171
|
+
target: GeneratorOptionTarget.generation,
|
|
172
|
+
defaultValue: false,
|
|
173
|
+
tooltipText: "S'il n'y a pas de droite perpendiculaire tracée, l'élève devra utiliser le vecteur directeur de la droite puis la propriété qui donne un vecteur normal à partir d'un vecteur directeur.",
|
|
174
|
+
},
|
|
175
|
+
];
|
|
176
|
+
export const readLineNormalVectorOnGraph = {
|
|
177
|
+
id: "readLineNormalVectorOnGraph",
|
|
178
|
+
label: "Déterminer graphiquement les coordonnées d'un vecteur normal à une droite",
|
|
179
|
+
isSingleStep: true,
|
|
180
|
+
generator: (nb, opts) => getDistinctQuestions(() => getReadLineNormalVectorOnGraphQuestion(opts), nb),
|
|
181
|
+
qcmTimer: 60,
|
|
182
|
+
freeTimer: 60,
|
|
183
|
+
getPropositions,
|
|
184
|
+
isAnswerValid,
|
|
185
|
+
subject: "Mathématiques",
|
|
186
|
+
getHint,
|
|
187
|
+
getCorrection,
|
|
188
|
+
getInstruction,
|
|
189
|
+
getAnswer,
|
|
190
|
+
getGGBOptions,
|
|
191
|
+
hasGeogebra: true,
|
|
192
|
+
getQuestionFromIdentifiers,
|
|
193
|
+
options,
|
|
194
|
+
hasHintAndCorrection: true,
|
|
195
|
+
};
|
|
@@ -11,4 +11,5 @@ export * from "./randomVariableSituationVariance.js";
|
|
|
11
11
|
export * from "./randomVariableSituationStandardDeviation.js";
|
|
12
12
|
export * from "./randomVariableSituationIsGameFavorable.js";
|
|
13
13
|
export * from "./randomVariableSituationProbabilityLaw.js";
|
|
14
|
+
export * from "./missingValueInRandomVariableProbabilityLaw.js";
|
|
14
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/randomVariable/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sCAAsC,CAAC;AAErD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,mCAAmC,CAAC;AAClD,cAAc,oCAAoC,CAAC;AACnD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,qCAAqC,CAAC;AACpD,cAAc,sCAAsC,CAAC;AACrD,cAAc,+CAA+C,CAAC;AAC9D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,4CAA4C,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/randomVariable/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sCAAsC,CAAC;AAErD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,mCAAmC,CAAC;AAClD,cAAc,oCAAoC,CAAC;AACnD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,qCAAqC,CAAC;AACpD,cAAc,sCAAsC,CAAC;AACrD,cAAc,+CAA+C,CAAC;AAC9D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,4CAA4C,CAAC;AAE3D,cAAc,iDAAiD,CAAC"}
|
|
@@ -13,3 +13,4 @@ export * from "./randomVariableSituationStandardDeviation.js";
|
|
|
13
13
|
export * from "./randomVariableSituationIsGameFavorable.js";
|
|
14
14
|
export * from "./randomVariableSituationProbabilityLaw.js";
|
|
15
15
|
// export * from "./decideWhichGameIsLessRisky.js";
|
|
16
|
+
export * from "./missingValueInRandomVariableProbabilityLaw.js";
|
package/lib/exercises/math/probaStat/randomVariable/missingValueInRandomVariableProbabilityLaw.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
xValues: NodeIdentifiers[];
|
|
5
|
+
pValues: NodeIdentifiers[];
|
|
6
|
+
};
|
|
7
|
+
export declare const missingValueInRandomVariableProbabilityLaw: Exercise<Identifiers>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=missingValueInRandomVariableProbabilityLaw.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"missingValueInRandomVariableProbabilityLaw.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/randomVariable/missingValueInRandomVariableProbabilityLaw.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAe7C,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,OAAO,EAAE,eAAe,EAAE,CAAC;CAC5B,CAAC;AAgHF,eAAO,MAAM,0CAA0C,EAAE,QAAQ,CAAC,WAAW,CAsB1E,CAAC"}
|
package/lib/exercises/math/probaStat/randomVariable/missingValueInRandomVariableProbabilityLaw.js
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
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 { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
7
|
+
import { reifyAlgebraic, } from "../../../../tree/nodes/nodeConstructor.js";
|
|
8
|
+
import { RandomVariable, RandomVariableConstructor, } from "../../../../math/probability/randomVariable.js";
|
|
9
|
+
import { isVariableNode, VariableNode, } from "../../../../tree/nodes/variables/variableNode.js";
|
|
10
|
+
import { operatorComposition } from "../../../../tree/utilities/operatorComposition.js";
|
|
11
|
+
import { AddNode } from "../../../../tree/nodes/operators/addNode.js";
|
|
12
|
+
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
13
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
14
|
+
const getPropositions = (n, { answer }) => {
|
|
15
|
+
const props = [];
|
|
16
|
+
addValidProp(props, answer);
|
|
17
|
+
propWhile(props, n, () => {
|
|
18
|
+
const numeric = answer.unfrenchify();
|
|
19
|
+
const offset = randfloat(-0.2, 0.2, 2);
|
|
20
|
+
const candidate = round(numeric + offset, 2).frenchify();
|
|
21
|
+
tryToAddWrongProp(props, candidate);
|
|
22
|
+
});
|
|
23
|
+
return shuffleProps(props, n);
|
|
24
|
+
};
|
|
25
|
+
const getAnswer = ({ pValues }) => {
|
|
26
|
+
const probas = pValues
|
|
27
|
+
.map((e) => reifyAlgebraic(e))
|
|
28
|
+
.filter((p) => !isVariableNode(p));
|
|
29
|
+
const sum = operatorComposition(AddNode, probas).simplify();
|
|
30
|
+
return substract(1, sum).simplify().toTex();
|
|
31
|
+
};
|
|
32
|
+
const getInstruction = ({ pValues, xValues }) => {
|
|
33
|
+
const va = new RandomVariable(xValues.map((e) => reifyAlgebraic(e)), pValues.map((e) => reifyAlgebraic(e)));
|
|
34
|
+
return `On considère une variable aléatoire $X$ dont la loi de probabilité est la suivante :
|
|
35
|
+
|
|
36
|
+
${va.getLawMdTable()}
|
|
37
|
+
|
|
38
|
+
Que vaut $x$ ?`;
|
|
39
|
+
};
|
|
40
|
+
const getHint = () => {
|
|
41
|
+
return `Dans une loi de probabilité, la somme des probabilités est égale à $1$.`;
|
|
42
|
+
};
|
|
43
|
+
const getCorrection = (identifiers) => {
|
|
44
|
+
const { pValues, xValues } = identifiers;
|
|
45
|
+
const probas = pValues.map((e) => reifyAlgebraic(e));
|
|
46
|
+
const index = probas.findIndex((p) => isVariableNode(p));
|
|
47
|
+
const xs = xValues.map((e) => reifyAlgebraic(e));
|
|
48
|
+
const sum = operatorComposition(AddNode, probas.filter((_p, i) => i !== index));
|
|
49
|
+
return `
|
|
50
|
+
On additionne les probabilités connues :
|
|
51
|
+
|
|
52
|
+
$$
|
|
53
|
+
${sum.toTex()} = ${sum.simplify().toTex()}
|
|
54
|
+
$$
|
|
55
|
+
|
|
56
|
+
Puisque la somme des probabilités d'une loi de probabilité vaut $1$, on peut en déduire la probabilité manquante :
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
$$
|
|
60
|
+
P(X = ${xs[index].toTex()}) = 1 - ${sum.simplify().toTex()} = ${getAnswer(identifiers)}.
|
|
61
|
+
$$
|
|
62
|
+
`;
|
|
63
|
+
};
|
|
64
|
+
const getKeys = () => {
|
|
65
|
+
return [];
|
|
66
|
+
};
|
|
67
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
68
|
+
try {
|
|
69
|
+
const a = parseAlgebraic(ans);
|
|
70
|
+
const b = parseAlgebraic(answer);
|
|
71
|
+
return a.simplify().equals(b.simplify());
|
|
72
|
+
}
|
|
73
|
+
catch (err) {
|
|
74
|
+
return handleVEAError(err);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
const getGetMissingProbabilityValueQuestion = () => {
|
|
78
|
+
const va = RandomVariableConstructor.random();
|
|
79
|
+
const pValues = [...va.yValues];
|
|
80
|
+
pValues[randint(0, pValues.length)] = new VariableNode("x");
|
|
81
|
+
const identifiers = {
|
|
82
|
+
pValues: pValues.map((e) => e.toIdentifiers()),
|
|
83
|
+
xValues: va.xValues.map((e) => e.toIdentifiers()),
|
|
84
|
+
};
|
|
85
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
86
|
+
};
|
|
87
|
+
const getQuestionFromIdentifiers = (identifiers) => ({
|
|
88
|
+
answer: getAnswer(identifiers),
|
|
89
|
+
instruction: getInstruction(identifiers),
|
|
90
|
+
keys: getKeys(identifiers),
|
|
91
|
+
answerFormat: "tex",
|
|
92
|
+
identifiers,
|
|
93
|
+
hint: getHint(identifiers),
|
|
94
|
+
correction: getCorrection(identifiers),
|
|
95
|
+
style: {
|
|
96
|
+
tableOptions: {
|
|
97
|
+
firstColumnIsHeader: true,
|
|
98
|
+
firstCellIsDivided: false,
|
|
99
|
+
firstRowIsHeader: false,
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
export const missingValueInRandomVariableProbabilityLaw = {
|
|
104
|
+
id: "missingValueInRandomVariableProbabilityLaw",
|
|
105
|
+
label: "Déterminer une valeur manquante dans la loi de probabilité d'une variable aléatoire",
|
|
106
|
+
isSingleStep: true,
|
|
107
|
+
generator: (nb, opts) => getDistinctQuestions(() => getGetMissingProbabilityValueQuestion(opts), nb),
|
|
108
|
+
qcmTimer: 60,
|
|
109
|
+
freeTimer: 60,
|
|
110
|
+
getPropositions,
|
|
111
|
+
isAnswerValid,
|
|
112
|
+
subject: "Mathématiques",
|
|
113
|
+
getInstruction,
|
|
114
|
+
getHint,
|
|
115
|
+
getCorrection,
|
|
116
|
+
getAnswer,
|
|
117
|
+
getQuestionFromIdentifiers,
|
|
118
|
+
hasHintAndCorrection: true,
|
|
119
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildTreeFromSituation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/trees/buildTreeFromSituation.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// import {
|
|
2
|
+
// Exercise,
|
|
3
|
+
// QuestionGenerator,
|
|
4
|
+
// GetHint,
|
|
5
|
+
// GetCorrection,
|
|
6
|
+
// GetInstruction,
|
|
7
|
+
// GetKeys,
|
|
8
|
+
// GetQuestionFromIdentifiers,
|
|
9
|
+
// GetAnswerTreeTable,
|
|
10
|
+
// TreeDiagramVEA,
|
|
11
|
+
// } from '../../../../exercises/exercise.js';
|
|
12
|
+
// import { getDistinctQuestions } from '../../../../exercises/utils/getDistinctQuestions.js';
|
|
13
|
+
// import { treeTableVEA } from '../../../../exercises/vea/treeTableVEA.js';
|
|
14
|
+
// import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
15
|
+
export {};
|
|
16
|
+
// type Identifiers = {
|
|
17
|
+
// situationId: string
|
|
18
|
+
// };
|
|
19
|
+
// const getAnswerTreeTable : GetAnswerTreeTable<Identifiers> = (identifiers)=>{
|
|
20
|
+
// }
|
|
21
|
+
// const getInstruction : GetInstruction<Identifiers> = (identifiers)=>{
|
|
22
|
+
// const {} = identifiers
|
|
23
|
+
// }
|
|
24
|
+
// const getHint : GetHint<Identifiers> = (identifiers)=>{
|
|
25
|
+
// }
|
|
26
|
+
// const getCorrection : GetCorrection<Identifiers> = (identifiers)=>{
|
|
27
|
+
// }
|
|
28
|
+
// const getKeys : GetKeys<Identifiers> = (identifiers)=>{
|
|
29
|
+
// return []
|
|
30
|
+
// }
|
|
31
|
+
// const isAnswerTreeTableValid: TreeDiagramVEA<Identifiers> = (ans, {answerTreeTable})=>{
|
|
32
|
+
// try {
|
|
33
|
+
// return treeTableVEA(ans, answerTreeTable)
|
|
34
|
+
// } catch(err){
|
|
35
|
+
// return handleVEAError(err)
|
|
36
|
+
// }
|
|
37
|
+
// }
|
|
38
|
+
// const getBuildTreeFromSituationQuestion: QuestionGenerator<Identifiers> = (ops)=>{
|
|
39
|
+
// const identifiers: Identifiers = {}
|
|
40
|
+
// return getQuestionFromIdentifiers(identifiers);
|
|
41
|
+
// }
|
|
42
|
+
// const getQuestionFromIdentifiers: GetQuestionFromIdentifiers<Identifiers> = (identifiers)=>{
|
|
43
|
+
// return {
|
|
44
|
+
// answerTreeTable: getAnswerTreeTable(identifiers),
|
|
45
|
+
// instruction: getInstruction(identifiers),
|
|
46
|
+
// keys: getKeys(identifiers),
|
|
47
|
+
// answerFormat: 'tex',
|
|
48
|
+
// identifiers,
|
|
49
|
+
// hint: getHint(identifiers),
|
|
50
|
+
// correction: getCorrection(identifiers)
|
|
51
|
+
// }
|
|
52
|
+
// }
|
|
53
|
+
// export const buildTreeFromSituation: Exercise<Identifiers> = {
|
|
54
|
+
// id: 'buildTreeFromSituation',
|
|
55
|
+
// label: "undefined",
|
|
56
|
+
// isSingleStep: true,
|
|
57
|
+
// generator: (nb, opts) => getDistinctQuestions(()=>getBuildTreeFromSituationQuestion(opts), nb),
|
|
58
|
+
// qcmTimer: 60,
|
|
59
|
+
// freeTimer: 60,
|
|
60
|
+
// isAnswerTreeTableValid,
|
|
61
|
+
// subject: "Mathématiques",
|
|
62
|
+
// getInstruction,
|
|
63
|
+
// getHint,
|
|
64
|
+
// getCorrection,
|
|
65
|
+
// getAnswerTreeTable,
|
|
66
|
+
// getQuestionFromIdentifiers,
|
|
67
|
+
// hasHintAndCorrection: true
|
|
68
|
+
// };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
initTree: string[][][][];
|
|
5
|
+
valueDatas: {
|
|
6
|
+
isComp: boolean;
|
|
7
|
+
value: NodeIdentifiers;
|
|
8
|
+
}[];
|
|
9
|
+
};
|
|
10
|
+
type Options = {
|
|
11
|
+
probaType?: string;
|
|
12
|
+
};
|
|
13
|
+
export declare const fillProbaTreeWithComplementaryProbabilities: Exercise<Identifiers, Options>;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=fillProbaTreeWithComplementaryProbabilities.d.ts.map
|
package/lib/exercises/math/probaStat/trees/fillProbaTreeWithComplementaryProbabilities.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fillProbaTreeWithComplementaryProbabilities.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/trees/fillProbaTreeWithComplementaryProbabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAKrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAM7C,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,CAAC;IACzB,UAAU,EAAE;QACV,MAAM,EAAE,OAAO,CAAC;QAChB,KAAK,EAAE,eAAe,CAAC;KACxB,EAAE,CAAC;CACL,CAAC;AA6KF,KAAK,OAAO,GAAG;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AA4BF,eAAO,MAAM,2CAA2C,EAAE,QAAQ,CAChE,WAAW,EACX,OAAO,CAuBR,CAAC"}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { GeneratorOptionTarget, GeneratorOptionType, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { treeTableVEA } from "../../../../exercises/vea/treeTableVEA.js";
|
|
4
|
+
import { RationalConstructor } from "../../../../math/numbers/rationals/rational.js";
|
|
5
|
+
import { randfloat } from "../../../../math/utils/random/randfloat.js";
|
|
6
|
+
import { reifyAlgebraic, } from "../../../../tree/nodes/nodeConstructor.js";
|
|
7
|
+
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
8
|
+
import { coinFlip } from "../../../../utils/alea/coinFlip.js";
|
|
9
|
+
import { random } from "../../../../utils/alea/random.js";
|
|
10
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
11
|
+
const getAnswerTreeTable = (identifiers) => {
|
|
12
|
+
const { valueDatas } = identifiers;
|
|
13
|
+
const reified = valueDatas.map((d) => reifyAlgebraic(d.value));
|
|
14
|
+
const missingData = reified.map((d) => substract(1, d).simplify());
|
|
15
|
+
const datas = [
|
|
16
|
+
[
|
|
17
|
+
(valueDatas[0].isComp ? missingData : reified)[0].toTex(),
|
|
18
|
+
(valueDatas[0].isComp ? reified : missingData)[0].toTex(),
|
|
19
|
+
],
|
|
20
|
+
[
|
|
21
|
+
(valueDatas[1].isComp ? missingData : reified)[1].toTex(),
|
|
22
|
+
(valueDatas[1].isComp ? reified : missingData)[1].toTex(),
|
|
23
|
+
],
|
|
24
|
+
[
|
|
25
|
+
(valueDatas[2].isComp ? missingData : reified)[2].toTex(),
|
|
26
|
+
(valueDatas[2].isComp ? reified : missingData)[2].toTex(),
|
|
27
|
+
],
|
|
28
|
+
];
|
|
29
|
+
return [
|
|
30
|
+
[
|
|
31
|
+
[
|
|
32
|
+
[`$${datas[0][0]}$`, "$A$"],
|
|
33
|
+
[`$${datas[0][1]}$`, "$\\overline{A}$"],
|
|
34
|
+
],
|
|
35
|
+
],
|
|
36
|
+
[
|
|
37
|
+
[
|
|
38
|
+
[`$${datas[1][0]}$`, "$B$"],
|
|
39
|
+
[`$${datas[1][1]}$`, "$\\overline{B}$"],
|
|
40
|
+
],
|
|
41
|
+
[
|
|
42
|
+
[`$${datas[2][0]}$`, "$B$"],
|
|
43
|
+
[`$${datas[2][1]}$`, "$\\overline{B}$"],
|
|
44
|
+
],
|
|
45
|
+
],
|
|
46
|
+
];
|
|
47
|
+
};
|
|
48
|
+
const getInstruction = () => {
|
|
49
|
+
return `Compléter les probabilités manquantes dans l'arbre pondéré suivant :
|
|
50
|
+
|
|
51
|
+
`;
|
|
52
|
+
};
|
|
53
|
+
const getHint = () => {
|
|
54
|
+
return `Dans un arbre pondéré, la somme des probabilités des branches issues d'un même noeud est égale à $1$.`;
|
|
55
|
+
};
|
|
56
|
+
const getCorrection = (identifiers) => {
|
|
57
|
+
const { valueDatas } = identifiers;
|
|
58
|
+
const events = valueDatas.map((d, i) => {
|
|
59
|
+
if (i === 0)
|
|
60
|
+
return d.isComp ? "P(A)" : "P\\left(\\overline{A}\\right)";
|
|
61
|
+
if (i === 1)
|
|
62
|
+
return d.isComp ? "P_A(B)" : "P_A\\left(\\overline{B}\\right)";
|
|
63
|
+
else
|
|
64
|
+
return d.isComp
|
|
65
|
+
? "P_{\\overline{A}}(B)"
|
|
66
|
+
: "P_{\\overline{A}}\\left(\\overline{B}\\right)";
|
|
67
|
+
});
|
|
68
|
+
const probas = valueDatas.map((d) => reifyAlgebraic(d.value));
|
|
69
|
+
return `Dans un arbre pondéré, la somme des probabilités des branches issues d'un même noeud est égale à $1$.
|
|
70
|
+
|
|
71
|
+
On a donc :
|
|
72
|
+
|
|
73
|
+
$$
|
|
74
|
+
${events[0]} = 1 - ${probas[0].toTex()} = ${substract(1, probas[0])
|
|
75
|
+
.simplify()
|
|
76
|
+
.toTex()}
|
|
77
|
+
$$
|
|
78
|
+
|
|
79
|
+
$$
|
|
80
|
+
${events[1]} = 1 - ${probas[1].toTex()} = ${substract(1, probas[1])
|
|
81
|
+
.simplify()
|
|
82
|
+
.toTex()}
|
|
83
|
+
$$
|
|
84
|
+
|
|
85
|
+
$$
|
|
86
|
+
${events[2]} = 1 - ${probas[2].toTex()} = ${substract(1, probas[2])
|
|
87
|
+
.simplify()
|
|
88
|
+
.toTex()}
|
|
89
|
+
$$
|
|
90
|
+
`;
|
|
91
|
+
};
|
|
92
|
+
const getKeys = () => {
|
|
93
|
+
return [];
|
|
94
|
+
};
|
|
95
|
+
const isAnswerTreeTableValid = (ans, { answerTreeTable }) => {
|
|
96
|
+
try {
|
|
97
|
+
return treeTableVEA(ans, answerTreeTable);
|
|
98
|
+
}
|
|
99
|
+
catch (err) {
|
|
100
|
+
return handleVEAError(err);
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
const getFillProbaTreeWithComplementaryProbabilitiesQuestion = (ops) => {
|
|
104
|
+
const type = ops?.probaType === "Fractions"
|
|
105
|
+
? "frac"
|
|
106
|
+
: ops?.probaType === "Décimales"
|
|
107
|
+
? "dec"
|
|
108
|
+
: random(["frac", "dec"]);
|
|
109
|
+
const valueDatas = [
|
|
110
|
+
{
|
|
111
|
+
isComp: coinFlip(),
|
|
112
|
+
value: type === "frac"
|
|
113
|
+
? RationalConstructor.randomIrreductibleProba().toTree()
|
|
114
|
+
: randfloat(0.1, 1, 1).toTree(),
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
isComp: coinFlip(),
|
|
118
|
+
value: type === "frac"
|
|
119
|
+
? RationalConstructor.randomIrreductibleProba().toTree()
|
|
120
|
+
: randfloat(0.1, 1, 1).toTree(),
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
isComp: coinFlip(),
|
|
124
|
+
value: type === "frac"
|
|
125
|
+
? RationalConstructor.randomIrreductibleProba().toTree()
|
|
126
|
+
: randfloat(0.1, 1, 1).toTree(),
|
|
127
|
+
},
|
|
128
|
+
];
|
|
129
|
+
const initTree = [
|
|
130
|
+
[
|
|
131
|
+
[
|
|
132
|
+
[!valueDatas[0].isComp ? valueDatas[0].value.toTex() : "", "$A$"],
|
|
133
|
+
[
|
|
134
|
+
valueDatas[0].isComp ? valueDatas[0].value.toTex() : "",
|
|
135
|
+
"$\\overline{A}$",
|
|
136
|
+
],
|
|
137
|
+
],
|
|
138
|
+
],
|
|
139
|
+
[
|
|
140
|
+
[
|
|
141
|
+
[!valueDatas[1].isComp ? valueDatas[1].value.toTex() : "", "$B$"],
|
|
142
|
+
[
|
|
143
|
+
valueDatas[1].isComp ? valueDatas[1].value.toTex() : "",
|
|
144
|
+
"$\\overline{B}$",
|
|
145
|
+
],
|
|
146
|
+
],
|
|
147
|
+
[
|
|
148
|
+
[!valueDatas[2].isComp ? valueDatas[2].value.toTex() : "", "$B$"],
|
|
149
|
+
[
|
|
150
|
+
valueDatas[2].isComp ? valueDatas[2].value.toTex() : "",
|
|
151
|
+
"$\\overline{B}$",
|
|
152
|
+
],
|
|
153
|
+
],
|
|
154
|
+
],
|
|
155
|
+
];
|
|
156
|
+
const identifiers = {
|
|
157
|
+
initTree,
|
|
158
|
+
valueDatas: valueDatas.map((d) => {
|
|
159
|
+
return {
|
|
160
|
+
isComp: d.isComp,
|
|
161
|
+
value: d.value.toIdentifiers(),
|
|
162
|
+
};
|
|
163
|
+
}),
|
|
164
|
+
};
|
|
165
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
166
|
+
};
|
|
167
|
+
const options = [
|
|
168
|
+
{
|
|
169
|
+
id: "probaType",
|
|
170
|
+
label: "Format des probabilités",
|
|
171
|
+
target: GeneratorOptionTarget.generation,
|
|
172
|
+
type: GeneratorOptionType.select,
|
|
173
|
+
defaultValue: "Aléatoire",
|
|
174
|
+
values: ["Fractions", "Décimales", "Aléatoire"],
|
|
175
|
+
},
|
|
176
|
+
];
|
|
177
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
178
|
+
return {
|
|
179
|
+
answerTreeTable: getAnswerTreeTable(identifiers),
|
|
180
|
+
instruction: getInstruction(identifiers),
|
|
181
|
+
keys: getKeys(identifiers),
|
|
182
|
+
answerFormat: "tex",
|
|
183
|
+
identifiers,
|
|
184
|
+
hint: getHint(identifiers),
|
|
185
|
+
correction: getCorrection(identifiers),
|
|
186
|
+
initTreeTable: identifiers.initTree,
|
|
187
|
+
};
|
|
188
|
+
};
|
|
189
|
+
export const fillProbaTreeWithComplementaryProbabilities = {
|
|
190
|
+
id: "fillProbaTreeWithComplementaryProbabilities",
|
|
191
|
+
label: "Compléter un arbre pondéré par les probabilités des événements contraires",
|
|
192
|
+
isSingleStep: true,
|
|
193
|
+
generator: (nb, opts) => getDistinctQuestions(() => getFillProbaTreeWithComplementaryProbabilitiesQuestion(opts), nb),
|
|
194
|
+
qcmTimer: 60,
|
|
195
|
+
freeTimer: 60,
|
|
196
|
+
isAnswerTreeTableValid,
|
|
197
|
+
subject: "Mathématiques",
|
|
198
|
+
getInstruction,
|
|
199
|
+
getHint,
|
|
200
|
+
getCorrection,
|
|
201
|
+
getAnswerTreeTable,
|
|
202
|
+
getQuestionFromIdentifiers,
|
|
203
|
+
hasHintAndCorrection: true,
|
|
204
|
+
answerType: "treeDiagram",
|
|
205
|
+
options,
|
|
206
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"probaTreeSituations.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/trees/probaTreeSituations.ts"],"names":[],"mappings":""}
|