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,210 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../../exercises/exercise.js";
|
|
2
|
+
import { getOptionFirstTermRankOneStuff, } from "../../../../../exercises/options/optionFirstTermRankOne.js";
|
|
3
|
+
import { getOptionIsWithSuperfluousData, } from "../../../../../exercises/options/optionIsWithSuperfluousData.js";
|
|
4
|
+
import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
|
|
5
|
+
import { randint } from "../../../../../math/utils/random/randint.js";
|
|
6
|
+
import { situationsArithmetic, } from "../../../../../math/utils/sequences/situations/seqArithmeticSituations.js";
|
|
7
|
+
import { EqualNode, isEqualNode, } from "../../../../../tree/nodes/equations/equalNode.js";
|
|
8
|
+
import { add } from "../../../../../tree/nodes/operators/addNode.js";
|
|
9
|
+
import { multiply } from "../../../../../tree/nodes/operators/multiplyNode.js";
|
|
10
|
+
import { substract } from "../../../../../tree/nodes/operators/substractNode.js";
|
|
11
|
+
import { parseAlgebraic } from "../../../../../tree/parsers/latexParser.js";
|
|
12
|
+
import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
|
|
13
|
+
const _getNodeFactor = (firstRank, varName = "n") => {
|
|
14
|
+
const nodeN = varName.toTree();
|
|
15
|
+
return firstRank === 0 ? nodeN : substract(nodeN, 1);
|
|
16
|
+
};
|
|
17
|
+
const situations = situationsArithmetic;
|
|
18
|
+
const getInstruction = (identifiers, optsIn) => {
|
|
19
|
+
const opts = optsIn ?? optsDefault;
|
|
20
|
+
const firstRank = opts?.firstTermRankOne ? 1 : 0;
|
|
21
|
+
const { situationIndex, initial, reason, superfluousData } = identifiers;
|
|
22
|
+
const situation = situations[situationIndex];
|
|
23
|
+
return `${situation.getStrSituation(initial, reason, firstRank, superfluousData)}
|
|
24
|
+
|
|
25
|
+
Donner la relation de récurrence pour la suite $(u_n)$.`;
|
|
26
|
+
};
|
|
27
|
+
const getAnswerNode = (identifiers, opts) => {
|
|
28
|
+
const firstRank = opts?.firstTermRankOne ? 1 : 0;
|
|
29
|
+
const { situationIndex, initial, reason } = identifiers;
|
|
30
|
+
const situation = situations[situationIndex];
|
|
31
|
+
return situation.variationFindRecurrenceFormula.getAnswerNode(initial, reason, firstRank);
|
|
32
|
+
};
|
|
33
|
+
const getAnswer = (identifiers, optsIn) => {
|
|
34
|
+
const opts = optsIn ?? optsDefault;
|
|
35
|
+
return getAnswerNode(identifiers, opts).toTex();
|
|
36
|
+
};
|
|
37
|
+
const getHint = (identifiers, optsIn) => {
|
|
38
|
+
const opts = optsIn ?? optsDefault;
|
|
39
|
+
const firstRank = opts?.firstTermRankOne ? 1 : 0;
|
|
40
|
+
const { situationIndex } = identifiers;
|
|
41
|
+
const situation = situations[situationIndex];
|
|
42
|
+
return situation.variationFindRecurrenceFormula.getHint(firstRank);
|
|
43
|
+
};
|
|
44
|
+
const getCorrection = (identifiers, optsIn) => {
|
|
45
|
+
const opts = optsIn ?? optsDefault;
|
|
46
|
+
const firstRank = opts?.firstTermRankOne ? 1 : 0;
|
|
47
|
+
const { situationIndex, initial, reason } = identifiers;
|
|
48
|
+
const situation = situations[situationIndex];
|
|
49
|
+
return situation.variationFindRecurrenceFormula.getCorrectionStuff(initial, reason, firstRank).str;
|
|
50
|
+
};
|
|
51
|
+
const getPropositions = (n, { answer, ...identifiers }, optsIn) => {
|
|
52
|
+
const opts = optsIn ?? optsDefault;
|
|
53
|
+
const firstRank = opts?.firstTermRankOne ? 1 : 0;
|
|
54
|
+
const { situationIndex, initial, reason } = identifiers;
|
|
55
|
+
const situation = situations[situationIndex];
|
|
56
|
+
const propositions = [];
|
|
57
|
+
addValidProp(propositions, answer);
|
|
58
|
+
//most to least probable mistakes:
|
|
59
|
+
//student: arithmetic -> geometric: u_{n+1} = u_n * reason
|
|
60
|
+
{
|
|
61
|
+
tryToAddWrongProp(propositions, new EqualNode("u_{n+1}".toTree(), multiply("u_{n}".toTree(), reason)).toTex());
|
|
62
|
+
}
|
|
63
|
+
//student: reason -> initial: u_{n+1} = u_n + initial
|
|
64
|
+
{
|
|
65
|
+
tryToAddWrongProp(propositions, new EqualNode("u_{n+1}".toTree(), add("u_{n}".toTree(), initial)).toTex());
|
|
66
|
+
}
|
|
67
|
+
//student: u_{n+1} = u_n + n * reason
|
|
68
|
+
{
|
|
69
|
+
tryToAddWrongProp(propositions, new EqualNode("u_{n+1}".toTree(), add("u_{n}".toTree(), multiply("n".toTree(), reason))).toTex());
|
|
70
|
+
}
|
|
71
|
+
//student: mixes explicit with recurrence: u_{n+1} = initial + u_n * reason
|
|
72
|
+
{
|
|
73
|
+
const strExplicitFormula = situation.variationFindExplicitFormula
|
|
74
|
+
.getAnswerNode(initial, reason, firstRank)
|
|
75
|
+
.toTex();
|
|
76
|
+
function strByReplacingVar(strSrc, strVar, strReplacement) {
|
|
77
|
+
const re = new RegExp(`(?!u.*\\{?.*)(${strVar})(?!.*\\}?)`, "g"); //capture n but not u_{n} u_{n+1} etc.
|
|
78
|
+
const matches = strSrc.match(re) ?? [];
|
|
79
|
+
return matches.reduce((acc, match) => {
|
|
80
|
+
return acc.replace(match, strReplacement);
|
|
81
|
+
}, strSrc);
|
|
82
|
+
}
|
|
83
|
+
const strWrong = strByReplacingVar(strExplicitFormula.replaceAll("u_{n}", "u_{n+1}"), "n", "u_{n}");
|
|
84
|
+
tryToAddWrongProp(propositions, strWrong);
|
|
85
|
+
}
|
|
86
|
+
//student: explicit formula
|
|
87
|
+
{
|
|
88
|
+
tryToAddWrongProp(propositions, situation.variationFindExplicitFormula
|
|
89
|
+
.getAnswerNode(initial, reason, firstRank)
|
|
90
|
+
.toTex());
|
|
91
|
+
}
|
|
92
|
+
//student: explicit formula for u_{n+1}
|
|
93
|
+
{
|
|
94
|
+
const nodeFormula = add(initial, multiply(reason, substract(add("n".toTree(), 1), firstRank).simplify())).simplify();
|
|
95
|
+
const equalNode = new EqualNode("u_{n+1}".toTree(), nodeFormula);
|
|
96
|
+
tryToAddWrongProp(propositions, equalNode.toTex());
|
|
97
|
+
}
|
|
98
|
+
return shuffleProps(propositions, n);
|
|
99
|
+
};
|
|
100
|
+
const isAnswerValid = (ans, { answer, ..._identifiers }, _optsIn) => {
|
|
101
|
+
try {
|
|
102
|
+
if (!ans.includes("=")) {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
//TODO faire fonctionner parseAlgebraic("u_n=3+2n") (token _ not implemented)
|
|
106
|
+
// const nodeAns = parseAlgebraic(ans);
|
|
107
|
+
function workaroundParser(strSrc) {
|
|
108
|
+
function workaroundReplacer(strSrc) {
|
|
109
|
+
const dictFromTo = {
|
|
110
|
+
u_n: "x",
|
|
111
|
+
"u_{n+1}": "y",
|
|
112
|
+
};
|
|
113
|
+
return Object.entries(dictFromTo).reduce((acc, [strFrom, strTo]) => {
|
|
114
|
+
return acc.replaceAll(strFrom, strTo);
|
|
115
|
+
}, strSrc);
|
|
116
|
+
}
|
|
117
|
+
const [lhs, rhs] = strSrc.split("=");
|
|
118
|
+
const [lhsRefined, rhsRefined] = [lhs, rhs].map(workaroundReplacer);
|
|
119
|
+
const [nodeLhs, nodeRhs] = [lhsRefined, rhsRefined].map((str) => parseAlgebraic(str));
|
|
120
|
+
return new EqualNode(nodeLhs, nodeRhs);
|
|
121
|
+
}
|
|
122
|
+
const nodeAns = workaroundParser(ans);
|
|
123
|
+
if (!isEqualNode(nodeAns)) {
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
// const nodeAnswer = getAnswerNode(identifiers, opts) as EqualNode;
|
|
127
|
+
const nodeAnswer = workaroundParser(answer);
|
|
128
|
+
const isValidLhs = () => {
|
|
129
|
+
// return (
|
|
130
|
+
// substract(nodeAns.leftChild, nodeAnswer.leftChild)
|
|
131
|
+
// .simplify()
|
|
132
|
+
// .evaluate() === 0
|
|
133
|
+
// );
|
|
134
|
+
return [1, 10, 100].every((y) => {
|
|
135
|
+
return (substract(nodeAns.leftChild, nodeAnswer.leftChild).evaluate({
|
|
136
|
+
y,
|
|
137
|
+
}) === 0);
|
|
138
|
+
});
|
|
139
|
+
};
|
|
140
|
+
const isValidRhs = () => {
|
|
141
|
+
// return (
|
|
142
|
+
// substract(nodeAns.rightChild, nodeAnswer.rightChild)
|
|
143
|
+
// .simplify()
|
|
144
|
+
// .evaluate() === 0
|
|
145
|
+
// );
|
|
146
|
+
return [1, 10, 100].every((x) => {
|
|
147
|
+
return (substract(nodeAns.rightChild, nodeAnswer.rightChild).evaluate({
|
|
148
|
+
x,
|
|
149
|
+
}) === 0);
|
|
150
|
+
});
|
|
151
|
+
};
|
|
152
|
+
return isValidLhs() && isValidRhs();
|
|
153
|
+
}
|
|
154
|
+
catch (e) {
|
|
155
|
+
return handleVEAError(e);
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
const getArithmeticFindRecurrenceFormulaFromSituationQuestion = (optsIn) => {
|
|
159
|
+
const opts = optsIn ?? optsDefault;
|
|
160
|
+
// const firstRank = opts?.firstTermRankOne ? 1 : 0;
|
|
161
|
+
const situationIndex = randint(0, situations.length);
|
|
162
|
+
const situation = situations[situationIndex];
|
|
163
|
+
const initial = situation.randInitial();
|
|
164
|
+
const reason = situation.randReason();
|
|
165
|
+
const superfluousData = opts.isWithSuperfluousData
|
|
166
|
+
? situation.randSuperfluousData()
|
|
167
|
+
: undefined;
|
|
168
|
+
const identifiers = {
|
|
169
|
+
situationIndex,
|
|
170
|
+
initial,
|
|
171
|
+
reason,
|
|
172
|
+
superfluousData,
|
|
173
|
+
};
|
|
174
|
+
return getQuestionFromIdentifiers(identifiers, opts);
|
|
175
|
+
};
|
|
176
|
+
const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
177
|
+
const question = {
|
|
178
|
+
answer: getAnswer(identifiers, opts),
|
|
179
|
+
instruction: getInstruction(identifiers, opts),
|
|
180
|
+
keys: ["un", "equal", "n", "unplus1"],
|
|
181
|
+
answerFormat: "tex",
|
|
182
|
+
identifiers,
|
|
183
|
+
hint: getHint(identifiers, opts),
|
|
184
|
+
correction: getCorrection(identifiers, opts),
|
|
185
|
+
options: opts,
|
|
186
|
+
};
|
|
187
|
+
return question;
|
|
188
|
+
};
|
|
189
|
+
const optionsStuffFirstTermRankOne = getOptionFirstTermRankOneStuff(false);
|
|
190
|
+
const optionsStuffIsWithSuperfluousData = getOptionIsWithSuperfluousData(false);
|
|
191
|
+
const optsDefault = Object.assign({}, optionsStuffFirstTermRankOne.optsDefaultFirstTermRankOne, optionsStuffIsWithSuperfluousData.optsDefaultIsWithSuperfluousData);
|
|
192
|
+
const options = [
|
|
193
|
+
optionsStuffFirstTermRankOne.generatorOptionFirstTermRankOne,
|
|
194
|
+
optionsStuffIsWithSuperfluousData.generatorOptionIsWithSuperfluousData,
|
|
195
|
+
];
|
|
196
|
+
export const arithmeticFindRecurrenceFormulaFromSituation = {
|
|
197
|
+
id: "arithmeticFindRecurrenceFormulaFromSituation",
|
|
198
|
+
connector: "=",
|
|
199
|
+
label: "À partir d'une situation décrivant une évolution arithmétique, exprimer la relation de récurrence",
|
|
200
|
+
isSingleStep: true,
|
|
201
|
+
generator: (nb, opts) => getDistinctQuestions(() => getArithmeticFindRecurrenceFormulaFromSituationQuestion(opts), nb),
|
|
202
|
+
options,
|
|
203
|
+
qcmTimer: 60,
|
|
204
|
+
freeTimer: 60,
|
|
205
|
+
getPropositions,
|
|
206
|
+
isAnswerValid,
|
|
207
|
+
subject: "Mathématiques",
|
|
208
|
+
getQuestionFromIdentifiers,
|
|
209
|
+
hasHintAndCorrection: true,
|
|
210
|
+
};
|
package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindTermFromSituation.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Exercise } from "../../../../../exercises/exercise.js";
|
|
2
|
+
import { OptionFirstTermRankOne } from "../../../../../exercises/options/optionFirstTermRankOne.js";
|
|
3
|
+
import { OptionIsWithSuperfluousData } from "../../../../../exercises/options/optionIsWithSuperfluousData.js";
|
|
4
|
+
import { SituationArithmeticSuperfluousData } from "../../../../../math/utils/sequences/situations/seqArithmeticSituations.js";
|
|
5
|
+
type Identifiers = {
|
|
6
|
+
situationIndex: number;
|
|
7
|
+
initial: number;
|
|
8
|
+
reason: number;
|
|
9
|
+
superfluousData?: SituationArithmeticSuperfluousData;
|
|
10
|
+
rankAsked: number;
|
|
11
|
+
};
|
|
12
|
+
type Options = OptionFirstTermRankOne & OptionIsWithSuperfluousData;
|
|
13
|
+
export declare const arithmeticFindTermFromSituation: Exercise<Identifiers, Options>;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=arithmeticFindTermFromSituation.d.ts.map
|
package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindTermFromSituation.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arithmeticFindTermFromSituation.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/sequences/arithmetic/situations/arithmeticFindTermFromSituation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,sBAAsB,EACvB,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAEL,2BAA2B,EAC5B,MAAM,wDAAwD,CAAC;AAIhE,OAAO,EAEL,kCAAkC,EAEnC,MAAM,kEAAkE,CAAC;AAQ1E,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,kCAAkC,CAAC;IACrD,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AA+LF,KAAK,OAAO,GAAG,sBAAsB,GAAG,2BAA2B,CAAC;AAcpE,eAAO,MAAM,+BAA+B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAmB1E,CAAC"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../../exercises/exercise.js";
|
|
2
|
+
import { getOptionFirstTermRankOneStuff, } from "../../../../../exercises/options/optionFirstTermRankOne.js";
|
|
3
|
+
import { getOptionIsWithSuperfluousData, } from "../../../../../exercises/options/optionIsWithSuperfluousData.js";
|
|
4
|
+
import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
|
|
5
|
+
import { numberVEA } from "../../../../../exercises/vea/numberVEA.js";
|
|
6
|
+
import { randint } from "../../../../../math/utils/random/randint.js";
|
|
7
|
+
import { situationsArithmetic, } from "../../../../../math/utils/sequences/situations/seqArithmeticSituations.js";
|
|
8
|
+
import { add } from "../../../../../tree/nodes/operators/addNode.js";
|
|
9
|
+
import { multiply } from "../../../../../tree/nodes/operators/multiplyNode.js";
|
|
10
|
+
import { power } from "../../../../../tree/nodes/operators/powerNode.js";
|
|
11
|
+
import { substract } from "../../../../../tree/nodes/operators/substractNode.js";
|
|
12
|
+
import { coinFlip } from "../../../../../utils/alea/coinFlip.js";
|
|
13
|
+
import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
|
|
14
|
+
const situations = situationsArithmetic;
|
|
15
|
+
const getInstruction = (identifiers, optsIn) => {
|
|
16
|
+
const opts = optsIn ?? optsDefault;
|
|
17
|
+
const firstRank = opts?.firstTermRankOne ? 1 : 0;
|
|
18
|
+
const { situationIndex, initial, reason, superfluousData, rankAsked } = identifiers;
|
|
19
|
+
const situation = situations[situationIndex];
|
|
20
|
+
return `${situation.getStrSituation(initial, reason, firstRank, superfluousData)}
|
|
21
|
+
|
|
22
|
+
Que vaut $u_{${rankAsked}}$ ?`;
|
|
23
|
+
};
|
|
24
|
+
const getAnswerNode = (identifiers, opts) => {
|
|
25
|
+
const firstRank = opts?.firstTermRankOne ? 1 : 0;
|
|
26
|
+
const { situationIndex, initial, reason, rankAsked } = identifiers;
|
|
27
|
+
const situation = situations[situationIndex];
|
|
28
|
+
return situation.variationFindRandomTerm.getAnswerNode(initial, reason, firstRank, rankAsked);
|
|
29
|
+
};
|
|
30
|
+
const getAnswer = (identifiers, optsIn) => {
|
|
31
|
+
const opts = optsIn ?? optsDefault;
|
|
32
|
+
return getAnswerNode(identifiers, opts).simplify().toTex();
|
|
33
|
+
};
|
|
34
|
+
const getHint = (identifiers, optsIn) => {
|
|
35
|
+
const opts = optsIn ?? optsDefault;
|
|
36
|
+
const firstRank = opts?.firstTermRankOne ? 1 : 0;
|
|
37
|
+
const { situationIndex, rankAsked } = identifiers;
|
|
38
|
+
const situation = situations[situationIndex];
|
|
39
|
+
return situation.variationFindRandomTerm.getHint(firstRank, rankAsked);
|
|
40
|
+
};
|
|
41
|
+
const getCorrection = (identifiers, optsIn) => {
|
|
42
|
+
const opts = optsIn ?? optsDefault;
|
|
43
|
+
const firstRank = opts?.firstTermRankOne ? 1 : 0;
|
|
44
|
+
const { situationIndex, initial, reason, rankAsked } = identifiers;
|
|
45
|
+
const situation = situations[situationIndex];
|
|
46
|
+
return situation.variationFindRandomTerm.getCorrectionStuff(initial, reason, firstRank, rankAsked).str;
|
|
47
|
+
};
|
|
48
|
+
const getPropositions = (n, { answer, ...identifiers }, optsIn) => {
|
|
49
|
+
const opts = optsIn ?? optsDefault;
|
|
50
|
+
const firstRank = opts?.firstTermRankOne ? 1 : 0;
|
|
51
|
+
const { situationIndex, initial, reason, rankAsked } = identifiers;
|
|
52
|
+
const situation = situations[situationIndex];
|
|
53
|
+
const propositions = [];
|
|
54
|
+
addValidProp(propositions, answer);
|
|
55
|
+
//student: arithmetic -> geometric
|
|
56
|
+
{
|
|
57
|
+
const nodeWrong = multiply(initial, power(reason, substract(rankAsked, firstRank))).simplify();
|
|
58
|
+
tryToAddWrongProp(propositions, nodeWrong.toTex());
|
|
59
|
+
}
|
|
60
|
+
if (coinFlip()) {
|
|
61
|
+
if (coinFlip()) {
|
|
62
|
+
//student: rankAsked - 1
|
|
63
|
+
{
|
|
64
|
+
const nodeWrong = situation.variationFindRandomTerm
|
|
65
|
+
.getAnswerNode(reason, initial, firstRank, rankAsked - 1)
|
|
66
|
+
.simplify();
|
|
67
|
+
tryToAddWrongProp(propositions, nodeWrong.toTex());
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
//student: rankAsked + 1
|
|
72
|
+
{
|
|
73
|
+
const nodeWrong = situation.variationFindRandomTerm
|
|
74
|
+
.getAnswerNode(reason, initial, firstRank, rankAsked + 1)
|
|
75
|
+
.simplify();
|
|
76
|
+
tryToAddWrongProp(propositions, nodeWrong.toTex());
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
//student: swaps(initial, reason)
|
|
81
|
+
{
|
|
82
|
+
const nodeWrong = situation.variationFindRandomTerm
|
|
83
|
+
.getAnswerNode(reason, initial, firstRank, rankAsked)
|
|
84
|
+
.simplify();
|
|
85
|
+
tryToAddWrongProp(propositions, nodeWrong.toTex());
|
|
86
|
+
}
|
|
87
|
+
//student: u_n = initial * reason + n
|
|
88
|
+
{
|
|
89
|
+
const nodeWrong = add(multiply(initial, reason), substract(rankAsked, firstRank)).simplify();
|
|
90
|
+
tryToAddWrongProp(propositions, nodeWrong.toTex());
|
|
91
|
+
}
|
|
92
|
+
//student: u_n = (initial + reason) * n
|
|
93
|
+
{
|
|
94
|
+
const nodeWrong = multiply(add(initial, reason), substract(rankAsked, firstRank)).simplify();
|
|
95
|
+
tryToAddWrongProp(propositions, nodeWrong.toTex());
|
|
96
|
+
}
|
|
97
|
+
return shuffleProps(propositions, n);
|
|
98
|
+
};
|
|
99
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
100
|
+
try {
|
|
101
|
+
return numberVEA(ans, answer);
|
|
102
|
+
}
|
|
103
|
+
catch (err) {
|
|
104
|
+
return handleVEAError(err);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
const getArithmeticFindTermFromSituationQuestion = (optsIn) => {
|
|
108
|
+
const opts = optsIn ?? optsDefault;
|
|
109
|
+
const { isWithSuperfluousData } = opts;
|
|
110
|
+
const situationIndex = randint(0, situations.length);
|
|
111
|
+
const situation = situations[situationIndex];
|
|
112
|
+
const initial = situation.randInitial();
|
|
113
|
+
const reason = situation.randReason();
|
|
114
|
+
const superfluousData = isWithSuperfluousData
|
|
115
|
+
? situation.randSuperfluousData()
|
|
116
|
+
: undefined;
|
|
117
|
+
const rankAsked = randint(4, 15);
|
|
118
|
+
const identifiers = {
|
|
119
|
+
situationIndex,
|
|
120
|
+
initial,
|
|
121
|
+
reason,
|
|
122
|
+
superfluousData,
|
|
123
|
+
rankAsked,
|
|
124
|
+
};
|
|
125
|
+
return getQuestionFromIdentifiers(identifiers, opts);
|
|
126
|
+
};
|
|
127
|
+
const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
128
|
+
const question = {
|
|
129
|
+
answer: getAnswer(identifiers, opts),
|
|
130
|
+
instruction: getInstruction(identifiers, opts),
|
|
131
|
+
keys: [],
|
|
132
|
+
answerFormat: "tex",
|
|
133
|
+
identifiers,
|
|
134
|
+
hint: getHint(identifiers, opts),
|
|
135
|
+
correction: getCorrection(identifiers, opts),
|
|
136
|
+
options: opts,
|
|
137
|
+
};
|
|
138
|
+
return question;
|
|
139
|
+
};
|
|
140
|
+
const optionsStuffFirstTermRankOne = getOptionFirstTermRankOneStuff(false);
|
|
141
|
+
const optionsStuffIsWithSuperfluousData = getOptionIsWithSuperfluousData(false);
|
|
142
|
+
const optsDefault = Object.assign({}, optionsStuffFirstTermRankOne.optsDefaultFirstTermRankOne, optionsStuffIsWithSuperfluousData.optsDefaultIsWithSuperfluousData);
|
|
143
|
+
const options = [
|
|
144
|
+
optionsStuffFirstTermRankOne.generatorOptionFirstTermRankOne,
|
|
145
|
+
optionsStuffIsWithSuperfluousData.generatorOptionIsWithSuperfluousData,
|
|
146
|
+
];
|
|
147
|
+
export const arithmeticFindTermFromSituation = {
|
|
148
|
+
id: "arithmeticFindTermFromSituation",
|
|
149
|
+
connector: "=",
|
|
150
|
+
label: "À partir d'une situation décrivant une évolution arithmétique, exprimer un terme de rang $n$ demandé",
|
|
151
|
+
isSingleStep: true,
|
|
152
|
+
generator: (nb, opts) => getDistinctQuestions(() => getArithmeticFindTermFromSituationQuestion(opts), nb),
|
|
153
|
+
options,
|
|
154
|
+
qcmTimer: 60,
|
|
155
|
+
freeTimer: 60,
|
|
156
|
+
getPropositions,
|
|
157
|
+
isAnswerValid,
|
|
158
|
+
subject: "Mathématiques",
|
|
159
|
+
getQuestionFromIdentifiers,
|
|
160
|
+
hasHintAndCorrection: true,
|
|
161
|
+
};
|
package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindThresholdFromSituation.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Exercise } from "../../../../../exercises/exercise.js";
|
|
2
|
+
import { OptionFirstTermRankOne } from "../../../../../exercises/options/optionFirstTermRankOne.js";
|
|
3
|
+
import { OptionIsWithSuperfluousData } from "../../../../../exercises/options/optionIsWithSuperfluousData.js";
|
|
4
|
+
import { InegalitySymbols } from "../../../../../math/inequations/inequation.js";
|
|
5
|
+
import { SituationArithmeticSuperfluousData } from "../../../../../math/utils/sequences/situations/seqArithmeticSituations.js";
|
|
6
|
+
type Identifiers = {
|
|
7
|
+
situationIndex: number;
|
|
8
|
+
initial: number;
|
|
9
|
+
reason: number;
|
|
10
|
+
superfluousData?: SituationArithmeticSuperfluousData;
|
|
11
|
+
valueThreshold: number;
|
|
12
|
+
inegSymbol: InegalitySymbols;
|
|
13
|
+
};
|
|
14
|
+
type Options = OptionFirstTermRankOne & OptionIsWithSuperfluousData;
|
|
15
|
+
export declare const arithmeticFindThresholdFromSituation: Exercise<Identifiers, Options>;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=arithmeticFindThresholdFromSituation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arithmeticFindThresholdFromSituation.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/sequences/arithmetic/situations/arithmeticFindThresholdFromSituation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,sBAAsB,EACvB,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAEL,2BAA2B,EAC5B,MAAM,wDAAwD,CAAC;AAGhE,OAAO,EACL,gBAAgB,EAGjB,MAAM,sCAAsC,CAAC;AAG9C,OAAO,EAEL,kCAAkC,EAEnC,MAAM,kEAAkE,CAAC;AAK1E,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,kCAAkC,CAAC;IACrD,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,gBAAgB,CAAC;CAC9B,CAAC;AAyPF,KAAK,OAAO,GAAG,sBAAsB,GAAG,2BAA2B,CAAC;AAcpE,eAAO,MAAM,oCAAoC,EAAE,QAAQ,CACzD,WAAW,EACX,OAAO,CAoBR,CAAC"}
|
package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindThresholdFromSituation.js
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, propWhile, } from "../../../../../exercises/exercise.js";
|
|
2
|
+
import { getOptionFirstTermRankOneStuff, } from "../../../../../exercises/options/optionFirstTermRankOne.js";
|
|
3
|
+
import { getOptionIsWithSuperfluousData, } from "../../../../../exercises/options/optionIsWithSuperfluousData.js";
|
|
4
|
+
import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
|
|
5
|
+
import { numberVEA } from "../../../../../exercises/vea/numberVEA.js";
|
|
6
|
+
import { InequationSymbol, InequationSymbolConstructor, } from "../../../../../math/inequations/inequation.js";
|
|
7
|
+
import { randint } from "../../../../../math/utils/random/randint.js";
|
|
8
|
+
import { round } from "../../../../../math/utils/round.js";
|
|
9
|
+
import { situationsArithmetic, } from "../../../../../math/utils/sequences/situations/seqArithmeticSituations.js";
|
|
10
|
+
import { coinFlip } from "../../../../../utils/alea/coinFlip.js";
|
|
11
|
+
import { random } from "../../../../../utils/alea/random.js";
|
|
12
|
+
import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
|
|
13
|
+
const situations = situationsArithmetic;
|
|
14
|
+
const getInstruction = (identifiers, optsIn) => {
|
|
15
|
+
const opts = optsIn ?? optsDefault;
|
|
16
|
+
const firstRank = opts?.firstTermRankOne ? 1 : 0;
|
|
17
|
+
const { situationIndex, initial, reason, superfluousData, valueThreshold, inegSymbol, } = identifiers;
|
|
18
|
+
const situation = situations[situationIndex];
|
|
19
|
+
const inequationSymbol = new InequationSymbol(inegSymbol);
|
|
20
|
+
return `${situation.getStrSituation(initial, reason, firstRank, superfluousData)}
|
|
21
|
+
|
|
22
|
+
${situation.variationFindThreshold.getStrQuestion(initial, reason, firstRank, valueThreshold, inequationSymbol)}`;
|
|
23
|
+
};
|
|
24
|
+
const getAnswerNode = (identifiers, opts) => {
|
|
25
|
+
const firstRank = opts?.firstTermRankOne ? 1 : 0;
|
|
26
|
+
const { situationIndex, initial, reason, valueThreshold, inegSymbol } = identifiers;
|
|
27
|
+
const situation = situations[situationIndex];
|
|
28
|
+
const inequationSymbol = new InequationSymbol(inegSymbol);
|
|
29
|
+
return situation.variationFindThreshold.getAnswerNode(initial, reason, firstRank, valueThreshold, inequationSymbol);
|
|
30
|
+
};
|
|
31
|
+
const getAnswer = (identifiers, optsIn) => {
|
|
32
|
+
const opts = optsIn ?? optsDefault;
|
|
33
|
+
return getAnswerNode(identifiers, opts).simplify().toTex();
|
|
34
|
+
};
|
|
35
|
+
const getHint = (identifiers, optsIn) => {
|
|
36
|
+
const opts = optsIn ?? optsDefault;
|
|
37
|
+
const firstRank = opts?.firstTermRankOne ? 1 : 0;
|
|
38
|
+
const { situationIndex, valueThreshold, inegSymbol, reason } = identifiers;
|
|
39
|
+
const situation = situations[situationIndex];
|
|
40
|
+
const inequationSymbol = new InequationSymbol(inegSymbol);
|
|
41
|
+
return situation.variationFindThreshold.getHint(firstRank, valueThreshold, inequationSymbol, reason);
|
|
42
|
+
};
|
|
43
|
+
const getCorrection = (identifiers, optsIn) => {
|
|
44
|
+
const opts = optsIn ?? optsDefault;
|
|
45
|
+
const firstRank = opts?.firstTermRankOne ? 1 : 0;
|
|
46
|
+
const { situationIndex, initial, reason, valueThreshold, inegSymbol } = identifiers;
|
|
47
|
+
const situation = situations[situationIndex];
|
|
48
|
+
const inequationSymbol = new InequationSymbol(inegSymbol);
|
|
49
|
+
return situation.variationFindThreshold.getCorrectionStuff(initial, reason, firstRank, valueThreshold, inequationSymbol).str;
|
|
50
|
+
};
|
|
51
|
+
const getPropositions = (n, { answer, ...identifiers }, optsIn) => {
|
|
52
|
+
const opts = optsIn ?? optsDefault;
|
|
53
|
+
const firstRank = opts?.firstTermRankOne ? 1 : 0;
|
|
54
|
+
const { situationIndex, initial, reason, valueThreshold, inegSymbol } = identifiers;
|
|
55
|
+
const situation = situations[situationIndex];
|
|
56
|
+
const inequationSymbol = new InequationSymbol(inegSymbol);
|
|
57
|
+
const propositions = [];
|
|
58
|
+
addValidProp(propositions, answer);
|
|
59
|
+
const arrNodeWrong = [];
|
|
60
|
+
const rankValid = round(situation.variationFindThreshold
|
|
61
|
+
.getAnswerNode(initial, reason, firstRank, valueThreshold, inequationSymbol)
|
|
62
|
+
.evaluate(), 0);
|
|
63
|
+
//student: gives u[threshold] instead of threshold
|
|
64
|
+
{
|
|
65
|
+
const nodeWrong = situation.variationFindRandomTerm.getAnswerNode(initial, reason, firstRank, rankValid);
|
|
66
|
+
tryToAddWrongProp(propositions, nodeWrong.simplify().toTex());
|
|
67
|
+
}
|
|
68
|
+
//pseudo terror
|
|
69
|
+
if (coinFlip()) {
|
|
70
|
+
if (coinFlip()) {
|
|
71
|
+
//student: rankValid - 1
|
|
72
|
+
{
|
|
73
|
+
const nodeWrong = (rankValid - 1).toTree();
|
|
74
|
+
tryToAddWrongProp(propositions, nodeWrong.toTex());
|
|
75
|
+
arrNodeWrong.push(nodeWrong);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
//student: rankValid + 1
|
|
80
|
+
{
|
|
81
|
+
const nodeWrong = (rankValid + 1).toTree();
|
|
82
|
+
tryToAddWrongProp(propositions, nodeWrong.toTex());
|
|
83
|
+
arrNodeWrong.push(nodeWrong);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
//random around
|
|
88
|
+
{
|
|
89
|
+
const nodeWrong = Math.max(1, rankValid + randint(-5, 6, [0])).toTree();
|
|
90
|
+
tryToAddWrongProp(propositions, nodeWrong.toTex());
|
|
91
|
+
arrNodeWrong.push(nodeWrong);
|
|
92
|
+
}
|
|
93
|
+
//terror
|
|
94
|
+
{
|
|
95
|
+
const nodePicked = random(arrNodeWrong);
|
|
96
|
+
if (coinFlip()) {
|
|
97
|
+
if (coinFlip()) {
|
|
98
|
+
//student: rankValid - 1
|
|
99
|
+
{
|
|
100
|
+
const nodeWrong = (nodePicked.evaluate() - 1).toTree();
|
|
101
|
+
tryToAddWrongProp(propositions, nodeWrong.toTex());
|
|
102
|
+
arrNodeWrong.push(nodeWrong);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
//student: rankValid + 1
|
|
107
|
+
{
|
|
108
|
+
const nodeWrong = (nodePicked.evaluate() + 1).toTree();
|
|
109
|
+
tryToAddWrongProp(propositions, nodeWrong.toTex());
|
|
110
|
+
arrNodeWrong.push(nodeWrong);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
//filler
|
|
116
|
+
{
|
|
117
|
+
propWhile(propositions, n, () => {
|
|
118
|
+
tryToAddWrongProp(propositions, randint(1, 25).frenchify());
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
return shuffleProps(propositions, n);
|
|
122
|
+
};
|
|
123
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
124
|
+
try {
|
|
125
|
+
return numberVEA(ans, answer);
|
|
126
|
+
}
|
|
127
|
+
catch (err) {
|
|
128
|
+
return handleVEAError(err);
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
const getArithmeticFindThresholdFromSituationQuestion = (optsIn) => {
|
|
132
|
+
const opts = optsIn ?? optsDefault;
|
|
133
|
+
const { isWithSuperfluousData } = opts;
|
|
134
|
+
const firstRank = opts?.firstTermRankOne ? 1 : 0;
|
|
135
|
+
const situationIndex = randint(0, situations.length);
|
|
136
|
+
const situation = situations[situationIndex];
|
|
137
|
+
const initial = situation.randInitial();
|
|
138
|
+
const reason = situation.randReason();
|
|
139
|
+
const superfluousData = isWithSuperfluousData
|
|
140
|
+
? situation.randSuperfluousData()
|
|
141
|
+
: undefined;
|
|
142
|
+
const valueThreshold = situation.randThreshold(initial, reason, firstRank);
|
|
143
|
+
const inegSymbol = InequationSymbolConstructor.randomSymbol();
|
|
144
|
+
const identifiers = {
|
|
145
|
+
situationIndex,
|
|
146
|
+
initial,
|
|
147
|
+
reason,
|
|
148
|
+
superfluousData,
|
|
149
|
+
valueThreshold,
|
|
150
|
+
inegSymbol,
|
|
151
|
+
};
|
|
152
|
+
return getQuestionFromIdentifiers(identifiers, opts);
|
|
153
|
+
};
|
|
154
|
+
const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
155
|
+
const question = {
|
|
156
|
+
answer: getAnswer(identifiers, opts),
|
|
157
|
+
instruction: getInstruction(identifiers, opts),
|
|
158
|
+
keys: [],
|
|
159
|
+
answerFormat: "tex",
|
|
160
|
+
identifiers,
|
|
161
|
+
hint: getHint(identifiers, opts),
|
|
162
|
+
correction: getCorrection(identifiers, opts),
|
|
163
|
+
options: opts,
|
|
164
|
+
};
|
|
165
|
+
return question;
|
|
166
|
+
};
|
|
167
|
+
const optionsStuffFirstTermRankOne = getOptionFirstTermRankOneStuff(false);
|
|
168
|
+
const optionsStuffIsWithSuperfluousData = getOptionIsWithSuperfluousData(false);
|
|
169
|
+
const optsDefault = Object.assign({}, optionsStuffFirstTermRankOne.optsDefaultFirstTermRankOne, optionsStuffIsWithSuperfluousData.optsDefaultIsWithSuperfluousData);
|
|
170
|
+
const options = [
|
|
171
|
+
optionsStuffFirstTermRankOne.generatorOptionFirstTermRankOne,
|
|
172
|
+
optionsStuffIsWithSuperfluousData.generatorOptionIsWithSuperfluousData,
|
|
173
|
+
];
|
|
174
|
+
export const arithmeticFindThresholdFromSituation = {
|
|
175
|
+
id: "arithmeticFindThresholdFromSituation",
|
|
176
|
+
connector: "=",
|
|
177
|
+
label: "À partir d'une situation décrivant une évolution arithmétique, calculer un seuil",
|
|
178
|
+
isSingleStep: true,
|
|
179
|
+
generator: (nb, opts) => getDistinctQuestions(() => getArithmeticFindThresholdFromSituationQuestion(opts), nb),
|
|
180
|
+
options,
|
|
181
|
+
qcmTimer: 60,
|
|
182
|
+
freeTimer: 60,
|
|
183
|
+
getPropositions,
|
|
184
|
+
isAnswerValid,
|
|
185
|
+
subject: "Mathématiques",
|
|
186
|
+
getQuestionFromIdentifiers,
|
|
187
|
+
hasHintAndCorrection: true,
|
|
188
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from "./arithmeticFindExplicitFormulaFromSituation.js";
|
|
2
|
+
export * from "./arithmeticFindRecurrenceFormulaFromSituation.js";
|
|
3
|
+
export * from "./arithmeticFindTermFromSituation.js";
|
|
4
|
+
export * from "./arithmeticFindRankFromSituation.js";
|
|
5
|
+
export * from "./arithmeticFindThresholdFromSituation.js";
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/sequences/arithmetic/situations/index.ts"],"names":[],"mappings":"AAAA,cAAc,iDAAiD,CAAC;AAChE,cAAc,mDAAmD,CAAC;AAClE,cAAc,sCAAsC,CAAC;AACrD,cAAc,sCAAsC,CAAC;AACrD,cAAc,2CAA2C,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export * from "./arithmeticFindExplicitFormulaFromSituation.js";
|
|
2
|
+
export * from "./arithmeticFindRecurrenceFormulaFromSituation.js";
|
|
3
|
+
export * from "./arithmeticFindTermFromSituation.js";
|
|
4
|
+
export * from "./arithmeticFindRankFromSituation.js";
|
|
5
|
+
export * from "./arithmeticFindThresholdFromSituation.js";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Exercise } from "../../../../../exercises/exercise.js";
|
|
2
|
+
import { OptionFirstTermRankOne } from "../../../../../exercises/options/optionFirstTermRankOne.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
initial: number;
|
|
5
|
+
reason: number;
|
|
6
|
+
nbTerms: number;
|
|
7
|
+
lowRankDots: number;
|
|
8
|
+
highRankDots: number;
|
|
9
|
+
};
|
|
10
|
+
type Options = OptionFirstTermRankOne & {
|
|
11
|
+
isGiveCount: boolean;
|
|
12
|
+
};
|
|
13
|
+
export declare const arithmeticComputeSumWithDots: Exercise<Identifiers, Options>;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=arithmeticComputeSumWithDots.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arithmeticComputeSumWithDots.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/sequences/arithmetic/sum/arithmeticComputeSumWithDots.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,sBAAsB,EACvB,MAAM,mDAAmD,CAAC;AAwE3D,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AA4NF,KAAK,OAAO,GAAG,sBAAsB,GAAG;IAAE,WAAW,EAAE,OAAO,CAAA;CAAE,CAAC;AAiBjE,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAkBvE,CAAC"}
|