math-exercises 3.0.217 → 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/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/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.map +1 -1
- package/lib/exercises/math/graphs/graphsCheckIsConnectedGraph.js +19 -42
- 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/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/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/index.d.ts +3 -8
- package/lib/index.d.ts.map +1 -1
- 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
|
@@ -23,7 +23,9 @@ const getHydrated = (identifiers) => {
|
|
|
23
23
|
};
|
|
24
24
|
const getInstruction = () => {
|
|
25
25
|
return `Un graphe est représenté ci-dessous.
|
|
26
|
-
Quel est son ordre
|
|
26
|
+
Quel est son ordre ?
|
|
27
|
+
|
|
28
|
+
*On peut déplacer les points sur la figure.*`;
|
|
27
29
|
};
|
|
28
30
|
const getAnswerNode = (identifiers) => {
|
|
29
31
|
const { graph } = getHydrated(identifiers);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rationalFracLimit.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/limits/rationalFracLimit.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAcrC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,UAAU,GAAG,UAAU,CAAC;IACjC,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;
|
|
1
|
+
{"version":3,"file":"rationalFracLimit.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/limits/rationalFracLimit.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAcrC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,UAAU,GAAG,UAAU,CAAC;IACjC,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AAoGF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAanD,CAAC"}
|
|
@@ -1,12 +1,13 @@
|
|
|
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 { Monom } from "../../../math/polynomials/monom.js";
|
|
5
6
|
import { Polynomial, PolynomialConstructor, } from "../../../math/polynomials/polynomial.js";
|
|
6
7
|
import { randint } from "../../../math/utils/random/randint.js";
|
|
7
|
-
import { NumberNode } from "../../../tree/nodes/numbers/numberNode.js";
|
|
8
8
|
import { coinFlip } from "../../../utils/alea/coinFlip.js";
|
|
9
9
|
import { shuffle } from "../../../utils/alea/shuffle.js";
|
|
10
|
+
import { handleVEAError } from "../../../utils/errors/handleVEAError.js";
|
|
10
11
|
const getInstruction = (identifiers) => {
|
|
11
12
|
const { numCoeffs, denumCoeffs, limitTo: to } = identifiers;
|
|
12
13
|
const polyNum = new Polynomial(numCoeffs);
|
|
@@ -79,27 +80,15 @@ const getPropositions = (n, { answer, denumCoeffs, numCoeffs }) => {
|
|
|
79
80
|
});
|
|
80
81
|
return shuffle(propositions);
|
|
81
82
|
};
|
|
82
|
-
const isAnswerValid = (ans, {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
const leadingCoeffsRational = new Rational(numLeadingCoeff, denumLeadingCoeff)
|
|
88
|
-
.simplify()
|
|
89
|
-
.toTree({ allowFractionToDecimal: true });
|
|
90
|
-
let answer;
|
|
91
|
-
if (denumDegree === numDegree) {
|
|
92
|
-
answer = leadingCoeffsRational;
|
|
83
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
84
|
+
try {
|
|
85
|
+
if (answer.includes("infty"))
|
|
86
|
+
return ans === answer;
|
|
87
|
+
return rationalVEA(ans, answer);
|
|
93
88
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
const tempPoly = new Monom(numDegree - denumDegree, numLeadingCoeff * denumLeadingCoeff > 0 ? 1 : -1);
|
|
99
|
-
answer = tempPoly.getLimitNode(limitTo);
|
|
89
|
+
catch (err) {
|
|
90
|
+
return handleVEAError(err);
|
|
100
91
|
}
|
|
101
|
-
const texs = answer.toAllValidTexs();
|
|
102
|
-
return texs.includes(ans);
|
|
103
92
|
};
|
|
104
93
|
export const rationalFracLimit = {
|
|
105
94
|
id: "rationalFracLimit",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sequenceRationalFracLimit.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/limits/sequences/sequenceRationalFracLimit.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAarC,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;
|
|
1
|
+
{"version":3,"file":"sequenceRationalFracLimit.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/limits/sequences/sequenceRationalFracLimit.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAarC,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AA+GF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAa3D,CAAC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
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 { Monom } from "../../../../math/polynomials/monom.js";
|
|
5
6
|
import { Polynomial, PolynomialConstructor, } from "../../../../math/polynomials/polynomial.js";
|
|
6
7
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
7
|
-
import { NumberNode } from "../../../../tree/nodes/numbers/numberNode.js";
|
|
8
8
|
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
9
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
9
10
|
const getInstruction = (identifiers) => {
|
|
10
11
|
const { numCoeffs, denumCoeffs } = identifiers;
|
|
11
12
|
const polyNum = new Polynomial(numCoeffs, "n");
|
|
@@ -77,27 +78,15 @@ const getPropositions = (n, { answer, numCoeffs, denumCoeffs }) => {
|
|
|
77
78
|
});
|
|
78
79
|
return shuffle(propositions);
|
|
79
80
|
};
|
|
80
|
-
const isAnswerValid = (ans, {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
const leadingCoeffsRational = new Rational(numLeadingCoeff, denumLeadingCoeff)
|
|
86
|
-
.simplify()
|
|
87
|
-
.toTree({ allowFractionToDecimal: true });
|
|
88
|
-
let answer;
|
|
89
|
-
if (denumDegree === numDegree) {
|
|
90
|
-
answer = leadingCoeffsRational;
|
|
81
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
82
|
+
try {
|
|
83
|
+
if (answer.includes("infty"))
|
|
84
|
+
return ans === answer;
|
|
85
|
+
return rationalVEA(ans, answer);
|
|
91
86
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
else {
|
|
96
|
-
const tempPoly = new Monom(numDegree - denumDegree, numLeadingCoeff * denumLeadingCoeff > 0 ? 1 : -1);
|
|
97
|
-
answer = tempPoly.getLimitNode("+\\infty");
|
|
87
|
+
catch (err) {
|
|
88
|
+
return handleVEAError(err);
|
|
98
89
|
}
|
|
99
|
-
const texs = answer.toAllValidTexs();
|
|
100
|
-
return texs.includes(ans);
|
|
101
90
|
};
|
|
102
91
|
export const sequenceRationalFracLimit = {
|
|
103
92
|
id: "sequenceRationalFracLimit",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometricFindExplicitFormula.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/geometricFindExplicitFormula.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"geometricFindExplicitFormula.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/geometricFindExplicitFormula.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AA4GF,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,WAAW,CAe9D,CAAC"}
|
|
@@ -2,13 +2,11 @@ import { addValidProp, propWhile, tryToAddWrongProp, } from "../../../../exercis
|
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
4
4
|
import { NumberNode } from "../../../../tree/nodes/numbers/numberNode.js";
|
|
5
|
-
import { EqualNode, isEqualNode, } from "../../../../tree/nodes/equations/equalNode.js";
|
|
6
5
|
import { MultiplyNode } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
7
6
|
import { PowerNode } from "../../../../tree/nodes/operators/powerNode.js";
|
|
8
7
|
import { VariableNode } from "../../../../tree/nodes/variables/variableNode.js";
|
|
9
8
|
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
10
|
-
import {
|
|
11
|
-
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
9
|
+
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
12
10
|
const getInstruction = (identifiers) => {
|
|
13
11
|
const { firstValue, reason } = identifiers;
|
|
14
12
|
const firstRank = 0;
|
|
@@ -19,7 +17,7 @@ Donner l'expression de $u_n$ en fonction de $n$.`;
|
|
|
19
17
|
const getAnswer = (identifiers) => {
|
|
20
18
|
const { firstValue, reason } = identifiers;
|
|
21
19
|
const formula = new MultiplyNode(new NumberNode(firstValue), new PowerNode(new NumberNode(reason), new VariableNode("n")));
|
|
22
|
-
const answer =
|
|
20
|
+
const answer = formula.toTex();
|
|
23
21
|
return answer;
|
|
24
22
|
};
|
|
25
23
|
const getHint = () => {
|
|
@@ -45,14 +43,14 @@ où $u_0$ est le premier terme et $r$ la raison.
|
|
|
45
43
|
Ici, puisque $u_0 = ${firstValue}$ et $r = ${reason}$, on a :
|
|
46
44
|
|
|
47
45
|
$$
|
|
48
|
-
${answer}
|
|
46
|
+
u_n = ${answer}
|
|
49
47
|
$$`;
|
|
50
48
|
};
|
|
51
49
|
const getQuestionFromIdentifiers = (identifiers) => {
|
|
52
50
|
const question = {
|
|
53
51
|
instruction: getInstruction(identifiers),
|
|
54
52
|
answer: getAnswer(identifiers),
|
|
55
|
-
keys: ["
|
|
53
|
+
keys: ["n"],
|
|
56
54
|
answerFormat: "tex",
|
|
57
55
|
identifiers,
|
|
58
56
|
hint: getHint(identifiers),
|
|
@@ -62,39 +60,24 @@ const getQuestionFromIdentifiers = (identifiers) => {
|
|
|
62
60
|
};
|
|
63
61
|
const getGeometricFindExplicitFormula = () => {
|
|
64
62
|
const firstValue = randint(1, 10);
|
|
65
|
-
const reason = randint(2, 10);
|
|
63
|
+
const reason = randint(2, 10, [firstValue]);
|
|
66
64
|
const identifiers = { reason, firstValue };
|
|
67
65
|
return getQuestionFromIdentifiers(identifiers);
|
|
68
66
|
};
|
|
69
67
|
const getPropositions = (n, { answer, reason, firstValue }) => {
|
|
70
68
|
const propositions = [];
|
|
71
69
|
addValidProp(propositions, answer);
|
|
72
|
-
tryToAddWrongProp(propositions, "
|
|
73
|
-
new MultiplyNode(new NumberNode(reason), new PowerNode(new NumberNode(firstValue), new VariableNode("n"))).toTex());
|
|
70
|
+
tryToAddWrongProp(propositions, new MultiplyNode(new NumberNode(reason), new PowerNode(new NumberNode(firstValue), new VariableNode("n"))).toTex());
|
|
74
71
|
propWhile(propositions, n, () => {
|
|
75
72
|
const wrongAnswer = new MultiplyNode(new NumberNode(firstValue + randint(-firstValue, 2 * firstValue + 1)), new PowerNode(new NumberNode(reason + +randint(-reason + 1, 2 * reason + 1)), new VariableNode("n")));
|
|
76
|
-
tryToAddWrongProp(propositions,
|
|
73
|
+
tryToAddWrongProp(propositions, wrongAnswer.toTex());
|
|
77
74
|
});
|
|
78
75
|
return shuffle(propositions);
|
|
79
76
|
};
|
|
80
|
-
const isAnswerValid = (ans, {
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
});
|
|
85
|
-
const texs = equal.toAllValidTexs();
|
|
86
|
-
return (texs.includes(ans) ||
|
|
87
|
-
(() => {
|
|
88
|
-
const refinedAns = ans.replace("u_n", "").replace("=", "");
|
|
89
|
-
let nodeAns = parseLatex(refinedAns);
|
|
90
|
-
if (isEqualNode(nodeAns)) {
|
|
91
|
-
nodeAns = nodeAns.rightChild;
|
|
92
|
-
}
|
|
93
|
-
const differenceNode = substract(nodeAns, formula);
|
|
94
|
-
return (differenceNode.evaluate({ n: 0 }) === 0 &&
|
|
95
|
-
differenceNode.evaluate({ n: 1 }) === 0 &&
|
|
96
|
-
differenceNode.evaluate({ n: 5 }) === 0);
|
|
97
|
-
})());
|
|
77
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
78
|
+
const trimed = ans.replace("u_n=", "").replace("u_{n}=", "");
|
|
79
|
+
return (parseAlgebraic(trimed).simplify({}).toTex() ===
|
|
80
|
+
parseAlgebraic(answer.replace("u_n=", "")).simplify().toTex());
|
|
98
81
|
};
|
|
99
82
|
export const geometricFindExplicitFormula = {
|
|
100
83
|
id: "geometricFindExplicitFormula",
|
package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFirstRankOne.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometricFindExplicitFormulaFirstRankOne.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/geometricFindExplicitFormulaFirstRankOne.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"geometricFindExplicitFormulaFirstRankOne.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/geometricFindExplicitFormulaFirstRankOne.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAmHF,eAAO,MAAM,wCAAwC,EAAE,QAAQ,CAAC,WAAW,CAe1E,CAAC"}
|
|
@@ -2,12 +2,11 @@ import { addValidProp, propWhile, tryToAddWrongProp, } from "../../../../exercis
|
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
4
4
|
import { NumberNode } from "../../../../tree/nodes/numbers/numberNode.js";
|
|
5
|
-
import { EqualNode } from "../../../../tree/nodes/equations/equalNode.js";
|
|
6
5
|
import { MultiplyNode } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
7
6
|
import { PowerNode } from "../../../../tree/nodes/operators/powerNode.js";
|
|
8
7
|
import { VariableNode } from "../../../../tree/nodes/variables/variableNode.js";
|
|
9
8
|
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
10
|
-
import {
|
|
9
|
+
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
11
10
|
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
12
11
|
const getInstruction = (identifiers) => {
|
|
13
12
|
const { firstValue, reason } = identifiers;
|
|
@@ -19,7 +18,7 @@ Donner l'expression de $u_n$ en fonction de $n$.`;
|
|
|
19
18
|
const getAnswer = (identifiers) => {
|
|
20
19
|
const { firstValue, reason } = identifiers;
|
|
21
20
|
const formula = new MultiplyNode(new NumberNode(firstValue), new PowerNode(new NumberNode(reason), substract("n", 1)));
|
|
22
|
-
const answer =
|
|
21
|
+
const answer = formula.toTex();
|
|
23
22
|
return answer;
|
|
24
23
|
};
|
|
25
24
|
const getHint = () => {
|
|
@@ -45,14 +44,14 @@ où $u_1$ est le premier terme et $q$ la raison.
|
|
|
45
44
|
Ici, puisque $u_1 = ${firstValue}$ et $q = ${reason}$, on a :
|
|
46
45
|
|
|
47
46
|
$$
|
|
48
|
-
${answer}
|
|
47
|
+
u_n = ${answer}
|
|
49
48
|
$$`;
|
|
50
49
|
};
|
|
51
50
|
const getQuestionFromIdentifiers = (identifiers) => {
|
|
52
51
|
const question = {
|
|
53
52
|
instruction: getInstruction(identifiers),
|
|
54
53
|
answer: getAnswer(identifiers),
|
|
55
|
-
keys: ["
|
|
54
|
+
keys: ["n"],
|
|
56
55
|
answerFormat: "tex",
|
|
57
56
|
identifiers,
|
|
58
57
|
hint: getHint(identifiers),
|
|
@@ -62,39 +61,25 @@ const getQuestionFromIdentifiers = (identifiers) => {
|
|
|
62
61
|
};
|
|
63
62
|
const getGeometricFindExplicitFormula = () => {
|
|
64
63
|
const firstValue = randint(1, 10);
|
|
65
|
-
const reason = randint(2, 10);
|
|
64
|
+
const reason = randint(2, 10, [firstValue]);
|
|
66
65
|
const identifiers = { reason, firstValue };
|
|
67
66
|
return getQuestionFromIdentifiers(identifiers);
|
|
68
67
|
};
|
|
69
68
|
const getPropositions = (n, { answer, reason, firstValue }) => {
|
|
70
69
|
const propositions = [];
|
|
71
70
|
addValidProp(propositions, answer);
|
|
72
|
-
tryToAddWrongProp(propositions, "
|
|
73
|
-
|
|
74
|
-
tryToAddWrongProp(propositions, "u_n=" +
|
|
75
|
-
new MultiplyNode(new NumberNode(reason), new PowerNode(new NumberNode(firstValue), substract("n", 1))).toTex());
|
|
71
|
+
tryToAddWrongProp(propositions, new MultiplyNode(new NumberNode(firstValue), new PowerNode(new NumberNode(reason), new VariableNode("n"))).toTex());
|
|
72
|
+
tryToAddWrongProp(propositions, new MultiplyNode(new NumberNode(reason), new PowerNode(new NumberNode(firstValue), substract("n", 1))).toTex());
|
|
76
73
|
propWhile(propositions, n, () => {
|
|
77
74
|
const wrongAnswer = new MultiplyNode(new NumberNode(firstValue + randint(-firstValue, 2 * firstValue + 1)), new PowerNode(new NumberNode(reason + +randint(-reason + 1, 2 * reason + 1)), substract("n", 1)));
|
|
78
|
-
tryToAddWrongProp(propositions,
|
|
75
|
+
tryToAddWrongProp(propositions, wrongAnswer.toTex());
|
|
79
76
|
});
|
|
80
77
|
return shuffle(propositions);
|
|
81
78
|
};
|
|
82
|
-
const isAnswerValid = (ans, {
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
});
|
|
87
|
-
const texs = equal.toAllValidTexs();
|
|
88
|
-
return (texs.includes(ans) ||
|
|
89
|
-
(() => {
|
|
90
|
-
const splitted = ans.split("=");
|
|
91
|
-
const rightTerm = splitted[1] ?? splitted[0];
|
|
92
|
-
const nodeAns = parseLatex(rightTerm);
|
|
93
|
-
const differenceNode = substract(nodeAns, formula);
|
|
94
|
-
return (differenceNode.evaluate({ n: 0 }) === 0 &&
|
|
95
|
-
differenceNode.evaluate({ n: 1 }) === 0 &&
|
|
96
|
-
differenceNode.evaluate({ n: 5 }) === 0);
|
|
97
|
-
})());
|
|
79
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
80
|
+
const trimed = ans.replace("u_n=", "").replace("u_{n}=", "");
|
|
81
|
+
return (parseAlgebraic(trimed).simplify({}).toTex() ===
|
|
82
|
+
parseAlgebraic(answer.replace("u_n=", "")).simplify().toTex());
|
|
98
83
|
};
|
|
99
84
|
export const geometricFindExplicitFormulaFirstRankOne = {
|
|
100
85
|
id: "geometricFindExplicitFormulaFirstRankOne",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spaceVectorNormCalculation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/spaceGeometry/vectors/spaceVectorNormCalculation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"spaceVectorNormCalculation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/spaceGeometry/vectors/spaceVectorNormCalculation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAarC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAkGF,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,WAAW,CAa5D,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 { sqrtVEA } from "../../../../exercises/vea/sqrtVEA.js";
|
|
3
4
|
import { SpaceVector, SpaceVectorConstructor, } from "../../../../math/geometry/spaceVector.js";
|
|
4
5
|
import { SquareRootConstructor } from "../../../../math/numbers/reals/real.js";
|
|
5
6
|
import { SqrtNode } from "../../../../tree/nodes/functions/sqrtNode.js";
|
|
@@ -70,11 +71,8 @@ const getPropositions = (n, { answer, x, y, z }) => {
|
|
|
70
71
|
});
|
|
71
72
|
return shuffleProps(propositions, n);
|
|
72
73
|
};
|
|
73
|
-
const isAnswerValid = (ans, {
|
|
74
|
-
|
|
75
|
-
return correctAnswer
|
|
76
|
-
.toAllValidTexs({ allowSimplifySqrt: true })
|
|
77
|
-
.includes(ans);
|
|
74
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
75
|
+
return sqrtVEA(ans, answer);
|
|
78
76
|
};
|
|
79
77
|
export const spaceVectorNormCalculation = {
|
|
80
78
|
id: "spaceVectorNormCalculation",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simpifySquareRoot.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/squareRoots/simpifySquareRoot.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"simpifySquareRoot.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/squareRoots/simpifySquareRoot.ts"],"names":[],"mappings":"AASA,OAAO,EACL,QAAQ,EAeT,MAAM,mBAAmB,CAAC;AAE3B,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAwGF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAcpD,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { sqrtVEA } from "../../../exercises/vea/sqrtVEA.js";
|
|
1
2
|
import { SquareRoot, SquareRootConstructor, } from "../../../math/numbers/reals/real.js";
|
|
2
3
|
import { sqrt } from "../../../tree/nodes/functions/sqrtNode.js";
|
|
3
4
|
import { multiply } from "../../../tree/nodes/operators/multiplyNode.js";
|
|
@@ -92,10 +93,10 @@ const getPropositions = (n, { answer }) => {
|
|
|
92
93
|
});
|
|
93
94
|
return shuffle(propositions);
|
|
94
95
|
};
|
|
95
|
-
const isAnswerValid = (ans, {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
97
|
+
return sqrtVEA(ans, answer, {
|
|
98
|
+
allowNonIrreductible: false,
|
|
99
|
+
});
|
|
99
100
|
};
|
|
100
101
|
export const simplifySquareRoot = {
|
|
101
102
|
id: "simplifySqrt",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"squareRootEquation.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/squareRoots/squareRootEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"squareRootEquation.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/squareRoots/squareRootEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAQrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAuFF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAcpD,CAAC"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { addValidProp, propWhile, tryToAddWrongProp, } from "../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { equationVEA } from "../../../exercises/vea/equationVEA.js";
|
|
3
4
|
import { randint } from "../../../math/utils/random/randint.js";
|
|
4
|
-
import { EquationSolutionNode } from "../../../tree/nodes/equations/equationSolutionNode.js";
|
|
5
|
-
import { NumberNode } from "../../../tree/nodes/numbers/numberNode.js";
|
|
6
5
|
import { square } from "../../../tree/nodes/operators/powerNode.js";
|
|
7
|
-
import { DiscreteSetNode, EmptySet, } from "../../../tree/nodes/sets/discreteSetNode.js";
|
|
8
6
|
import { shuffle } from "../../../utils/alea/shuffle.js";
|
|
7
|
+
import { handleVEAError } from "../../../utils/errors/handleVEAError.js";
|
|
9
8
|
const getInstruction = (identifiers) => {
|
|
10
9
|
const { k } = identifiers;
|
|
11
10
|
return `Résoudre l'équation suivante :
|
|
@@ -69,11 +68,13 @@ const getPropositions = (n, { answer, k }) => {
|
|
|
69
68
|
});
|
|
70
69
|
return shuffle(propositions);
|
|
71
70
|
};
|
|
72
|
-
const isAnswerValid = (ans, {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
71
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
72
|
+
try {
|
|
73
|
+
return equationVEA(ans, answer.replace("S=", ""));
|
|
74
|
+
}
|
|
75
|
+
catch (err) {
|
|
76
|
+
return handleVEAError(err);
|
|
77
|
+
}
|
|
77
78
|
};
|
|
78
79
|
export const squareRootEquation = {
|
|
79
80
|
id: "squareRootEquation",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"squareRootIdentities.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/squareRoots/squareRootIdentities.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"squareRootIdentities.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/squareRoots/squareRootIdentities.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAyBrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtB,CAAC,EAAE,MAAM,CAAC;IACV,eAAe,EAAE,OAAO,CAAC;CAC1B,CAAC;AA6UF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAetD,CAAC"}
|
|
@@ -8,6 +8,7 @@ import { add, AddNode } from "../../../tree/nodes/operators/addNode.js";
|
|
|
8
8
|
import { multiply, MultiplyNode, } from "../../../tree/nodes/operators/multiplyNode.js";
|
|
9
9
|
import { square, SquareNode } from "../../../tree/nodes/operators/powerNode.js";
|
|
10
10
|
import { substract, SubstractNode, } from "../../../tree/nodes/operators/substractNode.js";
|
|
11
|
+
import { parseAlgebraic } from "../../../tree/parsers/latexParser.js";
|
|
11
12
|
import { probaFlip } from "../../../utils/alea/probaFlip.js";
|
|
12
13
|
import { shuffle } from "../../../utils/alea/shuffle.js";
|
|
13
14
|
import { alignTex } from "../../../utils/latex/alignTex.js";
|
|
@@ -234,10 +235,12 @@ const getPropositions = (n, { answer, a, b, type, x, y }) => {
|
|
|
234
235
|
}
|
|
235
236
|
return shuffle(propositions);
|
|
236
237
|
};
|
|
237
|
-
const isAnswerValid = (ans, { answer
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
238
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
239
|
+
return (parseAlgebraic(ans)
|
|
240
|
+
.simplify({
|
|
241
|
+
forbidFactorize: true,
|
|
242
|
+
})
|
|
243
|
+
.toTex() === answer);
|
|
241
244
|
};
|
|
242
245
|
export const squareRootIdentities = {
|
|
243
246
|
id: "squareRootIdentities",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"squareRootsDistributivity.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/squareRoots/squareRootsDistributivity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"squareRootsDistributivity.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/squareRoots/squareRootsDistributivity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAcrC,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;AA+GF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAe3D,CAAC"}
|
|
@@ -6,6 +6,7 @@ import { sqrt, SqrtNode } from "../../../tree/nodes/functions/sqrtNode.js";
|
|
|
6
6
|
import { NumberNode } from "../../../tree/nodes/numbers/numberNode.js";
|
|
7
7
|
import { add, AddNode } from "../../../tree/nodes/operators/addNode.js";
|
|
8
8
|
import { multiply, MultiplyNode, } from "../../../tree/nodes/operators/multiplyNode.js";
|
|
9
|
+
import { parseAlgebraic } from "../../../tree/parsers/latexParser.js";
|
|
9
10
|
import { alignTex } from "../../../utils/latex/alignTex.js";
|
|
10
11
|
/**
|
|
11
12
|
* a sqrt(b) (c + d sqrt(b))
|
|
@@ -84,14 +85,12 @@ const getPropositions = (n, { answer, b }) => {
|
|
|
84
85
|
});
|
|
85
86
|
return shuffleProps(propositions, n);
|
|
86
87
|
};
|
|
87
|
-
const isAnswerValid = (ans, {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
const texs = answer.toAllValidTexs();
|
|
94
|
-
return texs.includes(ans);
|
|
88
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
89
|
+
return (parseAlgebraic(ans)
|
|
90
|
+
.simplify({
|
|
91
|
+
forbidFactorize: true,
|
|
92
|
+
})
|
|
93
|
+
.toTex() === answer);
|
|
95
94
|
};
|
|
96
95
|
export const squareRootsDistributivity = {
|
|
97
96
|
id: "squareRootsDistributivity",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arcLength.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/trigonometry/arcLength.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAKrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"arcLength.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/trigonometry/arcLength.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAKrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAO7C,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,iBAAiB,EAAE,eAAe,GAAG,SAAS,CAAC;IAC/C,eAAe,EAAE,OAAO,CAAC;CAC1B,CAAC;AAmGF,eAAO,MAAM,SAAS,EAAE,QAAQ,CAAC,WAAW,CAc3C,CAAC"}
|
|
@@ -6,6 +6,7 @@ import { NodeConstructor, } from "../../../tree/nodes/nodeConstructor.js";
|
|
|
6
6
|
import { PiNode } from "../../../tree/nodes/numbers/piNode.js";
|
|
7
7
|
import { FractionNode } from "../../../tree/nodes/operators/fractionNode.js";
|
|
8
8
|
import { MultiplyNode } from "../../../tree/nodes/operators/multiplyNode.js";
|
|
9
|
+
import { parseAlgebraic } from "../../../tree/parsers/latexParser.js";
|
|
9
10
|
import { coinFlip } from "../../../utils/alea/coinFlip.js";
|
|
10
11
|
const getPropositions = (n, { answer, isThetaInDegree, radius }) => {
|
|
11
12
|
const propositions = [];
|
|
@@ -41,14 +42,8 @@ const getInstruction = (identifiers) => {
|
|
|
41
42
|
const getKeys = () => {
|
|
42
43
|
return ["pi"];
|
|
43
44
|
};
|
|
44
|
-
const isAnswerValid = (ans, {
|
|
45
|
-
|
|
46
|
-
isThetaInDegree,
|
|
47
|
-
radius,
|
|
48
|
-
thetaInDegree,
|
|
49
|
-
thetaInRadNodeIds,
|
|
50
|
-
});
|
|
51
|
-
return node.toAllValidTexs().includes(ans);
|
|
45
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
46
|
+
return parseAlgebraic(ans).simplify().toTex() === answer;
|
|
52
47
|
};
|
|
53
48
|
const getArcLengthQuestion = () => {
|
|
54
49
|
const radius = randint(1, 6);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findAtomEntitiesNumberFromMass.d.ts","sourceRoot":"","sources":["../../../../src/exercises/pc/chemicalElements/findAtomEntitiesNumberFromMass.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EAAE,WAAW,EAAE,MAAM,sDAAsD,CAAC;AAMnF,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,WAAW,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;
|
|
1
|
+
{"version":3,"file":"findAtomEntitiesNumberFromMass.d.ts","sourceRoot":"","sources":["../../../../src/exercises/pc/chemicalElements/findAtomEntitiesNumberFromMass.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EAAE,WAAW,EAAE,MAAM,sDAAsD,CAAC;AAMnF,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,WAAW,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AA0FF,eAAO,MAAM,8BAA8B,EAAE,QAAQ,CAAC,WAAW,CAYhE,CAAC"}
|
|
@@ -65,12 +65,6 @@ const getPropositions = (n, { answer, atomSymbol, sampleMass }) => {
|
|
|
65
65
|
return shuffleProps(propositions, n);
|
|
66
66
|
};
|
|
67
67
|
const isAnswerValid = (ans, { answer }) => {
|
|
68
|
-
// const atom = atomes.find(a => a.symbole === atomSymbol)!
|
|
69
|
-
// const sampleMassMeasure = new Measure(sampleMass, 0);
|
|
70
|
-
// const atomMass = nucleonMass.value.times(atom.masseAtomique).toSignificant(2);
|
|
71
|
-
// const entitiesNumber = sampleMassMeasure.divide(atomMass).toSignificant(2);
|
|
72
|
-
// const texs = entitiesNumber.toAllValidTexs();
|
|
73
|
-
// return texs.includes(ans);
|
|
74
68
|
return ans === answer;
|
|
75
69
|
};
|
|
76
70
|
export const findAtomEntitiesNumberFromMass = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"beerLambertRandomValue.d.ts","sourceRoot":"","sources":["../../../../src/exercises/pc/dosage/beerLambertRandomValue.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"beerLambertRandomValue.d.ts","sourceRoot":"","sources":["../../../../src/exercises/pc/dosage/beerLambertRandomValue.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,kBAAkB,EAAE,MAAM,CAAC;CAC5B,CAAC;AAiOF,eAAO,MAAM,8BAA8B,EAAE,QAAQ,CAAC,WAAW,CAahE,CAAC"}
|
|
@@ -6,6 +6,7 @@ import { random } from "../../../utils/alea/random.js";
|
|
|
6
6
|
import { requiresApostropheBefore } from "../../../utils/strings/requiresApostropheBefore.js";
|
|
7
7
|
import { randfloat } from "../../../math/utils/random/randfloat.js";
|
|
8
8
|
import { molecules } from "../../../pc/constants/molecularChemistry/molecule.js";
|
|
9
|
+
import { numberVEA } from "../../../exercises/vea/numberVEA.js";
|
|
9
10
|
const getInstruction = (identifiers) => {
|
|
10
11
|
const { moleculeName, concentration, molarAbsorptivity, pathLength, absorbance, targetVariableName, } = identifiers;
|
|
11
12
|
const variables = [
|
|
@@ -165,10 +166,8 @@ const getPropositions = (n, { answer, concentration, molarAbsorptivity, pathLeng
|
|
|
165
166
|
});
|
|
166
167
|
return shuffleProps(propositions, n);
|
|
167
168
|
};
|
|
168
|
-
const isAnswerValid = (ans, { answer
|
|
169
|
-
|
|
170
|
-
const latexs = validAnswer.toTree().toAllValidTexs();
|
|
171
|
-
return latexs.includes(ans);
|
|
169
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
170
|
+
return numberVEA(ans, answer);
|
|
172
171
|
};
|
|
173
172
|
export const BeerLambertRandomValueExercise = {
|
|
174
173
|
id: "beerLambertRandomValue",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"concentrationFromMassCalculation.d.ts","sourceRoot":"","sources":["../../../../src/exercises/pc/dosage/concentrationFromMassCalculation.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"concentrationFromMassCalculation.d.ts","sourceRoot":"","sources":["../../../../src/exercises/pc/dosage/concentrationFromMassCalculation.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAOrC,KAAK,WAAW,GAAG;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;CAC3B,CAAC;AA6JF,eAAO,MAAM,gCAAgC,EAAE,QAAQ,CAAC,WAAW,CAclE,CAAC"}
|
|
@@ -4,6 +4,7 @@ import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuesti
|
|
|
4
4
|
import { round } from "../../../math/utils/round.js";
|
|
5
5
|
import { randfloat } from "../../../math/utils/random/randfloat.js";
|
|
6
6
|
import { randint } from "../../../math/utils/random/randint.js";
|
|
7
|
+
import { numberVEA } from "../../../exercises/vea/numberVEA.js";
|
|
7
8
|
const getInstruction = (identifiers) => {
|
|
8
9
|
const { concentration, mass, molarMass, variable } = identifiers;
|
|
9
10
|
switch (variable) {
|
|
@@ -118,24 +119,8 @@ const getPropositions = (n, { answer, concentration, mass, molarMass, variable }
|
|
|
118
119
|
});
|
|
119
120
|
return shuffleProps(propositions, n);
|
|
120
121
|
};
|
|
121
|
-
const isAnswerValid = (ans, {
|
|
122
|
-
|
|
123
|
-
switch (variable) {
|
|
124
|
-
case "C":
|
|
125
|
-
validanswer = round(mass / molarMass, 2);
|
|
126
|
-
break;
|
|
127
|
-
case "t":
|
|
128
|
-
validanswer = round(concentration * molarMass, 2);
|
|
129
|
-
break;
|
|
130
|
-
case "M":
|
|
131
|
-
validanswer = round(mass / concentration, 2);
|
|
132
|
-
break;
|
|
133
|
-
}
|
|
134
|
-
const latexs = [
|
|
135
|
-
...validanswer.toTree().toAllValidTexs(),
|
|
136
|
-
validanswer.toScientific(2).toTex(),
|
|
137
|
-
];
|
|
138
|
-
return latexs.includes(ans);
|
|
122
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
123
|
+
return numberVEA(ans, answer);
|
|
139
124
|
};
|
|
140
125
|
export const concentrationFromMassCalculation = {
|
|
141
126
|
id: "concentrationFromMassCalculation",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"energyTransfer.d.ts","sourceRoot":"","sources":["../../../../src/exercises/pc/energy/energyTransfer.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"energyTransfer.d.ts","sourceRoot":"","sources":["../../../../src/exercises/pc/energy/energyTransfer.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAOrC,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AA2EF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAYhD,CAAC"}
|