math-exercises 3.0.126 → 3.0.128
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/arithmetics/isMultipleOrDivisor.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/isMultipleOrDivisor.js +0 -10
- package/lib/exercises/math/calcul/mentalCaluls/mentalProgramSolve.d.ts +1 -1
- package/lib/exercises/math/calcul/mentalCaluls/mentalProgramSolve.d.ts.map +1 -1
- package/lib/exercises/math/calcul/mentalCaluls/mentalProgramSolve.js +66 -42
- package/lib/exercises/math/calcul/operations/expressionNature.d.ts.map +1 -1
- package/lib/exercises/math/calcul/operations/expressionNature.js +0 -4
- package/lib/exercises/math/calcul/ordering/compareA10N.d.ts.map +1 -1
- package/lib/exercises/math/calcul/ordering/compareA10N.js +0 -1
- package/lib/exercises/math/calcul/ordering/compareABUsingQuotient.d.ts.map +1 -1
- package/lib/exercises/math/calcul/ordering/compareABUsingQuotient.js +6 -105
- package/lib/exercises/math/calcul/ordering/compareFracABWithFracAPlusCBPlusC.d.ts.map +1 -1
- package/lib/exercises/math/calcul/ordering/compareFracABWithFracAPlusCBPlusC.js +22 -9
- package/lib/exercises/math/calcul/ordering/compareFracAndDec.d.ts.map +1 -1
- package/lib/exercises/math/calcul/ordering/compareFracAndDec.js +7 -7
- package/lib/exercises/math/calcul/ordering/compareWithSquareRoots.d.ts.map +1 -1
- package/lib/exercises/math/calcul/ordering/compareWithSquareRoots.js +23 -14
- package/lib/exercises/math/calcul/ordering/decimalOrdering.d.ts.map +1 -1
- package/lib/exercises/math/calcul/ordering/decimalOrdering.js +0 -4
- package/lib/exercises/math/calcul/ordering/decimalOrderingNoRelatives.d.ts.map +1 -1
- package/lib/exercises/math/calcul/ordering/decimalOrderingNoRelatives.js +0 -4
- package/lib/exercises/math/calcul/ordering/integerOrdering.d.ts.map +1 -1
- package/lib/exercises/math/calcul/ordering/integerOrdering.js +0 -4
- package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.d.ts.map +1 -1
- package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.js +0 -1
- package/lib/exercises/math/calcul/proportionality/isTableProportional.d.ts.map +1 -1
- package/lib/exercises/math/calcul/proportionality/isTableProportional.js +0 -4
- package/lib/exercises/math/calcul/proportionality/isTableProportionalNonInteger.d.ts.map +1 -1
- package/lib/exercises/math/calcul/proportionality/isTableProportionalNonInteger.js +0 -4
- package/lib/exercises/math/calcul/rounding/estimateAroundPow10NTimesAroundPow10N.d.ts.map +1 -1
- package/lib/exercises/math/calcul/rounding/estimateAroundPow10NTimesAroundPow10N.js +0 -1
- package/lib/exercises/math/calcul/rounding/estimatePow10NPlusPow10MinusN.d.ts.map +1 -1
- package/lib/exercises/math/calcul/rounding/estimatePow10NPlusPow10MinusN.js +0 -1
- package/lib/exercises/math/calcul/rounding/getPhysicalOrderOfMagnitude.d.ts.map +1 -1
- package/lib/exercises/math/calcul/rounding/getPhysicalOrderOfMagnitude.js +28 -14
- package/lib/exercises/math/calcul/sign/signFromAx.d.ts.map +1 -1
- package/lib/exercises/math/calcul/sign/signFromAx.js +0 -10
- package/lib/exercises/math/calculLitteral/equation/equationFromProblem.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equationFromProblem.js +63 -24
- package/lib/exercises/math/calculLitteral/inequations/isInequalityTrue.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/inequations/isInequalityTrue.js +0 -10
- package/lib/exercises/math/calculLitteral/isolate/isolateUInInvXPlusInvYEqualsInvU.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/isolate/isolateUInInvXPlusInvYEqualsInvU.js +6 -27
- package/lib/exercises/math/calculLitteral/ordering/compareAMinusB.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/ordering/compareAMinusB.js +41 -39
- package/lib/exercises/math/calculLitteral/ordering/compareFromPiMinusFrac.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/ordering/compareFromPiMinusFrac.js +1 -2
- package/lib/exercises/math/calculLitteral/simplifying/valuateExpression.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/simplifying/valuateExpression.js +0 -10
- package/lib/exercises/math/calculLitteral/writing/writeLitExpFromFrenchExp.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/writing/writeLitExpFromFrenchExp.js +68 -23
- package/lib/exercises/math/conversion/kmPerMinToKmPerHourConversion.d.ts +4 -1
- package/lib/exercises/math/conversion/kmPerMinToKmPerHourConversion.d.ts.map +1 -1
- package/lib/exercises/math/conversion/kmPerMinToKmPerHourConversion.js +52 -35
- package/lib/exercises/math/conversion/minutesToHours.d.ts.map +1 -1
- package/lib/exercises/math/conversion/minutesToHours.js +0 -1
- package/lib/exercises/math/conversion/prefixToNumber.d.ts.map +1 -1
- package/lib/exercises/math/conversion/prefixToNumber.js +14 -4
- package/lib/exercises/math/conversion/secondsToHours.d.ts.map +1 -1
- package/lib/exercises/math/conversion/secondsToHours.js +1 -2
- package/lib/exercises/math/dataRepresentations/barChartInterpreting.d.ts +5 -2
- package/lib/exercises/math/dataRepresentations/barChartInterpreting.d.ts.map +1 -1
- package/lib/exercises/math/dataRepresentations/barChartInterpreting.js +47 -31
- package/lib/exercises/math/dataRepresentations/cartesianGraphExtremaReading.d.ts.map +1 -1
- package/lib/exercises/math/dataRepresentations/cartesianGraphExtremaReading.js +5 -4
- package/lib/exercises/math/dataRepresentations/compareBoxPlot.d.ts.map +1 -1
- package/lib/exercises/math/dataRepresentations/compareBoxPlot.js +0 -1
- package/lib/exercises/math/dataRepresentations/dataToGraphGraphToData.js +4 -4
- package/lib/exercises/math/dataRepresentations/graphReading.js +13 -13
- package/lib/exercises/math/dataRepresentations/histogramReading.d.ts.map +1 -1
- package/lib/exercises/math/dataRepresentations/histogramReading.js +32 -32
- package/lib/exercises/math/dataRepresentations/plausibleGraph.d.ts.map +1 -1
- package/lib/exercises/math/dataRepresentations/plausibleGraph.js +53 -4
- package/lib/exercises/math/derivation/convexity/convexityQuadrinomials.d.ts.map +1 -1
- package/lib/exercises/math/derivation/convexity/convexityQuadrinomials.js +0 -1
- package/lib/exercises/math/equaDiff/equaDiffCheckSolutionFirstOrder.d.ts.map +1 -1
- package/lib/exercises/math/equaDiff/equaDiffCheckSolutionFirstOrder.js +0 -4
- package/lib/exercises/math/functions/affines/affineAdjustmentComplete.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/affineAdjustmentComplete.js +0 -1
- package/lib/exercises/math/functions/affines/coordsOfPointOnAffineFindX.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/coordsOfPointOnAffineFindX.js +17 -4
- package/lib/exercises/math/functions/affines/coordsOfPointOnAffineFindY.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/coordsOfPointOnAffineFindY.js +27 -10
- package/lib/exercises/math/functions/affines/drawAffineFromProgCalc.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/drawAffineFromProgCalc.js +33 -16
- package/lib/exercises/math/functions/affines/recognizeAffineGraph.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/recognizeAffineGraph.js +0 -4
- package/lib/exercises/math/functions/affines/representationOfAffine.d.ts +3 -0
- package/lib/exercises/math/functions/affines/representationOfAffine.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/representationOfAffine.js +121 -30
- package/lib/exercises/math/functions/basics/coordsOfPointOnCurveFindY.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/coordsOfPointOnCurveFindY.js +29 -11
- package/lib/exercises/math/functions/basics/isPointOnFunction.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/isPointOnFunction.js +0 -10
- package/lib/exercises/math/functions/basics/signOfFunction.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/signOfFunction.js +0 -10
- package/lib/exercises/math/functions/composition/functionComposition.d.ts.map +1 -1
- package/lib/exercises/math/functions/composition/functionComposition.js +2 -2
- package/lib/exercises/math/functions/cube/isPointOnCubicFunction.d.ts.map +1 -1
- package/lib/exercises/math/functions/cube/isPointOnCubicFunction.js +0 -10
- package/lib/exercises/math/functions/exponentials/exponentialsVariations.d.ts.map +1 -1
- package/lib/exercises/math/functions/exponentials/exponentialsVariations.js +0 -4
- package/lib/exercises/math/functions/inverse/compareInverseValues.d.ts.map +1 -1
- package/lib/exercises/math/functions/inverse/compareInverseValues.js +0 -1
- package/lib/exercises/math/functions/inverse/isPointOnReciprocalFunction.d.ts.map +1 -1
- package/lib/exercises/math/functions/inverse/isPointOnReciprocalFunction.js +0 -10
- package/lib/exercises/math/functions/parity/parityFromAlgebra.d.ts.map +1 -1
- package/lib/exercises/math/functions/parity/parityFromAlgebra.js +0 -4
- package/lib/exercises/math/functions/square/compareSquaredValues.d.ts.map +1 -1
- package/lib/exercises/math/functions/square/compareSquaredValues.js +0 -10
- package/lib/exercises/math/geometry/convexity/convexityTrinomialsGeo.d.ts.map +1 -1
- package/lib/exercises/math/geometry/convexity/convexityTrinomialsGeo.js +0 -4
- package/lib/exercises/math/geometry/euclidian/pythagoreOrThales.d.ts.map +1 -1
- package/lib/exercises/math/geometry/euclidian/pythagoreOrThales.js +0 -4
- package/lib/exercises/math/geometry/lines/isPointOnCartesianLine.d.ts.map +1 -1
- package/lib/exercises/math/geometry/lines/isPointOnCartesianLine.js +0 -4
- package/lib/exercises/math/geometry/lines/isPointOnLine.d.ts.map +1 -1
- package/lib/exercises/math/geometry/lines/isPointOnLine.js +0 -4
- package/lib/exercises/math/geometry/lines/linesRelativePositions.d.ts.map +1 -1
- package/lib/exercises/math/geometry/lines/linesRelativePositions.js +0 -4
- package/lib/exercises/math/geometry/parametric/pointFromParametricLine.d.ts.map +1 -1
- package/lib/exercises/math/geometry/parametric/pointFromParametricLine.js +0 -4
- package/lib/exercises/math/geometry/pythagore/isTriangleRight.d.ts.map +1 -1
- package/lib/exercises/math/geometry/pythagore/isTriangleRight.js +0 -4
- package/lib/exercises/math/geometry/quadrilaterals/parallelogramRectangle.d.ts.map +1 -1
- package/lib/exercises/math/geometry/quadrilaterals/parallelogramRectangle.js +0 -4
- package/lib/exercises/math/geometry/quadrilaterals/parallelogramRhombus.d.ts.map +1 -1
- package/lib/exercises/math/geometry/quadrilaterals/parallelogramRhombus.js +0 -4
- package/lib/exercises/math/geometry/quadrilaterals/quadrilateralRecognition.d.ts.map +1 -1
- package/lib/exercises/math/geometry/quadrilaterals/quadrilateralRecognition.js +0 -4
- package/lib/exercises/math/geometry/shapes/basicShapesRecognition.d.ts.map +1 -1
- package/lib/exercises/math/geometry/shapes/basicShapesRecognition.js +6 -7
- package/lib/exercises/math/geometry/vectors/colinearity/colinearityFromBasis.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/colinearity/colinearityFromBasis.js +0 -10
- package/lib/exercises/math/geometry/vectors/colinearity/colinearityFromPicture.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/colinearity/colinearityFromPicture.js +0 -10
- package/lib/exercises/math/geometry/vectors/equalCaracteristicFromGraph.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/equalCaracteristicFromGraph.js +0 -4
- package/lib/exercises/math/percent/evolutions/findRightCalculForPriceEvolution.d.ts.map +1 -1
- package/lib/exercises/math/percent/evolutions/findRightCalculForPriceEvolution.js +0 -4
- package/lib/exercises/math/probaStat/basicProbas/mostLeastProbable.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/basicProbas/mostLeastProbable.js +0 -10
- package/lib/exercises/math/probaStat/basicProbas/possibleValuesForProba.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/basicProbas/possibleValuesForProba.js +24 -9
- package/lib/exercises/math/probaStat/checkEquiprobability.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/checkEquiprobability.js +0 -10
- package/lib/exercises/math/probaStat/conditionalProbaWriteFromFrench.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/conditionalProbaWriteFromFrench.js +9 -6
- package/lib/exercises/math/probaStat/events/describeEvent.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/events/describeEvent.js +0 -10
- package/lib/exercises/math/probaStat/events/eventNotation.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/events/eventNotation.js +0 -10
- package/lib/exercises/math/probaStat/probaAsSumOfProbas.d.ts +0 -1
- package/lib/exercises/math/probaStat/probaAsSumOfProbas.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/probaAsSumOfProbas.js +13 -14
- package/lib/exercises/math/probaStat/stats1var/compareSeriesDispersion.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/compareSeriesDispersion.js +0 -4
- package/lib/exercises/math/probaStat/stats1var/getQuartileProportionQuestion.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/getQuartileProportionQuestion.js +0 -10
- package/lib/exercises/math/probaStat/stats1var/interpretIndicatorsForLists.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/interpretIndicatorsForLists.js +2 -3
- package/lib/exercises/math/probaStat/stats1var/plausibilityOfAverage.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/plausibilityOfAverage.js +26 -25
- package/lib/exercises/math/probaStat/stats2var/fineAdjustementExercise.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats2var/fineAdjustementExercise.js +0 -4
- package/lib/exercises/math/python/pythonForLoopInstructionCompletion.d.ts.map +1 -1
- package/lib/exercises/math/python/pythonForLoopInstructionCompletion.js +0 -10
- package/lib/exercises/math/python/pythonIfStatementCompletion.d.ts.map +1 -1
- package/lib/exercises/math/python/pythonIfStatementCompletion.js +7 -8
- package/lib/exercises/math/python/pythonSimpleFunctionInstructionCompletion.d.ts.map +1 -1
- package/lib/exercises/math/python/pythonSimpleFunctionInstructionCompletion.js +0 -10
- package/lib/exercises/math/python/pythonWhileStatementCompletion.d.ts.map +1 -1
- package/lib/exercises/math/python/pythonWhileStatementCompletion.js +5 -6
- package/lib/exercises/math/python/pythonWhileStatementOperationCompletion.d.ts.map +1 -1
- package/lib/exercises/math/python/pythonWhileStatementOperationCompletion.js +5 -6
- package/lib/exercises/math/python/variableType.d.ts.map +1 -1
- package/lib/exercises/math/python/variableType.js +0 -10
- package/lib/exercises/math/sampling/isSamplingRepresentative.d.ts.map +1 -1
- package/lib/exercises/math/sampling/isSamplingRepresentative.js +0 -4
- package/lib/exercises/math/sequences/arithmetic/recognizeArithmeticFromFirstTerms.d.ts.map +1 -1
- package/lib/exercises/math/sequences/arithmetic/recognizeArithmeticFromFirstTerms.js +0 -4
- package/lib/exercises/math/sequences/arithmetic/recognizeArithmeticFromGraph.d.ts.map +1 -1
- package/lib/exercises/math/sequences/arithmetic/recognizeArithmeticFromGraph.js +0 -4
- package/lib/exercises/math/sequences/geometric/geometricVariations.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/geometricVariations.js +0 -4
- package/lib/exercises/math/sets/intervals/isNumberInInterval.d.ts.map +1 -1
- package/lib/exercises/math/sets/intervals/isNumberInInterval.js +0 -10
- package/lib/exercises/math/sets/isNumberDecimal.d.ts.map +1 -1
- package/lib/exercises/math/sets/isNumberDecimal.js +0 -10
- package/lib/exercises/math/sets/nameOfNumberSets.d.ts.map +1 -1
- package/lib/exercises/math/sets/nameOfNumberSets.js +0 -10
- package/lib/exercises/pc/chemicalElements/atomicStructureOfNucleus.d.ts.map +1 -1
- package/lib/exercises/pc/chemicalElements/atomicStructureOfNucleus.js +0 -1
- package/lib/exercises/pc/chemicalElements/identifyRightElectronicConfiguration.d.ts.map +1 -1
- package/lib/exercises/pc/chemicalElements/identifyRightElectronicConfiguration.js +0 -4
- package/lib/exercises/pc/chemicalReactions/identifyLimitingReagent.d.ts.map +1 -1
- package/lib/exercises/pc/chemicalReactions/identifyLimitingReagent.js +0 -4
- package/lib/exercises/pc/chemicalReactions/identifyStoichiometricMixture.d.ts.map +1 -1
- package/lib/exercises/pc/chemicalReactions/identifyStoichiometricMixture.js +0 -4
- package/lib/exercises/pc/chemicalReactions/stoichiometricReaction.d.ts.map +1 -1
- package/lib/exercises/pc/chemicalReactions/stoichiometricReaction.js +0 -4
- package/lib/exercises/pc/electricity/ohmicConductorOrGenerator.d.ts.map +1 -1
- package/lib/exercises/pc/electricity/ohmicConductorOrGenerator.js +0 -4
- package/lib/exercises/pc/moleculeNomenclature.d.ts.map +1 -1
- package/lib/exercises/pc/moleculeNomenclature.js +0 -4
- package/lib/exercises/pc/motion/motionReference.d.ts.map +1 -1
- package/lib/exercises/pc/motion/motionReference.js +0 -4
- package/lib/exercises/pc/motion/typeOfAcceleration.d.ts.map +1 -1
- package/lib/exercises/pc/motion/typeOfAcceleration.js +0 -4
- package/lib/exercises/pc/sound/frequencyComparison.d.ts.map +1 -1
- package/lib/exercises/pc/sound/frequencyComparison.js +0 -4
- package/lib/index.d.ts +10 -5
- package/lib/index.d.ts.map +1 -1
- package/lib/math/progCalc/progCalc.d.ts +3 -3
- package/lib/math/progCalc/progCalc.d.ts.map +1 -1
- package/lib/math/progCalc/progCalc.js +13 -3
- package/lib/tests/exoTest.d.ts.map +1 -1
- package/lib/tests/exoTest.js +7 -0
- package/lib/tests/questionTest.d.ts.map +1 -1
- package/lib/tests/questionTest.js +3 -2
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isMultipleOrDivisor.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/arithmetics/isMultipleOrDivisor.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"isMultipleOrDivisor.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/arithmetics/isMultipleOrDivisor.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAK7C,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,eAAe,CAAC;IACnB,CAAC,EAAE,eAAe,CAAC;CACpB,CAAC;AAyGF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAiBrD,CAAC"}
|
|
@@ -6,7 +6,6 @@ import { reifyAlgebraic, } from "../../../../tree/nodes/nodeConstructor.js";
|
|
|
6
6
|
import { DivideNode } from "../../../../tree/nodes/operators/divideNode.js";
|
|
7
7
|
import { coinFlip } from "../../../../utils/alea/coinFlip.js";
|
|
8
8
|
import { random } from "../../../../utils/alea/random.js";
|
|
9
|
-
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
10
9
|
function isMultiple(a, b) {
|
|
11
10
|
return a !== 0 && b % a === 0;
|
|
12
11
|
}
|
|
@@ -66,14 +65,6 @@ $$`;
|
|
|
66
65
|
const getKeys = () => {
|
|
67
66
|
return [];
|
|
68
67
|
};
|
|
69
|
-
const isAnswerValid = () => {
|
|
70
|
-
try {
|
|
71
|
-
throw Error("VEA not implemented");
|
|
72
|
-
}
|
|
73
|
-
catch (err) {
|
|
74
|
-
return handleVEAError(err);
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
68
|
const getIsMultipleOrDivisorQuestion = () => {
|
|
78
69
|
const isMultiple = coinFlip();
|
|
79
70
|
const a = randint(10, 100);
|
|
@@ -105,7 +96,6 @@ export const isMultipleOrDivisor = {
|
|
|
105
96
|
qcmTimer: 60,
|
|
106
97
|
freeTimer: 60,
|
|
107
98
|
getPropositions,
|
|
108
|
-
isAnswerValid,
|
|
109
99
|
subject: "Mathématiques",
|
|
110
100
|
getInstruction,
|
|
111
101
|
getHint,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mentalProgramSolve.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/mentalCaluls/mentalProgramSolve.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"mentalProgramSolve.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/mentalCaluls/mentalProgramSolve.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAG7C,OAAO,EAGL,mBAAmB,EACpB,MAAM,iCAAiC,CAAC;AAgCzC,KAAK,WAAW,GAAG;IACjB,qBAAqB,EAAE,eAAe,CAAC;IACvC,WAAW,EAAE,mBAAmB,CAAC;CAClC,CAAC;AAkNF,KAAK,OAAO,GAAG;IACb,UAAU,EAAE,QAAQ,GAAG,SAAS,CAAC;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAiCF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAyB7D,CAAC"}
|
|
@@ -2,22 +2,27 @@ import { addValidProp, shuffleProps, GeneratorOptionTarget, GeneratorOptionType,
|
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
4
4
|
import { NodeConstructor, } from "../../../../tree/nodes/nodeConstructor.js";
|
|
5
|
-
import { randomMany } from "../../../../utils/alea/random.js";
|
|
6
5
|
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
7
6
|
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
8
|
-
import { ProgCalcConstructor, } from "../../../../math/progCalc/progCalc.js";
|
|
9
|
-
import {
|
|
7
|
+
import { ProgCalc, ProgCalcConstructor, } from "../../../../math/progCalc/progCalc.js";
|
|
8
|
+
import { isAddNode } from "../../../../tree/nodes/operators/addNode.js";
|
|
10
9
|
import { abs } from "../../../../tree/nodes/functions/absNode.js";
|
|
10
|
+
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
11
|
+
import { isOppositeNode } from "../../../../tree/nodes/functions/oppositeNode.js";
|
|
12
|
+
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
11
13
|
const getStrSolvingStep = (nodeStep) => {
|
|
12
14
|
//write 10 + (-8) instead of 10 - 8
|
|
13
15
|
function isNegative(node) {
|
|
14
16
|
return !abs(node).simplify().equals(node.simplify());
|
|
15
17
|
}
|
|
16
|
-
if (nodeStep
|
|
18
|
+
if (isAddNode(nodeStep) && isNegative(nodeStep.rightChild)) {
|
|
17
19
|
return `${nodeStep.leftChild.toTex()} + (${nodeStep.rightChild.toTex()}) = ${nodeStep
|
|
18
20
|
.simplify()
|
|
19
21
|
.toTex()}`;
|
|
20
22
|
}
|
|
23
|
+
else if (isOppositeNode(nodeStep)) {
|
|
24
|
+
return `-(${nodeStep.child.toTex()}) = ${nodeStep.simplify().toTex()}`;
|
|
25
|
+
}
|
|
21
26
|
else {
|
|
22
27
|
const texL = nodeStep.toTex({
|
|
23
28
|
allowDoubleMinus: true,
|
|
@@ -30,52 +35,72 @@ const getStrSolvingStep = (nodeStep) => {
|
|
|
30
35
|
return `${texL} = ${texR}`;
|
|
31
36
|
}
|
|
32
37
|
};
|
|
33
|
-
const getPropositions = (n, { answer }) => {
|
|
38
|
+
const getPropositions = (n, { answer, progCalcIds, nodeIdsStartingNumber }) => {
|
|
34
39
|
const propositions = [];
|
|
35
40
|
addValidProp(propositions, answer);
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
const nodeStartingNumber = NodeConstructor.fromIdentifiers(nodeIdsStartingNumber);
|
|
42
|
+
const progCalc = ProgCalcConstructor.fromIdentifiers(progCalcIds);
|
|
43
|
+
const nodeFinalNumber = progCalc.apply(nodeStartingNumber).simplify();
|
|
44
|
+
//applies progCalc to finalNumber
|
|
45
|
+
const node1 = progCalc.apply(nodeFinalNumber);
|
|
46
|
+
if (node1) {
|
|
47
|
+
tryToAddWrongProp(propositions, node1.simplify().toTex());
|
|
42
48
|
}
|
|
49
|
+
//applies progCalc operations in reverse to finalNumber
|
|
50
|
+
const progCalcReversed = new ProgCalc(progCalc.operations.toReversed());
|
|
51
|
+
const node2 = progCalcReversed.apply(nodeFinalNumber);
|
|
52
|
+
if (node2) {
|
|
53
|
+
tryToAddWrongProp(propositions, node2.simplify().toTex());
|
|
54
|
+
}
|
|
55
|
+
//stops at intermediary step (stops before goal)
|
|
56
|
+
const progCalcInverse = progCalc.getInverseProgCalc();
|
|
57
|
+
const inverseOperations = progCalcInverse.operations;
|
|
58
|
+
const arrStepNodes = [nodeFinalNumber];
|
|
59
|
+
for (let i = 0; i < inverseOperations.length - 1; i++) {
|
|
60
|
+
const nodePrevious = arrStepNodes[arrStepNodes.length - 1].simplify();
|
|
61
|
+
const operation = inverseOperations[i];
|
|
62
|
+
const nodeStep = operation.func(nodePrevious);
|
|
63
|
+
if (nodeStep) {
|
|
64
|
+
arrStepNodes.push(nodeStep);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
shuffle(arrStepNodes).forEach((nodeStep) => {
|
|
71
|
+
if (propositions.length < n) {
|
|
72
|
+
tryToAddWrongProp(propositions, nodeStep.simplify().toTex());
|
|
73
|
+
}
|
|
74
|
+
});
|
|
43
75
|
return shuffleProps(propositions, n);
|
|
44
76
|
};
|
|
45
|
-
const
|
|
77
|
+
const getAnswerNode = (identifiers) => {
|
|
46
78
|
const { nodeIdsStartingNumber } = identifiers;
|
|
47
|
-
|
|
48
|
-
|
|
79
|
+
return NodeConstructor.fromIdentifiers(nodeIdsStartingNumber);
|
|
80
|
+
};
|
|
81
|
+
const getAnswer = (identifiers) => {
|
|
82
|
+
return getAnswerNode(identifiers).toTex();
|
|
49
83
|
};
|
|
50
84
|
const getInstruction = (identifiers, opts) => {
|
|
51
85
|
const { nodeIdsStartingNumber, progCalcIds } = identifiers;
|
|
52
86
|
const nodeStartingNumber = NodeConstructor.fromIdentifiers(nodeIdsStartingNumber);
|
|
53
87
|
const progCalc = ProgCalcConstructor.fromIdentifiers(progCalcIds);
|
|
54
88
|
const nodeFinalNumber = progCalc.apply(nodeStartingNumber).simplify();
|
|
55
|
-
const
|
|
56
|
-
const strChooseANumber = `Choisir un nombre
|
|
57
|
-
|
|
58
|
-
`;
|
|
59
|
-
const arrStrProgCalc = progCalc.getArrOfFrenchStrings().map((str) => `
|
|
60
|
-
|
|
61
|
-
${str}`);
|
|
62
|
-
const strProgCalc = arrStrProgCalc.reduce((acc, str) => acc + str);
|
|
63
|
-
const strFinalNumber = opts?.numberType == "Integer"
|
|
89
|
+
const strFinalNumber = opts?.numberType == "Entier"
|
|
64
90
|
? nodeFinalNumber.evaluate().frenchify()
|
|
65
91
|
: nodeFinalNumber
|
|
66
92
|
.evaluate()
|
|
67
93
|
.toFixed(opts?.nbDigits ?? 0)
|
|
68
94
|
.replace(".", ",");
|
|
69
|
-
|
|
70
|
-
return `
|
|
71
|
-
${strOpening}
|
|
95
|
+
return `Voici un programme de calcul :
|
|
72
96
|
|
|
73
|
-
|
|
97
|
+
> Choisir un nombre
|
|
74
98
|
|
|
75
|
-
${
|
|
99
|
+
${progCalc.getArrOfFrenchStrings().map((str) => `> ${str}`).join(`
|
|
100
|
+
|
|
101
|
+
`)}
|
|
76
102
|
|
|
77
|
-
${
|
|
78
|
-
`;
|
|
103
|
+
Quel nombre faut-il choisir au départ pour obtenir $ ${strFinalNumber} $ à la fin ?`;
|
|
79
104
|
};
|
|
80
105
|
const getHint = () => {
|
|
81
106
|
return `Pars du résultat obtenu à la fin et remonte à l'envers en inversant chaque étape.`;
|
|
@@ -106,12 +131,10 @@ const getCorrection = (identifiers) => {
|
|
|
106
131
|
return `
|
|
107
132
|
On part de la fin et on remonte à l'envers en inversant chaque étape.
|
|
108
133
|
|
|
109
|
-
${arrStrSolvingSteps.map((str) =>
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
$$
|
|
114
|
-
`)}
|
|
134
|
+
${alignTex(arrStrSolvingSteps.map((str) => {
|
|
135
|
+
const [lhs, rhs] = str.split("=");
|
|
136
|
+
return [lhs, "=", rhs];
|
|
137
|
+
}))}
|
|
115
138
|
|
|
116
139
|
Le nombre choisi au départ était donc $ ${nodeStartingNumber.toTex()} $.`;
|
|
117
140
|
};
|
|
@@ -131,12 +154,13 @@ const getMentalProgramSolveQuestion = (optsIn) => {
|
|
|
131
154
|
const opts = optsIn ? Object.assign(optsDefault, optsIn) : optsDefault;
|
|
132
155
|
let nbDigits = 0;
|
|
133
156
|
switch (opts.numberType) {
|
|
134
|
-
case "
|
|
135
|
-
nbDigits = 0;
|
|
136
|
-
break;
|
|
137
|
-
case "Decimal":
|
|
157
|
+
case "Décimal":
|
|
138
158
|
nbDigits = opts.nbDigits ?? 2;
|
|
139
159
|
break;
|
|
160
|
+
default:
|
|
161
|
+
case "Entier":
|
|
162
|
+
nbDigits = 0;
|
|
163
|
+
break;
|
|
140
164
|
}
|
|
141
165
|
const powerOf10 = Math.pow(10, nbDigits);
|
|
142
166
|
const valueStart = randint(0, 33 * powerOf10, []) / powerOf10;
|
|
@@ -161,7 +185,7 @@ const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
|
161
185
|
};
|
|
162
186
|
};
|
|
163
187
|
const optsDefault = {
|
|
164
|
-
numberType: "
|
|
188
|
+
numberType: "Entier",
|
|
165
189
|
nbSteps: 4,
|
|
166
190
|
nbDigits: 0,
|
|
167
191
|
};
|
|
@@ -170,7 +194,7 @@ const options = [
|
|
|
170
194
|
id: "numberType",
|
|
171
195
|
label: "Type de nombres utilisés",
|
|
172
196
|
defaultValue: optsDefault.numberType,
|
|
173
|
-
values: ["
|
|
197
|
+
values: ["Entier", "Décimal"],
|
|
174
198
|
target: GeneratorOptionTarget.generation,
|
|
175
199
|
type: GeneratorOptionType.select,
|
|
176
200
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expressionNature.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/operations/expressionNature.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"expressionNature.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/operations/expressionNature.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAO7C,KAAK,WAAW,GAAG;IAAE,OAAO,EAAE,eAAe,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAuM/E,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAclD,CAAC"}
|
|
@@ -173,9 +173,6 @@ const getPropositions = (n, { answer }) => {
|
|
|
173
173
|
tryToAddWrongProp(propositions, "un quotient", "raw");
|
|
174
174
|
return shuffleProps(propositions, n);
|
|
175
175
|
};
|
|
176
|
-
const isAnswerValid = (ans, { answer }) => {
|
|
177
|
-
return ans === answer;
|
|
178
|
-
};
|
|
179
176
|
export const expressionNature = {
|
|
180
177
|
id: "expressionNature",
|
|
181
178
|
connector: "=",
|
|
@@ -185,7 +182,6 @@ export const expressionNature = {
|
|
|
185
182
|
qcmTimer: 60,
|
|
186
183
|
freeTimer: 60,
|
|
187
184
|
getPropositions,
|
|
188
|
-
isAnswerValid,
|
|
189
185
|
subject: "Mathématiques",
|
|
190
186
|
answerType: "QCU",
|
|
191
187
|
getQuestionFromIdentifiers,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compareA10N.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/ordering/compareA10N.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAmBrC,KAAK,IAAI,GAAG;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,IAAI,EAAE,CAAC;CACf,CAAC;AAwTF,KAAK,OAAO,GAAG;IACb,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AA0CF,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"compareA10N.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/ordering/compareA10N.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAmBrC,KAAK,IAAI,GAAG;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,IAAI,EAAE,CAAC;CACf,CAAC;AAwTF,KAAK,OAAO,GAAG;IACb,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AA0CF,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAetD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compareABUsingQuotient.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/ordering/compareABUsingQuotient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"compareABUsingQuotient.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/ordering/compareABUsingQuotient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAK7C,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,eAAe,EAAE,CAAC;CACnC,CAAC;AA+IF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAgBxD,CAAC"}
|
|
@@ -1,73 +1,10 @@
|
|
|
1
1
|
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
4
|
-
import { abs } from "../../../../tree/nodes/functions/absNode.js";
|
|
5
|
-
import { FunctionsIds, isFunctionNode, } from "../../../../tree/nodes/functions/functionNode.js";
|
|
6
|
-
import { opposite } from "../../../../tree/nodes/functions/oppositeNode.js";
|
|
7
4
|
import { sqrt } from "../../../../tree/nodes/functions/sqrtNode.js";
|
|
8
5
|
import { NodeConstructor, } from "../../../../tree/nodes/nodeConstructor.js";
|
|
9
6
|
import { add } from "../../../../tree/nodes/operators/addNode.js";
|
|
10
|
-
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
11
|
-
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
12
|
-
import { isOperatorNode, OperatorIds, } from "../../../../tree/nodes/operators/operatorNode.js";
|
|
13
|
-
import { power } from "../../../../tree/nodes/operators/powerNode.js";
|
|
14
|
-
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
15
|
-
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
16
7
|
import { coinFlip } from "../../../../utils/alea/coinFlip.js";
|
|
17
|
-
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
18
|
-
const randomOperatorReplacementDict = () => {
|
|
19
|
-
const operatorIds = [
|
|
20
|
-
OperatorIds.add,
|
|
21
|
-
OperatorIds.multiply,
|
|
22
|
-
OperatorIds.fraction,
|
|
23
|
-
];
|
|
24
|
-
return Object.fromEntries(shuffle(operatorIds).map((opId, i) => [opId, operatorIds[i]]));
|
|
25
|
-
};
|
|
26
|
-
const randomFunctionReplacementDict = () => {
|
|
27
|
-
const functionIds = [FunctionsIds.sqrt, FunctionsIds.abs];
|
|
28
|
-
return Object.fromEntries(shuffle(functionIds).map((fId, i) => [fId, functionIds[i]]));
|
|
29
|
-
};
|
|
30
|
-
const nodeByReplacingOperations = (node, operatorReplacementDict, functionReplacementDict) => {
|
|
31
|
-
if (isOperatorNode(node)) {
|
|
32
|
-
const leftChild = nodeByReplacingOperations(node.leftChild, operatorReplacementDict, functionReplacementDict);
|
|
33
|
-
const rightChild = nodeByReplacingOperations(node.rightChild, operatorReplacementDict, functionReplacementDict);
|
|
34
|
-
const targetOperatorId = operatorReplacementDict[+node.id] ?? node.id;
|
|
35
|
-
switch (+targetOperatorId) {
|
|
36
|
-
case OperatorIds.add:
|
|
37
|
-
return add(leftChild, rightChild);
|
|
38
|
-
case OperatorIds.substract:
|
|
39
|
-
return substract(leftChild, rightChild);
|
|
40
|
-
case OperatorIds.multiply:
|
|
41
|
-
return multiply(leftChild, rightChild);
|
|
42
|
-
case OperatorIds.divide:
|
|
43
|
-
case OperatorIds.fraction:
|
|
44
|
-
return frac(leftChild, rightChild);
|
|
45
|
-
case OperatorIds.power:
|
|
46
|
-
return power(leftChild, rightChild);
|
|
47
|
-
default:
|
|
48
|
-
return add(leftChild, rightChild);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
else if (isFunctionNode(node)) {
|
|
52
|
-
const child = nodeByReplacingOperations(node.child, operatorReplacementDict, functionReplacementDict);
|
|
53
|
-
const targetFunctionId = functionReplacementDict[+node.id] ?? node.id;
|
|
54
|
-
switch (+targetFunctionId) {
|
|
55
|
-
case FunctionsIds.sqrt:
|
|
56
|
-
return sqrt(child);
|
|
57
|
-
case FunctionsIds.abs:
|
|
58
|
-
return abs(child);
|
|
59
|
-
case FunctionsIds.opposite:
|
|
60
|
-
default:
|
|
61
|
-
return opposite(child);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
return node;
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
const nodeBySubstitutingX = (node, strVar) => {
|
|
69
|
-
return parseAlgebraic(node.toTex().replaceAll("{x}", `"${strVar}"`));
|
|
70
|
-
};
|
|
71
8
|
const getInstruction = (identifiers) => {
|
|
72
9
|
const { orderedNodeIds } = identifiers;
|
|
73
10
|
const [A, B] = orderedNodeIds.map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds).toTex());
|
|
@@ -84,13 +21,7 @@ $$
|
|
|
84
21
|
\\frac{${B}}{${A}} > 1
|
|
85
22
|
$$
|
|
86
23
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
$$
|
|
90
|
-
${B} <(ou >) ${A}
|
|
91
|
-
$$
|
|
92
|
-
|
|
93
|
-
par des opérations que l'on effectue à droite et à gauche de l'inégalité.`;
|
|
24
|
+
essaye d’isoler chaque expression de chaque côté de l’inégalité.`;
|
|
94
25
|
};
|
|
95
26
|
const getCorrection = (identifiers) => {
|
|
96
27
|
const { orderedNodeIds } = identifiers;
|
|
@@ -111,7 +42,7 @@ $$
|
|
|
111
42
|
const getAnswer = (identifiers) => {
|
|
112
43
|
const { orderedNodeIds } = identifiers;
|
|
113
44
|
const [A, B] = orderedNodeIds.map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds).toTex());
|
|
114
|
-
return `${B}
|
|
45
|
+
return `${B}>${A}`;
|
|
115
46
|
};
|
|
116
47
|
const isAnswerValid = (ans, { ...identifiers }) => {
|
|
117
48
|
const { orderedNodeIds } = identifiers;
|
|
@@ -156,40 +87,11 @@ const getKeys = (identifiers) => {
|
|
|
156
87
|
];
|
|
157
88
|
};
|
|
158
89
|
const getCompareABUsingQuotientQuestion = () => {
|
|
159
|
-
const nbNodes = 2;
|
|
160
90
|
const n = randint(2, 150);
|
|
161
|
-
const
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
while (!isValidNodes) {
|
|
166
|
-
const nodeInner = nodeBySubstitutingX(sqrt(add(1, "{x}")), `${n.frenchify()}`);
|
|
167
|
-
const nodes = [...Array(nbNodes).keys()].map(() => nodeBySubstitutingX(nodeByReplacingOperations(refNode, randomOperatorReplacementDict(), randomFunctionReplacementDict()), `{${nodeInner.toTex()}}`));
|
|
168
|
-
try {
|
|
169
|
-
const evaluations = nodes.map((node) => node.evaluate());
|
|
170
|
-
//discard impossible
|
|
171
|
-
if (evaluations.some((evaluation) => isNaN(evaluation) || evaluation <= 0)) {
|
|
172
|
-
isValidNodes = false;
|
|
173
|
-
continue;
|
|
174
|
-
}
|
|
175
|
-
//discard same
|
|
176
|
-
if (evaluations.some((evaluation, i) => evaluations.filter((_, j) => j !== i).includes(evaluation))) {
|
|
177
|
-
isValidNodes = false;
|
|
178
|
-
continue;
|
|
179
|
-
}
|
|
180
|
-
orderedNodesAndEvaluations = nodes
|
|
181
|
-
.map((node, i) => {
|
|
182
|
-
return { node, evaluation: evaluations[i] };
|
|
183
|
-
})
|
|
184
|
-
.toSorted(({ evaluation: evaluation1 }, { evaluation: evaluation2 }) => evaluation1 - evaluation2);
|
|
185
|
-
isValidNodes = true;
|
|
186
|
-
}
|
|
187
|
-
catch (_) {
|
|
188
|
-
continue;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
const orderedNodeIds = orderedNodesAndEvaluations.map(({ node }) => node.toIdentifiers());
|
|
192
|
-
return getQuestionFromIdentifiers({ orderedNodeIds });
|
|
91
|
+
const orderedNodesIncreasing = [add(1, sqrt(add(1, n))), add(2, sqrt(n))];
|
|
92
|
+
return getQuestionFromIdentifiers({
|
|
93
|
+
orderedNodeIds: orderedNodesIncreasing.map((node) => node.toIdentifiers()),
|
|
94
|
+
});
|
|
193
95
|
};
|
|
194
96
|
const getQuestionFromIdentifiers = (identifiers) => {
|
|
195
97
|
const question = {
|
|
@@ -216,6 +118,5 @@ export const compareABUsingQuotient = {
|
|
|
216
118
|
subject: "Mathématiques",
|
|
217
119
|
maxAllowedQuestions: 30,
|
|
218
120
|
getQuestionFromIdentifiers,
|
|
219
|
-
answerType: "QCU",
|
|
220
121
|
hasHintAndCorrection: true,
|
|
221
122
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compareFracABWithFracAPlusCBPlusC.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/ordering/compareFracABWithFracAPlusCBPlusC.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"compareFracABWithFracAPlusCBPlusC.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/ordering/compareFracABWithFracAPlusCBPlusC.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAY7C,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AA4LF,eAAO,MAAM,iCAAiC,EAAE,QAAQ,CAAC,WAAW,CAmBnE,CAAC"}
|
|
@@ -4,7 +4,7 @@ import { lcm } from "../../../../math/utils/arithmetic/lcm.js";
|
|
|
4
4
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
5
5
|
import { NodeConstructor, } from "../../../../tree/nodes/nodeConstructor.js";
|
|
6
6
|
import { add } from "../../../../tree/nodes/operators/addNode.js";
|
|
7
|
-
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
7
|
+
import { frac, isFractionNode, } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
8
8
|
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
9
9
|
import { coinFlip } from "../../../../utils/alea/coinFlip.js";
|
|
10
10
|
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
@@ -19,18 +19,27 @@ const getHint = () => {
|
|
|
19
19
|
const getCorrection = (identifiers) => {
|
|
20
20
|
const { nodeIds } = identifiers;
|
|
21
21
|
const nodes = nodeIds.map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
|
|
22
|
-
const
|
|
22
|
+
const nodesSimplified = nodes.map((node) => node.simplify());
|
|
23
|
+
const [den1, den2] = nodesSimplified.map((nodeSimplified) => {
|
|
24
|
+
return isFractionNode(nodeSimplified)
|
|
25
|
+
? nodeSimplified.rightChild
|
|
26
|
+
: (1).toTree();
|
|
27
|
+
});
|
|
23
28
|
const sameDen = lcm(den1.evaluate(), den2.evaluate());
|
|
24
|
-
const nodesSameDenMult =
|
|
25
|
-
|
|
29
|
+
const nodesSameDenMult = nodesSimplified.map((node) => isFractionNode(node)
|
|
30
|
+
? frac(multiply(node.leftChild.simplify(), frac(sameDen, node.rightChild).simplify()), multiply(node.rightChild.simplify(), frac(sameDen, node.rightChild).simplify()))
|
|
31
|
+
: frac(multiply(node, sameDen), multiply(1, sameDen)));
|
|
32
|
+
const nodesSameDen = nodes.map((node) => isFractionNode(node)
|
|
33
|
+
? frac(multiply(node.leftChild.simplify(), frac(sameDen, node.rightChild)).simplify(), sameDen)
|
|
34
|
+
: frac(multiply(node, sameDen).simplify(), sameDen));
|
|
26
35
|
const answer = getAnswer(identifiers);
|
|
27
36
|
return `On a :
|
|
28
37
|
|
|
29
38
|
$$
|
|
30
|
-
${nodes[1].
|
|
39
|
+
${nodes[1].toSimplificationTex()}
|
|
31
40
|
$$
|
|
32
41
|
|
|
33
|
-
On veut donc comparer $${
|
|
42
|
+
On veut donc comparer $${nodesSimplified[0].toTex()}$ et $${nodesSimplified[1].toTex()}$.
|
|
34
43
|
|
|
35
44
|
On peut choisir $${sameDen.frenchify()}$ comme dénominateur commun.
|
|
36
45
|
|
|
@@ -39,7 +48,12 @@ ${nodes
|
|
|
39
48
|
? `
|
|
40
49
|
|
|
41
50
|
$$
|
|
42
|
-
${(i === 0 ? nodes[i] : nodes[i].simplify()).toTex()} = ${
|
|
51
|
+
${(i === 0 ? nodes[i] : nodes[i].simplify()).toTex()} = ${[
|
|
52
|
+
...new Set([
|
|
53
|
+
nodesSameDenMult[i].toTex(),
|
|
54
|
+
nodesSameDen[i].toTex(),
|
|
55
|
+
]).values(),
|
|
56
|
+
].join("=")}
|
|
43
57
|
$$`
|
|
44
58
|
: ``)
|
|
45
59
|
.join("")}
|
|
@@ -75,7 +89,7 @@ const isAnswerValid = (ans, { texAnswers }) => {
|
|
|
75
89
|
};
|
|
76
90
|
const getCompareFracABWithFracAPlusCBPlusCQuestion = () => {
|
|
77
91
|
const a = randint(1, 10);
|
|
78
|
-
const b = randint(1, 10);
|
|
92
|
+
const b = randint(1, 10, [a]);
|
|
79
93
|
const c = randint(1, 10);
|
|
80
94
|
const nodes = [frac(a, b), frac(add(a, c), add(b, c))];
|
|
81
95
|
const isOrderAsc = coinFlip();
|
|
@@ -130,6 +144,5 @@ export const compareFracABWithFracAPlusCBPlusC = {
|
|
|
130
144
|
subject: "Mathématiques",
|
|
131
145
|
maxAllowedQuestions: 30,
|
|
132
146
|
getQuestionFromIdentifiers,
|
|
133
|
-
answerType: "QCU",
|
|
134
147
|
hasHintAndCorrection: true,
|
|
135
148
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compareFracAndDec.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/ordering/compareFracAndDec.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAY7C,KAAK,OAAO,GAAG;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,aAAa,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,KAAK,aAAa,GAAG;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,eAAe,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,2BAA2B,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC3D,KAAK,EAAE,OAAO,EAAE,CAAC;CAClB,CAAC;
|
|
1
|
+
{"version":3,"file":"compareFracAndDec.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/ordering/compareFracAndDec.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAY7C,KAAK,OAAO,GAAG;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,aAAa,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,KAAK,aAAa,GAAG;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,eAAe,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,2BAA2B,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC3D,KAAK,EAAE,OAAO,EAAE,CAAC;CAClB,CAAC;AAkYF,KAAK,OAAO,GAAG;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,yBAAyB,EAAE,OAAO,CAAC;CACpC,CAAC;AA+BF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAgB5D,CAAC"}
|
|
@@ -47,7 +47,7 @@ $$
|
|
|
47
47
|
Le classement par ordre décroissant de ces trois nombres est :`;
|
|
48
48
|
};
|
|
49
49
|
const getHint = () => {
|
|
50
|
-
return `Pour comparer des nombres on peut soit les écrire sous
|
|
50
|
+
return `Pour comparer des nombres on peut soit les écrire sous forme décimale
|
|
51
51
|
|
|
52
52
|
soit les mettre au même dénominateur.`;
|
|
53
53
|
};
|
|
@@ -215,7 +215,9 @@ const getCompareFracAndDecQuestion = (optsIn) => {
|
|
|
215
215
|
const nodes = {
|
|
216
216
|
A: frac(a, 5),
|
|
217
217
|
B: frac(substract(multiply(20, a), b).simplify(), 100),
|
|
218
|
-
C: frac(add(multiply(2, a), c).simplify(), 10)
|
|
218
|
+
C: frac(add(multiply(2, a), c).simplify(), 10)
|
|
219
|
+
.evaluate()
|
|
220
|
+
.toTree(),
|
|
219
221
|
};
|
|
220
222
|
Object.keys(nodes).forEach((letter) => {
|
|
221
223
|
nodes[letter] = multiply(sign, nodes[letter]);
|
|
@@ -246,8 +248,7 @@ const getCompareFracAndDecQuestion = (optsIn) => {
|
|
|
246
248
|
return `
|
|
247
249
|
|
|
248
250
|
$$
|
|
249
|
-
${opts.isUseABC ? `${fakeName} =` : ``}
|
|
250
|
-
${dictIsInDecimalFormat[trueName]
|
|
251
|
+
${opts.isUseABC ? `${fakeName} =` : ``}${dictIsInDecimalFormat[trueName]
|
|
251
252
|
? ``
|
|
252
253
|
: (() => {
|
|
253
254
|
if (trueName === "A") {
|
|
@@ -322,7 +323,7 @@ const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
|
322
323
|
};
|
|
323
324
|
const optsDefault = {
|
|
324
325
|
isUseABC: false,
|
|
325
|
-
nbDecimalFormat:
|
|
326
|
+
nbDecimalFormat: 1,
|
|
326
327
|
isAllowingNegativeNumbers: false,
|
|
327
328
|
};
|
|
328
329
|
const options = [
|
|
@@ -338,7 +339,7 @@ const options = [
|
|
|
338
339
|
label: "Nombre d'écritures décimales",
|
|
339
340
|
target: GeneratorOptionTarget.generation,
|
|
340
341
|
type: GeneratorOptionType.select,
|
|
341
|
-
values: [
|
|
342
|
+
values: [1, 2],
|
|
342
343
|
defaultValue: optsDefault.nbDecimalFormat,
|
|
343
344
|
},
|
|
344
345
|
{
|
|
@@ -362,6 +363,5 @@ export const compareFracAndDec = {
|
|
|
362
363
|
subject: "Mathématiques",
|
|
363
364
|
maxAllowedQuestions: 30,
|
|
364
365
|
getQuestionFromIdentifiers,
|
|
365
|
-
answerType: "QCU",
|
|
366
366
|
hasHintAndCorrection: true,
|
|
367
367
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compareWithSquareRoots.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/ordering/compareWithSquareRoots.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"compareWithSquareRoots.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/ordering/compareWithSquareRoots.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AA+KF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAexD,CAAC"}
|