math-exercises 3.0.171 → 3.0.173
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/derivation/variations/signVarTable3dDegree.js +38 -10
- package/lib/exercises/math/derivation/variations/signVarTableFromDerivativeGraph.d.ts.map +1 -1
- package/lib/exercises/math/derivation/variations/signVarTableFromDerivativeGraph.js +7 -4
- package/lib/exercises/math/derivation/variations/signVarTableFromGraph.d.ts.map +1 -1
- package/lib/exercises/math/derivation/variations/signVarTableFromGraph.js +2 -3
- 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/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/functions/variations/partialVarTableFromGraph.d.ts.map +1 -1
- package/lib/exercises/math/functions/variations/partialVarTableFromGraph.js +2 -1
- package/lib/exercises/math/functions/variations/varTableFromGraph.d.ts.map +1 -1
- package/lib/exercises/math/functions/variations/varTableFromGraph.js +2 -1
- package/lib/exercises/math/functions/variations/varTableFromSentences.d.ts.map +1 -1
- package/lib/exercises/math/functions/variations/varTableFromSentences.js +2 -1
- package/lib/exercises/math/geometry/circles/circleCenterAndRadiusFromEquation.d.ts.map +1 -1
- package/lib/exercises/math/geometry/circles/circleCenterAndRadiusFromEquation.js +0 -2
- 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/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiAngle.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiAngle.js +64 -60
- package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiBH.d.ts +1 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiBH.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiBH.js +173 -47
- package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiSideLength.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiSideLength.js +112 -46
- package/lib/exercises/math/geometry/vectors/scalarProduct/alg/scalarProductInOrthonormalBasisIJ.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/scalarProduct/alg/scalarProductInOrthonormalBasisIJ.js +6 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/alg/scalarProductLamdbaULambdaV.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/scalarProduct/alg/scalarProductLamdbaULambdaV.js +60 -82
- package/lib/exercises/math/geometry/vectors/scalarProduct/angleFromScalarProduct.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/scalarProduct/angleFromScalarProduct.js +92 -6
- package/lib/exercises/math/geometry/vectors/scalarProduct/index.d.ts +6 -1
- package/lib/exercises/math/geometry/vectors/scalarProduct/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/scalarProduct/index.js +6 -1
- package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsOrthogonalVecsBasisIJ.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsOrthogonalVecsBasisIJ.js +6 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsOrthogonalVecsUsingCoords.js +1 -1
- package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsPointOnCircle.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsPointOnCircle.js +15 -5
- package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsPointOnPerpendicularBisector.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsPointOnPerpendicularBisector.js +18 -14
- package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsRightTriangleUsingPointCoords.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/scalarProduct/orth/scalarProductIsRightTriangleUsingPointCoords.js +15 -5
- package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductComputeBH.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductComputeBH.js +38 -4
- package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductOfVectsOnGrid1.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductOfVectsOnGrid1.js +77 -26
- package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductParallelogramDiagonalPlus.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductParallelogramDiagonalPlus.js +6 -7
- package/lib/exercises/math/probaStat/basicProbas/calculateProbaFromProbaLaw.js +1 -1
- package/lib/exercises/math/probaStat/probaFromTableWithContext.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/probaFromTableWithContext.js +3 -16
- package/lib/exercises/math/probaStat/randomVariable/decideWhichGameIsLessRisky.d.ts +14 -0
- package/lib/exercises/math/probaStat/randomVariable/decideWhichGameIsLessRisky.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/decideWhichGameIsLessRisky.js +167 -0
- package/lib/exercises/math/probaStat/randomVariable/findValueForFairRandomVariable.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/randomVariable/findValueForFairRandomVariable.js +29 -56
- package/lib/exercises/math/probaStat/randomVariable/index.d.ts +8 -0
- package/lib/exercises/math/probaStat/randomVariable/index.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/randomVariable/index.js +9 -0
- package/lib/exercises/math/probaStat/randomVariable/isTableProbabilityLaw.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/randomVariable/isTableProbabilityLaw.js +6 -6
- 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/randomVariable/randomVariableAverage.js +1 -1
- package/lib/exercises/math/probaStat/randomVariable/randomVariableFindMissingProbabilityInLaw.d.ts +9 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableFindMissingProbabilityInLaw.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableFindMissingProbabilityInLaw.js +116 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationAverage.d.ts +11 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationAverage.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationAverage.js +112 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationComputeProbability.d.ts +9 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationComputeProbability.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationComputeProbability.js +176 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationIsGameFavorable.d.ts +8 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationIsGameFavorable.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationIsGameFavorable.js +94 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationProbabilityLaw.d.ts +9 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationProbabilityLaw.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationProbabilityLaw.js +162 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationStandardDeviation.d.ts +8 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationStandardDeviation.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationStandardDeviation.js +133 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationValues.d.ts +8 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationValues.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationValues.js +211 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationVariance.d.ts +8 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationVariance.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationVariance.js +113 -0
- package/lib/exercises/math/probaStat/randomVariable/randomVariableStandardDeviation.js +1 -1
- package/lib/exercises/math/probaStat/randomVariable/randomVariableVariance.js +1 -1
- package/lib/exercises/math/probaStat/randomVariable/utils/buildVAOfGivenAverage.d.ts +31 -0
- package/lib/exercises/math/probaStat/randomVariable/utils/buildVAOfGivenAverage.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/randomVariable/utils/buildVAOfGivenAverage.js +192 -0
- package/lib/exercises/math/probaStat/randomVariable/utils/randomVariableSituations.d.ts +40 -11
- package/lib/exercises/math/probaStat/randomVariable/utils/randomVariableSituations.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/randomVariable/utils/randomVariableSituations.js +172 -30
- package/lib/exercises/math/probaStat/stats1var/medianWithList.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/medianWithList.js +16 -2
- 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/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/placeAssociateAngleOnCircle.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/circle/placeAssociateAngleOnCircle.js +0 -2
- 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/rationalVEA.d.ts.map +1 -1
- package/lib/exercises/vea/rationalVEA.js +7 -3
- package/lib/exercises/vea/varLineVEA.d.ts.map +1 -1
- package/lib/exercises/vea/varLineVEA.js +7 -3
- package/lib/exercises/vea/varSignTableVEA.d.ts +8 -0
- package/lib/exercises/vea/varSignTableVEA.d.ts.map +1 -1
- package/lib/exercises/vea/varSignTableVEA.js +8 -0
- package/lib/exercises/vea/xTableLineVEA.d.ts +1 -0
- package/lib/exercises/vea/xTableLineVEA.d.ts.map +1 -1
- package/lib/exercises/vea/xTableLineVEA.js +1 -0
- package/lib/index.d.ts +104 -5
- package/lib/index.d.ts.map +1 -1
- package/lib/latexTester.d.ts.map +1 -1
- package/lib/latexTester.js +3 -1
- package/lib/math/geometry/angle.d.ts +2 -0
- package/lib/math/geometry/angle.d.ts.map +1 -1
- package/lib/math/geometry/angle.js +17 -0
- 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/geometry/segment.js +1 -1
- package/lib/math/numbers/reals/real.d.ts.map +1 -1
- package/lib/math/numbers/reals/real.js +4 -0
- package/lib/math/probability/randomVariable.d.ts +2 -1
- package/lib/math/probability/randomVariable.d.ts.map +1 -1
- package/lib/math/probability/randomVariable.js +7 -1
- package/lib/math/utils/arithmetic/primeFactors.d.ts +1 -1
- package/lib/math/utils/arithmetic/primeFactors.d.ts.map +1 -1
- package/lib/math/utils/arithmetic/primeFactors.js +23 -9
- 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/pdfs/mdTableToLatexTabular.js +1 -1
- package/lib/tree/nodes/algebraicNode.d.ts +1 -0
- package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
- package/lib/tree/nodes/complex/complexNode.d.ts +1 -0
- package/lib/tree/nodes/complex/complexNode.d.ts.map +1 -1
- package/lib/tree/nodes/complex/complexNode.js +3 -0
- package/lib/tree/nodes/equations/equalNode.d.ts +1 -0
- package/lib/tree/nodes/equations/equalNode.d.ts.map +1 -1
- package/lib/tree/nodes/equations/equalNode.js +3 -0
- package/lib/tree/nodes/equations/equationSolutionNode.d.ts +1 -0
- package/lib/tree/nodes/equations/equationSolutionNode.d.ts.map +1 -1
- package/lib/tree/nodes/equations/equationSolutionNode.js +3 -0
- package/lib/tree/nodes/equations/multiEqualNode.d.ts +1 -0
- package/lib/tree/nodes/equations/multiEqualNode.d.ts.map +1 -1
- package/lib/tree/nodes/equations/multiEqualNode.js +3 -0
- package/lib/tree/nodes/equations/notEqualNode.d.ts +1 -0
- package/lib/tree/nodes/equations/notEqualNode.d.ts.map +1 -1
- package/lib/tree/nodes/equations/notEqualNode.js +3 -0
- package/lib/tree/nodes/functions/absNode.d.ts +1 -0
- package/lib/tree/nodes/functions/absNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/absNode.js +7 -0
- package/lib/tree/nodes/functions/arcSinNode.d.ts +1 -0
- package/lib/tree/nodes/functions/arcSinNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/arcSinNode.js +7 -0
- package/lib/tree/nodes/functions/arccosNode.d.ts +1 -0
- package/lib/tree/nodes/functions/arccosNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/arccosNode.js +7 -0
- package/lib/tree/nodes/functions/arctanNode.d.ts +1 -0
- package/lib/tree/nodes/functions/arctanNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/arctanNode.js +7 -0
- package/lib/tree/nodes/functions/cosNode.d.ts +1 -0
- package/lib/tree/nodes/functions/cosNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/cosNode.js +7 -0
- package/lib/tree/nodes/functions/expNode.d.ts +1 -0
- package/lib/tree/nodes/functions/expNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/expNode.js +7 -0
- package/lib/tree/nodes/functions/factorialNode.d.ts +30 -0
- package/lib/tree/nodes/functions/factorialNode.d.ts.map +1 -0
- package/lib/tree/nodes/functions/factorialNode.js +79 -0
- package/lib/tree/nodes/functions/functionNode.d.ts +2 -1
- package/lib/tree/nodes/functions/functionNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/functionNode.js +1 -0
- package/lib/tree/nodes/functions/integralNode.d.ts +1 -0
- package/lib/tree/nodes/functions/integralNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/integralNode.js +7 -0
- package/lib/tree/nodes/functions/log10Node.d.ts +1 -0
- package/lib/tree/nodes/functions/log10Node.d.ts.map +1 -1
- package/lib/tree/nodes/functions/log10Node.js +7 -0
- package/lib/tree/nodes/functions/logNode.d.ts +1 -0
- package/lib/tree/nodes/functions/logNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/logNode.js +9 -0
- package/lib/tree/nodes/functions/oppositeNode.d.ts +1 -0
- package/lib/tree/nodes/functions/oppositeNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/oppositeNode.js +7 -0
- package/lib/tree/nodes/functions/sinNode.d.ts +1 -0
- package/lib/tree/nodes/functions/sinNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/sinNode.js +7 -0
- package/lib/tree/nodes/functions/sqrtNode.d.ts +1 -0
- package/lib/tree/nodes/functions/sqrtNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/sqrtNode.js +7 -0
- package/lib/tree/nodes/functions/tanNode.d.ts +1 -0
- package/lib/tree/nodes/functions/tanNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/tanNode.js +7 -0
- package/lib/tree/nodes/geometry/degree.d.ts +1 -0
- package/lib/tree/nodes/geometry/degree.d.ts.map +1 -1
- package/lib/tree/nodes/geometry/degree.js +7 -0
- package/lib/tree/nodes/geometry/lengthNode.d.ts +1 -0
- package/lib/tree/nodes/geometry/lengthNode.d.ts.map +1 -1
- package/lib/tree/nodes/geometry/lengthNode.js +7 -0
- package/lib/tree/nodes/geometry/pointNode.d.ts +1 -0
- package/lib/tree/nodes/geometry/pointNode.d.ts.map +1 -1
- package/lib/tree/nodes/geometry/pointNode.js +7 -0
- package/lib/tree/nodes/geometry/vectorNode.d.ts +1 -0
- package/lib/tree/nodes/geometry/vectorNode.d.ts.map +1 -1
- package/lib/tree/nodes/geometry/vectorNode.js +7 -0
- 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 +7 -0
- package/lib/tree/nodes/inequations/inequationSolutionNode.d.ts +1 -0
- package/lib/tree/nodes/inequations/inequationSolutionNode.d.ts.map +1 -1
- package/lib/tree/nodes/inequations/inequationSolutionNode.js +7 -0
- package/lib/tree/nodes/node.d.ts +2 -1
- package/lib/tree/nodes/node.d.ts.map +1 -1
- package/lib/tree/nodes/node.js +2 -0
- package/lib/tree/nodes/nodeConstructor.d.ts.map +1 -1
- package/lib/tree/nodes/nodeConstructor.js +4 -0
- package/lib/tree/nodes/numbers/percentNode.d.ts +1 -0
- package/lib/tree/nodes/numbers/percentNode.d.ts.map +1 -1
- package/lib/tree/nodes/numbers/percentNode.js +7 -0
- package/lib/tree/nodes/operators/addNode.d.ts +1 -0
- package/lib/tree/nodes/operators/addNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/addNode.js +7 -0
- package/lib/tree/nodes/operators/binomialCoefficientNode.d.ts +4 -3
- package/lib/tree/nodes/operators/binomialCoefficientNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/binomialCoefficientNode.js +24 -5
- package/lib/tree/nodes/operators/divideNode.d.ts +1 -0
- package/lib/tree/nodes/operators/divideNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/divideNode.js +7 -0
- package/lib/tree/nodes/operators/fractionNode.d.ts +1 -0
- package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/fractionNode.js +7 -0
- package/lib/tree/nodes/operators/limitNode.d.ts +1 -0
- package/lib/tree/nodes/operators/limitNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/limitNode.js +7 -0
- package/lib/tree/nodes/operators/multiplyNode.d.ts +1 -0
- package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/multiplyNode.js +7 -0
- package/lib/tree/nodes/operators/powerNode.d.ts +1 -0
- package/lib/tree/nodes/operators/powerNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/powerNode.js +7 -0
- package/lib/tree/nodes/operators/substractNode.d.ts +1 -0
- package/lib/tree/nodes/operators/substractNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/substractNode.js +7 -0
- package/lib/tree/nodes/polynomials/monomNode.d.ts +1 -0
- package/lib/tree/nodes/polynomials/monomNode.d.ts.map +1 -1
- package/lib/tree/nodes/polynomials/monomNode.js +7 -0
- package/lib/tree/nodes/polynomials/trinomNode.d.ts +1 -0
- package/lib/tree/nodes/polynomials/trinomNode.d.ts.map +1 -1
- package/lib/tree/nodes/polynomials/trinomNode.js +7 -0
- package/lib/tree/nodes/sets/belongsNode.d.ts +1 -0
- package/lib/tree/nodes/sets/belongsNode.d.ts.map +1 -1
- package/lib/tree/nodes/sets/belongsNode.js +7 -0
- package/lib/tree/nodes/sets/discreteSetNode.d.ts +1 -0
- package/lib/tree/nodes/sets/discreteSetNode.d.ts.map +1 -1
- package/lib/tree/nodes/sets/discreteSetNode.js +7 -0
- package/lib/tree/nodes/sets/intervalNode.d.ts +1 -0
- package/lib/tree/nodes/sets/intervalNode.d.ts.map +1 -1
- package/lib/tree/nodes/sets/intervalNode.js +7 -0
- package/lib/tree/nodes/sets/unionIntervalNode.d.ts +1 -0
- package/lib/tree/nodes/sets/unionIntervalNode.d.ts.map +1 -1
- package/lib/tree/nodes/sets/unionIntervalNode.js +7 -0
- package/lib/tree/nodes/variables/variableNode.d.ts +1 -0
- package/lib/tree/nodes/variables/variableNode.d.ts.map +1 -1
- package/lib/tree/nodes/variables/variableNode.js +7 -0
- package/lib/tree/parsers/vectorParser.d.ts.map +1 -1
- package/lib/tree/parsers/vectorParser.js +8 -0
- package/lib/tree/utilities/nodeShuffler.d.ts.map +1 -1
- package/lib/tree/utilities/nodeShuffler.js +3 -0
- package/lib/tree/utilities/nodeSimplifier.d.ts.map +1 -1
- package/lib/tree/utilities/nodeSimplifier.js +3 -0
- package/package.json +1 -1
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
2
|
+
import { xTableLineVEA } from "../../../../exercises/vea/xTableLineVEA.js";
|
|
3
|
+
import { opposite } from "../../../../tree/nodes/functions/oppositeNode.js";
|
|
4
|
+
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
5
|
+
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
6
|
+
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
7
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
8
|
+
import { buildRandomVariableSituation, getRandomVariableSituation, } from "./utils/randomVariableSituations.js";
|
|
9
|
+
const getAnswerTable = (identifiers) => {
|
|
10
|
+
const { params } = identifiers;
|
|
11
|
+
const va = getRandomVariableSituation(params).getVA();
|
|
12
|
+
return va.getLawTable();
|
|
13
|
+
};
|
|
14
|
+
const getInstruction = (identifiers) => {
|
|
15
|
+
const { params } = identifiers;
|
|
16
|
+
const context = getRandomVariableSituation(params).getContext();
|
|
17
|
+
return (context +
|
|
18
|
+
`
|
|
19
|
+
|
|
20
|
+
Déterminer la loi de probabilité de $X$.`);
|
|
21
|
+
};
|
|
22
|
+
const getHint = () => {
|
|
23
|
+
return `Détermine les valeurs possibles $x_i$ que peut prendre $X$. Puis, pour chaque valeur, calcule la probabilité $p_i$ associée.`;
|
|
24
|
+
};
|
|
25
|
+
const getCorrection = (identifiers) => {
|
|
26
|
+
const { params } = identifiers;
|
|
27
|
+
const table = getRandomVariableSituation(params).getVA().getLawMdTable();
|
|
28
|
+
switch (params.id) {
|
|
29
|
+
case "coin":
|
|
30
|
+
return `On liste toutes les issues possibles :
|
|
31
|
+
|
|
32
|
+
- $2$ piles : le gain du joueur est alors $${multiply(2, params.a).toSimplificationTex()}$ points. De plus, la probabilité d'obtenir $2$ piles est :
|
|
33
|
+
|
|
34
|
+
$$
|
|
35
|
+
\\frac{1}{2}\\times \\frac{1}{2} = \\frac{1}{4}
|
|
36
|
+
$$
|
|
37
|
+
|
|
38
|
+
- $1$ pile, $1$ face : le gain du joueur est alors $${substract(params.a, params.b).toSimplificationTex()}$ points. De plus, il y a deux possibilités pour réaliser cette issue : obtenir pile au premier lancer puis face au deuxième, ou obtenir face au premier lance puis pile au deuxième. La probabilité de cette issue est donc :
|
|
39
|
+
|
|
40
|
+
$$
|
|
41
|
+
\\frac{1}{2}\\times \\frac{1}{2} + \\frac{1}{2}\\times \\frac{1}{2} = \\frac{1}{2}
|
|
42
|
+
$$
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
- $2$ faces: le gain du joueur est alors $${opposite(multiply(2, params.b)).toSimplificationTex()}$ points. De plus, la probabilité d'obtenir $2$ piles est :
|
|
46
|
+
|
|
47
|
+
$$
|
|
48
|
+
\\frac{1}{2}\\times \\frac{1}{2} = \\frac{1}{4}
|
|
49
|
+
$$
|
|
50
|
+
|
|
51
|
+
La loi de probabilité de $X$ est donc :
|
|
52
|
+
|
|
53
|
+
${table}
|
|
54
|
+
|
|
55
|
+
`;
|
|
56
|
+
case "urne": {
|
|
57
|
+
const total = params.n + params.r + params.b;
|
|
58
|
+
return `On s'intéresse à chaque issue :
|
|
59
|
+
|
|
60
|
+
- Tirer une boule blanche : le gain algébrique est $${params.gb}$, et la probabilité vaut $${frac(params.b, total).toSimplificationTex()}$ ;
|
|
61
|
+
- Tirer une boule rouge : le gain algébrique est $${params.gr}$, et la probabilité vaut $${frac(params.r, total).toSimplificationTex()}$ ;
|
|
62
|
+
- Tirer une boule noire : le gain algébrique est $${params.gn}$, et la probabilité vaut $${frac(params.n, total).toSimplificationTex()}$.
|
|
63
|
+
|
|
64
|
+
La loi de probabilité de $X$ est donc :
|
|
65
|
+
|
|
66
|
+
${table}
|
|
67
|
+
`;
|
|
68
|
+
}
|
|
69
|
+
case "diceMultiple": {
|
|
70
|
+
const multiples = [];
|
|
71
|
+
for (let i = 1; i < params.n; i++) {
|
|
72
|
+
if (i % params.winningMultiple === 0) {
|
|
73
|
+
multiples.push(i);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return `Les faces du dés qui sont des multiples de $${params.winningMultiple}$ sont : $${multiples.join("\\ ; \\ ")}$.
|
|
77
|
+
|
|
78
|
+
La probabilité d'obtenir un multiple de $${params.winningMultiple}$ est donc $${frac(multiples.length, params.n).toSimplificationTex()}$, et dans ce cas on gagne $${params.gain}\\ €$.
|
|
79
|
+
|
|
80
|
+
La probabilité de ne pas obtenir un multiple de $${params.winningMultiple}$ est alors $${frac(params.n - multiples.length, params.n).toSimplificationTex()}$, et dans ce cas on perd $${params.loss}\\ €$.
|
|
81
|
+
|
|
82
|
+
La loi de probabilité de $X$ est donc :
|
|
83
|
+
|
|
84
|
+
${table}
|
|
85
|
+
`;
|
|
86
|
+
}
|
|
87
|
+
case "cards": {
|
|
88
|
+
return `On s'intéresse à chaque issue :
|
|
89
|
+
|
|
90
|
+
- Tirer un as : le gain algébrique est $${params.gAs}$, et la probabilité vaut $${frac(4, 52).toSimplificationTex()}$ ;
|
|
91
|
+
- Tirer une figure: le gain algébrique est $${params.gFigure}$, et la probabilité vaut $${frac(12, 52).toSimplificationTex()}$ ;
|
|
92
|
+
- Tirer une autre carte : le gain algébrique est $${params.gOther}$, et la probabilité vaut $${frac(36, 52).toSimplificationTex()}$.
|
|
93
|
+
|
|
94
|
+
La loi de probabilité de $X$ est donc :
|
|
95
|
+
|
|
96
|
+
${table}
|
|
97
|
+
`;
|
|
98
|
+
}
|
|
99
|
+
// case "diceSum": {
|
|
100
|
+
// const results = [["\\ ", "1", "2", "3", "4"], ["1"], ["2"], ["3"], ["4"]];
|
|
101
|
+
// for (let i = 1; i < 5; i++) {
|
|
102
|
+
// for (let j = 1; j < 5; j++) {
|
|
103
|
+
// results[i][j] = (i + j).frenchify();
|
|
104
|
+
// }
|
|
105
|
+
// }
|
|
106
|
+
// return `Voici tous les résultats possibles en fonction du résultat de chaque dé :
|
|
107
|
+
// ${mdTable(results, true)}
|
|
108
|
+
// Les valeurs possibles pour $X$ sont donc :
|
|
109
|
+
// ${mdTable(getAnswerTable(identifiers), true)}`;
|
|
110
|
+
// }
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
const getKeys = () => {
|
|
114
|
+
return [];
|
|
115
|
+
};
|
|
116
|
+
const isAnswerTableValid = (ans, { answerTable }) => {
|
|
117
|
+
try {
|
|
118
|
+
return (xTableLineVEA(ans[0], answerTable[0]) &&
|
|
119
|
+
xTableLineVEA(ans[1], answerTable[1]));
|
|
120
|
+
}
|
|
121
|
+
catch (err) {
|
|
122
|
+
return handleVEAError(err);
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
const getRandomVariableSituationValuesQuestion = () => {
|
|
126
|
+
const params = buildRandomVariableSituation();
|
|
127
|
+
const values = getRandomVariableSituation(params).getVA().xValues;
|
|
128
|
+
const identifiers = {
|
|
129
|
+
params,
|
|
130
|
+
initTable: [
|
|
131
|
+
[`$x_i$`, ...values.map((_e) => "")],
|
|
132
|
+
[`$P(X=x_i)$`, ...values.map((_e) => "")],
|
|
133
|
+
],
|
|
134
|
+
};
|
|
135
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
136
|
+
};
|
|
137
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
138
|
+
return {
|
|
139
|
+
answerTable: getAnswerTable(identifiers),
|
|
140
|
+
instruction: getInstruction(identifiers),
|
|
141
|
+
keys: getKeys(identifiers),
|
|
142
|
+
answerFormat: "tex",
|
|
143
|
+
identifiers,
|
|
144
|
+
hint: getHint(identifiers),
|
|
145
|
+
correction: getCorrection(identifiers),
|
|
146
|
+
initTable: identifiers.initTable,
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
export const randomVariableSituationProbabilityLaw = {
|
|
150
|
+
id: "randomVariableSituationProbabilityLaw",
|
|
151
|
+
label: "Dresser la loi de probabilité d'une variable aléatoire avec contexte",
|
|
152
|
+
isSingleStep: true,
|
|
153
|
+
generator: (nb, opts) => getDistinctQuestions(() => getRandomVariableSituationValuesQuestion(opts), nb),
|
|
154
|
+
qcmTimer: 60,
|
|
155
|
+
freeTimer: 60,
|
|
156
|
+
isAnswerTableValid,
|
|
157
|
+
getAnswerTable,
|
|
158
|
+
subject: "Mathématiques",
|
|
159
|
+
getQuestionFromIdentifiers,
|
|
160
|
+
hasHintAndCorrection: true,
|
|
161
|
+
answerType: "valueTable",
|
|
162
|
+
};
|
package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationStandardDeviation.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { SituationParams } from "./utils/randomVariableSituations.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
params: SituationParams;
|
|
5
|
+
};
|
|
6
|
+
export declare const randomVariableSituationStandardDeviation: Exercise<Identifiers>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=randomVariableSituationStandardDeviation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"randomVariableSituationStandardDeviation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/randomVariable/randomVariableSituationStandardDeviation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAQrC,OAAO,EAGL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAE7C,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,eAAe,CAAC;CACzB,CAAC;AA6HF,eAAO,MAAM,wCAAwC,EAAE,QAAQ,CAAC,WAAW,CAqB1E,CAAC"}
|
package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationStandardDeviation.js
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, propWhile, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { rationalVEA } from "../../../../exercises/vea/rationalVEA.js";
|
|
4
|
+
import { RationalConstructor } from "../../../../math/numbers/rationals/rational.js";
|
|
5
|
+
import { sqrt } from "../../../../tree/nodes/functions/sqrtNode.js";
|
|
6
|
+
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
7
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
8
|
+
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
9
|
+
import { buildRandomVariableSituation, getRandomVariableSituation, } from "./utils/randomVariableSituations.js";
|
|
10
|
+
const getPropositions = (n, { answer }) => {
|
|
11
|
+
const propositions = [];
|
|
12
|
+
addValidProp(propositions, answer);
|
|
13
|
+
propWhile(propositions, n, () => {
|
|
14
|
+
tryToAddWrongProp(propositions, sqrt(RationalConstructor.randomIrreductible(30).toTree())
|
|
15
|
+
.simplify()
|
|
16
|
+
.toTex());
|
|
17
|
+
});
|
|
18
|
+
return shuffleProps(propositions, n);
|
|
19
|
+
};
|
|
20
|
+
const getAnswer = (identifiers) => {
|
|
21
|
+
const { params } = identifiers;
|
|
22
|
+
const va = getRandomVariableSituation(params).getVA();
|
|
23
|
+
return va.getStandardDeviation().simplify().toTex();
|
|
24
|
+
};
|
|
25
|
+
const getInstruction = (identifiers) => {
|
|
26
|
+
const { params } = identifiers;
|
|
27
|
+
const context = getRandomVariableSituation(params).getContext();
|
|
28
|
+
return (context +
|
|
29
|
+
`
|
|
30
|
+
|
|
31
|
+
Que vaut l'écart-type $\\sigma(X)$ de $X$ ?
|
|
32
|
+
|
|
33
|
+
Donner la valeur exacte ou une valeur arrondie au centième.`);
|
|
34
|
+
};
|
|
35
|
+
const getHint = () => {
|
|
36
|
+
return `Dresse la loi de probabilité de $X$. Pour cela, détermine les valeurs possibles $x_i$ que peut prendre $X$, puis pour chaque valeur, calcule la probabilité $p_i$ associée.
|
|
37
|
+
|
|
38
|
+
Tu peux alors calculer l'espérance de $X$ par la formule :
|
|
39
|
+
|
|
40
|
+
$$
|
|
41
|
+
E(X) = x_1\\times p_1 + \\ldots + x_n\\times p_n
|
|
42
|
+
$$
|
|
43
|
+
|
|
44
|
+
La variance $V(X)$ s'obtient par la formule :
|
|
45
|
+
|
|
46
|
+
$$
|
|
47
|
+
V(X) = p_1(x_1-E(X))^2 + \\ldots + p_n(x_n-E(X))^2
|
|
48
|
+
$$
|
|
49
|
+
|
|
50
|
+
Et enfin, l'écart-type est la racine carrée de la variance :
|
|
51
|
+
|
|
52
|
+
$$
|
|
53
|
+
\\sigma(X) = \\sqrt{V(X)}
|
|
54
|
+
$$
|
|
55
|
+
`;
|
|
56
|
+
};
|
|
57
|
+
const getCorrection = (identifiers) => {
|
|
58
|
+
const { params } = identifiers;
|
|
59
|
+
const va = getRandomVariableSituation(params).getVA();
|
|
60
|
+
return `On dresse la loi de probabilité de $X$ :
|
|
61
|
+
|
|
62
|
+
${va.getLawMdTable()}
|
|
63
|
+
|
|
64
|
+
Puis on calcule l'espérance :
|
|
65
|
+
|
|
66
|
+
${alignTex([
|
|
67
|
+
["E(X)", "=", va.getAverage().toTex()],
|
|
68
|
+
["", "=", va.getAverage().simplify().toTex()],
|
|
69
|
+
])}
|
|
70
|
+
|
|
71
|
+
Puis la variance :
|
|
72
|
+
|
|
73
|
+
${alignTex([
|
|
74
|
+
["V(X)", "=", va.getVariance().toTex()],
|
|
75
|
+
["", "=", va.getVariance().simplify().toTex()],
|
|
76
|
+
])}
|
|
77
|
+
|
|
78
|
+
Enfin, on en déduit l'écart type :
|
|
79
|
+
|
|
80
|
+
${alignTex([
|
|
81
|
+
["\\sigma(X)", "=", "\\sqrt{V(X)}"],
|
|
82
|
+
["", "=", va.getStandardDeviation().simplify().toTex()],
|
|
83
|
+
])}`;
|
|
84
|
+
};
|
|
85
|
+
const getKeys = () => {
|
|
86
|
+
return [];
|
|
87
|
+
};
|
|
88
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
89
|
+
try {
|
|
90
|
+
const parsed = parseAlgebraic(ans);
|
|
91
|
+
if (!parsed)
|
|
92
|
+
return false;
|
|
93
|
+
return rationalVEA(ans, answer) || parsed.simplify().toTex() === answer;
|
|
94
|
+
}
|
|
95
|
+
catch (err) {
|
|
96
|
+
return handleVEAError(err);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
const getRandomVariableSituationAverageQuestion = () => {
|
|
100
|
+
const params = buildRandomVariableSituation();
|
|
101
|
+
const identifiers = {
|
|
102
|
+
params,
|
|
103
|
+
};
|
|
104
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
105
|
+
};
|
|
106
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
107
|
+
return {
|
|
108
|
+
answer: getAnswer(identifiers),
|
|
109
|
+
instruction: getInstruction(identifiers),
|
|
110
|
+
keys: getKeys(identifiers),
|
|
111
|
+
answerFormat: "tex",
|
|
112
|
+
identifiers,
|
|
113
|
+
hint: getHint(identifiers),
|
|
114
|
+
correction: getCorrection(identifiers),
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
export const randomVariableSituationStandardDeviation = {
|
|
118
|
+
id: "randomVariableSituationStandardDeviation",
|
|
119
|
+
connector: "=",
|
|
120
|
+
label: "Calculer l'écart-type $\\sigma(X)$ d'une variable aléatoire dans un contexte",
|
|
121
|
+
isSingleStep: true,
|
|
122
|
+
generator: (nb, opts) => getDistinctQuestions(() => getRandomVariableSituationAverageQuestion(opts), nb),
|
|
123
|
+
qcmTimer: 60,
|
|
124
|
+
freeTimer: 60,
|
|
125
|
+
getPropositions,
|
|
126
|
+
isAnswerValid,
|
|
127
|
+
subject: "Mathématiques",
|
|
128
|
+
getHint,
|
|
129
|
+
getCorrection,
|
|
130
|
+
getAnswer,
|
|
131
|
+
getQuestionFromIdentifiers,
|
|
132
|
+
hasHintAndCorrection: true,
|
|
133
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { SituationParams } from "./utils/randomVariableSituations.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
params: SituationParams;
|
|
5
|
+
};
|
|
6
|
+
export declare const randomVariableSituationValues: Exercise<Identifiers>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=randomVariableSituationValues.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"randomVariableSituationValues.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/randomVariable/randomVariableSituationValues.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AASrC,OAAO,EAGL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAE7C,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,eAAe,CAAC;CACzB,CAAC;AAuPF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,CAqB/D,CAAC"}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { addValidProp, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { opposite } from "../../../../tree/nodes/functions/oppositeNode.js";
|
|
4
|
+
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
5
|
+
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
6
|
+
import { DiscreteSetNode } from "../../../../tree/nodes/sets/discreteSetNode.js";
|
|
7
|
+
import { discreteSetParser } from "../../../../tree/parsers/discreteSetParser.js";
|
|
8
|
+
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
9
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
10
|
+
import { buildRandomVariableSituation, getRandomVariableSituation, } from "./utils/randomVariableSituations.js";
|
|
11
|
+
const getAnswer = (identifiers) => {
|
|
12
|
+
const { params } = identifiers;
|
|
13
|
+
const va = getRandomVariableSituation(params).getVA();
|
|
14
|
+
return new DiscreteSetNode(va.xValues).simplify().toTex();
|
|
15
|
+
};
|
|
16
|
+
const getPropositions = (_n, { answer, params }) => {
|
|
17
|
+
const propositions = [];
|
|
18
|
+
addValidProp(propositions, answer);
|
|
19
|
+
switch (params.id) {
|
|
20
|
+
case "coin":
|
|
21
|
+
tryToAddWrongProp(propositions, new DiscreteSetNode([params.a.toTree(), params.b.toTree()])
|
|
22
|
+
.simplify()
|
|
23
|
+
.toTex());
|
|
24
|
+
tryToAddWrongProp(propositions, new DiscreteSetNode(["\\text{Pile}".toTree(), "\\text{Face}".toTree()])
|
|
25
|
+
.simplify()
|
|
26
|
+
.toTex());
|
|
27
|
+
tryToAddWrongProp(propositions, new DiscreteSetNode([params.a.toTree(), (-params.b).toTree()])
|
|
28
|
+
.simplify()
|
|
29
|
+
.toTex());
|
|
30
|
+
tryToAddWrongProp(propositions, new DiscreteSetNode([params.a.toTree(), params.b.toTree()])
|
|
31
|
+
.simplify()
|
|
32
|
+
.toTex());
|
|
33
|
+
break;
|
|
34
|
+
case "urne":
|
|
35
|
+
tryToAddWrongProp(propositions, new DiscreteSetNode([
|
|
36
|
+
"\\text{Blanche}".toTree(),
|
|
37
|
+
"\\text{Rouge}".toTree(),
|
|
38
|
+
"\\text{Noire}".toTree(),
|
|
39
|
+
])
|
|
40
|
+
.simplify()
|
|
41
|
+
.toTex());
|
|
42
|
+
tryToAddWrongProp(propositions, new DiscreteSetNode([
|
|
43
|
+
params.b.toTree(),
|
|
44
|
+
params.r.toTree(),
|
|
45
|
+
params.n.toTree(),
|
|
46
|
+
])
|
|
47
|
+
.simplify()
|
|
48
|
+
.toTex());
|
|
49
|
+
tryToAddWrongProp(propositions, new DiscreteSetNode([
|
|
50
|
+
params.gb.toTree(),
|
|
51
|
+
params.gr.toTree(),
|
|
52
|
+
(-params.gn).toTree(),
|
|
53
|
+
])
|
|
54
|
+
.simplify()
|
|
55
|
+
.toTex());
|
|
56
|
+
break;
|
|
57
|
+
case "diceMultiple": {
|
|
58
|
+
const allValues = [...Array(params.n).keys()].map((i) => i + 1);
|
|
59
|
+
const multiples = [];
|
|
60
|
+
for (let i = 1; i < params.n; i++) {
|
|
61
|
+
if (i % params.winningMultiple === 0) {
|
|
62
|
+
multiples.push(i);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
tryToAddWrongProp(propositions, new DiscreteSetNode(multiples.map((m) => m.toTree()))
|
|
66
|
+
.simplify()
|
|
67
|
+
.toTex());
|
|
68
|
+
tryToAddWrongProp(propositions, new DiscreteSetNode(allValues.map((v) => v.toTree()))
|
|
69
|
+
.simplify()
|
|
70
|
+
.toTex());
|
|
71
|
+
tryToAddWrongProp(propositions, new DiscreteSetNode([params.gain.toTree(), params.loss.toTree()])
|
|
72
|
+
.simplify()
|
|
73
|
+
.toTex());
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return shuffle(propositions);
|
|
77
|
+
};
|
|
78
|
+
const getInstruction = (identifiers) => {
|
|
79
|
+
const { params } = identifiers;
|
|
80
|
+
const context = getRandomVariableSituation(params).getContext();
|
|
81
|
+
return (context +
|
|
82
|
+
`
|
|
83
|
+
|
|
84
|
+
Quel est l'ensemble des valeurs possibles pour $X$ ?`);
|
|
85
|
+
};
|
|
86
|
+
const getHint = (identifiers) => {
|
|
87
|
+
const { params } = identifiers;
|
|
88
|
+
switch (params.id) {
|
|
89
|
+
case "coin":
|
|
90
|
+
return `La variable aléatoire $X$ donne le gain algébrique du joueur (c'est à dire un gain qui peut être négatif si le joueur perd des points) en fonction du résultat de ses lancers. Les valeurs $x_i$ qu'elle prend sont donc les valeurs de gain (ou de perte) possibles.`;
|
|
91
|
+
case "urne":
|
|
92
|
+
return `La variable aléatoire $X$ donne le gain algébrique du joueur (c'est à dire un gain qui peut être négatif si le joueur perd de l'argent) en fonction de la boule qu'il a tirée. Les valeurs $x_i$ qu'elle prend sont donc les valeurs de gain (ou de perte) possibles.`;
|
|
93
|
+
case "diceMultiple":
|
|
94
|
+
return `La variable aléatoire $X$ donne le gain algébrique du joueur (c'est à dire un gain qui peut être négatif si le joueur perd de l'argent) en fonction de la face obtenue. Les valeurs $x_i$ qu'elle prend sont donc les valeurs de gain (ou de perte) possibles.`;
|
|
95
|
+
case "cards":
|
|
96
|
+
return `La variable aléatoire $X$ donne le gain algébrique du joueur (c'est à dire un gain qui peut être négatif si le joueur perd de l'argent) en fonction de la carte qu'il a tirée. Les valeurs $x_i$ qu'elle prend sont donc les valeurs de gain (ou de perte) possibles.`;
|
|
97
|
+
// case "diceSum":
|
|
98
|
+
// return `Chaque dé peut valoir $1$, $2$, $3$ ou $4$. Cela créé donc $16$ résultats possibles, par exemple $1+1=2$, $3+4=7$, etc... Détermine tous les résultats possibles.`;
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
const getCorrection = (identifiers) => {
|
|
102
|
+
const { params } = identifiers;
|
|
103
|
+
switch (params.id) {
|
|
104
|
+
case "coin":
|
|
105
|
+
return `On liste toutes les issues possibles :
|
|
106
|
+
|
|
107
|
+
- $2$ piles : le gain du joueur est alors $${multiply(2, params.a).toSimplificationTex()}$ points.
|
|
108
|
+
- $1$ pile, $1$ face : le gain du joueur est alors $${substract(params.a, params.b).toSimplificationTex()}$ points.
|
|
109
|
+
- $2$ faces: le gain du joueur est alors $${opposite(multiply(2, params.b)).toSimplificationTex()}$ points.
|
|
110
|
+
|
|
111
|
+
L'ensemble des valeurs possibles pour $X$ est donc :
|
|
112
|
+
|
|
113
|
+
$$
|
|
114
|
+
${getAnswer(identifiers)}
|
|
115
|
+
$$
|
|
116
|
+
`;
|
|
117
|
+
case "urne":
|
|
118
|
+
return `Le gain pour chaque tirage vaut :
|
|
119
|
+
|
|
120
|
+
- $${params.gb}$ si on tire une boule blanche ;
|
|
121
|
+
- $${params.gr}$ si on tire une boule rouge ;
|
|
122
|
+
- $${params.gn}$ si on tire une boule noire.
|
|
123
|
+
|
|
124
|
+
L'ensemble des valeurs possibles pour $X$ est donc :
|
|
125
|
+
|
|
126
|
+
$$
|
|
127
|
+
${getAnswer(identifiers)}
|
|
128
|
+
$$`;
|
|
129
|
+
case "diceMultiple":
|
|
130
|
+
return `Si on obtient un multiple de $${params.winningMultiple}$, on gagne $${params.gain}\\ €$, donc $X$ vaut $${params.gain}$ dans ce cas. Sinon, on perd $${params.loss}\\ €$, donc $X$ vaut $-${params.loss}$.
|
|
131
|
+
|
|
132
|
+
L'ensemble des valeurs possibles pour $X$ est donc :
|
|
133
|
+
|
|
134
|
+
$$
|
|
135
|
+
${getAnswer(identifiers)}
|
|
136
|
+
$$`;
|
|
137
|
+
case "cards":
|
|
138
|
+
return `Le gain pour chaque tirage vaut :
|
|
139
|
+
|
|
140
|
+
- $${params.gAs}$ si on tire un as ;
|
|
141
|
+
- $${params.gFigure}$ si on tire une figure ;
|
|
142
|
+
- $${params.gOther}$ si on tire une autre carte.
|
|
143
|
+
|
|
144
|
+
L'ensemble des valeurs possibles pour $X$ est donc :
|
|
145
|
+
|
|
146
|
+
$$
|
|
147
|
+
${getAnswer(identifiers)}
|
|
148
|
+
$$`;
|
|
149
|
+
// case "diceSum": {
|
|
150
|
+
// const results = [["\\ ", "1", "2", "3", "4"], ["1"], ["2"], ["3"], ["4"]];
|
|
151
|
+
// for (let i = 1; i < 5; i++) {
|
|
152
|
+
// for (let j = 1; j < 5; j++) {
|
|
153
|
+
// results[i][j] = (i + j).frenchify();
|
|
154
|
+
// }
|
|
155
|
+
// }
|
|
156
|
+
// return `Voici tous les résultats possibles en fonction du résultat de chaque dé :
|
|
157
|
+
// ${mdTable(results, true)}
|
|
158
|
+
// Les valeurs possibles pour $X$ sont donc :
|
|
159
|
+
// ${mdTable(getAnswerTable(identifiers), true)}`;
|
|
160
|
+
// }
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
const getKeys = () => {
|
|
164
|
+
return ["lbrace", "semicolon", "rbrace"];
|
|
165
|
+
};
|
|
166
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
167
|
+
try {
|
|
168
|
+
const parsed = discreteSetParser(ans);
|
|
169
|
+
if (!parsed)
|
|
170
|
+
return false;
|
|
171
|
+
return parsed.simplify().toTex() === answer;
|
|
172
|
+
}
|
|
173
|
+
catch (err) {
|
|
174
|
+
return handleVEAError(err);
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
const getRandomVariableSituationValuesQuestion = () => {
|
|
178
|
+
const params = buildRandomVariableSituation();
|
|
179
|
+
const identifiers = {
|
|
180
|
+
params,
|
|
181
|
+
};
|
|
182
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
183
|
+
};
|
|
184
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
185
|
+
return {
|
|
186
|
+
answer: getAnswer(identifiers),
|
|
187
|
+
instruction: getInstruction(identifiers),
|
|
188
|
+
keys: getKeys(identifiers),
|
|
189
|
+
answerFormat: "tex",
|
|
190
|
+
identifiers,
|
|
191
|
+
hint: getHint(identifiers),
|
|
192
|
+
correction: getCorrection(identifiers),
|
|
193
|
+
};
|
|
194
|
+
};
|
|
195
|
+
export const randomVariableSituationValues = {
|
|
196
|
+
id: "randomVariableSituationValues",
|
|
197
|
+
label: "Donner l'ensemble des valeurs possibles d'une variable aléatoire avec contexte",
|
|
198
|
+
isSingleStep: true,
|
|
199
|
+
generator: (nb, opts) => getDistinctQuestions(() => getRandomVariableSituationValuesQuestion(opts), nb),
|
|
200
|
+
qcmTimer: 60,
|
|
201
|
+
freeTimer: 60,
|
|
202
|
+
isAnswerValid,
|
|
203
|
+
getAnswer,
|
|
204
|
+
subject: "Mathématiques",
|
|
205
|
+
getInstruction,
|
|
206
|
+
getHint,
|
|
207
|
+
getCorrection,
|
|
208
|
+
getPropositions,
|
|
209
|
+
getQuestionFromIdentifiers,
|
|
210
|
+
hasHintAndCorrection: true,
|
|
211
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { SituationParams } from "./utils/randomVariableSituations.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
params: SituationParams;
|
|
5
|
+
};
|
|
6
|
+
export declare const randomVariableSituationVariance: Exercise<Identifiers>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=randomVariableSituationVariance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"randomVariableSituationVariance.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/randomVariable/randomVariableSituationVariance.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EAGL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAE7C,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,eAAe,CAAC;CACzB,CAAC;AA4GF,eAAO,MAAM,+BAA+B,EAAE,QAAQ,CAAC,WAAW,CAqBjE,CAAC"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, propWhile, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { rationalVEA } from "../../../../exercises/vea/rationalVEA.js";
|
|
4
|
+
import { RationalConstructor } from "../../../../math/numbers/rationals/rational.js";
|
|
5
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
6
|
+
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
7
|
+
import { buildRandomVariableSituation, getRandomVariableSituation, } from "./utils/randomVariableSituations.js";
|
|
8
|
+
const getPropositions = (n, { answer }) => {
|
|
9
|
+
const propositions = [];
|
|
10
|
+
addValidProp(propositions, answer);
|
|
11
|
+
propWhile(propositions, n, () => {
|
|
12
|
+
tryToAddWrongProp(propositions, RationalConstructor.randomIrreductibleWithSign().toTree().toTex());
|
|
13
|
+
});
|
|
14
|
+
return shuffleProps(propositions, n);
|
|
15
|
+
};
|
|
16
|
+
const getAnswer = (identifiers) => {
|
|
17
|
+
const { params } = identifiers;
|
|
18
|
+
const va = getRandomVariableSituation(params).getVA();
|
|
19
|
+
return va.getVariance().simplify().toTex();
|
|
20
|
+
};
|
|
21
|
+
const getInstruction = (identifiers) => {
|
|
22
|
+
const { params } = identifiers;
|
|
23
|
+
const context = getRandomVariableSituation(params).getContext();
|
|
24
|
+
return (context +
|
|
25
|
+
`
|
|
26
|
+
|
|
27
|
+
Que vaut la variance $V(X)$ de $X$ ?
|
|
28
|
+
|
|
29
|
+
Donner la valeur exacte ou une valeur arrondie au centième.`);
|
|
30
|
+
};
|
|
31
|
+
const getHint = () => {
|
|
32
|
+
return `Dresse la loi de probabilité de $X$. Pour cela, détermine les valeurs possibles $x_i$ que peut prendre $X$, puis pour chaque valeur, calcule la probabilité $p_i$ associée.
|
|
33
|
+
|
|
34
|
+
Tu peux alors calculer l'espérance de $X$ par la formule :
|
|
35
|
+
|
|
36
|
+
$$
|
|
37
|
+
E(X) = x_1\\times p_1 + \\ldots + x_n\\times p_n
|
|
38
|
+
$$
|
|
39
|
+
|
|
40
|
+
La variance $V(X)$ s'obtient par la formule :
|
|
41
|
+
|
|
42
|
+
$$
|
|
43
|
+
V(X) = p_1(x_1-E(X))^2 + \\ldots + p_n(x_n-E(X))^2
|
|
44
|
+
$$
|
|
45
|
+
`;
|
|
46
|
+
};
|
|
47
|
+
const getCorrection = (identifiers) => {
|
|
48
|
+
const { params } = identifiers;
|
|
49
|
+
const va = getRandomVariableSituation(params).getVA();
|
|
50
|
+
return `On dresse la loi de probabilité de $X$ :
|
|
51
|
+
|
|
52
|
+
${va.getLawMdTable()}
|
|
53
|
+
|
|
54
|
+
Puis on calcule l'espérance :
|
|
55
|
+
|
|
56
|
+
${alignTex([
|
|
57
|
+
["E(X)", "=", va.getAverage().toTex()],
|
|
58
|
+
["", "=", va.getAverage().simplify().toTex()],
|
|
59
|
+
])}
|
|
60
|
+
|
|
61
|
+
Enfin, on calcule la variance :
|
|
62
|
+
|
|
63
|
+
${alignTex([
|
|
64
|
+
["V(X)", "=", va.getVariance().toTex()],
|
|
65
|
+
["", "=", va.getVariance().simplify().toTex()],
|
|
66
|
+
])}`;
|
|
67
|
+
};
|
|
68
|
+
const getKeys = () => {
|
|
69
|
+
return [];
|
|
70
|
+
};
|
|
71
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
72
|
+
try {
|
|
73
|
+
return rationalVEA(ans, answer);
|
|
74
|
+
}
|
|
75
|
+
catch (err) {
|
|
76
|
+
return handleVEAError(err);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
const getRandomVariableSituationAverageQuestion = () => {
|
|
80
|
+
const params = buildRandomVariableSituation();
|
|
81
|
+
const identifiers = {
|
|
82
|
+
params,
|
|
83
|
+
};
|
|
84
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
85
|
+
};
|
|
86
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
87
|
+
return {
|
|
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
|
+
};
|
|
96
|
+
};
|
|
97
|
+
export const randomVariableSituationVariance = {
|
|
98
|
+
id: "randomVariableSituationVariance",
|
|
99
|
+
connector: "=",
|
|
100
|
+
label: "Calculer la variance $V(X)$ d'une variable aléatoire dans un contexte",
|
|
101
|
+
isSingleStep: true,
|
|
102
|
+
generator: (nb, opts) => getDistinctQuestions(() => getRandomVariableSituationAverageQuestion(opts), nb),
|
|
103
|
+
qcmTimer: 60,
|
|
104
|
+
freeTimer: 60,
|
|
105
|
+
getPropositions,
|
|
106
|
+
isAnswerValid,
|
|
107
|
+
subject: "Mathématiques",
|
|
108
|
+
getHint,
|
|
109
|
+
getCorrection,
|
|
110
|
+
getAnswer,
|
|
111
|
+
getQuestionFromIdentifiers,
|
|
112
|
+
hasHintAndCorrection: true,
|
|
113
|
+
};
|
|
@@ -25,7 +25,7 @@ const getInstruction = (identifiers) => {
|
|
|
25
25
|
const va = new RandomVariable(xValuesIds.map((e) => reifyAlgebraic(e)), yValuesIds.map((e) => reifyAlgebraic(e)));
|
|
26
26
|
return `Soit $X$ une variable aléatoire dont la loi de probabilités est donnée ci-dessous.
|
|
27
27
|
|
|
28
|
-
${va.
|
|
28
|
+
${va.getLawMdTable()}
|
|
29
29
|
|
|
30
30
|
Que vaut l'écart type $\\sigma(X)$ de $X$ ?
|
|
31
31
|
|
|
@@ -27,7 +27,7 @@ const getInstruction = (identifiers) => {
|
|
|
27
27
|
const va = new RandomVariable(xValuesIds.map((e) => reifyAlgebraic(e)), yValuesIds.map((e) => reifyAlgebraic(e)));
|
|
28
28
|
return `Soit $X$ une variable aléatoire dont la loi de probabilités est donnée ci-dessous.
|
|
29
29
|
|
|
30
|
-
${va.
|
|
30
|
+
${va.getLawMdTable()}
|
|
31
31
|
|
|
32
32
|
Que vaut la variance $V(X)$ de $X$ ?
|
|
33
33
|
|