math-exercises 3.0.216 → 3.0.218
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/commonDivisorsList.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/commonDivisorsList.js +1 -0
- package/lib/exercises/math/calcul/fractions/fractionAndIntegerDivision.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionAndIntegerDivision.js +5 -8
- package/lib/exercises/math/calcul/fractions/fractionAndIntegerProduct.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionAndIntegerProduct.js +7 -17
- package/lib/exercises/math/calcul/fractions/fractionForbiddenValue.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionForbiddenValue.js +5 -6
- package/lib/exercises/math/calcul/fractions/fractionsDivision.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionsDivision.js +7 -17
- package/lib/exercises/math/calcul/fractions/fractionsSum.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionsSum.js +7 -22
- package/lib/exercises/math/calcul/fractions/fractionsSumFillInTheBlank.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionsSumFillInTheBlank.js +7 -19
- package/lib/exercises/math/calcul/fractions/fractionsSumsMultiplesDenominators.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionsSumsMultiplesDenominators.js +7 -22
- package/lib/exercises/math/calcul/fractions/fractionsSumsPrimeDenominators.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionsSumsPrimeDenominators.js +7 -22
- package/lib/exercises/math/calcul/fractions/fractionsSumsSameDenominators.d.ts +4 -1
- package/lib/exercises/math/calcul/fractions/fractionsSumsSameDenominators.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionsSumsSameDenominators.js +7 -23
- package/lib/exercises/math/calcul/fractions/periodicWritingToFraction.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/periodicWritingToFraction.js +3 -7
- package/lib/exercises/math/calcul/fractions/simplifyFraction.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/simplifyFraction.js +6 -7
- package/lib/exercises/math/calcul/mentalCaluls/mentalDivisions.d.ts.map +1 -1
- package/lib/exercises/math/calcul/mentalCaluls/mentalDivisions.js +3 -4
- package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplication101AndFriends.d.ts.map +1 -1
- package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplication101AndFriends.js +2 -4
- package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplication11AndFriends.d.ts.map +1 -1
- package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplication11AndFriends.js +2 -4
- package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplicationTable.d.ts.map +1 -1
- package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplicationTable.js +2 -4
- package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplications.d.ts.map +1 -1
- package/lib/exercises/math/calcul/mentalCaluls/mentalMultiplications.js +2 -4
- package/lib/exercises/math/calcul/operations/operationsPrioritiesWithoutRelative.d.ts.map +1 -1
- package/lib/exercises/math/calcul/operations/operationsPrioritiesWithoutRelative.js +3 -4
- package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivityAdd.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivityAdd.js +14 -3
- package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivitySubstract.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivitySubstract.js +14 -3
- package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivityWithCoeff.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivityWithCoeff.js +8 -5
- package/lib/exercises/math/calculLitteral/distributivity/simpleDistriXCoeff.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/distributivity/simpleDistriXCoeff.js +14 -5
- package/lib/exercises/math/calculLitteral/equation/exp/expOfFEqualsExpOfGEquation.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/exp/expOfFEqualsExpOfGEquation.js +19 -32
- package/lib/exercises/math/calculLitteral/equation/fractionEquation.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/fractionEquation.js +10 -10
- package/lib/exercises/math/calculLitteral/factorisation/factoByXK.d.ts +0 -8
- package/lib/exercises/math/calculLitteral/factorisation/factoByXK.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/factorisation/factoByXK.js +223 -190
- package/lib/exercises/math/calculLitteral/factorisation/factorizeCanonicalFormWithSqrt.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/factorisation/factorizeCanonicalFormWithSqrt.js +22 -9
- package/lib/exercises/math/calculLitteral/factorisation/index.d.ts +0 -1
- package/lib/exercises/math/calculLitteral/factorisation/index.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/factorisation/index.js +1 -1
- package/lib/exercises/math/complex/argumentFromAlgebraicComplex.d.ts.map +1 -1
- package/lib/exercises/math/complex/argumentFromAlgebraicComplex.js +10 -4
- package/lib/exercises/math/derivation/derivative/trigo/sinCosDerivativeRewriteUsingCos2PlusSin2Equals1.js +2 -2
- package/lib/exercises/math/functions/absolute/absoluteValueEquations.js +12 -12
- package/lib/exercises/math/functions/affines/adjustment/affineAdjustmentRsquared.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/adjustment/affineAdjustmentRsquared.js +10 -18
- package/lib/exercises/math/functions/affines/affineMeanValue.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/affineMeanValue.js +3 -5
- package/lib/exercises/math/functions/basics/findZeroesProductQuotient.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/findZeroesProductQuotient.js +0 -1
- package/lib/exercises/math/functions/basics/twoFunctionsEquation.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/twoFunctionsEquation.js +12 -7
- package/lib/exercises/math/functions/integral/integralExpAxPlusB.d.ts.map +1 -1
- package/lib/exercises/math/functions/integral/integralExpAxPlusB.js +19 -3
- package/lib/exercises/math/functions/logarithm/log10Simplifying.d.ts.map +1 -1
- package/lib/exercises/math/functions/logarithm/log10Simplifying.js +20 -6
- package/lib/exercises/math/functions/logarithm/logSimplifiying.d.ts.map +1 -1
- package/lib/exercises/math/functions/logarithm/logSimplifiying.js +14 -9
- package/lib/exercises/math/functions/rationalFraction/rationalFractionForbiddenValue.d.ts.map +1 -1
- package/lib/exercises/math/functions/rationalFraction/rationalFractionForbiddenValue.js +9 -6
- package/lib/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationFromCano.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationFromCano.js +12 -8
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/canonicalFromDevForm.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/canonicalFromDevForm.js +21 -4
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/extremumFromCanonicalForm.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/extremumFromCanonicalForm.js +4 -7
- package/lib/exercises/math/functions/trinoms/trinomialMeanValue.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/trinomialMeanValue.js +3 -5
- package/lib/exercises/math/geometry/areas/circleArea.d.ts.map +1 -1
- package/lib/exercises/math/geometry/areas/circleArea.js +4 -2
- package/lib/exercises/math/geometry/areas/rectangleArea.d.ts.map +1 -1
- package/lib/exercises/math/geometry/areas/rectangleArea.js +4 -2
- package/lib/exercises/math/geometry/areas/rightTriangleArea.d.ts.map +1 -1
- package/lib/exercises/math/geometry/areas/rightTriangleArea.js +14 -11
- package/lib/exercises/math/geometry/areas/squareArea.d.ts.map +1 -1
- package/lib/exercises/math/geometry/areas/squareArea.js +4 -2
- package/lib/exercises/math/geometry/areas/squareSideFromArea.d.ts.map +1 -1
- package/lib/exercises/math/geometry/areas/squareSideFromArea.js +6 -4
- package/lib/exercises/math/geometry/areas/triangleArea.d.ts.map +1 -1
- package/lib/exercises/math/geometry/areas/triangleArea.js +3 -1
- package/lib/exercises/math/geometry/areas/triangleAreaV2.d.ts.map +1 -1
- package/lib/exercises/math/geometry/areas/triangleAreaV2.js +4 -2
- package/lib/exercises/math/geometry/cartesian/midpoint.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/midpoint.js +6 -11
- package/lib/exercises/math/geometry/perimeters/rectangleSideFromPerimeter.d.ts.map +1 -1
- package/lib/exercises/math/geometry/perimeters/rectangleSideFromPerimeter.js +3 -3
- package/lib/exercises/math/geometry/perimeters/squareSideFromPerimeter.d.ts.map +1 -1
- package/lib/exercises/math/geometry/perimeters/squareSideFromPerimeter.js +3 -3
- package/lib/exercises/math/geometry/vectors/vectorNormCalculation.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/vectorNormCalculation.js +3 -5
- package/lib/exercises/math/geometry/volumes/parallelepipedVolume.d.ts.map +1 -1
- package/lib/exercises/math/geometry/volumes/parallelepipedVolume.js +3 -4
- package/lib/exercises/math/geometry/volumes/sphereVolume.d.ts.map +1 -1
- package/lib/exercises/math/geometry/volumes/sphereVolume.js +3 -4
- package/lib/exercises/math/geometry/volumes/volumeOfCube.d.ts.map +1 -1
- package/lib/exercises/math/geometry/volumes/volumeOfCube.js +3 -4
- package/lib/exercises/math/geometry/volumes/volumeOfPyramidWithTriangleBase.d.ts.map +1 -1
- package/lib/exercises/math/geometry/volumes/volumeOfPyramidWithTriangleBase.js +3 -6
- package/lib/exercises/math/geometry/volumes/volumeOfPyramidWithTriangleRectBase.d.ts.map +1 -1
- package/lib/exercises/math/geometry/volumes/volumeOfPyramidWithTriangleRectBase.js +3 -6
- package/lib/exercises/math/graphs/graphsChainOrPathOfLengthN.d.ts.map +1 -1
- package/lib/exercises/math/graphs/graphsChainOrPathOfLengthN.js +3 -1
- package/lib/exercises/math/graphs/graphsCheckIsConnectedGraph.d.ts +11 -0
- package/lib/exercises/math/graphs/graphsCheckIsConnectedGraph.d.ts.map +1 -0
- package/lib/exercises/math/graphs/graphsCheckIsConnectedGraph.js +155 -0
- package/lib/exercises/math/graphs/graphsCheckIsConnectedUndirectedGraph.js +1 -1
- package/lib/exercises/math/graphs/graphsCheckIsSameGraph.d.ts +0 -2
- package/lib/exercises/math/graphs/graphsCheckIsSameGraph.d.ts.map +1 -1
- package/lib/exercises/math/graphs/graphsCheckIsSameGraph.js +4 -14
- package/lib/exercises/math/graphs/graphsCheckIsVerticesAdjacent.d.ts.map +1 -1
- package/lib/exercises/math/graphs/graphsCheckIsVerticesAdjacent.js +3 -1
- package/lib/exercises/math/graphs/graphsDegreeOfVertex.d.ts.map +1 -1
- package/lib/exercises/math/graphs/graphsDegreeOfVertex.js +3 -1
- package/lib/exercises/math/graphs/graphsOrderOfGraph.d.ts.map +1 -1
- package/lib/exercises/math/graphs/graphsOrderOfGraph.js +3 -1
- package/lib/exercises/math/graphs/index.d.ts +1 -1
- package/lib/exercises/math/graphs/index.d.ts.map +1 -1
- package/lib/exercises/math/graphs/index.js +1 -1
- package/lib/exercises/math/integration/fromExpr/integralFromExpr.d.ts.map +1 -1
- package/lib/exercises/math/integration/fromExpr/integralFromExpr.js +2 -0
- package/lib/exercises/math/limits/rationalFracLimit.d.ts.map +1 -1
- package/lib/exercises/math/limits/rationalFracLimit.js +9 -20
- package/lib/exercises/math/limits/sequences/sequenceRationalFracLimit.d.ts.map +1 -1
- package/lib/exercises/math/limits/sequences/sequenceRationalFracLimit.js +9 -20
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormula.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormula.js +11 -28
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFirstRankOne.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFirstRankOne.js +12 -27
- package/lib/exercises/math/spaceGeometry/parametricLine/lineLineRelativePositionsFromParametricLines.d.ts.map +1 -1
- package/lib/exercises/math/spaceGeometry/parametricLine/lineLineRelativePositionsFromParametricLines.js +56 -3
- package/lib/exercises/math/spaceGeometry/planes/findNormalVectorFromPlaneEquation.d.ts.map +1 -1
- package/lib/exercises/math/spaceGeometry/planes/findNormalVectorFromPlaneEquation.js +6 -0
- package/lib/exercises/math/spaceGeometry/vectors/spaceVectorNormCalculation.d.ts.map +1 -1
- package/lib/exercises/math/spaceGeometry/vectors/spaceVectorNormCalculation.js +3 -5
- package/lib/exercises/math/squareRoots/simpifySquareRoot.d.ts.map +1 -1
- package/lib/exercises/math/squareRoots/simpifySquareRoot.js +5 -4
- package/lib/exercises/math/squareRoots/squareRootEquation.d.ts.map +1 -1
- package/lib/exercises/math/squareRoots/squareRootEquation.js +9 -8
- package/lib/exercises/math/squareRoots/squareRootIdentities.d.ts.map +1 -1
- package/lib/exercises/math/squareRoots/squareRootIdentities.js +7 -4
- package/lib/exercises/math/squareRoots/squareRootsDistributivity.d.ts.map +1 -1
- package/lib/exercises/math/squareRoots/squareRootsDistributivity.js +7 -8
- package/lib/exercises/math/trigonometry/arcLength.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/arcLength.js +3 -8
- package/lib/exercises/pc/chemicalElements/findAtomEntitiesNumberFromMass.d.ts.map +1 -1
- package/lib/exercises/pc/chemicalElements/findAtomEntitiesNumberFromMass.js +0 -6
- package/lib/exercises/pc/dosage/beerLambertRandomValue.d.ts.map +1 -1
- package/lib/exercises/pc/dosage/beerLambertRandomValue.js +3 -4
- package/lib/exercises/pc/dosage/concentrationFromMassCalculation.d.ts.map +1 -1
- package/lib/exercises/pc/dosage/concentrationFromMassCalculation.js +3 -18
- package/lib/exercises/pc/energy/energyTransfer.d.ts.map +1 -1
- package/lib/exercises/pc/energy/energyTransfer.js +3 -8
- package/lib/exercises/pc/energy/thermalEnergyTransferCalculation.d.ts.map +1 -1
- package/lib/exercises/pc/energy/thermalEnergyTransferCalculation.js +3 -24
- package/lib/exercises/pc/math/proportionnalityCoeffFromLine.d.ts.map +1 -1
- package/lib/exercises/pc/math/proportionnalityCoeffFromLine.js +9 -6
- package/lib/exercises/vea/equationVEA.d.ts.map +1 -1
- package/lib/exercises/vea/equationVEA.js +2 -0
- package/lib/exercises/vea/rationalVEA.d.ts +2 -1
- package/lib/exercises/vea/rationalVEA.d.ts.map +1 -1
- package/lib/exercises/vea/rationalVEA.js +36 -2
- package/lib/exercises/vea/treeTableVEA.d.ts.map +1 -1
- package/lib/exercises/vea/treeTableVEA.js +2 -0
- package/lib/index.d.ts +3 -8
- package/lib/index.d.ts.map +1 -1
- package/lib/math/graphs/graph.d.ts +1 -1
- package/lib/math/graphs/graph.d.ts.map +1 -1
- package/lib/math/graphs/graph.js +86 -30
- package/lib/math/utils/graphs/graphRenderer.d.ts +7 -9
- package/lib/math/utils/graphs/graphRenderer.d.ts.map +1 -1
- package/lib/math/utils/graphs/graphRenderer.js +25 -117
- package/lib/tree/nodes/algebraicNode.d.ts +2 -0
- package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
- package/lib/tree/nodes/algebraicNode.js +11 -0
- package/lib/tree/nodes/functions/log10Node.d.ts +2 -2
- package/lib/tree/nodes/functions/log10Node.d.ts.map +1 -1
- package/lib/tree/nodes/functions/log10Node.js +3 -1
- package/lib/tree/nodes/functions/logNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/logNode.js +2 -0
- package/lib/tree/nodes/operators/addNode.js +1 -1
- package/lib/tree/nodes/operators/fractionNode.js +1 -1
- package/package.json +1 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commonDivisorsList.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/arithmetics/commonDivisorsList.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;
|
|
1
|
+
{"version":3,"file":"commonDivisorsList.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/arithmetics/commonDivisorsList.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA8GF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAapD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fractionAndIntegerDivision.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionAndIntegerDivision.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"fractionAndIntegerDivision.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionAndIntegerDivision.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAcrC,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,OAAO,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AA+JF,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,WAAW,CAc5D,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { addValidProp, propWhile, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { rationalVEA } from "../../../../exercises/vea/rationalVEA.js";
|
|
3
4
|
import { Integer } from "../../../../math/numbers/integer/integer.js";
|
|
4
5
|
import { Rational, RationalConstructor, } from "../../../../math/numbers/rationals/rational.js";
|
|
5
6
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
@@ -124,14 +125,10 @@ const getPropositions = (n, { answer, integerFirst, integer, rational }) => {
|
|
|
124
125
|
});
|
|
125
126
|
return shuffleProps(propositions, n);
|
|
126
127
|
};
|
|
127
|
-
const isAnswerValid = (ans, {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
? integerObj.divide(rationalObj).toTree({ allowFractionToDecimal: true })
|
|
132
|
-
: rationalObj.divide(integerObj).toTree({ allowFractionToDecimal: true });
|
|
133
|
-
const texs = answerTree.toAllValidTexs();
|
|
134
|
-
return texs.includes(ans);
|
|
128
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
129
|
+
return rationalVEA(ans, answer, {
|
|
130
|
+
allowNonIrreductible: false,
|
|
131
|
+
});
|
|
135
132
|
};
|
|
136
133
|
export const fractionAndIntegerDivision = {
|
|
137
134
|
id: "fractionAndIntegerDivision",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fractionAndIntegerProduct.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionAndIntegerProduct.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAiBrC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;
|
|
1
|
+
{"version":3,"file":"fractionAndIntegerProduct.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionAndIntegerProduct.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAiBrC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AAqIF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAepE,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { addValidProp, propWhile, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
2
|
import { allowNonIrreductibleOption } from "../../../../exercises/options/allowNonIrreductibleFractions.js";
|
|
3
3
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
4
|
+
import { rationalVEA } from "../../../../exercises/vea/rationalVEA.js";
|
|
4
5
|
import { Rational, RationalConstructor, } from "../../../../math/numbers/rationals/rational.js";
|
|
5
6
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
6
7
|
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
7
8
|
import { MultiplyNode, multiply, } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
8
|
-
import { rationalParser } from "../../../../tree/parsers/rationalParser.js";
|
|
9
9
|
import { coinFlip } from "../../../../utils/alea/coinFlip.js";
|
|
10
10
|
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
11
11
|
const options = [allowNonIrreductibleOption];
|
|
@@ -97,22 +97,12 @@ const getPropositions = (n, { answer, integer, rational }) => {
|
|
|
97
97
|
});
|
|
98
98
|
return shuffle(propositions);
|
|
99
99
|
};
|
|
100
|
-
const isAnswerValid = (ans, {
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
})
|
|
106
|
-
const texs = answerTree.toAllValidTexs({ allowFractionToDecimal: true });
|
|
107
|
-
if (opts?.allowNonIrreductible) {
|
|
108
|
-
const parsed = rationalParser(ans);
|
|
109
|
-
if (!parsed)
|
|
110
|
-
return false;
|
|
111
|
-
return texs.includes(parsed.simplify().toTex());
|
|
112
|
-
}
|
|
113
|
-
else {
|
|
114
|
-
return texs.includes(ans);
|
|
115
|
-
}
|
|
100
|
+
const isAnswerValid = (ans, { answer }, opts) => {
|
|
101
|
+
const allowNonIrr = opts?.allowNonIrreductible ?? false;
|
|
102
|
+
return rationalVEA(ans, answer, {
|
|
103
|
+
allowNonIrreductible: allowNonIrr,
|
|
104
|
+
allowDecimalApprox: false,
|
|
105
|
+
});
|
|
116
106
|
};
|
|
117
107
|
export const fractionAndIntegerProduct = {
|
|
118
108
|
id: "fractionAndIntegerProduct",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fractionForbiddenValue.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionForbiddenValue.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"fractionForbiddenValue.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionForbiddenValue.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAoGF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAcxD,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { addValidProp, propWhile, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { rationalVEA } from "../../../../exercises/vea/rationalVEA.js";
|
|
3
4
|
import { Rational } from "../../../../math/numbers/rationals/rational.js";
|
|
4
5
|
import { Affine } from "../../../../math/polynomials/affine.js";
|
|
5
6
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
@@ -81,12 +82,10 @@ const getPropositions = (n, { answer, a, b, d }) => {
|
|
|
81
82
|
});
|
|
82
83
|
return shuffle(propositions);
|
|
83
84
|
};
|
|
84
|
-
const isAnswerValid = (ans, {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
const texs = answerTree.toAllValidTexs();
|
|
89
|
-
return texs.includes(ans);
|
|
85
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
86
|
+
return rationalVEA(ans, answer, {
|
|
87
|
+
allowDecimalApprox: false,
|
|
88
|
+
});
|
|
90
89
|
};
|
|
91
90
|
export const fractionForbiddenValue = {
|
|
92
91
|
id: "fractionForbiddenValue",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fractionsDivision.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionsDivision.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;
|
|
1
|
+
{"version":3,"file":"fractionsDivision.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionsDivision.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AAmJF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAe5D,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { addValidProp, propWhile, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
2
|
import { allowNonIrreductibleOption } from "../../../../exercises/options/allowNonIrreductibleFractions.js";
|
|
3
3
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
4
|
+
import { rationalVEA } from "../../../../exercises/vea/rationalVEA.js";
|
|
4
5
|
import { Rational, RationalConstructor, } from "../../../../math/numbers/rationals/rational.js";
|
|
5
6
|
import { DivideNode } from "../../../../tree/nodes/operators/divideNode.js";
|
|
6
|
-
import { rationalParser } from "../../../../tree/parsers/rationalParser.js";
|
|
7
7
|
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
8
8
|
const options = [allowNonIrreductibleOption];
|
|
9
9
|
const getInstruction = (identifiers, opts) => {
|
|
@@ -106,22 +106,12 @@ const getPropositions = (n, { answer, rationalNum, rationalDenum }) => {
|
|
|
106
106
|
});
|
|
107
107
|
return shuffle(propositions);
|
|
108
108
|
};
|
|
109
|
-
const isAnswerValid = (ans, {
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
const texs = answerTree.toAllValidTexs();
|
|
116
|
-
if (opts?.allowNonIrreductible) {
|
|
117
|
-
const parsed = rationalParser(ans);
|
|
118
|
-
if (!parsed)
|
|
119
|
-
return false;
|
|
120
|
-
return texs.includes(parsed.simplify().toTex());
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
return texs.includes(ans);
|
|
124
|
-
}
|
|
109
|
+
const isAnswerValid = (ans, { answer }, opts) => {
|
|
110
|
+
const allowNonIrr = opts?.allowNonIrreductible ?? false;
|
|
111
|
+
return rationalVEA(ans, answer, {
|
|
112
|
+
allowNonIrreductible: allowNonIrr,
|
|
113
|
+
allowDecimalApprox: false,
|
|
114
|
+
});
|
|
125
115
|
};
|
|
126
116
|
export const fractionsDivision = {
|
|
127
117
|
id: "fractionsDivision",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fractionsSum.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionsSum.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"fractionsSum.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionsSum.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAarC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AAuRF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAevD,CAAC"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { GeneratorOptionTarget, GeneratorOptionType, addValidProp, propWhile, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { rationalVEA } from "../../../../exercises/vea/rationalVEA.js";
|
|
3
4
|
import { Rational, RationalConstructor, } from "../../../../math/numbers/rationals/rational.js";
|
|
4
5
|
import { gcd } from "../../../../math/utils/arithmetic/gcd.js";
|
|
5
6
|
import { add, AddNode } from "../../../../tree/nodes/operators/addNode.js";
|
|
6
7
|
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
7
8
|
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
8
|
-
import { rationalParser } from "../../../../tree/parsers/rationalParser.js";
|
|
9
9
|
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
10
|
-
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
11
10
|
const getInstruction = (identifiers, opts) => {
|
|
12
11
|
const { rational, rational2 } = identifiers;
|
|
13
12
|
const rationalObj = new Rational(rational[0], rational[1]);
|
|
@@ -208,26 +207,12 @@ const getPropositions = (n, { answer, rational, rational2 }) => {
|
|
|
208
207
|
});
|
|
209
208
|
return shuffle(propositions);
|
|
210
209
|
};
|
|
211
|
-
const isAnswerValid = (ans, {
|
|
212
|
-
const
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
.toTree({ allowFractionToDecimal: true });
|
|
218
|
-
const texs = answerTree.toAllValidTexs();
|
|
219
|
-
if (allow)
|
|
220
|
-
try {
|
|
221
|
-
const parsed = rationalParser(ans);
|
|
222
|
-
if (!parsed)
|
|
223
|
-
return false;
|
|
224
|
-
return texs.includes(parsed.simplify().toTex());
|
|
225
|
-
}
|
|
226
|
-
catch (err) {
|
|
227
|
-
return handleVEAError(err);
|
|
228
|
-
}
|
|
229
|
-
else
|
|
230
|
-
return texs.includes(ans);
|
|
210
|
+
const isAnswerValid = (ans, { answer }, opts) => {
|
|
211
|
+
const allowNonIrr = opts?.allowNonIrreductible ?? false;
|
|
212
|
+
return rationalVEA(ans, answer, {
|
|
213
|
+
allowNonIrreductible: allowNonIrr,
|
|
214
|
+
allowDecimalApprox: false,
|
|
215
|
+
});
|
|
231
216
|
};
|
|
232
217
|
const options = [
|
|
233
218
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fractionsSumFillInTheBlank.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionsSumFillInTheBlank.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"fractionsSumFillInTheBlank.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionsSumFillInTheBlank.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAiBrC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAiRF,KAAK,OAAO,GAAG;IACb,oBAAoB,EAAE,OAAO,CAAC;IAC9B,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAiCF,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAerE,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { addValidProp, shuffleProps, tryToAddWrongProp, GeneratorOptionTarget, GeneratorOptionType, propWhile, } from "../../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { defaultArrayedOptsWhereNeeded } from "../../../../exercises/utils/options/arrayedOptions.js";
|
|
4
|
+
import { rationalVEA } from "../../../../exercises/vea/rationalVEA.js";
|
|
4
5
|
import { RationalConstructor } from "../../../../math/numbers/rationals/rational.js";
|
|
5
6
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
6
7
|
import { EqualNode } from "../../../../tree/nodes/equations/equalNode.js";
|
|
@@ -8,9 +9,7 @@ import { add } from "../../../../tree/nodes/operators/addNode.js";
|
|
|
8
9
|
import { frac, isFractionNode, } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
9
10
|
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
10
11
|
import { VariableNode } from "../../../../tree/nodes/variables/variableNode.js";
|
|
11
|
-
import { rationalParser } from "../../../../tree/parsers/rationalParser.js";
|
|
12
12
|
import { random } from "../../../../utils/alea/random.js";
|
|
13
|
-
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
14
13
|
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
15
14
|
const getHydrated = (identifiers) => {
|
|
16
15
|
const { numSum, numOperand, denom, indexBlank } = identifiers;
|
|
@@ -146,23 +145,12 @@ const getPropositions = (n, { answer, ...identifiers }) => {
|
|
|
146
145
|
});
|
|
147
146
|
return shuffleProps(propositions, n);
|
|
148
147
|
};
|
|
149
|
-
const isAnswerValid = (ans, { answer
|
|
150
|
-
const
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
if (!parsed)
|
|
156
|
-
return false;
|
|
157
|
-
return texs.includes(parsed.simplify().toTex());
|
|
158
|
-
}
|
|
159
|
-
catch (err) {
|
|
160
|
-
return handleVEAError(err);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
else {
|
|
164
|
-
return texs.includes(ans);
|
|
165
|
-
}
|
|
148
|
+
const isAnswerValid = (ans, { answer }, opts) => {
|
|
149
|
+
const allowNonIrr = opts?.allowNonIrreductible ?? false;
|
|
150
|
+
return rationalVEA(ans, answer, {
|
|
151
|
+
allowNonIrreductible: allowNonIrr,
|
|
152
|
+
allowDecimalApprox: false,
|
|
153
|
+
});
|
|
166
154
|
};
|
|
167
155
|
const createRandomIdentifiers = (opts) => {
|
|
168
156
|
const denomSrc = parseInt(opts.denom);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fractionsSumsMultiplesDenominators.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionsSumsMultiplesDenominators.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"fractionsSumsMultiplesDenominators.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionsSumsMultiplesDenominators.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAerC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AAiJF,eAAO,MAAM,kCAAkC,EAAE,QAAQ,CACvD,WAAW,EACX,OAAO,CAmBR,CAAC"}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { addValidProp, shuffleProps, tryToAddWrongProp, GeneratorOptionTarget, GeneratorOptionType, propWhile, } from "../../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { rationalVEA } from "../../../../exercises/vea/rationalVEA.js";
|
|
3
4
|
import { Rational, RationalConstructor, } from "../../../../math/numbers/rationals/rational.js";
|
|
4
5
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
5
6
|
import { round } from "../../../../math/utils/round.js";
|
|
6
7
|
import { add, AddNode } from "../../../../tree/nodes/operators/addNode.js";
|
|
7
8
|
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
8
9
|
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
9
|
-
import { rationalParser } from "../../../../tree/parsers/rationalParser.js";
|
|
10
10
|
import { coinFlip } from "../../../../utils/alea/coinFlip.js";
|
|
11
|
-
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
12
11
|
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
13
12
|
const getInstruction = (identifiers, opts) => {
|
|
14
13
|
const { num1, num2, denom1, denom2 } = identifiers;
|
|
@@ -96,26 +95,12 @@ const getPropositions = (n, { answer, num1, num2, denom1, denom2 }) => {
|
|
|
96
95
|
});
|
|
97
96
|
return shuffleProps(propositions, n);
|
|
98
97
|
};
|
|
99
|
-
const isAnswerValid = (ans, {
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
const texs = answerTree.toAllValidTexs();
|
|
106
|
-
if (opts?.allowNonIrreductible) {
|
|
107
|
-
try {
|
|
108
|
-
const parsed = rationalParser(ans);
|
|
109
|
-
if (!parsed)
|
|
110
|
-
return false;
|
|
111
|
-
return texs.includes(parsed.simplify().toTex());
|
|
112
|
-
}
|
|
113
|
-
catch (err) {
|
|
114
|
-
return handleVEAError(err);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
else
|
|
118
|
-
return texs.includes(ans);
|
|
98
|
+
const isAnswerValid = (ans, { answer }, opts) => {
|
|
99
|
+
const allowNonIrr = opts?.allowNonIrreductible ?? false;
|
|
100
|
+
return rationalVEA(ans, answer, {
|
|
101
|
+
allowNonIrreductible: allowNonIrr,
|
|
102
|
+
allowDecimalApprox: false,
|
|
103
|
+
});
|
|
119
104
|
};
|
|
120
105
|
const options = [
|
|
121
106
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fractionsSumsPrimeDenominators.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionsSumsPrimeDenominators.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"fractionsSumsPrimeDenominators.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionsSumsPrimeDenominators.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAarC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAwKF,eAAO,MAAM,8BAA8B,EAAE,QAAQ,CAAC,WAAW,CAkBhE,CAAC"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { addValidProp, shuffleProps, tryToAddWrongProp, GeneratorOptionTarget, GeneratorOptionType, propWhile, } from "../../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { rationalVEA } from "../../../../exercises/vea/rationalVEA.js";
|
|
3
4
|
import { Rational, RationalConstructor, } from "../../../../math/numbers/rationals/rational.js";
|
|
4
5
|
import { gcd } from "../../../../math/utils/arithmetic/gcd.js";
|
|
5
6
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
6
7
|
import { add, AddNode } from "../../../../tree/nodes/operators/addNode.js";
|
|
7
8
|
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
8
9
|
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
9
|
-
import { rationalParser } from "../../../../tree/parsers/rationalParser.js";
|
|
10
|
-
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
11
10
|
const getInstruction = (identifiers, opts) => {
|
|
12
11
|
const { num1, num2, denom1, denom2 } = identifiers;
|
|
13
12
|
const ratio1 = new Rational(num1, denom1);
|
|
@@ -120,26 +119,12 @@ const getPropositions = (n, { answer, num1, denom1, denom2, num2 }) => {
|
|
|
120
119
|
});
|
|
121
120
|
return shuffleProps(propositions, n);
|
|
122
121
|
};
|
|
123
|
-
const isAnswerValid = (ans, {
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
const texs = answerTree.toAllValidTexs();
|
|
130
|
-
if (opts?.allowNonIrreductible) {
|
|
131
|
-
try {
|
|
132
|
-
const parsed = rationalParser(ans);
|
|
133
|
-
if (!parsed)
|
|
134
|
-
return false;
|
|
135
|
-
return texs.includes(parsed.simplify().toTex());
|
|
136
|
-
}
|
|
137
|
-
catch (err) {
|
|
138
|
-
return handleVEAError(err);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
else
|
|
142
|
-
return texs.includes(ans);
|
|
122
|
+
const isAnswerValid = (ans, { answer }, opts) => {
|
|
123
|
+
const allowNonIrr = opts?.allowNonIrreductible ?? false;
|
|
124
|
+
return rationalVEA(ans, answer, {
|
|
125
|
+
allowNonIrreductible: allowNonIrr,
|
|
126
|
+
allowDecimalApprox: false,
|
|
127
|
+
});
|
|
143
128
|
};
|
|
144
129
|
const options = [
|
|
145
130
|
{
|
|
@@ -4,6 +4,9 @@ type Identifiers = {
|
|
|
4
4
|
num1: number;
|
|
5
5
|
num2: number;
|
|
6
6
|
};
|
|
7
|
-
|
|
7
|
+
type Options = {
|
|
8
|
+
allowNonIrreductible?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export declare const fractionsSumsSameDenominators: Exercise<Identifiers, Options>;
|
|
8
11
|
export {};
|
|
9
12
|
//# sourceMappingURL=fractionsSumsSameDenominators.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fractionsSumsSameDenominators.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionsSumsSameDenominators.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"fractionsSumsSameDenominators.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionsSumsSameDenominators.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAerC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AA0IF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAkBxE,CAAC"}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { addValidProp, shuffleProps, tryToAddWrongProp, GeneratorOptionTarget, GeneratorOptionType, propWhile, } from "../../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { rationalVEA } from "../../../../exercises/vea/rationalVEA.js";
|
|
3
4
|
import { Rational, RationalConstructor, } from "../../../../math/numbers/rationals/rational.js";
|
|
4
5
|
import { primeFactors } from "../../../../math/utils/arithmetic/primeFactors.js";
|
|
5
6
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
6
7
|
import { AddNode } from "../../../../tree/nodes/operators/addNode.js";
|
|
7
8
|
import { FractionNode } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
8
9
|
import { MultiplyNode } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
9
|
-
import { rationalParser } from "../../../../tree/parsers/rationalParser.js";
|
|
10
10
|
import { operatorComposition } from "../../../../tree/utilities/operatorComposition.js";
|
|
11
|
-
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
12
11
|
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
13
12
|
const getInstruction = (identifiers, opts) => {
|
|
14
13
|
const { denom, num1, num2 } = identifiers;
|
|
@@ -92,27 +91,12 @@ const getPropositions = (n, { answer, denom, num1, num2 }) => {
|
|
|
92
91
|
});
|
|
93
92
|
return shuffleProps(propositions, n);
|
|
94
93
|
};
|
|
95
|
-
const isAnswerValid = (ans, {
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
const texs = answerTree.toAllValidTexs();
|
|
102
|
-
if (opts?.allowNonIrreductible) {
|
|
103
|
-
try {
|
|
104
|
-
const parsed = rationalParser(ans);
|
|
105
|
-
if (!parsed)
|
|
106
|
-
return false;
|
|
107
|
-
return texs.includes(parsed.simplify().toTex());
|
|
108
|
-
}
|
|
109
|
-
catch (err) {
|
|
110
|
-
return handleVEAError(err);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
else {
|
|
114
|
-
return texs.includes(ans);
|
|
115
|
-
}
|
|
94
|
+
const isAnswerValid = (ans, { answer }, opts) => {
|
|
95
|
+
const allowNonIrr = opts?.allowNonIrreductible ?? false;
|
|
96
|
+
return rationalVEA(ans, answer, {
|
|
97
|
+
allowNonIrreductible: allowNonIrr,
|
|
98
|
+
allowDecimalApprox: false,
|
|
99
|
+
});
|
|
116
100
|
};
|
|
117
101
|
const options = [
|
|
118
102
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"periodicWritingToFraction.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/periodicWritingToFraction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"periodicWritingToFraction.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/periodicWritingToFraction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAgGF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAa3D,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { rationalVEA } from "../../../../exercises/vea/rationalVEA.js";
|
|
3
4
|
import { Decimal, DecimalConstructor, } from "../../../../math/numbers/decimals/decimal.js";
|
|
4
5
|
import { Rational } from "../../../../math/numbers/rationals/rational.js";
|
|
5
6
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
@@ -76,13 +77,8 @@ const getPropositions = (n, { answer, num, denum, leadingPart }) => {
|
|
|
76
77
|
}
|
|
77
78
|
return shuffleProps(propositions, n);
|
|
78
79
|
};
|
|
79
|
-
const isAnswerValid = (ans, {
|
|
80
|
-
|
|
81
|
-
const answer = new Rational(num, denum * 10 ** leadingPartDec.precision)
|
|
82
|
-
.add(leadingPartDec.toRational(true))
|
|
83
|
-
.toTree();
|
|
84
|
-
const texs = answer.toAllValidTexs();
|
|
85
|
-
return texs.includes(ans);
|
|
80
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
81
|
+
return rationalVEA(ans, answer);
|
|
86
82
|
};
|
|
87
83
|
export const periodicWritingToFraction = {
|
|
88
84
|
id: "periodicWritingToFraction",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simplifyFraction.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/simplifyFraction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"simplifyFraction.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/simplifyFraction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAarC,KAAK,WAAW,GAAG;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAkGF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAclD,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { addValidProp, propWhile, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { rationalVEA } from "../../../../exercises/vea/rationalVEA.js";
|
|
3
4
|
import { Rational, RationalConstructor, } from "../../../../math/numbers/rationals/rational.js";
|
|
4
5
|
import { gcd } from "../../../../math/utils/arithmetic/gcd.js";
|
|
5
6
|
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
@@ -81,13 +82,11 @@ const getPropositions = (n, { answer }) => {
|
|
|
81
82
|
});
|
|
82
83
|
return shuffle(propositions);
|
|
83
84
|
};
|
|
84
|
-
const isAnswerValid = (ans, {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
const texs = answerTree.toAllValidTexs();
|
|
90
|
-
return texs.includes(ans);
|
|
85
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
86
|
+
return rationalVEA(ans, answer, {
|
|
87
|
+
allowNonIrreductible: false,
|
|
88
|
+
allowDecimal: false,
|
|
89
|
+
});
|
|
91
90
|
};
|
|
92
91
|
export const simplifyFraction = {
|
|
93
92
|
id: "simplifyFrac",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mentalDivisions.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/mentalCaluls/mentalDivisions.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"mentalDivisions.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/mentalCaluls/mentalDivisions.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAqHF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAYjD,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { addValidProp, propWhile, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { numberVEA } from "../../../../exercises/vea/numberVEA.js";
|
|
3
4
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
4
5
|
import { round } from "../../../../math/utils/round.js";
|
|
5
6
|
import { NumberNode } from "../../../../tree/nodes/numbers/numberNode.js";
|
|
@@ -86,10 +87,8 @@ const getPropositions = (n, { answer }) => {
|
|
|
86
87
|
});
|
|
87
88
|
return shuffle(propositions);
|
|
88
89
|
};
|
|
89
|
-
const isAnswerValid = (
|
|
90
|
-
|
|
91
|
-
const texs = answerTree.toAllValidTexs();
|
|
92
|
-
return texs.includes(studentAns);
|
|
90
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
91
|
+
return numberVEA(ans, answer);
|
|
93
92
|
};
|
|
94
93
|
export const mentalDivisions = {
|
|
95
94
|
id: "mentalDivisions",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mentalMultiplication101AndFriends.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/mentalCaluls/mentalMultiplication101AndFriends.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAQrC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;
|
|
1
|
+
{"version":3,"file":"mentalMultiplication101AndFriends.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/mentalCaluls/mentalMultiplication101AndFriends.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAQrC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAiRF,KAAK,OAAO,GAAG;IACb,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAuBF,eAAO,MAAM,iCAAiC,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAqB1E,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { GeneratorOptionTarget, GeneratorOptionType, addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { defaultArrayedOptsWhereNeeded } from "../../../../exercises/utils/options/arrayedOptions.js";
|
|
4
|
-
import {
|
|
4
|
+
import { numberVEA } from "../../../../exercises/vea/numberVEA.js";
|
|
5
5
|
import { MultiplyNode } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
6
6
|
import { operatorComposition } from "../../../../tree/utilities/operatorComposition.js";
|
|
7
7
|
import { random } from "../../../../utils/alea/random.js";
|
|
@@ -205,9 +205,7 @@ const getPropositions = (n, { answer, ...identifiers }) => {
|
|
|
205
205
|
return shuffleProps(propositions, n);
|
|
206
206
|
};
|
|
207
207
|
const isAnswerValid = (studentAns, { answer }) => {
|
|
208
|
-
|
|
209
|
-
const texs = answerTree.toAllValidTexs();
|
|
210
|
-
return texs.includes(studentAns);
|
|
208
|
+
return numberVEA(studentAns, answer);
|
|
211
209
|
};
|
|
212
210
|
const getMentalMultiplication101AndFriendsQuestion = (optsIn) => {
|
|
213
211
|
const arrayedOptions = defaultArrayedOptsWhereNeeded(optsIn, arrayedOptsDefault);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mentalMultiplication11AndFriends.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/mentalCaluls/mentalMultiplication11AndFriends.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAQrC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;
|
|
1
|
+
{"version":3,"file":"mentalMultiplication11AndFriends.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/mentalCaluls/mentalMultiplication11AndFriends.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAQrC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAiRF,KAAK,OAAO,GAAG;IACb,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAuBF,eAAO,MAAM,gCAAgC,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAqBzE,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { GeneratorOptionTarget, GeneratorOptionType, addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { defaultArrayedOptsWhereNeeded } from "../../../../exercises/utils/options/arrayedOptions.js";
|
|
4
|
-
import {
|
|
4
|
+
import { numberVEA } from "../../../../exercises/vea/numberVEA.js";
|
|
5
5
|
import { MultiplyNode } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
6
6
|
import { operatorComposition } from "../../../../tree/utilities/operatorComposition.js";
|
|
7
7
|
import { random } from "../../../../utils/alea/random.js";
|
|
@@ -205,9 +205,7 @@ const getPropositions = (n, { answer, ...identifiers }) => {
|
|
|
205
205
|
return shuffleProps(propositions, n);
|
|
206
206
|
};
|
|
207
207
|
const isAnswerValid = (studentAns, { answer }) => {
|
|
208
|
-
|
|
209
|
-
const texs = answerTree.toAllValidTexs();
|
|
210
|
-
return texs.includes(studentAns);
|
|
208
|
+
return numberVEA(studentAns, answer);
|
|
211
209
|
};
|
|
212
210
|
const getMentalMultiplication11AndFriendsQuestion = (optsIn) => {
|
|
213
211
|
const arrayedOptions = defaultArrayedOptsWhereNeeded(optsIn, arrayedOptsDefault);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mentalMultiplicationTable.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/mentalCaluls/mentalMultiplicationTable.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;
|
|
1
|
+
{"version":3,"file":"mentalMultiplicationTable.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/mentalCaluls/mentalMultiplicationTable.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAgIF,KAAK,OAAO,GAAG;IACb,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AAgCF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAiBpE,CAAC"}
|