math-exercises 3.0.125 → 3.0.126
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/calcul/fractions/fractionsSumsPrimeDenominators.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionsSumsPrimeDenominators.js +61 -1
- package/lib/exercises/math/calcul/mentalCaluls/index.d.ts +1 -0
- package/lib/exercises/math/calcul/mentalCaluls/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/mentalCaluls/index.js +1 -0
- package/lib/exercises/math/calcul/mentalCaluls/mentalProgramSolve.d.ts +15 -0
- package/lib/exercises/math/calcul/mentalCaluls/mentalProgramSolve.d.ts.map +1 -0
- package/lib/exercises/math/calcul/mentalCaluls/mentalProgramSolve.js +217 -0
- package/lib/exercises/math/calcul/ordering/compareA10N.d.ts +16 -0
- package/lib/exercises/math/calcul/ordering/compareA10N.d.ts.map +1 -0
- package/lib/exercises/math/calcul/ordering/compareA10N.js +327 -0
- package/lib/exercises/math/calcul/ordering/compareABUsingQuotient.d.ts +8 -0
- package/lib/exercises/math/calcul/ordering/compareABUsingQuotient.d.ts.map +1 -0
- package/lib/exercises/math/calcul/ordering/compareABUsingQuotient.js +221 -0
- package/lib/exercises/math/calcul/ordering/compareFracABWithFracAPlusCBPlusC.d.ts +9 -0
- package/lib/exercises/math/calcul/ordering/compareFracABWithFracAPlusCBPlusC.d.ts.map +1 -0
- package/lib/exercises/math/calcul/ordering/compareFracABWithFracAPlusCBPlusC.js +135 -0
- package/lib/exercises/math/calcul/ordering/compareFracAndDec.d.ts +29 -0
- package/lib/exercises/math/calcul/ordering/compareFracAndDec.d.ts.map +1 -0
- package/lib/exercises/math/calcul/ordering/compareFracAndDec.js +367 -0
- package/lib/exercises/math/calcul/ordering/comparePowersOfFracs.d.ts +12 -0
- package/lib/exercises/math/calcul/ordering/comparePowersOfFracs.d.ts.map +1 -0
- package/lib/exercises/math/calcul/ordering/comparePowersOfFracs.js +164 -0
- package/lib/exercises/math/calcul/ordering/compareWithSquareRoots.d.ts +9 -0
- package/lib/exercises/math/calcul/ordering/compareWithSquareRoots.d.ts.map +1 -0
- package/lib/exercises/math/calcul/ordering/compareWithSquareRoots.js +140 -0
- package/lib/exercises/math/calcul/ordering/index.d.ts +6 -0
- package/lib/exercises/math/calcul/ordering/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/ordering/index.js +6 -0
- package/lib/exercises/math/calcul/rounding/estimateAroundPow10NTimesAroundPow10N.d.ts +9 -0
- package/lib/exercises/math/calcul/rounding/estimateAroundPow10NTimesAroundPow10N.d.ts.map +1 -0
- package/lib/exercises/math/calcul/rounding/estimateAroundPow10NTimesAroundPow10N.js +84 -0
- package/lib/exercises/math/calcul/rounding/estimatePow10NPlusPow10MinusN.d.ts +8 -0
- package/lib/exercises/math/calcul/rounding/estimatePow10NPlusPow10MinusN.d.ts.map +1 -0
- package/lib/exercises/math/calcul/rounding/estimatePow10NPlusPow10MinusN.js +90 -0
- package/lib/exercises/math/calcul/rounding/index.d.ts +2 -0
- package/lib/exercises/math/calcul/rounding/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/rounding/index.js +2 -0
- package/lib/exercises/math/calculLitteral/equation/equationFromProblem.d.ts +13 -0
- package/lib/exercises/math/calculLitteral/equation/equationFromProblem.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/equation/equationFromProblem.js +414 -0
- package/lib/exercises/math/calculLitteral/equation/index.d.ts +1 -0
- package/lib/exercises/math/calculLitteral/equation/index.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/index.js +1 -0
- package/lib/exercises/math/calculLitteral/factorisation/factorizeAX2PlusBX.d.ts +10 -0
- package/lib/exercises/math/calculLitteral/factorisation/factorizeAX2PlusBX.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/factorisation/factorizeAX2PlusBX.js +70 -0
- package/lib/exercises/math/calculLitteral/factorisation/index.d.ts +1 -0
- package/lib/exercises/math/calculLitteral/factorisation/index.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/factorisation/index.js +1 -0
- package/lib/exercises/math/calculLitteral/index.d.ts +2 -0
- package/lib/exercises/math/calculLitteral/index.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/index.js +2 -0
- package/lib/exercises/math/calculLitteral/isolate/index.d.ts +2 -1
- package/lib/exercises/math/calculLitteral/isolate/index.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/isolate/index.js +2 -1
- package/lib/exercises/math/calculLitteral/isolate/isolateUInInvXPlusInvYEqualsInvU.d.ts +8 -0
- package/lib/exercises/math/calculLitteral/isolate/isolateUInInvXPlusInvYEqualsInvU.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/isolate/isolateUInInvXPlusInvYEqualsInvU.js +107 -0
- package/lib/exercises/math/calculLitteral/isolate/isolateXInInvXPlusInvYEqualsInvU.d.ts +7 -0
- package/lib/exercises/math/calculLitteral/isolate/isolateXInInvXPlusInvYEqualsInvU.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/isolate/isolateXInInvXPlusInvYEqualsInvU.js +80 -0
- package/lib/exercises/math/calculLitteral/ordering/compareAMinusB.d.ts +10 -0
- package/lib/exercises/math/calculLitteral/ordering/compareAMinusB.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/ordering/compareAMinusB.js +182 -0
- package/lib/exercises/math/calculLitteral/ordering/compareFromPiMinusFrac.d.ts +9 -0
- package/lib/exercises/math/calculLitteral/ordering/compareFromPiMinusFrac.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/ordering/compareFromPiMinusFrac.js +144 -0
- package/lib/exercises/math/calculLitteral/ordering/index.d.ts +3 -0
- package/lib/exercises/math/calculLitteral/ordering/index.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/ordering/index.js +2 -0
- package/lib/exercises/math/calculLitteral/simplifying/compareATimes0.d.ts +11 -0
- package/lib/exercises/math/calculLitteral/simplifying/compareATimes0.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/simplifying/compareATimes0.js +120 -0
- package/lib/exercises/math/calculLitteral/simplifying/compareFracXA.d.ts +8 -0
- package/lib/exercises/math/calculLitteral/simplifying/compareFracXA.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/simplifying/compareFracXA.js +67 -0
- package/lib/exercises/math/calculLitteral/simplifying/compareMinusA.d.ts +11 -0
- package/lib/exercises/math/calculLitteral/simplifying/compareMinusA.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/simplifying/compareMinusA.js +114 -0
- package/lib/exercises/math/calculLitteral/simplifying/index.d.ts +5 -0
- package/lib/exercises/math/calculLitteral/simplifying/index.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/simplifying/index.js +5 -0
- package/lib/exercises/math/calculLitteral/simplifying/pickSameAsAPercentOfB.d.ts +13 -0
- package/lib/exercises/math/calculLitteral/simplifying/pickSameAsAPercentOfB.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/simplifying/pickSameAsAPercentOfB.js +125 -0
- package/lib/exercises/math/calculLitteral/simplifying/pickSameAsInverseOfFracAB.d.ts +14 -0
- package/lib/exercises/math/calculLitteral/simplifying/pickSameAsInverseOfFracAB.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/simplifying/pickSameAsInverseOfFracAB.js +148 -0
- package/lib/exercises/math/calculLitteral/writing/writeLitExpFromFrenchExp.d.ts +5 -27
- package/lib/exercises/math/calculLitteral/writing/writeLitExpFromFrenchExp.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/writing/writeLitExpFromFrenchExp.js +178 -241
- package/lib/exercises/math/conversion/index.d.ts +4 -0
- package/lib/exercises/math/conversion/index.d.ts.map +1 -1
- package/lib/exercises/math/conversion/index.js +4 -0
- package/lib/exercises/math/conversion/kmPerMinToKmPerHourConversion.d.ts +8 -0
- package/lib/exercises/math/conversion/kmPerMinToKmPerHourConversion.d.ts.map +1 -0
- package/lib/exercises/math/conversion/kmPerMinToKmPerHourConversion.js +98 -0
- package/lib/exercises/math/conversion/minutesToHours.d.ts +10 -0
- package/lib/exercises/math/conversion/minutesToHours.d.ts.map +1 -0
- package/lib/exercises/math/conversion/minutesToHours.js +150 -0
- package/lib/exercises/math/conversion/prefixToNumber.d.ts +15 -0
- package/lib/exercises/math/conversion/prefixToNumber.d.ts.map +1 -0
- package/lib/exercises/math/conversion/prefixToNumber.js +233 -0
- package/lib/exercises/math/conversion/secondsToHours.d.ts +10 -0
- package/lib/exercises/math/conversion/secondsToHours.d.ts.map +1 -0
- package/lib/exercises/math/conversion/secondsToHours.js +150 -0
- package/lib/exercises/math/dataRepresentations/barChartInterpreting.d.ts +50 -0
- package/lib/exercises/math/dataRepresentations/barChartInterpreting.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/barChartInterpreting.js +517 -0
- package/lib/exercises/math/dataRepresentations/boxPlotInterpreting.d.ts +7 -0
- package/lib/exercises/math/dataRepresentations/boxPlotInterpreting.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/boxPlotInterpreting.js +223 -0
- package/lib/exercises/math/dataRepresentations/cartesianGraphExtremaReading.d.ts +10 -0
- package/lib/exercises/math/dataRepresentations/cartesianGraphExtremaReading.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/cartesianGraphExtremaReading.js +139 -0
- package/lib/exercises/math/dataRepresentations/dataToGraphGraphToData.d.ts +8 -0
- package/lib/exercises/math/dataRepresentations/dataToGraphGraphToData.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/dataToGraphGraphToData.js +133 -0
- package/lib/exercises/math/dataRepresentations/graphReading.d.ts +8 -0
- package/lib/exercises/math/dataRepresentations/graphReading.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/graphReading.js +136 -0
- package/lib/exercises/math/dataRepresentations/halfPieChartCommenting.d.ts +18 -0
- package/lib/exercises/math/dataRepresentations/halfPieChartCommenting.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/halfPieChartCommenting.js +228 -0
- package/lib/exercises/math/dataRepresentations/halfPieChartReading.d.ts +8 -0
- package/lib/exercises/math/dataRepresentations/halfPieChartReading.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/halfPieChartReading.js +213 -0
- package/lib/exercises/math/dataRepresentations/histogramReading.d.ts +9 -0
- package/lib/exercises/math/dataRepresentations/histogramReading.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/histogramReading.js +163 -0
- package/lib/exercises/math/dataRepresentations/index.d.ts +10 -0
- package/lib/exercises/math/dataRepresentations/index.d.ts.map +1 -1
- package/lib/exercises/math/dataRepresentations/index.js +10 -0
- package/lib/exercises/math/dataRepresentations/plausibleGraph.d.ts +9 -0
- package/lib/exercises/math/dataRepresentations/plausibleGraph.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/plausibleGraph.js +145 -0
- package/lib/exercises/math/dataRepresentations/scatterPlotCommenting.d.ts +9 -0
- package/lib/exercises/math/dataRepresentations/scatterPlotCommenting.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/scatterPlotCommenting.js +308 -0
- package/lib/exercises/math/derivation/derivative/exp/expDerivativeFour.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/exp/expDerivativeFour.js +5 -6
- package/lib/exercises/math/functions/affines/coordsOfPointOnAffineFindX.d.ts +8 -0
- package/lib/exercises/math/functions/affines/coordsOfPointOnAffineFindX.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/coordsOfPointOnAffineFindX.js +103 -0
- package/lib/exercises/math/functions/affines/coordsOfPointOnAffineFindY.d.ts +8 -0
- package/lib/exercises/math/functions/affines/coordsOfPointOnAffineFindY.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/coordsOfPointOnAffineFindY.js +100 -0
- package/lib/exercises/math/functions/affines/drawAffineFromPointAndLeadingCoeff.d.ts +16 -0
- package/lib/exercises/math/functions/affines/drawAffineFromPointAndLeadingCoeff.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/drawAffineFromPointAndLeadingCoeff.js +215 -0
- package/lib/exercises/math/functions/affines/drawAffineFromProgCalc.d.ts +13 -0
- package/lib/exercises/math/functions/affines/drawAffineFromProgCalc.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/drawAffineFromProgCalc.js +206 -0
- package/lib/exercises/math/functions/affines/index.d.ts +7 -0
- package/lib/exercises/math/functions/affines/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/index.js +7 -0
- package/lib/exercises/math/functions/affines/recognizeExprAffine.d.ts +20 -0
- package/lib/exercises/math/functions/affines/recognizeExprAffine.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/recognizeExprAffine.js +284 -0
- package/lib/exercises/math/functions/affines/representationOfAffine.d.ts +13 -0
- package/lib/exercises/math/functions/affines/representationOfAffine.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/representationOfAffine.js +184 -0
- package/lib/exercises/math/functions/basics/coordsOfPointOnCurveFindY.d.ts +14 -0
- package/lib/exercises/math/functions/basics/coordsOfPointOnCurveFindY.d.ts.map +1 -0
- package/lib/exercises/math/functions/basics/coordsOfPointOnCurveFindY.js +216 -0
- package/lib/exercises/math/functions/basics/index.d.ts +1 -0
- package/lib/exercises/math/functions/basics/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/index.js +1 -0
- package/lib/exercises/math/functions/composition/functionComposition.d.ts +8 -0
- package/lib/exercises/math/functions/composition/functionComposition.d.ts.map +1 -0
- package/lib/exercises/math/functions/composition/functionComposition.js +238 -0
- package/lib/exercises/math/functions/composition/index.d.ts +2 -0
- package/lib/exercises/math/functions/composition/index.d.ts.map +1 -0
- package/lib/exercises/math/functions/composition/index.js +1 -0
- package/lib/exercises/math/functions/index.d.ts +1 -0
- package/lib/exercises/math/functions/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/index.js +1 -0
- package/lib/exercises/math/geometry/angles/anglesUsingIsParallel.d.ts +23 -0
- package/lib/exercises/math/geometry/angles/anglesUsingIsParallel.d.ts.map +1 -0
- package/lib/exercises/math/geometry/angles/anglesUsingIsParallel.js +448 -0
- package/lib/exercises/math/geometry/angles/index.js +2 -0
- package/lib/exercises/math/geometry/angles/isParallelUsingAngles.d.ts +23 -0
- package/lib/exercises/math/geometry/angles/isParallelUsingAngles.d.ts.map +1 -0
- package/lib/exercises/math/geometry/angles/isParallelUsingAngles.js +402 -0
- package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLine.d.ts +9 -6
- package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLine.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLine.js +140 -60
- package/lib/exercises/math/geometry/convexity/convexityQuadrinomialsGeo.js +1 -1
- package/lib/exercises/math/geometry/vectors/colinearity/colinearityFromPicture.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/colinearity/colinearityFromPicture.js +121 -104
- package/lib/exercises/math/geometry/vectors/vectorRepresentative.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/vectorRepresentative.js +3 -2
- package/lib/exercises/math/probaStat/basicProbas/index.d.ts +1 -0
- package/lib/exercises/math/probaStat/basicProbas/index.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/basicProbas/index.js +1 -0
- package/lib/exercises/math/probaStat/basicProbas/possibleValuesForProba.d.ts +0 -1
- package/lib/exercises/math/probaStat/basicProbas/possibleValuesForProba.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/basicProbas/possibleValuesForProba.js +42 -80
- package/lib/exercises/math/probaStat/conditionalProbaWriteFromFrench.d.ts +9 -0
- package/lib/exercises/math/probaStat/conditionalProbaWriteFromFrench.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/conditionalProbaWriteFromFrench.js +217 -0
- package/lib/exercises/math/probaStat/index.d.ts +2 -0
- package/lib/exercises/math/probaStat/index.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/index.js +2 -0
- package/lib/exercises/math/probaStat/probaAsSumOfProbas.d.ts +30 -0
- package/lib/exercises/math/probaStat/probaAsSumOfProbas.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/probaAsSumOfProbas.js +548 -0
- package/lib/exercises/math/probaStat/stats1var/index.d.ts +2 -0
- package/lib/exercises/math/probaStat/stats1var/index.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/index.js +2 -0
- package/lib/exercises/math/probaStat/stats1var/interpretIndicatorsForLists.d.ts +9 -0
- package/lib/exercises/math/probaStat/stats1var/interpretIndicatorsForLists.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/stats1var/interpretIndicatorsForLists.js +90 -0
- package/lib/exercises/math/probaStat/stats1var/plausibilityOfAverage.d.ts +10 -0
- package/lib/exercises/math/probaStat/stats1var/plausibilityOfAverage.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/stats1var/plausibilityOfAverage.js +151 -0
- package/lib/exercises/pc/electricity/calculateUEqualsRI.d.ts +7 -0
- package/lib/exercises/pc/electricity/calculateUEqualsRI.d.ts.map +1 -0
- package/lib/exercises/pc/electricity/calculateUEqualsRI.js +73 -0
- package/lib/exercises/pc/electricity/index.d.ts +1 -0
- package/lib/exercises/pc/electricity/index.d.ts.map +1 -1
- package/lib/exercises/pc/electricity/index.js +1 -0
- package/lib/exercises/pc/index.d.ts +1 -0
- package/lib/exercises/pc/index.d.ts.map +1 -1
- package/lib/exercises/pc/index.js +1 -0
- package/lib/exercises/pc/moleculeFormula.d.ts.map +1 -1
- package/lib/exercises/pc/moleculeFormula.js +4 -3
- package/lib/exercises/pc/optics/index.d.ts +2 -0
- package/lib/exercises/pc/optics/index.d.ts.map +1 -0
- package/lib/exercises/pc/optics/index.js +1 -0
- package/lib/exercises/pc/optics/lensFormula.d.ts +21 -0
- package/lib/exercises/pc/optics/lensFormula.d.ts.map +1 -0
- package/lib/exercises/pc/optics/lensFormula.js +415 -0
- package/lib/exercises/pc/weight/calculateWeight.d.ts +8 -1
- package/lib/exercises/pc/weight/calculateWeight.d.ts.map +1 -1
- package/lib/exercises/pc/weight/calculateWeight.js +113 -38
- package/lib/geogebra/parsers/geogebraParser.d.ts +4 -0
- package/lib/geogebra/parsers/geogebraParser.d.ts.map +1 -1
- package/lib/geogebra/parsers/geogebraParser.js +17 -0
- package/lib/index.d.ts +346 -12
- package/lib/index.d.ts.map +1 -1
- package/lib/latexTester.d.ts.map +1 -1
- package/lib/latexTester.js +1 -0
- package/lib/math/geometry/CloudPoints.d.ts +10 -0
- package/lib/math/geometry/CloudPoints.d.ts.map +1 -1
- package/lib/math/geometry/CloudPoints.js +119 -0
- package/lib/math/geometry/line.d.ts +1 -0
- package/lib/math/geometry/line.d.ts.map +1 -1
- package/lib/math/geometry/line.js +10 -2
- package/lib/math/geometry/vector.d.ts +1 -0
- package/lib/math/geometry/vector.d.ts.map +1 -1
- package/lib/math/geometry/vector.js +12 -0
- package/lib/math/progCalc/progCalc.d.ts +46 -0
- package/lib/math/progCalc/progCalc.d.ts.map +1 -0
- package/lib/math/progCalc/progCalc.js +239 -0
- package/lib/math/utils/latex/realize.d.ts +12 -0
- package/lib/math/utils/latex/realize.d.ts.map +1 -0
- package/lib/math/utils/latex/realize.js +43 -0
- package/lib/pc/constants/molecularChemistry/molecule.d.ts +2 -0
- package/lib/pc/constants/molecularChemistry/molecule.d.ts.map +1 -1
- package/lib/pc/constants/molecularChemistry/molecule.js +52 -0
- package/lib/tests/questionTest.d.ts.map +1 -1
- package/lib/tests/questionTest.js +1 -1
- package/lib/tests/singleExo.test.js +3 -3
- package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/addNode.d.ts +4 -2
- package/lib/tree/nodes/operators/addNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/addNode.js +8 -17
- package/lib/tree/nodes/operators/fractionNode.d.ts +1 -1
- package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/fractionNode.js +5 -1
- package/lib/tree/nodes/operators/multiplyNode.d.ts +4 -2
- package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/multiplyNode.js +8 -17
- package/lib/tree/nodes/operators/operatorNode.d.ts +3 -3
- package/lib/tree/nodes/operators/operatorNode.d.ts.map +1 -1
- package/lib/tree/nodes/variables/variableNode.d.ts +1 -1
- package/lib/tree/nodes/variables/variableNode.d.ts.map +1 -1
- package/lib/tree/utilities/nodeShuffler.d.ts +12 -0
- package/lib/tree/utilities/nodeShuffler.d.ts.map +1 -0
- package/lib/tree/utilities/nodeShuffler.js +123 -0
- package/lib/utils/arrays/getAllPicks.d.ts +2 -0
- package/lib/utils/arrays/getAllPicks.d.ts.map +1 -0
- package/lib/utils/arrays/getAllPicks.js +17 -0
- package/lib/utils/errors/handleVEAError.d.ts +1 -1
- package/lib/utils/errors/handleVEAError.d.ts.map +1 -1
- package/lib/utils/strings/decapitalize.d.ts +2 -0
- package/lib/utils/strings/decapitalize.d.ts.map +1 -0
- package/lib/utils/strings/decapitalize.js +3 -0
- package/package.json +1 -1
|
@@ -0,0 +1,415 @@
|
|
|
1
|
+
import { GeneratorOptionTarget, GeneratorOptionType, addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { randint } from "../../../math/utils/random/randint.js";
|
|
4
|
+
import { round } from "../../../math/utils/round.js";
|
|
5
|
+
import { EqualNode } from "../../../tree/nodes/equations/equalNode.js";
|
|
6
|
+
import { NodeConstructor, } from "../../../tree/nodes/nodeConstructor.js";
|
|
7
|
+
import { InfinityNode, MinusInfinityNode, } from "../../../tree/nodes/numbers/infiniteNode.js";
|
|
8
|
+
import { add } from "../../../tree/nodes/operators/addNode.js";
|
|
9
|
+
import { frac } from "../../../tree/nodes/operators/fractionNode.js";
|
|
10
|
+
import { multiply } from "../../../tree/nodes/operators/multiplyNode.js";
|
|
11
|
+
import { substract } from "../../../tree/nodes/operators/substractNode.js";
|
|
12
|
+
import { random } from "../../../utils/alea/random.js";
|
|
13
|
+
import { alignTex } from "../../../utils/latex/alignTex.js";
|
|
14
|
+
const optsDefault = {
|
|
15
|
+
typeDistance: [
|
|
16
|
+
"distance focale",
|
|
17
|
+
"distance objet",
|
|
18
|
+
"distance image",
|
|
19
|
+
],
|
|
20
|
+
typeImage: [
|
|
21
|
+
"réelle finie",
|
|
22
|
+
"réelle infinie",
|
|
23
|
+
"imaginaire finie",
|
|
24
|
+
"imaginaire infinie",
|
|
25
|
+
],
|
|
26
|
+
unit: ["cm", "m"],
|
|
27
|
+
roundTo: [0, 1, 2],
|
|
28
|
+
};
|
|
29
|
+
const options = [
|
|
30
|
+
{
|
|
31
|
+
id: "typeDistance",
|
|
32
|
+
label: "Distance à calculer",
|
|
33
|
+
target: GeneratorOptionTarget.generation,
|
|
34
|
+
type: GeneratorOptionType.multiselect,
|
|
35
|
+
defaultValue: optsDefault.typeDistance,
|
|
36
|
+
values: ["distance focale", "distance objet", "distance image"],
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
id: "typeImage",
|
|
40
|
+
label: "Type d'image",
|
|
41
|
+
target: GeneratorOptionTarget.generation,
|
|
42
|
+
type: GeneratorOptionType.multiselect,
|
|
43
|
+
defaultValue: optsDefault.typeImage,
|
|
44
|
+
values: [
|
|
45
|
+
"réelle finie",
|
|
46
|
+
"réelle infinie",
|
|
47
|
+
"imaginaire finie",
|
|
48
|
+
"imaginaire infinie",
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
id: "unit",
|
|
53
|
+
label: "unité de mesure",
|
|
54
|
+
target: GeneratorOptionTarget.generation,
|
|
55
|
+
type: GeneratorOptionType.multiselect,
|
|
56
|
+
defaultValue: optsDefault.unit,
|
|
57
|
+
values: ["cm", "m"],
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
id: "roundTo",
|
|
61
|
+
label: "Arrondir à (nombre de décimales)",
|
|
62
|
+
target: GeneratorOptionTarget.generation,
|
|
63
|
+
type: GeneratorOptionType.multiselect,
|
|
64
|
+
defaultValue: optsDefault.roundTo,
|
|
65
|
+
values: [0, 1, 2],
|
|
66
|
+
},
|
|
67
|
+
];
|
|
68
|
+
const getLensFormulaEqualNode = () => {
|
|
69
|
+
const equation = new EqualNode(frac(1, "\\overline {OA'}"), add(frac(1, "\\overline {OF'}"), frac(1, "\\overline {OA}")));
|
|
70
|
+
return equation;
|
|
71
|
+
};
|
|
72
|
+
const getInstruction = (identifiers) => {
|
|
73
|
+
const { OFPrime, OA, OAPrime, opts } = identifiers;
|
|
74
|
+
const nodeOFPrime = NodeConstructor.fromIdentifiers(OFPrime);
|
|
75
|
+
const nodeOA = NodeConstructor.fromIdentifiers(OA);
|
|
76
|
+
const nodeOAPrime = NodeConstructor.fromIdentifiers(OAPrime);
|
|
77
|
+
const strRounTo = (() => {
|
|
78
|
+
switch (opts.roundTo) {
|
|
79
|
+
case 0:
|
|
80
|
+
return "à l'unité";
|
|
81
|
+
case 1:
|
|
82
|
+
return "au dixième";
|
|
83
|
+
case 2:
|
|
84
|
+
return "au centième";
|
|
85
|
+
}
|
|
86
|
+
})();
|
|
87
|
+
let strOAPrime = `$${nodeOAPrime.simplify().toTex()}${opts.unit}$`;
|
|
88
|
+
let strOA = `$${nodeOA.simplify().toTex()}${opts.unit}$`;
|
|
89
|
+
const strOFPrime = `$${nodeOFPrime.simplify().toTex()}${opts.unit}$`;
|
|
90
|
+
if (strOAPrime.includes("\\infty")) {
|
|
91
|
+
strOAPrime = "à l'infini";
|
|
92
|
+
}
|
|
93
|
+
if (strOA.includes("\\infty")) {
|
|
94
|
+
strOA = "à l'infini";
|
|
95
|
+
}
|
|
96
|
+
const strLensType = nodeOFPrime.evaluate() >= 0 ? "convergente" : "divergente";
|
|
97
|
+
switch (opts.typeDistance) {
|
|
98
|
+
case "distance focale": {
|
|
99
|
+
return `Calculer la distance focale algébrique de la lentille, en $${opts.unit}$, arrondie ${strRounTo},
|
|
100
|
+
sachant que la position algébrique de l'objet de l'objet $AB$ est ${strOA},
|
|
101
|
+
et que la position algébrique de l'image $A'$ est ${strOAPrime}.`;
|
|
102
|
+
}
|
|
103
|
+
case "distance image": {
|
|
104
|
+
return `Calculer la position algébrique de l'image $A'$ de l'objet $AB$, en $${opts.unit}$, arrondie ${strRounTo},
|
|
105
|
+
situé algébriquement à ${strOA}
|
|
106
|
+
d'une lentille ${strLensType} ayant une distance focale de ${strOFPrime}.`;
|
|
107
|
+
}
|
|
108
|
+
case "distance objet": {
|
|
109
|
+
return `Calculer la position algébrique $A$ de l'objet $AB$, en $${opts.unit}$, arrondie ${strRounTo},
|
|
110
|
+
sachant que la position algébrique de l'image $A'$ est ${strOAPrime},
|
|
111
|
+
et que la distance focale algébrique est ${strOFPrime}.`;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
const getHint = () => {
|
|
116
|
+
return `Relation de conjugaison de Descartes :
|
|
117
|
+
|
|
118
|
+
$$
|
|
119
|
+
${getLensFormulaEqualNode().toTex()}
|
|
120
|
+
$$
|
|
121
|
+
|
|
122
|
+
`;
|
|
123
|
+
};
|
|
124
|
+
const getCorrection = (identifiers) => {
|
|
125
|
+
const { OFPrime, OA, OAPrime, opts } = identifiers;
|
|
126
|
+
const nodeOFPrime = NodeConstructor.fromIdentifiers(OFPrime);
|
|
127
|
+
const nodeOA = NodeConstructor.fromIdentifiers(OA);
|
|
128
|
+
const nodeOAPrime = NodeConstructor.fromIdentifiers(OAPrime);
|
|
129
|
+
const answer = getAnswer(identifiers);
|
|
130
|
+
return `La relation de conjugaison de Descartes s'écrit :
|
|
131
|
+
|
|
132
|
+
$$
|
|
133
|
+
${getLensFormulaEqualNode().toTex()}
|
|
134
|
+
$$
|
|
135
|
+
|
|
136
|
+
Dans notre cas :
|
|
137
|
+
|
|
138
|
+
${(() => {
|
|
139
|
+
switch (opts.typeDistance) {
|
|
140
|
+
case "distance focale":
|
|
141
|
+
return alignTex([
|
|
142
|
+
[
|
|
143
|
+
`\\frac{1}{\\overline {OF'}}`,
|
|
144
|
+
`=`,
|
|
145
|
+
`\\frac{1}{\\overline {OA'}} - \\frac{1}{\\overline {OA}}`,
|
|
146
|
+
],
|
|
147
|
+
[
|
|
148
|
+
`\\overline {OF'}`,
|
|
149
|
+
`=`,
|
|
150
|
+
`\\frac{1} {\\frac{1}{\\overline {OA'}} - \\frac{1}{\\overline {OA}}}`,
|
|
151
|
+
],
|
|
152
|
+
[
|
|
153
|
+
`\\overline {OF'}`,
|
|
154
|
+
`=`,
|
|
155
|
+
`\\frac{1} {\\frac{1}{${nodeOAPrime.toTex()}} - \\frac{1}{${nodeOA.toTex()}}}`,
|
|
156
|
+
],
|
|
157
|
+
[`\\overline {OF'}`, `=`, answer.replaceAll("$", "")],
|
|
158
|
+
]);
|
|
159
|
+
case "distance image":
|
|
160
|
+
return alignTex([
|
|
161
|
+
[
|
|
162
|
+
`\\overline {OA'}`,
|
|
163
|
+
`=`,
|
|
164
|
+
`\\frac{1} {\\frac{1}{\\overline {OF'}} + \\frac{1}{\\overline {OA}}}`,
|
|
165
|
+
],
|
|
166
|
+
[
|
|
167
|
+
`\\overline {OA'}`,
|
|
168
|
+
`=`,
|
|
169
|
+
`\\frac{1} {\\frac{1}{${nodeOFPrime.toTex()}} + \\frac{1}{${nodeOA.toTex()}}}`,
|
|
170
|
+
],
|
|
171
|
+
[`\\overline {OA'}`, `=`, answer.replaceAll("$", "")],
|
|
172
|
+
]);
|
|
173
|
+
case "distance objet":
|
|
174
|
+
return alignTex([
|
|
175
|
+
[
|
|
176
|
+
`\\frac{1}{\\overline {OA}}`,
|
|
177
|
+
`=`,
|
|
178
|
+
`\\frac{1}{\\overline {OA'}} - \\frac{1}{\\overline {OF'}}`,
|
|
179
|
+
],
|
|
180
|
+
[
|
|
181
|
+
`\\overline {OA}`,
|
|
182
|
+
`=`,
|
|
183
|
+
`\\frac{1} {\\frac{1}{\\overline {OA'}} - \\frac{1}{\\overline {OF'}}}`,
|
|
184
|
+
],
|
|
185
|
+
[
|
|
186
|
+
`\\overline {OA}`,
|
|
187
|
+
`=`,
|
|
188
|
+
`\\frac{1} {\\frac{1}{${nodeOAPrime.toTex()}} - \\frac{1}{${nodeOFPrime.toTex()}}}`,
|
|
189
|
+
],
|
|
190
|
+
[`\\overline {OA}`, `=`, answer.replaceAll("$", "")],
|
|
191
|
+
]);
|
|
192
|
+
}
|
|
193
|
+
})()}`;
|
|
194
|
+
};
|
|
195
|
+
const getAnswer = (identifiers) => {
|
|
196
|
+
const { OFPrime, OA, OAPrime, opts } = identifiers;
|
|
197
|
+
const nodeOFPrime = NodeConstructor.fromIdentifiers(OFPrime);
|
|
198
|
+
const nodeOA = NodeConstructor.fromIdentifiers(OA);
|
|
199
|
+
const nodeOAPrime = NodeConstructor.fromIdentifiers(OAPrime);
|
|
200
|
+
return `${round((() => {
|
|
201
|
+
switch (opts.typeDistance) {
|
|
202
|
+
case "distance focale":
|
|
203
|
+
return nodeOFPrime;
|
|
204
|
+
case "distance image":
|
|
205
|
+
return nodeOAPrime;
|
|
206
|
+
case "distance objet":
|
|
207
|
+
return nodeOA;
|
|
208
|
+
}
|
|
209
|
+
})().evaluate(), opts.roundTo).frenchify()}${opts.unit}`;
|
|
210
|
+
};
|
|
211
|
+
const isAnswerValid = (ans, { answer, ...identifiers }) => {
|
|
212
|
+
const { opts } = identifiers;
|
|
213
|
+
if (!ans.endsWith(opts.unit))
|
|
214
|
+
return false;
|
|
215
|
+
const ansNumber = parseFloat(ans.replace(opts.unit, ""));
|
|
216
|
+
const answerNumber = parseFloat(answer.replace(opts.unit, ""));
|
|
217
|
+
return ansNumber === answerNumber;
|
|
218
|
+
};
|
|
219
|
+
const getPropositions = (nbProps, { answer, ...identifiers }) => {
|
|
220
|
+
const { OFPrime, OA, OAPrime, opts } = identifiers;
|
|
221
|
+
const nodeOFPrime = NodeConstructor.fromIdentifiers(OFPrime);
|
|
222
|
+
const nodeOA = NodeConstructor.fromIdentifiers(OA);
|
|
223
|
+
const nodeOAPrime = NodeConstructor.fromIdentifiers(OAPrime);
|
|
224
|
+
let propositions = [];
|
|
225
|
+
function toUnitedTex(tex) {
|
|
226
|
+
return `${tex}${opts.unit}`;
|
|
227
|
+
}
|
|
228
|
+
addValidProp(propositions, answer, "tex");
|
|
229
|
+
switch (opts.typeDistance) {
|
|
230
|
+
case "distance focale":
|
|
231
|
+
{
|
|
232
|
+
function tryToAddWrongProps(roundTo) {
|
|
233
|
+
//x = A + B
|
|
234
|
+
tryToAddWrongProp(propositions, toUnitedTex(round(add(nodeOAPrime, nodeOA).evaluate(), roundTo).frenchify()));
|
|
235
|
+
//erreur d'inverse
|
|
236
|
+
tryToAddWrongProp(propositions, toUnitedTex(round(nodeOFPrime.rightChild.evaluate(), roundTo).frenchify()));
|
|
237
|
+
//erreur de signe
|
|
238
|
+
tryToAddWrongProp(propositions, toUnitedTex(round(frac(1, add(frac(1, nodeOAPrime.evaluate()), frac(1, nodeOA.evaluate()))).evaluate(), roundTo).frenchify()));
|
|
239
|
+
}
|
|
240
|
+
//erreurs d'arrondis
|
|
241
|
+
[0, 1, 2].forEach((roundTo) => {
|
|
242
|
+
tryToAddWrongProps(roundTo);
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
break;
|
|
246
|
+
case "distance image":
|
|
247
|
+
{
|
|
248
|
+
function tryToAddWrongProps(roundTo) {
|
|
249
|
+
//x = A + B
|
|
250
|
+
tryToAddWrongProp(propositions, toUnitedTex(round(add(nodeOFPrime, nodeOA).evaluate(), roundTo).frenchify()));
|
|
251
|
+
//erreur d'inverse
|
|
252
|
+
tryToAddWrongProp(propositions, toUnitedTex(round(frac(1, nodeOAPrime).evaluate(), roundTo).frenchify()));
|
|
253
|
+
//erreur de signe
|
|
254
|
+
tryToAddWrongProp(propositions, toUnitedTex(round(substract(frac(1, nodeOFPrime.evaluate()), frac(1, nodeOA.evaluate())).evaluate(), roundTo).frenchify()));
|
|
255
|
+
}
|
|
256
|
+
//erreurs d'arrondis
|
|
257
|
+
[0, 1, 2].forEach((roundTo) => {
|
|
258
|
+
tryToAddWrongProps(roundTo);
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
break;
|
|
262
|
+
case "distance objet":
|
|
263
|
+
{
|
|
264
|
+
function tryToAddWrongProps(roundTo) {
|
|
265
|
+
//x = A + B
|
|
266
|
+
tryToAddWrongProp(propositions, toUnitedTex(round(add(nodeOAPrime, nodeOFPrime).evaluate(), roundTo).frenchify()));
|
|
267
|
+
//erreur d'inverse
|
|
268
|
+
tryToAddWrongProp(propositions, toUnitedTex(round(nodeOA.rightChild.evaluate(), roundTo).frenchify()));
|
|
269
|
+
//erreur de signe
|
|
270
|
+
tryToAddWrongProp(propositions, toUnitedTex(round(frac(1, add(frac(1, nodeOAPrime.evaluate()), frac(1, nodeOFPrime.evaluate()))).evaluate(), roundTo).frenchify()));
|
|
271
|
+
}
|
|
272
|
+
//erreurs d'arrondis
|
|
273
|
+
[0, 1, 2].forEach((roundTo) => {
|
|
274
|
+
tryToAddWrongProps(roundTo);
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
break;
|
|
278
|
+
}
|
|
279
|
+
propositions = propositions.filter((proposition) => !proposition.statement.includes("NaN"));
|
|
280
|
+
return shuffleProps(propositions, nbProps);
|
|
281
|
+
};
|
|
282
|
+
const getLensFormulaQuestion = (optsIn) => {
|
|
283
|
+
const optsInRetyped = optsIn
|
|
284
|
+
? {
|
|
285
|
+
typeDistance: optsIn?.typeDistance,
|
|
286
|
+
typeImage: optsIn?.typeImage,
|
|
287
|
+
unit: optsIn?.unit,
|
|
288
|
+
roundTo: (optsIn?.roundTo)
|
|
289
|
+
.filter((a) => typeof a === "string")
|
|
290
|
+
.map((str) => +str),
|
|
291
|
+
}
|
|
292
|
+
: undefined;
|
|
293
|
+
console.log("optsIn", optsIn);
|
|
294
|
+
console.log("optsInRetyped", optsInRetyped);
|
|
295
|
+
let nodeOFPrime = NaN.toTree();
|
|
296
|
+
let nodeOA = NaN.toTree();
|
|
297
|
+
let nodeOAPrime = NaN.toTree();
|
|
298
|
+
let opts;
|
|
299
|
+
function getRandomNodes() {
|
|
300
|
+
opts = optsInRetyped
|
|
301
|
+
? {
|
|
302
|
+
typeDistance: random(optsInRetyped.typeDistance),
|
|
303
|
+
typeImage: random(optsInRetyped.typeImage),
|
|
304
|
+
unit: random(optsInRetyped.unit),
|
|
305
|
+
roundTo: random(optsInRetyped.roundTo),
|
|
306
|
+
}
|
|
307
|
+
: {
|
|
308
|
+
typeDistance: random(optsDefault.typeDistance),
|
|
309
|
+
typeImage: random(optsDefault.typeImage),
|
|
310
|
+
unit: random(optsDefault.unit),
|
|
311
|
+
roundTo: random(optsDefault.roundTo),
|
|
312
|
+
};
|
|
313
|
+
console.log("opts", opts);
|
|
314
|
+
//objet réel: \\overline {OA} < 0
|
|
315
|
+
//image réelle : \\overline {OA'} > 0
|
|
316
|
+
function factorNodeForTypeImage(typeImage) {
|
|
317
|
+
let factorNode;
|
|
318
|
+
switch (typeImage) {
|
|
319
|
+
case "réelle finie":
|
|
320
|
+
factorNode = (+1).toTree();
|
|
321
|
+
break;
|
|
322
|
+
case "réelle infinie":
|
|
323
|
+
factorNode = (-1).toTree();
|
|
324
|
+
break;
|
|
325
|
+
case "imaginaire finie":
|
|
326
|
+
factorNode = InfinityNode;
|
|
327
|
+
break;
|
|
328
|
+
case "imaginaire infinie":
|
|
329
|
+
factorNode = MinusInfinityNode;
|
|
330
|
+
break;
|
|
331
|
+
}
|
|
332
|
+
return factorNode;
|
|
333
|
+
}
|
|
334
|
+
switch (opts.typeDistance) {
|
|
335
|
+
case "distance focale":
|
|
336
|
+
{
|
|
337
|
+
nodeOA = (-randint(1, 10)).toTree();
|
|
338
|
+
nodeOAPrime = multiply(factorNodeForTypeImage(opts.typeImage), randint(1, 10, [-nodeOA.evaluate()]).toTree()).simplify();
|
|
339
|
+
const equalNode = getLensFormulaEqualNode();
|
|
340
|
+
nodeOFPrime = frac(1, substract(equalNode.leftChild.evaluate({
|
|
341
|
+
"\\overline {OA'}": nodeOA.evaluate(),
|
|
342
|
+
}), equalNode.rightChild.rightChild.evaluate({
|
|
343
|
+
"\\overline {OA}": nodeOAPrime.evaluate(),
|
|
344
|
+
})));
|
|
345
|
+
}
|
|
346
|
+
break;
|
|
347
|
+
case "distance image":
|
|
348
|
+
{
|
|
349
|
+
nodeOA = (-randint(1, 10)).toTree();
|
|
350
|
+
nodeOFPrime = multiply(factorNodeForTypeImage(opts.typeImage), randint(1, 10, [-nodeOA.evaluate()]).toTree()).simplify();
|
|
351
|
+
const equalNode = getLensFormulaEqualNode();
|
|
352
|
+
nodeOAPrime = frac(1, equalNode.rightChild.evaluate({
|
|
353
|
+
"\\overline {OA}": nodeOA.evaluate(),
|
|
354
|
+
"\\overline {OF'}": nodeOFPrime.evaluate(),
|
|
355
|
+
}));
|
|
356
|
+
}
|
|
357
|
+
break;
|
|
358
|
+
case "distance objet":
|
|
359
|
+
{
|
|
360
|
+
nodeOAPrime = multiply(factorNodeForTypeImage(opts.typeImage), randint(1, 10).toTree()).simplify();
|
|
361
|
+
nodeOFPrime = randint(1, 10, [-nodeOAPrime.evaluate()]).toTree();
|
|
362
|
+
const equalNode = getLensFormulaEqualNode();
|
|
363
|
+
nodeOA = frac(1, substract(equalNode.leftChild.evaluate({
|
|
364
|
+
"\\overline {OA'}": nodeOAPrime.evaluate(),
|
|
365
|
+
}), equalNode.rightChild.leftChild.evaluate({
|
|
366
|
+
"\\overline {OF'}": nodeOFPrime.evaluate(),
|
|
367
|
+
})));
|
|
368
|
+
}
|
|
369
|
+
break;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
function checkValidNodes() {
|
|
373
|
+
const isContainingNaN = [nodeOA, nodeOAPrime, nodeOFPrime].some((node) => isNaN(node.evaluate()));
|
|
374
|
+
const valueOFPrime = nodeOFPrime.evaluate();
|
|
375
|
+
const isFocalInfinite = valueOFPrime === -Infinity || valueOFPrime == Infinity;
|
|
376
|
+
return !isContainingNaN && !isFocalInfinite;
|
|
377
|
+
}
|
|
378
|
+
do {
|
|
379
|
+
getRandomNodes();
|
|
380
|
+
} while (!checkValidNodes());
|
|
381
|
+
return getQuestionFromIdentifiers({
|
|
382
|
+
OFPrime: nodeOFPrime.toIdentifiers(),
|
|
383
|
+
OA: nodeOA.toIdentifiers(),
|
|
384
|
+
OAPrime: nodeOAPrime.toIdentifiers(),
|
|
385
|
+
opts: opts,
|
|
386
|
+
}, opts);
|
|
387
|
+
};
|
|
388
|
+
const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
389
|
+
const question = {
|
|
390
|
+
instruction: getInstruction(identifiers, opts),
|
|
391
|
+
keys: [],
|
|
392
|
+
answerFormat: "tex",
|
|
393
|
+
identifiers,
|
|
394
|
+
hint: getHint(identifiers, opts),
|
|
395
|
+
correction: getCorrection(identifiers, opts),
|
|
396
|
+
answer: getAnswer(identifiers),
|
|
397
|
+
};
|
|
398
|
+
return question;
|
|
399
|
+
};
|
|
400
|
+
export const lensFormula = {
|
|
401
|
+
id: "lensFormula",
|
|
402
|
+
label: "Exploiter la relation de conjugaison de Descartes",
|
|
403
|
+
isSingleStep: true,
|
|
404
|
+
generator: (nb, opts) => getDistinctQuestions(() => getLensFormulaQuestion(opts), nb, 30, () => false),
|
|
405
|
+
options,
|
|
406
|
+
qcmTimer: 60,
|
|
407
|
+
freeTimer: 60,
|
|
408
|
+
getPropositions,
|
|
409
|
+
isAnswerValid,
|
|
410
|
+
subject: "Physique",
|
|
411
|
+
maxAllowedQuestions: 30,
|
|
412
|
+
getQuestionFromIdentifiers,
|
|
413
|
+
answerType: "QCU",
|
|
414
|
+
hasHintAndCorrection: true,
|
|
415
|
+
};
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import { Exercise } from "../../../exercises/exercise.js";
|
|
2
2
|
type Identifiers = {
|
|
3
3
|
mass: number;
|
|
4
|
+
optsIdent: Options;
|
|
4
5
|
};
|
|
5
|
-
|
|
6
|
+
type InputType = "decimal" | "sci";
|
|
7
|
+
type NbDigitsType = 0 | 1 | 2;
|
|
8
|
+
type Options = {
|
|
9
|
+
inputType: InputType;
|
|
10
|
+
nbDigits: NbDigitsType;
|
|
11
|
+
};
|
|
12
|
+
export declare const calculateWeight: Exercise<Identifiers, Options>;
|
|
6
13
|
export {};
|
|
7
14
|
//# sourceMappingURL=calculateWeight.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculateWeight.d.ts","sourceRoot":"","sources":["../../../../src/exercises/pc/weight/calculateWeight.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"calculateWeight.d.ts","sourceRoot":"","sources":["../../../../src/exercises/pc/weight/calculateWeight.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,KAAK,SAAS,GAAG,SAAS,GAAG,KAAK,CAAC;AACnC,KAAK,YAAY,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAE9B,KAAK,OAAO,GAAG;IACb,SAAS,EAAE,SAAS,CAAC;IACrB,QAAQ,EAAE,YAAY,CAAC;CACxB,CAAC;AAuMF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAc1D,CAAC"}
|
|
@@ -1,21 +1,62 @@
|
|
|
1
|
-
import { addValidProp, propWhile, shuffleProps, tryToAddWrongProp, } from "../../../exercises/exercise.js";
|
|
1
|
+
import { GeneratorOptionTarget, GeneratorOptionType, addValidProp, propWhile, shuffleProps, tryToAddWrongProp, } from "../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { randfloat } from "../../../math/utils/random/randfloat.js";
|
|
4
4
|
import { randint } from "../../../math/utils/random/randint.js";
|
|
5
|
+
import { round } from "../../../math/utils/round.js";
|
|
5
6
|
import { earthGravity } from "../../../pc/constants/gravity.js";
|
|
7
|
+
import { random } from "../../../utils/alea/random.js";
|
|
6
8
|
const g = +earthGravity.measure.significantPart.toFixed(2);
|
|
9
|
+
const optsDefault = {
|
|
10
|
+
inputType: "sci",
|
|
11
|
+
nbDigits: 2,
|
|
12
|
+
};
|
|
13
|
+
const options = [
|
|
14
|
+
{
|
|
15
|
+
id: "inputType",
|
|
16
|
+
label: "Format de la réponse",
|
|
17
|
+
type: GeneratorOptionType.multiselect,
|
|
18
|
+
target: GeneratorOptionTarget.generation,
|
|
19
|
+
values: ["decimal", "sci"],
|
|
20
|
+
defaultValue: [optsDefault.inputType],
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
id: "nbDigits",
|
|
24
|
+
label: "Nombre de décimales",
|
|
25
|
+
type: GeneratorOptionType.multiselect,
|
|
26
|
+
target: GeneratorOptionTarget.generation,
|
|
27
|
+
values: [0, 1, 2],
|
|
28
|
+
defaultValue: [optsDefault.nbDigits],
|
|
29
|
+
},
|
|
30
|
+
];
|
|
7
31
|
const getInstruction = (identifiers) => {
|
|
8
|
-
const { mass } = identifiers;
|
|
32
|
+
const { mass, optsIdent } = identifiers;
|
|
9
33
|
const instruction = `Soit un objet avec une masse de $${mass}\\ \\textrm{kg}$.
|
|
34
|
+
|
|
35
|
+
L'accélération due à la gravité vaut $${g.frenchify()}$ $\\textrm{m} \\cdot \\textrm{s}^{${-2}}$.
|
|
10
36
|
|
|
11
|
-
Calculer le poids de cet objet
|
|
37
|
+
Calculer le poids de cet objet en Newtons.
|
|
38
|
+
Donner le résultat
|
|
39
|
+
${(() => {
|
|
40
|
+
switch (optsIdent.inputType) {
|
|
41
|
+
case "decimal":
|
|
42
|
+
return `en écriture décimale`;
|
|
43
|
+
case "sci":
|
|
44
|
+
return `en écriture scientifique`;
|
|
45
|
+
}
|
|
46
|
+
})()}
|
|
47
|
+
${(() => {
|
|
48
|
+
switch (optsIdent.nbDigits) {
|
|
49
|
+
case 0:
|
|
50
|
+
return `arrondie à l'unité`;
|
|
51
|
+
case 1:
|
|
52
|
+
return `arrondie à une décimale`;
|
|
53
|
+
case 2:
|
|
54
|
+
return `arrondie à deux décimales`;
|
|
55
|
+
}
|
|
56
|
+
})()}.
|
|
57
|
+
`;
|
|
12
58
|
return instruction;
|
|
13
59
|
};
|
|
14
|
-
const getAnswer = (identifiers) => {
|
|
15
|
-
const { mass } = identifiers;
|
|
16
|
-
const answer = (mass * g).toScientific(2);
|
|
17
|
-
return answer.toTex();
|
|
18
|
-
};
|
|
19
60
|
const getHint = () => {
|
|
20
61
|
const hint = `Le poids $P$ se calcule en utilisant la formule :
|
|
21
62
|
|
|
@@ -27,7 +68,7 @@ où
|
|
|
27
68
|
|
|
28
69
|
- m est la masse de l'objet (en $\\textrm{kg}$).
|
|
29
70
|
|
|
30
|
-
- g est l'accélération due à la gravité (en $\\textrm{m} \\cdot \\textrm{s}
|
|
71
|
+
- g est l'accélération due à la gravité (en $\\textrm{m} \\cdot \\textrm{s}^{${-2}}$).`;
|
|
31
72
|
return hint;
|
|
32
73
|
};
|
|
33
74
|
const getCorrection = (identifiers) => {
|
|
@@ -42,52 +83,85 @@ $$
|
|
|
42
83
|
On a :
|
|
43
84
|
|
|
44
85
|
$$
|
|
45
|
-
P = ${mass.frenchify()} \\times ${g.frenchify()} \\Rightarrow P=${answer}
|
|
86
|
+
P = ${mass.frenchify()} \\times ${g.frenchify()} \\Rightarrow P=${answer}
|
|
46
87
|
$$`;
|
|
47
88
|
return correction;
|
|
48
89
|
};
|
|
49
|
-
const
|
|
90
|
+
const getAnswer = (identifiers) => {
|
|
91
|
+
const { mass, optsIdent } = identifiers;
|
|
92
|
+
switch (optsIdent.inputType) {
|
|
93
|
+
case "decimal": {
|
|
94
|
+
const answer = round(mass * g, optsIdent.nbDigits);
|
|
95
|
+
return `${answer.frenchify()}N`;
|
|
96
|
+
}
|
|
97
|
+
case "sci": {
|
|
98
|
+
const answer = (mass * g).toScientific(optsIdent.nbDigits);
|
|
99
|
+
return `${answer.toTex()}N`;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
104
|
+
return ans === answer;
|
|
105
|
+
};
|
|
106
|
+
const getPropositions = (n, { answer, mass, optsIdent }) => {
|
|
107
|
+
const propositions = [];
|
|
108
|
+
const weight = mass * g;
|
|
109
|
+
addValidProp(propositions, answer);
|
|
110
|
+
switch (optsIdent.inputType) {
|
|
111
|
+
case "decimal":
|
|
112
|
+
{
|
|
113
|
+
tryToAddWrongProp(propositions, `${round(weight * 10, optsIdent.nbDigits).frenchify()}N`);
|
|
114
|
+
tryToAddWrongProp(propositions, `${round(randfloat(weight - 100, weight + 100, 2, [weight]) / 10, optsIdent.nbDigits).frenchify()}N`);
|
|
115
|
+
propWhile(propositions, n, () => {
|
|
116
|
+
const random = randfloat(weight - 50, weight + 50, 2, [weight]);
|
|
117
|
+
tryToAddWrongProp(propositions, `${round(random, optsIdent.nbDigits).frenchify()}N`);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
break;
|
|
121
|
+
case "sci":
|
|
122
|
+
{
|
|
123
|
+
tryToAddWrongProp(propositions, `${(weight * 10).toScientific(optsIdent.nbDigits).toTex()}N`);
|
|
124
|
+
tryToAddWrongProp(propositions, `${(randfloat(weight - 100, weight + 100, 2, [weight]) / 10)
|
|
125
|
+
.toScientific(optsIdent.nbDigits)
|
|
126
|
+
.toTex()}N`);
|
|
127
|
+
propWhile(propositions, n, () => {
|
|
128
|
+
const random = randfloat(weight - 50, weight + 50, 2, [weight]);
|
|
129
|
+
tryToAddWrongProp(propositions, `${random.toScientific(optsIdent.nbDigits).toTex()}N`);
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
return shuffleProps(propositions, n);
|
|
135
|
+
};
|
|
136
|
+
const getCalculateWeightQuestion = (optsIn) => {
|
|
137
|
+
const opts = optsIn
|
|
138
|
+
? Object.assign(optsDefault, {
|
|
139
|
+
inputType: random(optsIn.inputType),
|
|
140
|
+
nbDigits: +random(optsIn.nbDigits),
|
|
141
|
+
})
|
|
142
|
+
: optsDefault;
|
|
143
|
+
const mass = randint(30, 151);
|
|
144
|
+
const identifiers = { mass: mass, optsIdent: opts };
|
|
145
|
+
return getQuestionFromIdentifiers(identifiers, opts);
|
|
146
|
+
};
|
|
147
|
+
const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
50
148
|
const question = {
|
|
51
149
|
answer: getAnswer(identifiers),
|
|
52
150
|
instruction: getInstruction(identifiers),
|
|
53
|
-
keys: [],
|
|
151
|
+
keys: ["N"],
|
|
54
152
|
hint: getHint(identifiers),
|
|
55
153
|
correction: getCorrection(identifiers),
|
|
56
154
|
answerFormat: "tex",
|
|
57
155
|
identifiers,
|
|
156
|
+
options: opts,
|
|
58
157
|
};
|
|
59
158
|
return question;
|
|
60
159
|
};
|
|
61
|
-
const getCalculateWeightQuestion = () => {
|
|
62
|
-
const mass = randint(30, 151);
|
|
63
|
-
const identifiers = { mass: mass };
|
|
64
|
-
return getQuestionFromIdentifiers(identifiers);
|
|
65
|
-
};
|
|
66
|
-
const getPropositions = (n, { answer, mass }) => {
|
|
67
|
-
const propositions = [];
|
|
68
|
-
const weight = mass * g;
|
|
69
|
-
addValidProp(propositions, answer);
|
|
70
|
-
generatePropositions(mass).forEach((value) => tryToAddWrongProp(propositions, value));
|
|
71
|
-
propWhile(propositions, n, () => {
|
|
72
|
-
const random = randfloat(weight - 50, weight + 50, 2, [weight]);
|
|
73
|
-
tryToAddWrongProp(propositions, random.toScientific(2).toTex());
|
|
74
|
-
});
|
|
75
|
-
return shuffleProps(propositions, n);
|
|
76
|
-
};
|
|
77
|
-
const isAnswerValid = (ans, { answer }) => {
|
|
78
|
-
return ans === answer;
|
|
79
|
-
};
|
|
80
|
-
const generatePropositions = (mass) => {
|
|
81
|
-
const weight = mass * g;
|
|
82
|
-
const first = (weight * 10).toScientific(2);
|
|
83
|
-
const second = (randfloat(weight - 100, weight + 100, 2, [weight]) / 10).toScientific(2);
|
|
84
|
-
return [first.toTex(), second.toTex()];
|
|
85
|
-
};
|
|
86
160
|
export const calculateWeight = {
|
|
87
161
|
id: "calculateWeight",
|
|
88
162
|
label: "Calculer le poids d'un objet",
|
|
89
163
|
isSingleStep: true,
|
|
90
|
-
generator: (nb) => getDistinctQuestions(getCalculateWeightQuestion, nb),
|
|
164
|
+
generator: (nb, opts) => getDistinctQuestions(() => getCalculateWeightQuestion(opts), nb),
|
|
91
165
|
qcmTimer: 60,
|
|
92
166
|
freeTimer: 60,
|
|
93
167
|
getPropositions,
|
|
@@ -95,4 +169,5 @@ export const calculateWeight = {
|
|
|
95
169
|
subject: "Physique",
|
|
96
170
|
hasHintAndCorrection: true,
|
|
97
171
|
getQuestionFromIdentifiers,
|
|
172
|
+
options,
|
|
98
173
|
};
|
|
@@ -3,5 +3,9 @@ export declare class GeogebraParser {
|
|
|
3
3
|
constructor(studentCommands: string[]);
|
|
4
4
|
pointCoords(name: string): number[] | undefined;
|
|
5
5
|
vectors(): number[][];
|
|
6
|
+
objectDict(): {
|
|
7
|
+
[k: string]: string;
|
|
8
|
+
};
|
|
9
|
+
static pointNamesForLineObj(lineObj: string): string[];
|
|
6
10
|
}
|
|
7
11
|
//# sourceMappingURL=geogebraParser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geogebraParser.d.ts","sourceRoot":"","sources":["../../../src/geogebra/parsers/geogebraParser.ts"],"names":[],"mappings":"AAAA,qBAAa,cAAc;IACzB,QAAQ,EAAE,MAAM,EAAE,CAAC;gBACP,eAAe,EAAE,MAAM,EAAE;IAIrC,WAAW,CAAC,IAAI,EAAE,MAAM;IAWxB,OAAO;
|
|
1
|
+
{"version":3,"file":"geogebraParser.d.ts","sourceRoot":"","sources":["../../../src/geogebra/parsers/geogebraParser.ts"],"names":[],"mappings":"AAAA,qBAAa,cAAc;IACzB,QAAQ,EAAE,MAAM,EAAE,CAAC;gBACP,eAAe,EAAE,MAAM,EAAE;IAIrC,WAAW,CAAC,IAAI,EAAE,MAAM;IAWxB,OAAO;IAyCP,UAAU;;;IAWV,MAAM,CAAC,oBAAoB,CAAC,OAAO,EAAE,MAAM;CAS5C"}
|
|
@@ -56,4 +56,21 @@ export class GeogebraParser {
|
|
|
56
56
|
}
|
|
57
57
|
return res;
|
|
58
58
|
}
|
|
59
|
+
objectDict() {
|
|
60
|
+
return Object.fromEntries(this.commands
|
|
61
|
+
.filter((command) => command.includes("="))
|
|
62
|
+
.map((definitionCommand) => {
|
|
63
|
+
const [name, obj] = definitionCommand.split("=");
|
|
64
|
+
return [name, obj];
|
|
65
|
+
}));
|
|
66
|
+
}
|
|
67
|
+
static pointNamesForLineObj(lineObj) {
|
|
68
|
+
const reLine = /^Line\[\s*([^,\]]+)\s*,\s*([^,\]]+)\s*\]$/;
|
|
69
|
+
const match = lineObj.match(reLine);
|
|
70
|
+
if (!match) {
|
|
71
|
+
return [];
|
|
72
|
+
}
|
|
73
|
+
const [, nameA, nameB] = match;
|
|
74
|
+
return [nameA, nameB];
|
|
75
|
+
}
|
|
59
76
|
}
|