math-exercises 3.0.125 → 3.0.127
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 +231 -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 +123 -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 +149 -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 +368 -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 +454 -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 +86 -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 +180 -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 +231 -248
- 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 +11 -0
- package/lib/exercises/math/conversion/kmPerMinToKmPerHourConversion.d.ts.map +1 -0
- package/lib/exercises/math/conversion/kmPerMinToKmPerHourConversion.js +116 -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 +243 -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 +53 -0
- package/lib/exercises/math/dataRepresentations/barChartInterpreting.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/barChartInterpreting.js +533 -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 +140 -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 +194 -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 +117 -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 +118 -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 +223 -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 +16 -0
- package/lib/exercises/math/functions/affines/representationOfAffine.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/representationOfAffine.js +275 -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 +235 -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 +65 -88
- 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 +221 -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 +29 -0
- package/lib/exercises/math/probaStat/probaAsSumOfProbas.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/probaAsSumOfProbas.js +547 -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 +89 -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 +152 -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 +351 -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,454 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { randfloat } from "../../../../math/utils/random/randfloat.js";
|
|
4
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
5
|
+
import { round } from "../../../../math/utils/round.js";
|
|
6
|
+
import { EqualNode, isEqualNode, } from "../../../../tree/nodes/equations/equalNode.js";
|
|
7
|
+
import { add } from "../../../../tree/nodes/operators/addNode.js";
|
|
8
|
+
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
9
|
+
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
10
|
+
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
11
|
+
import { random, randomMany } from "../../../../utils/alea/random.js";
|
|
12
|
+
import { isOperatorNode, OperatorIds, } from "../../../../tree/nodes/operators/operatorNode.js";
|
|
13
|
+
import { parseLatex } from "../../../../tree/parsers/latexParser.js";
|
|
14
|
+
import { mdTable } from "../../../../utils/markdown/mdTable.js";
|
|
15
|
+
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
16
|
+
class ProblemConstructor {
|
|
17
|
+
static byHydratingSkeleton(skeleton, groupNameToVarNameToValue, mysteryVarPath, shuffleArrays) {
|
|
18
|
+
const shuffleFuncs = shuffleArrays.map((shuffleArray) => {
|
|
19
|
+
return (array) => {
|
|
20
|
+
return array.map((_, i) => array[shuffleArray[i]]);
|
|
21
|
+
};
|
|
22
|
+
});
|
|
23
|
+
const groups = Object.fromEntries(Object.entries(skeleton.groups).map(([gpName, gp]) => {
|
|
24
|
+
const vars = Object.fromEntries(Object.entries(gp.vars).map(([varName, varSkeleton]) => {
|
|
25
|
+
const node = groupNameToVarNameToValue[gpName][varName];
|
|
26
|
+
return [varName, new ProblemVar(varSkeleton, node)];
|
|
27
|
+
}));
|
|
28
|
+
return [gpName, new ProblemVarGroup(gp, vars)];
|
|
29
|
+
}));
|
|
30
|
+
const [mysteryGroupName, mysteryVarNameInGroup] = mysteryVarPath.split(".");
|
|
31
|
+
const mysteryGroup = groups[mysteryGroupName];
|
|
32
|
+
const mysteryVar = mysteryGroup.vars[mysteryVarNameInGroup];
|
|
33
|
+
return new Problem(skeleton, groups, mysteryGroup, mysteryVar, shuffleFuncs);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
class Problem {
|
|
37
|
+
skeleton;
|
|
38
|
+
groups;
|
|
39
|
+
mysteryGroup;
|
|
40
|
+
mysteryVar;
|
|
41
|
+
shuffleFuncs;
|
|
42
|
+
equalNode;
|
|
43
|
+
frenchStr;
|
|
44
|
+
constructor(skeleton, groups, mysteryGroup, mysteryVar, shuffleFuncs) {
|
|
45
|
+
this.skeleton = skeleton;
|
|
46
|
+
this.groups = groups;
|
|
47
|
+
this.mysteryGroup = mysteryGroup;
|
|
48
|
+
this.mysteryVar = mysteryVar;
|
|
49
|
+
this.shuffleFuncs = shuffleFuncs;
|
|
50
|
+
this.equalNode = this.skeleton.equalNodeFunc(mysteryGroup, mysteryVar, groups, shuffleFuncs);
|
|
51
|
+
this.frenchStr = this.skeleton.strFunc(mysteryGroup, mysteryVar, groups, shuffleFuncs);
|
|
52
|
+
//populate computed groups
|
|
53
|
+
Object.values(groups)
|
|
54
|
+
.filter((group) => group.skeleton.isComputed)
|
|
55
|
+
.forEach((group) => {
|
|
56
|
+
Object.values(group.vars).forEach((problemVar) => {
|
|
57
|
+
if (problemVar.value === undefined) {
|
|
58
|
+
problemVar.value = group.getNode(mysteryVar, groups, shuffleFuncs);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
getArrayOfUsefulVarNames() {
|
|
64
|
+
return [this.mysteryVar.skeleton.varName];
|
|
65
|
+
}
|
|
66
|
+
getArrayOfUsefulNodes() {
|
|
67
|
+
return Object.values(this.groups).flatMap((group) => {
|
|
68
|
+
return Object.values(group.vars)
|
|
69
|
+
.flatMap((problemVar) => problemVar === this.mysteryVar
|
|
70
|
+
? problemVar.getVarNode()
|
|
71
|
+
: problemVar.getValueNode())
|
|
72
|
+
.filter((node) => !!node);
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
getExplanationString() {
|
|
76
|
+
const arrArr = Object.values(this.groups).map((group) => [
|
|
77
|
+
`\\text{${group.getScalarString(this.mysteryVar).replaceAll("$", "")}}`,
|
|
78
|
+
`:`,
|
|
79
|
+
`${group
|
|
80
|
+
.getNode(this.mysteryVar, this.groups, this.shuffleFuncs)
|
|
81
|
+
.toTex()}`,
|
|
82
|
+
]);
|
|
83
|
+
return alignTex(arrArr, false);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
class ProblemVarGroup {
|
|
87
|
+
skeleton;
|
|
88
|
+
vars;
|
|
89
|
+
constructor(skeleton, vars) {
|
|
90
|
+
this.skeleton = skeleton;
|
|
91
|
+
this.vars = vars;
|
|
92
|
+
}
|
|
93
|
+
toTex(mysteryVar) {
|
|
94
|
+
return this.skeleton.strFunc(this, mysteryVar);
|
|
95
|
+
}
|
|
96
|
+
getNode(mysteryVar, groups, shuffleFuncs) {
|
|
97
|
+
return this.skeleton.nodeFunc(this, mysteryVar, groups, shuffleFuncs);
|
|
98
|
+
}
|
|
99
|
+
getScalarString(mysteryVar) {
|
|
100
|
+
return `${this.skeleton.strToScalar} ${this.toTex(mysteryVar)}`;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
class ProblemVar {
|
|
104
|
+
skeleton;
|
|
105
|
+
value;
|
|
106
|
+
constructor(skeleton, value) {
|
|
107
|
+
this.skeleton = skeleton;
|
|
108
|
+
this.value = value;
|
|
109
|
+
}
|
|
110
|
+
getVarNode() {
|
|
111
|
+
return this.skeleton.varName.toTree();
|
|
112
|
+
}
|
|
113
|
+
getValueNode() {
|
|
114
|
+
return this.value;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
class ProblemVarSkeletonGroup {
|
|
118
|
+
vars;
|
|
119
|
+
strToScalar;
|
|
120
|
+
strFunc;
|
|
121
|
+
nodeFunc;
|
|
122
|
+
isCanBeMysteryGroup;
|
|
123
|
+
isComputed;
|
|
124
|
+
constructor(vars, strToScalar, strFunc, nodeFunc, isCanBeMysteryGroup, isComputed) {
|
|
125
|
+
this.vars = vars;
|
|
126
|
+
this.strToScalar = strToScalar;
|
|
127
|
+
this.strFunc = strFunc;
|
|
128
|
+
this.nodeFunc = nodeFunc;
|
|
129
|
+
this.isCanBeMysteryGroup = isCanBeMysteryGroup;
|
|
130
|
+
this.isComputed = isComputed;
|
|
131
|
+
}
|
|
132
|
+
createRandomValuesDict() {
|
|
133
|
+
return Object.fromEntries(Object.entries(this.vars)
|
|
134
|
+
.filter(([_, varSkeleton]) => !!varSkeleton.randNode)
|
|
135
|
+
.map(([varName, varSkeleton]) => {
|
|
136
|
+
return [varName, varSkeleton.randNode()];
|
|
137
|
+
}));
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
class ProblemSkeleton {
|
|
141
|
+
sampleStr;
|
|
142
|
+
strFunc;
|
|
143
|
+
equalNodeFunc;
|
|
144
|
+
groups;
|
|
145
|
+
swappableGroups;
|
|
146
|
+
constructor(sampleStr, strFunc, equalNodeFunc, groups, swappableGroups) {
|
|
147
|
+
this.sampleStr = sampleStr;
|
|
148
|
+
this.strFunc = strFunc;
|
|
149
|
+
this.equalNodeFunc = equalNodeFunc;
|
|
150
|
+
this.groups = groups;
|
|
151
|
+
this.swappableGroups = swappableGroups;
|
|
152
|
+
}
|
|
153
|
+
createRandomValuesDict() {
|
|
154
|
+
return Object.fromEntries(Object.entries(this.groups).map(([gpName, gp]) => {
|
|
155
|
+
return [gpName, gp.createRandomValuesDict()];
|
|
156
|
+
}));
|
|
157
|
+
}
|
|
158
|
+
createRandomMysteryVarPath() {
|
|
159
|
+
const [groupName, group] = random(Object.entries(this.groups).filter(([_, group]) => group.isCanBeMysteryGroup));
|
|
160
|
+
const [groupVarNameInGroup, _] = random(Object.entries(group.vars));
|
|
161
|
+
return `${groupName}.${groupVarNameInGroup}`;
|
|
162
|
+
}
|
|
163
|
+
createRandomShuffleArrays() {
|
|
164
|
+
return this.swappableGroups.map((arrayOfGroupNames) => {
|
|
165
|
+
return randomMany([...Array(arrayOfGroupNames.length).keys()], arrayOfGroupNames.length);
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
const skeletons = [
|
|
170
|
+
new ProblemSkeleton(`Clara a acheté des ingrédients pour réaliser des pizzas.
|
|
171
|
+
Elle a pris trois pâtes à pizza à 1,95 € l’unité et deux pots de sauce tomate.
|
|
172
|
+
Elle a payé au total 8,37 €.
|
|
173
|
+
Quel est le prix, noté a, d'un pot de sauce ?`, (_group, mysteryVar, groups, shuffleFuncs) => {
|
|
174
|
+
const { total, ...groupsWithoutTotal } = groups;
|
|
175
|
+
const [gp1, gp2] = shuffleFuncs[0](Object.values(groupsWithoutTotal));
|
|
176
|
+
return `Clara a acheté des ingrédients pour réaliser des pizzas. Elle a pris ${gp1.toTex(mysteryVar)} et, dans un autre rayon, ${gp2.toTex(mysteryVar)}. Elle a payé au total $${total
|
|
177
|
+
.getNode(mysteryVar, groups, shuffleFuncs)
|
|
178
|
+
.toTex()}$ €. ${mysteryVar.skeleton.question}`;
|
|
179
|
+
}, (_group, mysteryVar, groups, shuffleFuncs) => {
|
|
180
|
+
const { pizza, sauce } = groups;
|
|
181
|
+
const [gp1, gp2] = shuffleFuncs[0]([pizza, sauce]);
|
|
182
|
+
return new EqualNode(add(gp1.getNode(mysteryVar), gp2.getNode(mysteryVar)), groups.total.getNode(mysteryVar, groups, shuffleFuncs));
|
|
183
|
+
}, {
|
|
184
|
+
pizza: new ProblemVarSkeletonGroup({
|
|
185
|
+
count: {
|
|
186
|
+
varName: "n",
|
|
187
|
+
str: "le nombre de pâtes à pizza",
|
|
188
|
+
question: `Quel est le nombre, noté $n$, de pâtes à pizza ?`,
|
|
189
|
+
randNode() {
|
|
190
|
+
return randint(1, 11, []).toTree();
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
price: {
|
|
194
|
+
varName: "p",
|
|
195
|
+
str: "le prix d'une pâte à pizza",
|
|
196
|
+
question: `Quel est le prix, noté $p$, d'une pâte à pizza ?`,
|
|
197
|
+
randNode() {
|
|
198
|
+
return randfloat(0.5, 4, 2, []).toTree();
|
|
199
|
+
},
|
|
200
|
+
},
|
|
201
|
+
}, "le coût pour", (group, mysteryVar) => {
|
|
202
|
+
switch (mysteryVar?.skeleton.varName) {
|
|
203
|
+
case "n":
|
|
204
|
+
return `des pâtes à pizza à $${group.vars.price.value.toTex()}$ € l’unité`;
|
|
205
|
+
case "p": {
|
|
206
|
+
const isPlural = group.vars.count.value.evaluate() >= 2;
|
|
207
|
+
return `$${group.vars.count.value.toTex()}$ ${"pâte" + (isPlural ? "s" : "")} à pizza`;
|
|
208
|
+
}
|
|
209
|
+
default: {
|
|
210
|
+
const isPlural = group.vars.count.value.evaluate() >= 2;
|
|
211
|
+
return `$${group.vars.count.value.toTex()}$ ${"pâte" + (isPlural ? "s" : "")} à pizza à $${group.vars.price.value.toTex()}$ € l’unité`;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}, (group, mysteryVar) => {
|
|
215
|
+
const varCount = group.vars.count;
|
|
216
|
+
const varPrice = group.vars.price;
|
|
217
|
+
return multiply(varCount === mysteryVar
|
|
218
|
+
? varCount.getVarNode()
|
|
219
|
+
: varCount.getValueNode(), varPrice === mysteryVar
|
|
220
|
+
? varPrice.getVarNode()
|
|
221
|
+
: varPrice.getValueNode());
|
|
222
|
+
}, true, false),
|
|
223
|
+
sauce: new ProblemVarSkeletonGroup({
|
|
224
|
+
count: {
|
|
225
|
+
varName: "m",
|
|
226
|
+
str: "le nombre de boîtes de sauce tomate",
|
|
227
|
+
question: `Quel est le nombre, noté $m$, de boîtes de sauce tomate ?`,
|
|
228
|
+
randNode() {
|
|
229
|
+
return randint(1, 11, []).toTree();
|
|
230
|
+
},
|
|
231
|
+
},
|
|
232
|
+
price: {
|
|
233
|
+
varName: "s",
|
|
234
|
+
str: "le prix d'une boîte de sauce",
|
|
235
|
+
question: `Quel est le prix, noté $s$, d'une boîte de sauce tomate ?`,
|
|
236
|
+
randNode() {
|
|
237
|
+
return randfloat(0.5, 4, 2, []).toTree();
|
|
238
|
+
},
|
|
239
|
+
},
|
|
240
|
+
}, "le coût pour", (group, mysteryVar) => {
|
|
241
|
+
switch (mysteryVar?.skeleton.varName) {
|
|
242
|
+
case "m":
|
|
243
|
+
return `des boîtes de sauce tomate à $${group.vars.price.value.toTex()}$ € l’unité`;
|
|
244
|
+
case "s": {
|
|
245
|
+
const isPlural = group.vars.count.value.evaluate() >= 2;
|
|
246
|
+
return `$${group.vars.count.value.toTex()}$ ${"boîte" + (isPlural ? "s" : "")} de sauce tomate`;
|
|
247
|
+
}
|
|
248
|
+
default: {
|
|
249
|
+
const isPlural = group.vars.count.value.evaluate() >= 2;
|
|
250
|
+
return `$${group.vars.count.value.toTex()}$ ${"boîte" + (isPlural ? "s" : "")} de sauce tomate à $${group.vars.price.value.toTex()}$ € l’unité`;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}, (group, mysteryVar) => {
|
|
254
|
+
const varCount = group.vars.count;
|
|
255
|
+
const varPrice = group.vars.price;
|
|
256
|
+
return multiply(varCount === mysteryVar
|
|
257
|
+
? varCount.getVarNode()
|
|
258
|
+
: varCount.getValueNode(), varPrice === mysteryVar
|
|
259
|
+
? varPrice.getVarNode()
|
|
260
|
+
: varPrice.getValueNode());
|
|
261
|
+
}, true, false),
|
|
262
|
+
total: new ProblemVarSkeletonGroup({
|
|
263
|
+
total: {
|
|
264
|
+
varName: "t",
|
|
265
|
+
str: "le coût total",
|
|
266
|
+
question: `Quel est le coût total, noté $t$, de ses achats ?`,
|
|
267
|
+
},
|
|
268
|
+
}, "le", () => {
|
|
269
|
+
return "coût total";
|
|
270
|
+
}, (_group, _mysteryVar, groups, shuffleFuncs) => {
|
|
271
|
+
const { total, ...groupsWithoutTotal } = groups;
|
|
272
|
+
const orderedNodes = shuffleFuncs[0](Object.values(groupsWithoutTotal)).map((group) => group.getNode());
|
|
273
|
+
// console.log(
|
|
274
|
+
// "orderedNodes[0].leftChild",
|
|
275
|
+
// (orderedNodes[0] as MultiplyNode).leftChild,
|
|
276
|
+
// );
|
|
277
|
+
// console.log(
|
|
278
|
+
// "isAlgebraicNode((orderedNodes[0] as MultiplyNode).leftChild)",
|
|
279
|
+
// isAlgebraicNode((orderedNodes[0] as MultiplyNode).leftChild),
|
|
280
|
+
// );
|
|
281
|
+
// console.log(
|
|
282
|
+
// "orderedNodes[0].leftChild.evaluate",
|
|
283
|
+
// (orderedNodes[0] as MultiplyNode).leftChild.evaluate,
|
|
284
|
+
// );
|
|
285
|
+
// console.log("orderedNodes[0].evaluate()", orderedNodes[0].evaluate());
|
|
286
|
+
// console.log("orderedNodes[1].evaluate()", orderedNodes[1].evaluate());
|
|
287
|
+
return round(add(orderedNodes[0], orderedNodes[1]).evaluate(), 2).toTree();
|
|
288
|
+
}, false, true),
|
|
289
|
+
}, [["pizza", "sauce"]]),
|
|
290
|
+
];
|
|
291
|
+
const getInstruction = (identifiers) => {
|
|
292
|
+
const { problemSkeletonIndex, groupNameToVarNameToValue, mysteryVarPath, shuffleArrays, } = identifiers;
|
|
293
|
+
const skeleton = skeletons[problemSkeletonIndex];
|
|
294
|
+
const problem = ProblemConstructor.byHydratingSkeleton(skeleton, groupNameToVarNameToValue, mysteryVarPath, shuffleArrays);
|
|
295
|
+
return `${mdTable([[""], [problem.frenchStr]])}
|
|
296
|
+
|
|
297
|
+
Parmi les équations suivantes, laquelle modélise cette situation ?`;
|
|
298
|
+
};
|
|
299
|
+
const getHint = (identifiers) => {
|
|
300
|
+
const { problemSkeletonIndex, groupNameToVarNameToValue, mysteryVarPath, shuffleArrays, } = identifiers;
|
|
301
|
+
const skeleton = skeletons[problemSkeletonIndex];
|
|
302
|
+
const problem = ProblemConstructor.byHydratingSkeleton(skeleton, groupNameToVarNameToValue, mysteryVarPath, shuffleArrays);
|
|
303
|
+
return `${Object.values(problem.groups).map((group) => `Quel est ${group.getScalarString(problem.mysteryVar)} ?`).join(`
|
|
304
|
+
|
|
305
|
+
`)}`;
|
|
306
|
+
};
|
|
307
|
+
const getCorrection = (identifiers) => {
|
|
308
|
+
const { problemSkeletonIndex, groupNameToVarNameToValue, mysteryVarPath, shuffleArrays, } = identifiers;
|
|
309
|
+
const skeleton = skeletons[problemSkeletonIndex];
|
|
310
|
+
const problem = ProblemConstructor.byHydratingSkeleton(skeleton, groupNameToVarNameToValue, mysteryVarPath, shuffleArrays);
|
|
311
|
+
return `On peut former les expressions suivantes:
|
|
312
|
+
${problem.getExplanationString()}
|
|
313
|
+
|
|
314
|
+
L'équation qui modélise la situation est donc:
|
|
315
|
+
|
|
316
|
+
$$
|
|
317
|
+
${getAnswer(identifiers)}
|
|
318
|
+
$$
|
|
319
|
+
|
|
320
|
+
`;
|
|
321
|
+
};
|
|
322
|
+
const getAnswerNode = (identifiers) => {
|
|
323
|
+
const { problemSkeletonIndex, groupNameToVarNameToValue, mysteryVarPath, shuffleArrays, } = identifiers;
|
|
324
|
+
const skeleton = skeletons[problemSkeletonIndex];
|
|
325
|
+
const problem = ProblemConstructor.byHydratingSkeleton(skeleton, groupNameToVarNameToValue, mysteryVarPath, shuffleArrays);
|
|
326
|
+
return problem.equalNode;
|
|
327
|
+
};
|
|
328
|
+
const getAnswer = (identifiers) => {
|
|
329
|
+
return getAnswerNode(identifiers).toTex();
|
|
330
|
+
};
|
|
331
|
+
const getKeys = (identifiers) => {
|
|
332
|
+
const { problemSkeletonIndex, groupNameToVarNameToValue, mysteryVarPath, shuffleArrays, } = identifiers;
|
|
333
|
+
const skeleton = skeletons[problemSkeletonIndex];
|
|
334
|
+
const problem = ProblemConstructor.byHydratingSkeleton(skeleton, groupNameToVarNameToValue, mysteryVarPath, shuffleArrays);
|
|
335
|
+
const arrayOfNodes = problem.getArrayOfUsefulNodes();
|
|
336
|
+
return [
|
|
337
|
+
"equal",
|
|
338
|
+
...arrayOfNodes.map((node) => {
|
|
339
|
+
const tex = node.toTex();
|
|
340
|
+
return {
|
|
341
|
+
id: "custom",
|
|
342
|
+
label: tex,
|
|
343
|
+
labelType: "tex",
|
|
344
|
+
mathfieldInstructions: {
|
|
345
|
+
method: "write",
|
|
346
|
+
content: tex,
|
|
347
|
+
},
|
|
348
|
+
};
|
|
349
|
+
}),
|
|
350
|
+
];
|
|
351
|
+
};
|
|
352
|
+
const getEquationFromSentenceExerciseQuestion = () => {
|
|
353
|
+
const problemSkeletonIndex = random([...Array(skeletons.length).keys()]);
|
|
354
|
+
const problemSkeleton = skeletons[problemSkeletonIndex];
|
|
355
|
+
const groupNameToVarNameToValue = problemSkeleton.createRandomValuesDict();
|
|
356
|
+
const mysteryVarPath = problemSkeleton.createRandomMysteryVarPath();
|
|
357
|
+
const shuffleArrays = problemSkeleton.createRandomShuffleArrays();
|
|
358
|
+
const problem = ProblemConstructor.byHydratingSkeleton(problemSkeleton, groupNameToVarNameToValue, mysteryVarPath, shuffleArrays);
|
|
359
|
+
const equalNodeIds = problem.equalNode.toIdentifiers();
|
|
360
|
+
const identifiers = {
|
|
361
|
+
problemSkeletonIndex,
|
|
362
|
+
groupNameToVarNameToValue,
|
|
363
|
+
mysteryVarPath,
|
|
364
|
+
shuffleArrays,
|
|
365
|
+
equalNodeIds,
|
|
366
|
+
};
|
|
367
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
368
|
+
};
|
|
369
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
370
|
+
const question = {
|
|
371
|
+
answer: getAnswer(identifiers),
|
|
372
|
+
instruction: getInstruction(identifiers),
|
|
373
|
+
hint: getHint(identifiers),
|
|
374
|
+
correction: getCorrection(identifiers),
|
|
375
|
+
keys: getKeys(identifiers),
|
|
376
|
+
answerFormat: "tex",
|
|
377
|
+
identifiers,
|
|
378
|
+
};
|
|
379
|
+
return question;
|
|
380
|
+
};
|
|
381
|
+
const getPropositions = (n, { answer, ...identifiers }) => {
|
|
382
|
+
const propositions = [];
|
|
383
|
+
addValidProp(propositions, answer);
|
|
384
|
+
const answerNode = getAnswerNode(identifiers);
|
|
385
|
+
function nodeByReplacingOperations(node, replacementDict) {
|
|
386
|
+
if (isOperatorNode(node)) {
|
|
387
|
+
const leftChild = nodeByReplacingOperations(node.leftChild, replacementDict);
|
|
388
|
+
const rightChild = nodeByReplacingOperations(node.rightChild, replacementDict);
|
|
389
|
+
const targetOperatorId = replacementDict[+node.id] ?? node.id;
|
|
390
|
+
switch (+targetOperatorId) {
|
|
391
|
+
case OperatorIds.add:
|
|
392
|
+
return add(leftChild, rightChild);
|
|
393
|
+
case OperatorIds.substract:
|
|
394
|
+
return substract(leftChild, rightChild);
|
|
395
|
+
case OperatorIds.multiply:
|
|
396
|
+
return multiply(leftChild, rightChild);
|
|
397
|
+
case OperatorIds.divide:
|
|
398
|
+
return frac(leftChild, rightChild);
|
|
399
|
+
default:
|
|
400
|
+
return add(leftChild, rightChild);
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
else if (isEqualNode(node)) {
|
|
404
|
+
const leftChild = nodeByReplacingOperations(node.leftChild, replacementDict);
|
|
405
|
+
const rightChild = nodeByReplacingOperations(node.rightChild, replacementDict);
|
|
406
|
+
return new EqualNode(leftChild, rightChild);
|
|
407
|
+
}
|
|
408
|
+
else {
|
|
409
|
+
return node;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
//add everywhere
|
|
413
|
+
{
|
|
414
|
+
const wrongEqualNode = nodeByReplacingOperations(answerNode, {
|
|
415
|
+
[OperatorIds.multiply]: OperatorIds.add,
|
|
416
|
+
[OperatorIds.substract]: OperatorIds.add,
|
|
417
|
+
[OperatorIds.divide]: OperatorIds.add,
|
|
418
|
+
});
|
|
419
|
+
tryToAddWrongProp(propositions, wrongEqualNode.toTex());
|
|
420
|
+
}
|
|
421
|
+
//multiply becomes frac
|
|
422
|
+
{
|
|
423
|
+
const wrongEqualNode = nodeByReplacingOperations(answerNode, {
|
|
424
|
+
[OperatorIds.multiply]: OperatorIds.divide,
|
|
425
|
+
});
|
|
426
|
+
tryToAddWrongProp(propositions, wrongEqualNode.toTex());
|
|
427
|
+
}
|
|
428
|
+
//l*r = a becomes l = r
|
|
429
|
+
{
|
|
430
|
+
const leftChild = answerNode.leftChild;
|
|
431
|
+
const wrongEqualNode = new EqualNode(leftChild.leftChild, leftChild.rightChild);
|
|
432
|
+
tryToAddWrongProp(propositions, wrongEqualNode.toTex());
|
|
433
|
+
}
|
|
434
|
+
return shuffleProps(propositions, n);
|
|
435
|
+
};
|
|
436
|
+
const isAnswerValid = (ans, { answer, ...identifiers }) => {
|
|
437
|
+
const answerNode = getAnswerNode(identifiers); //!TODO: this call crashes but it's a mystery
|
|
438
|
+
const ansNode = parseLatex(ans);
|
|
439
|
+
return substract(ansNode, answerNode).evaluate() === 0;
|
|
440
|
+
};
|
|
441
|
+
export const equationFromProblem = {
|
|
442
|
+
id: "equationFromProblem",
|
|
443
|
+
label: "Traduire un problème en une équation mathématique",
|
|
444
|
+
isSingleStep: true,
|
|
445
|
+
generator: (nb) => getDistinctQuestions(getEquationFromSentenceExerciseQuestion, nb),
|
|
446
|
+
qcmTimer: 60,
|
|
447
|
+
freeTimer: 60,
|
|
448
|
+
getPropositions,
|
|
449
|
+
isAnswerValid,
|
|
450
|
+
subject: "Mathématiques",
|
|
451
|
+
getQuestionFromIdentifiers,
|
|
452
|
+
answerType: "QCU",
|
|
453
|
+
hasHintAndCorrection: true,
|
|
454
|
+
};
|
|
@@ -14,4 +14,5 @@ export * from "./binomialsTrinomialsProposedSolutions.js";
|
|
|
14
14
|
export * from "./equationWithDistributivity.js";
|
|
15
15
|
export * from "./choseOperationToSolveEquation.js";
|
|
16
16
|
export * from "./factorizeEquation.js";
|
|
17
|
+
export * from "./equationFromProblem.js";
|
|
17
18
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC;AACzC,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,mCAAmC,CAAC;AAClD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,iCAAiC,CAAC;AAChD,cAAc,oCAAoC,CAAC;AACnD,cAAc,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC;AACzC,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,mCAAmC,CAAC;AAClD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,iCAAiC,CAAC;AAChD,cAAc,oCAAoC,CAAC;AACnD,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
a: number;
|
|
4
|
+
b: number;
|
|
5
|
+
isAdd: boolean;
|
|
6
|
+
varName: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const factorizeAX2PlusBX: Exercise<Identifiers>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=factorizeAX2PlusBX.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factorizeAX2PlusBX.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/factorisation/factorizeAX2PlusBX.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAmFF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAcpD,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { primes } from "../../../../math/numbers/integer/primes.js";
|
|
4
|
+
import { add } from "../../../../tree/nodes/operators/addNode.js";
|
|
5
|
+
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
6
|
+
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
7
|
+
import { coinFlip } from "../../../../utils/alea/coinFlip.js";
|
|
8
|
+
import { random, randomMany } from "../../../../utils/alea/random.js";
|
|
9
|
+
const getInstruction = (identifiers) => {
|
|
10
|
+
const { a, b, isAdd, varName } = identifiers;
|
|
11
|
+
const x = varName;
|
|
12
|
+
return `Laquelle de ces propositions est la forme factorisée de $${a}${x}^2 ${isAdd ? "+" : "-"} ${b}${x}$ ?`;
|
|
13
|
+
};
|
|
14
|
+
const getHint = (identifiers) => {
|
|
15
|
+
const { varName } = identifiers;
|
|
16
|
+
return `$${varName}$ semble être le facteur commun.`;
|
|
17
|
+
};
|
|
18
|
+
const getCorrection = (identifiers) => {
|
|
19
|
+
const { a, b, isAdd, varName } = identifiers;
|
|
20
|
+
const x = varName;
|
|
21
|
+
return `Si on factorise par $${x}$ on obtient :
|
|
22
|
+
|
|
23
|
+
$$
|
|
24
|
+
${a}${x}^2 ${isAdd ? "+" : "-"} ${b}${x} = ${x}(${a}${x}${isAdd ? "+" : "-"}${b})
|
|
25
|
+
$$
|
|
26
|
+
|
|
27
|
+
`;
|
|
28
|
+
};
|
|
29
|
+
const getPropositions = (n, { answer, ...identifiers }) => {
|
|
30
|
+
const { a, b, isAdd, varName } = identifiers;
|
|
31
|
+
const x = varName;
|
|
32
|
+
const addSub = isAdd ? add : substract;
|
|
33
|
+
const propositions = [];
|
|
34
|
+
addValidProp(propositions, `${x}(${a}${x}${isAdd ? "+" : "-"}${b})`, "tex");
|
|
35
|
+
tryToAddWrongProp(propositions, `(${multiply(a.toTree(), b.toTree()).toTex()})${x}^3`, "tex");
|
|
36
|
+
tryToAddWrongProp(propositions, `(${addSub(a.toTree(), b.toTree()).toTex()})${x}`, "tex");
|
|
37
|
+
tryToAddWrongProp(propositions, `(${a}${x}^2${isAdd ? "+" : "-"}${b}${x})${x}^2`, "tex");
|
|
38
|
+
return shuffleProps(propositions, n);
|
|
39
|
+
};
|
|
40
|
+
const getFactorizeAX2PlusBXQuestion = () => {
|
|
41
|
+
const [a, b] = randomMany(primes, 2);
|
|
42
|
+
const varName = random(["x", "y", "z", "t"]);
|
|
43
|
+
const isAdd = coinFlip();
|
|
44
|
+
return getQuestionFromIdentifiers({ a, b, isAdd, varName });
|
|
45
|
+
};
|
|
46
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
47
|
+
const question = {
|
|
48
|
+
instruction: getInstruction(identifiers),
|
|
49
|
+
keys: [],
|
|
50
|
+
answerFormat: "tex",
|
|
51
|
+
identifiers,
|
|
52
|
+
hint: getHint(identifiers),
|
|
53
|
+
correction: getCorrection(identifiers),
|
|
54
|
+
};
|
|
55
|
+
return question;
|
|
56
|
+
};
|
|
57
|
+
export const factorizeAX2PlusBX = {
|
|
58
|
+
id: "factorizeAX2PlusBX",
|
|
59
|
+
label: "Factoriser $ax^2 + bx$",
|
|
60
|
+
isSingleStep: true,
|
|
61
|
+
generator: (nb) => getDistinctQuestions(() => getFactorizeAX2PlusBXQuestion(), nb, 30),
|
|
62
|
+
qcmTimer: 60,
|
|
63
|
+
freeTimer: 60,
|
|
64
|
+
getPropositions,
|
|
65
|
+
subject: "Mathématiques",
|
|
66
|
+
maxAllowedQuestions: 30,
|
|
67
|
+
getQuestionFromIdentifiers,
|
|
68
|
+
answerType: "QCU",
|
|
69
|
+
hasHintAndCorrection: true,
|
|
70
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/factorisation/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qCAAqC,CAAC;AACpD,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/factorisation/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qCAAqC,CAAC;AACpD,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,yBAAyB,CAAC"}
|
|
@@ -5,5 +5,7 @@ export * from "./inequations/index.js";
|
|
|
5
5
|
export * from "./simplifying/index.js";
|
|
6
6
|
export * from "./systems/index.js";
|
|
7
7
|
export * from "./isolate/index.js";
|
|
8
|
+
export * from "./writing/index.js";
|
|
8
9
|
export * from "./formulas/index.js";
|
|
10
|
+
export * from "./ordering/index.js";
|
|
9
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/calculLitteral/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/calculLitteral/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC"}
|
|
@@ -5,4 +5,6 @@ export * from "./inequations/index.js";
|
|
|
5
5
|
export * from "./simplifying/index.js";
|
|
6
6
|
export * from "./systems/index.js";
|
|
7
7
|
export * from "./isolate/index.js";
|
|
8
|
+
export * from "./writing/index.js";
|
|
8
9
|
export * from "./formulas/index.js";
|
|
10
|
+
export * from "./ordering/index.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/isolate/index.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/isolate/index.ts"],"names":[],"mappings":"AACA,cAAc,uCAAuC,CAAC;AACtD,cAAc,uCAAuC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
varNames: string[];
|
|
4
|
+
};
|
|
5
|
+
export declare const isolateUInInvXPlusInvYEqualsInvU: Exercise<Identifiers>;
|
|
6
|
+
export declare const isolateRInInvR1PlusInvR2EqualsInvR: Exercise<Identifiers>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=isolateUInInvXPlusInvYEqualsInvU.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isolateUInInvXPlusInvYEqualsInvU.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/isolate/isolateUInInvXPlusInvYEqualsInvU.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAKrC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AAqEF,eAAO,MAAM,gCAAgC,EAAE,QAAQ,CAAC,WAAW,CAmBlE,CAAC;AAUF,eAAO,MAAM,kCAAkC,EAAE,QAAQ,CAAC,WAAW,CAoBpE,CAAC"}
|