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,12 +1,9 @@
|
|
|
1
1
|
import { addValidProp, propWhile, shuffleProps, 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 { round } from "../../../../../math/utils/round.js";
|
|
4
5
|
import { generateAffineCloud } from "../../../../../math/utils/stats/generateAffineCloud.js";
|
|
5
6
|
import { rSquared } from "../../../../../math/utils/stats/rSquared.js";
|
|
6
|
-
import { EqualNode } from "../../../../../tree/nodes/equations/equalNode.js";
|
|
7
|
-
import { NumberNode } from "../../../../../tree/nodes/numbers/numberNode.js";
|
|
8
|
-
import { PowerNode } from "../../../../../tree/nodes/operators/powerNode.js";
|
|
9
|
-
import { VariableNode } from "../../../../../tree/nodes/variables/variableNode.js";
|
|
10
7
|
import { dollarize } from "../../../../../utils/latex/dollarize.js";
|
|
11
8
|
import { mdTable } from "../../../../../utils/markdown/mdTable.js";
|
|
12
9
|
const getInstruction = (identifiers) => {
|
|
@@ -25,7 +22,7 @@ Déterminer la valeur du coefficient de détermination pour un ajustement affine
|
|
|
25
22
|
const getAnswer = (identifiers) => {
|
|
26
23
|
const { xValues, yValues } = identifiers;
|
|
27
24
|
const r2 = round(rSquared(xValues, yValues), 2);
|
|
28
|
-
const answer =
|
|
25
|
+
const answer = r2.toTree().toTex();
|
|
29
26
|
return answer;
|
|
30
27
|
};
|
|
31
28
|
const getAffineAdjustmentRsquaredQuestion = () => {
|
|
@@ -52,7 +49,7 @@ const getQuestionFromIdentifiers = (identifiers) => {
|
|
|
52
49
|
const question = {
|
|
53
50
|
answer: getAnswer(identifiers),
|
|
54
51
|
instruction: getInstruction(identifiers),
|
|
55
|
-
keys: [
|
|
52
|
+
keys: [],
|
|
56
53
|
answerFormat: "tex",
|
|
57
54
|
identifiers,
|
|
58
55
|
style: {
|
|
@@ -71,26 +68,21 @@ const getPropositions = (n, { answer, xValues, yValues }) => {
|
|
|
71
68
|
const propositions = [];
|
|
72
69
|
const r2 = round(rSquared(xValues, yValues), 2);
|
|
73
70
|
addValidProp(propositions, answer, "tex");
|
|
74
|
-
const wrongAnswer1 =
|
|
75
|
-
const wrongAnswer2 =
|
|
76
|
-
const wrongAnswer3 =
|
|
71
|
+
const wrongAnswer1 = r2.toTree().toTex();
|
|
72
|
+
const wrongAnswer2 = (r2 + 0.01).toTree().toTex();
|
|
73
|
+
const wrongAnswer3 = (r2 - 0.01).toTree().toTex();
|
|
77
74
|
tryToAddWrongProp(propositions, wrongAnswer1);
|
|
78
75
|
tryToAddWrongProp(propositions, wrongAnswer2);
|
|
79
76
|
tryToAddWrongProp(propositions, wrongAnswer3);
|
|
80
77
|
propWhile(propositions, n, () => {
|
|
81
|
-
const wrongAnswer =
|
|
78
|
+
const wrongAnswer = round(Math.random(), 2).toTree().toTex();
|
|
82
79
|
tryToAddWrongProp(propositions, wrongAnswer);
|
|
83
80
|
});
|
|
84
81
|
return shuffleProps(propositions, n);
|
|
85
82
|
};
|
|
86
|
-
const isAnswerValid = (ans, {
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
const latexs = validanswer.toAllValidTexs({
|
|
90
|
-
allowRawRightChildAsSolution: true,
|
|
91
|
-
allowFractionToDecimal: true,
|
|
92
|
-
});
|
|
93
|
-
return latexs.includes(ans);
|
|
83
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
84
|
+
const trimed = ans.replace("R^2=", "").replace("R^{2}=", "");
|
|
85
|
+
return numberVEA(trimed, answer.replace("R^2=", "").replace("R^{2}=", ""));
|
|
94
86
|
};
|
|
95
87
|
export const affineAdjustmentRsquaredExercise = {
|
|
96
88
|
id: "affineAdjustmentRsquared",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"affineMeanValue.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/affineMeanValue.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"affineMeanValue.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/affineMeanValue.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAgHF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAYjD,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 { Trinom } from "../../../../math/polynomials/trinom.js";
|
|
4
5
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
5
6
|
import { NumberNode } from "../../../../tree/nodes/numbers/numberNode.js";
|
|
@@ -73,11 +74,8 @@ const getPropositions = (n, { answer, trinomial, leftbound, rightbound }) => {
|
|
|
73
74
|
});
|
|
74
75
|
return shuffleProps(propositions, n);
|
|
75
76
|
};
|
|
76
|
-
const isAnswerValid = (ans, {
|
|
77
|
-
|
|
78
|
-
const validanswer = new MultiplyNode(new FractionNode(new NumberNode(1), (rightbound - leftbound).toTree()), (trinomial1.calculate(rightbound) - trinomial1.calculate(leftbound)).toTree()).simplify();
|
|
79
|
-
const latexs = validanswer.toAllValidTexs();
|
|
80
|
-
return latexs.includes(ans);
|
|
77
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
78
|
+
return rationalVEA(ans, answer);
|
|
81
79
|
};
|
|
82
80
|
export const affineMeanValue = {
|
|
83
81
|
id: "affineMeanValue",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findZeroesProductQuotient.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/findZeroesProductQuotient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAuBrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;CACZ,CAAC;
|
|
1
|
+
{"version":3,"file":"findZeroesProductQuotient.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/findZeroesProductQuotient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAuBrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;CACZ,CAAC;AA4QF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAkB3D,CAAC"}
|
|
@@ -166,7 +166,6 @@ const isAnswerValid = (ans, { answer, ...identifiers }) => {
|
|
|
166
166
|
}
|
|
167
167
|
};
|
|
168
168
|
const isArrayOfNodesValid = (arrAns, arrAnswer) => {
|
|
169
|
-
//tried with toAllValidTexs() but there is always an unhandled case
|
|
170
169
|
function isNodesEqual(node1, node2) {
|
|
171
170
|
return [1, 1_000, 1_000_000].every((factor) => substract(multiply(factor, node1), multiply(factor, node2)).evaluate() === 0);
|
|
172
171
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"twoFunctionsEquation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/twoFunctionsEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"twoFunctionsEquation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/twoFunctionsEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAgBrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,EAAE,EAAE,CAAC;IAC1B,aAAa,EAAE,MAAM,EAAE,EAAE,CAAC;IAC1B,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AA0LF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CActD,CAAC"}
|
|
@@ -11,6 +11,8 @@ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
|
|
|
11
11
|
import { random } from "../../../../utils/alea/random.js";
|
|
12
12
|
import { Point } from "../../../../math/geometry/point.js";
|
|
13
13
|
import { pluralize } from "../../../../utils/strings/pluralize.js";
|
|
14
|
+
import { discreteSetParser } from "../../../../tree/parsers/discreteSetParser.js";
|
|
15
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
14
16
|
const getHint = () => {
|
|
15
17
|
return `Les solutions de l'équation $f(x) = g(x)$ sont les abscisses des points qui appartiennent à la fois à la courbe de $f$ et à celle de $g$.`;
|
|
16
18
|
};
|
|
@@ -147,13 +149,16 @@ const getPropositions = (n, { answer }) => {
|
|
|
147
149
|
});
|
|
148
150
|
return shuffleProps(propositions, n);
|
|
149
151
|
};
|
|
150
|
-
const isAnswerValid = (ans, {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
152
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
153
|
+
try {
|
|
154
|
+
const parsed = discreteSetParser(ans);
|
|
155
|
+
if (!parsed)
|
|
156
|
+
return false;
|
|
157
|
+
return ("S=" + parsed.simplify({ decimalToFractions: true }).toTex() === answer);
|
|
158
|
+
}
|
|
159
|
+
catch (err) {
|
|
160
|
+
return handleVEAError(err);
|
|
161
|
+
}
|
|
157
162
|
};
|
|
158
163
|
export const twoFunctionsEquation = {
|
|
159
164
|
id: "twoFunctionsEquation",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integralExpAxPlusB.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/integral/integralExpAxPlusB.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"integralExpAxPlusB.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/integral/integralExpAxPlusB.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAcrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AA0IF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAYpD,CAAC"}
|
|
@@ -8,6 +8,8 @@ import { AddNode } from "../../../../tree/nodes/operators/addNode.js";
|
|
|
8
8
|
import { FractionNode } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
9
9
|
import { MultiplyNode } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
10
10
|
import { SubstractNode } from "../../../../tree/nodes/operators/substractNode.js";
|
|
11
|
+
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
12
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
11
13
|
const getInstruction = (identifiers) => {
|
|
12
14
|
const { a, b, aX, bX } = identifiers;
|
|
13
15
|
const f = new Affine(aX, bX, "x");
|
|
@@ -53,9 +55,23 @@ const getPropositions = (n, { answer, a, b, aX, bX }) => {
|
|
|
53
55
|
});
|
|
54
56
|
return shuffleProps(propositions, n);
|
|
55
57
|
};
|
|
56
|
-
const isAnswerValid = (ans, { answer, ...identifiers }) => {
|
|
57
|
-
|
|
58
|
-
|
|
58
|
+
const isAnswerValid = (ans, { answer: _answer, ...identifiers }) => {
|
|
59
|
+
try {
|
|
60
|
+
const nodeAns = getAnswerNode(identifiers).simplify({
|
|
61
|
+
towardsDistribute: true,
|
|
62
|
+
forbidFactorize: true,
|
|
63
|
+
});
|
|
64
|
+
const parsed = parseAlgebraic(ans);
|
|
65
|
+
return (parsed
|
|
66
|
+
.simplify({
|
|
67
|
+
towardsDistribute: true,
|
|
68
|
+
forbidFactorize: true,
|
|
69
|
+
})
|
|
70
|
+
.toTex() === nodeAns.toTex());
|
|
71
|
+
}
|
|
72
|
+
catch (err) {
|
|
73
|
+
return handleVEAError(err);
|
|
74
|
+
}
|
|
59
75
|
};
|
|
60
76
|
const getAnswerNode = (identifiers) => {
|
|
61
77
|
const { a, b, aX, bX } = identifiers;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log10Simplifying.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/logarithm/log10Simplifying.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"log10Simplifying.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/logarithm/log10Simplifying.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAerC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAuLF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAiB9D,CAAC;AACF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAiB5D,CAAC"}
|
|
@@ -8,8 +8,10 @@ import { NumberNode } from "../../../../tree/nodes/numbers/numberNode.js";
|
|
|
8
8
|
import { AddNode } from "../../../../tree/nodes/operators/addNode.js";
|
|
9
9
|
import { MultiplyNode } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
10
10
|
import { power, PowerNode } from "../../../../tree/nodes/operators/powerNode.js";
|
|
11
|
+
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
11
12
|
import { operatorComposition } from "../../../../tree/utilities/operatorComposition.js";
|
|
12
13
|
import { random } from "../../../../utils/alea/random.js";
|
|
14
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
13
15
|
const getStatement = (identifiers, opts) => {
|
|
14
16
|
const { nb, powers, signs } = identifiers;
|
|
15
17
|
const nbNode = new NumberNode(nb);
|
|
@@ -126,12 +128,24 @@ ${getStatement(identifiers, opts).toTex()} = ${getAnswer(identifiers, opts)}
|
|
|
126
128
|
$$
|
|
127
129
|
`;
|
|
128
130
|
};
|
|
129
|
-
const isAnswerValid = (ans, { answer
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
131
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
132
|
+
try {
|
|
133
|
+
const rawNode = parseAlgebraic(answer);
|
|
134
|
+
const parsed = parseAlgebraic(ans);
|
|
135
|
+
return (parsed
|
|
136
|
+
.simplify({
|
|
137
|
+
forbidLogSimplify: true,
|
|
138
|
+
})
|
|
139
|
+
.toTex() ===
|
|
140
|
+
rawNode
|
|
141
|
+
.simplify({
|
|
142
|
+
forbidLogSimplify: true,
|
|
143
|
+
})
|
|
144
|
+
.toTex());
|
|
145
|
+
}
|
|
146
|
+
catch (err) {
|
|
147
|
+
return handleVEAError(err);
|
|
148
|
+
}
|
|
135
149
|
};
|
|
136
150
|
export const log10SumSimplifying = {
|
|
137
151
|
id: "log10SumSimplifying",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logSimplifiying.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/logarithm/logSimplifiying.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"logSimplifiying.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/logarithm/logSimplifiying.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAmBrC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAqIF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAcjD,CAAC"}
|
|
@@ -2,14 +2,16 @@ import { addValidProp, propWhile, tryToAddWrongProp, } from "../../../../exercis
|
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { Rational } from "../../../../math/numbers/rationals/rational.js";
|
|
4
4
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
5
|
-
import { logn, LogNode } from "../../../../tree/nodes/functions/logNode.js";
|
|
5
|
+
import { isLogNode, logn, LogNode, } from "../../../../tree/nodes/functions/logNode.js";
|
|
6
6
|
import { NumberNode } from "../../../../tree/nodes/numbers/numberNode.js";
|
|
7
7
|
import { AddNode } from "../../../../tree/nodes/operators/addNode.js";
|
|
8
8
|
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
9
9
|
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
10
10
|
import { SubstractNode } from "../../../../tree/nodes/operators/substractNode.js";
|
|
11
|
+
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
11
12
|
import { coinFlip } from "../../../../utils/alea/coinFlip.js";
|
|
12
13
|
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
14
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
13
15
|
const getStatementNode = (identifiers) => {
|
|
14
16
|
const { a, b, pm } = identifiers;
|
|
15
17
|
const opts = { allowLnOfOne: true };
|
|
@@ -110,16 +112,19 @@ const getPropositions = (n, { answer, pm }) => {
|
|
|
110
112
|
});
|
|
111
113
|
return shuffle(propositions);
|
|
112
114
|
};
|
|
113
|
-
const isAnswerValid = (ans, {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
115
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
116
|
+
try {
|
|
117
|
+
const parsed = parseAlgebraic(ans);
|
|
118
|
+
return (isLogNode(parsed) &&
|
|
119
|
+
parsed
|
|
120
|
+
.simplify({
|
|
121
|
+
forbidLogSimplify: true,
|
|
122
|
+
})
|
|
123
|
+
.toTex() === answer);
|
|
117
124
|
}
|
|
118
|
-
|
|
119
|
-
|
|
125
|
+
catch (err) {
|
|
126
|
+
return handleVEAError(err);
|
|
120
127
|
}
|
|
121
|
-
const texs = answer.toAllValidTexs();
|
|
122
|
-
return texs.includes(ans);
|
|
123
128
|
};
|
|
124
129
|
export const logSimplifiying = {
|
|
125
130
|
id: "logSimplifiying",
|
package/lib/exercises/math/functions/rationalFraction/rationalFractionForbiddenValue.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rationalFractionForbiddenValue.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/rationalFraction/rationalFractionForbiddenValue.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"rationalFractionForbiddenValue.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/rationalFraction/rationalFractionForbiddenValue.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAWrC,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;AAuGF,eAAO,MAAM,8BAA8B,EAAE,QAAQ,CAAC,WAAW,CAchE,CAAC"}
|
|
@@ -1,11 +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 { Affine } from "../../../../math/polynomials/affine.js";
|
|
5
6
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
6
7
|
import { equationResolutionTex } from "../../../../tree/nodes/equations/equalNode.js";
|
|
7
8
|
import { FractionNode } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
8
9
|
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
10
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
9
11
|
const getInstruction = (identifiers) => {
|
|
10
12
|
const { a, b, c, d } = identifiers;
|
|
11
13
|
const affine1 = new Affine(a, b);
|
|
@@ -81,12 +83,13 @@ const getPropositions = (n, { answer, a, b, d }) => {
|
|
|
81
83
|
});
|
|
82
84
|
return shuffle(propositions);
|
|
83
85
|
};
|
|
84
|
-
const isAnswerValid = (ans, {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
86
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
87
|
+
try {
|
|
88
|
+
return rationalVEA(ans, answer);
|
|
89
|
+
}
|
|
90
|
+
catch (err) {
|
|
91
|
+
return handleVEAError(err);
|
|
92
|
+
}
|
|
90
93
|
};
|
|
91
94
|
export const rationalFractionForbiddenValue = {
|
|
92
95
|
id: "rationalFractionForbiddenValue",
|
package/lib/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationFromCano.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solveSecondDegreeEquationFromCano.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationFromCano.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"solveSecondDegreeEquationFromCano.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationFromCano.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAerC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AA6IF,eAAO,MAAM,iCAAiC,EAAE,QAAQ,CAAC,WAAW,CAcnE,CAAC"}
|
|
@@ -10,6 +10,8 @@ import { frac } from "../../../../../tree/nodes/operators/fractionNode.js";
|
|
|
10
10
|
import { square } from "../../../../../tree/nodes/operators/powerNode.js";
|
|
11
11
|
import { substract } from "../../../../../tree/nodes/operators/substractNode.js";
|
|
12
12
|
import { DiscreteSetNode } from "../../../../../tree/nodes/sets/discreteSetNode.js";
|
|
13
|
+
import { discreteSetParser } from "../../../../../tree/parsers/discreteSetParser.js";
|
|
14
|
+
import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
|
|
13
15
|
import { alignTex } from "../../../../../utils/latex/alignTex.js";
|
|
14
16
|
const getInstruction = (identifiers) => {
|
|
15
17
|
const { coeffs } = identifiers;
|
|
@@ -116,14 +118,16 @@ const getPropositions = (n, { answer }) => {
|
|
|
116
118
|
});
|
|
117
119
|
return shuffleProps(propositions, n);
|
|
118
120
|
};
|
|
119
|
-
const isAnswerValid = (ans, {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
121
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
122
|
+
try {
|
|
123
|
+
const parsed = discreteSetParser(ans);
|
|
124
|
+
if (!parsed)
|
|
125
|
+
return false;
|
|
126
|
+
return ("S=" + parsed.simplify({ decimalToFractions: true }).toTex() === answer);
|
|
127
|
+
}
|
|
128
|
+
catch (err) {
|
|
129
|
+
return handleVEAError(err);
|
|
130
|
+
}
|
|
127
131
|
};
|
|
128
132
|
export const solveSecondDegreeEquationFromCano = {
|
|
129
133
|
id: "solveSecondDegreeEquationFromCano",
|
package/lib/exercises/math/functions/trinoms/summitAndCanonical/canonicalFromDevForm.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canonicalFromDevForm.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/summitAndCanonical/canonicalFromDevForm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"canonicalFromDevForm.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/summitAndCanonical/canonicalFromDevForm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAerC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAqOF,KAAK,OAAO,GAAG;IACb,cAAc,EACV,2BAA2B,GAC3B,kCAAkC,CAAC;CACxC,CAAC;AAWF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAgB/D,CAAC"}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { GeneratorOptionTarget, GeneratorOptionType, addValidProp, propWhile, tryToAddWrongProp, } from "../../../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { Trinom, TrinomConstructor } from "../../../../../math/polynomials/trinom.js";
|
|
4
|
+
import { isFactorizedNode } from "../../../../../tree/nodes/algebraicNode.js";
|
|
4
5
|
import { opposite } from "../../../../../tree/nodes/functions/oppositeNode.js";
|
|
5
6
|
import { add } 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
9
|
import { square } from "../../../../../tree/nodes/operators/powerNode.js";
|
|
9
10
|
import { substract } from "../../../../../tree/nodes/operators/substractNode.js";
|
|
11
|
+
import { parseAlgebraic } from "../../../../../tree/parsers/latexParser.js";
|
|
10
12
|
import { shuffle } from "../../../../../utils/alea/shuffle.js";
|
|
13
|
+
import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
|
|
11
14
|
import { alignTex } from "../../../../../utils/latex/alignTex.js";
|
|
12
15
|
const getInstruction = (identifiers) => {
|
|
13
16
|
const { a, b, c } = identifiers;
|
|
@@ -154,10 +157,24 @@ const getPropositions = (n, { answer, a }) => {
|
|
|
154
157
|
return shuffle(propositions);
|
|
155
158
|
};
|
|
156
159
|
const isAnswerValid = (ans, { a, b, c }) => {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
160
|
+
try {
|
|
161
|
+
const parsed = parseAlgebraic(ans);
|
|
162
|
+
const trinom = new Trinom(a, b, c);
|
|
163
|
+
const beta = trinom.getBetaNode();
|
|
164
|
+
const parsedWithoutBeta = substract(parsed, beta).simplify({
|
|
165
|
+
forbidFactorize: true,
|
|
166
|
+
});
|
|
167
|
+
return (isFactorizedNode(parsedWithoutBeta) &&
|
|
168
|
+
parsed
|
|
169
|
+
.simplify({
|
|
170
|
+
towardsDistribute: true,
|
|
171
|
+
forbidFactorize: true,
|
|
172
|
+
})
|
|
173
|
+
.toTex() === trinom.toTree().toTex());
|
|
174
|
+
}
|
|
175
|
+
catch (err) {
|
|
176
|
+
return handleVEAError(err);
|
|
177
|
+
}
|
|
161
178
|
};
|
|
162
179
|
const options = [
|
|
163
180
|
{
|
package/lib/exercises/math/functions/trinoms/summitAndCanonical/extremumFromCanonicalForm.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extremumFromCanonicalForm.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/summitAndCanonical/extremumFromCanonicalForm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAMrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;
|
|
1
|
+
{"version":3,"file":"extremumFromCanonicalForm.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/summitAndCanonical/extremumFromCanonicalForm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAMrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAgGF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAe3D,CAAC"}
|
package/lib/exercises/math/functions/trinoms/summitAndCanonical/extremumFromCanonicalForm.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { addValidProp, propWhile, tryToAddWrongProp, } from "../../../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { pointVEA } from "../../../../../exercises/vea/pointVEA.js";
|
|
3
4
|
import { Trinom, TrinomConstructor } from "../../../../../math/polynomials/trinom.js";
|
|
4
5
|
import { randint } from "../../../../../math/utils/random/randint.js";
|
|
5
|
-
import { PointNode } from "../../../../../tree/nodes/geometry/pointNode.js";
|
|
6
6
|
import { shuffle } from "../../../../../utils/alea/shuffle.js";
|
|
7
7
|
const getHint = () => {
|
|
8
8
|
return `La forme canonique d'une fonction polynôme du second degré est :
|
|
@@ -76,12 +76,9 @@ const getPropositions = (n, { answer, a, b, c }) => {
|
|
|
76
76
|
});
|
|
77
77
|
return shuffle(propositions);
|
|
78
78
|
};
|
|
79
|
-
const isAnswerValid = (ans, {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
const answer = new PointNode(sommet);
|
|
83
|
-
const texs = answer.toAllValidTexs();
|
|
84
|
-
return texs.includes(ans);
|
|
79
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
80
|
+
return (pointVEA(ans, answer) ||
|
|
81
|
+
pointVEA(ans.replace("S", ""), answer.replace("S", "")));
|
|
85
82
|
};
|
|
86
83
|
export const extremumFromCanonicalForm = {
|
|
87
84
|
id: "extremumFromCanonicalForm",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trinomialMeanValue.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/trinoms/trinomialMeanValue.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"trinomialMeanValue.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/trinoms/trinomialMeanValue.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AA6GF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAYpD,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 { Polynomial } from "../../../../math/polynomials/polynomial.js";
|
|
4
5
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
5
6
|
import { NumberNode } from "../../../../tree/nodes/numbers/numberNode.js";
|
|
@@ -73,11 +74,8 @@ const getPropositions = (n, { answer, quadrinomial, leftbound, rightbound }) =>
|
|
|
73
74
|
});
|
|
74
75
|
return shuffleProps(propositions, n);
|
|
75
76
|
};
|
|
76
|
-
const isAnswerValid = (ans, {
|
|
77
|
-
|
|
78
|
-
const validanswer = new MultiplyNode(new FractionNode(new NumberNode(1), (rightbound - leftbound).toTree()), (quadrinomial1.calculate(rightbound) - quadrinomial1.calculate(leftbound)).toTree()).simplify();
|
|
79
|
-
const latexs = validanswer.toAllValidTexs();
|
|
80
|
-
return latexs.includes(ans);
|
|
77
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
78
|
+
return rationalVEA(ans, answer);
|
|
81
79
|
};
|
|
82
80
|
export const trinomialMeanValue = {
|
|
83
81
|
id: "trinomialMeanValue",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"circleArea.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/areas/circleArea.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"circleArea.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/areas/circleArea.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAQrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAyGF,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,WAAW,CAgB5C,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { addValidProp, tryToAddWrongProp, propWhile, } 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 { coinFlip } from "../../../../utils/alea/coinFlip.js";
|
|
@@ -85,8 +86,9 @@ const getPropositions = (n, { answer }) => {
|
|
|
85
86
|
return shuffle(propositions);
|
|
86
87
|
};
|
|
87
88
|
const isAnswerValid = (ans, { answer }) => {
|
|
88
|
-
const
|
|
89
|
-
|
|
89
|
+
const trimed = ans.replace("\\text{cm}^2", "").replace("\\text{cm}^{2}", "");
|
|
90
|
+
const nb = answer.split("\\text")[0];
|
|
91
|
+
return numberVEA(trimed, nb);
|
|
90
92
|
};
|
|
91
93
|
export const circleArea = {
|
|
92
94
|
id: "circleArea",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rectangleArea.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/areas/rectangleArea.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"rectangleArea.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/areas/rectangleArea.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAKrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAmFF,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,WAAW,CAa/C,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 { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
5
6
|
const getKeys = () => ["cm", "cm2"];
|
|
@@ -56,8 +57,9 @@ const getPropositions = (n, { answer, length, width }) => {
|
|
|
56
57
|
return shuffle(propositions);
|
|
57
58
|
};
|
|
58
59
|
const isAnswerValid = (ans, { answer }) => {
|
|
59
|
-
const
|
|
60
|
-
|
|
60
|
+
const trimed = ans.replace("\\text{cm}^2", "").replace("\\text{cm}^{2}", "");
|
|
61
|
+
const nb = answer.split("\\text")[0];
|
|
62
|
+
return numberVEA(trimed, nb);
|
|
61
63
|
};
|
|
62
64
|
export const rectangleArea = {
|
|
63
65
|
id: "rectangleArea",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rightTriangleArea.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/areas/rightTriangleArea.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"rightTriangleArea.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/areas/rightTriangleArea.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAKrC,OAAO,EAEL,mBAAmB,EACpB,MAAM,2CAA2C,CAAC;AAOnD,KAAK,WAAW,GAAG;IACjB,YAAY;IAEZ,mBAAmB,EAAE,mBAAmB,CAAC;CAC1C,CAAC;AA4IF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAcnD,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 { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
|
|
4
5
|
import { RightTriangleConstructor } from "../../../../math/geometry/triangles/rightTriangle.js";
|
|
5
6
|
import { TriangleConstructor, } from "../../../../math/geometry/triangles/triangle.js";
|
|
6
|
-
import { Rational } from "../../../../math/numbers/rationals/rational.js";
|
|
7
7
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
8
8
|
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
9
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
9
10
|
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
10
11
|
const getInstruction = (identifiers) => {
|
|
11
12
|
const triangle = TriangleConstructor.fromIdentifiers(identifiers.triangleIdentifiers);
|
|
@@ -98,16 +99,18 @@ const getPropositions = (n, { answer }) => {
|
|
|
98
99
|
return shuffle(propositions);
|
|
99
100
|
};
|
|
100
101
|
const isAnswerValid = (ans, { answer }) => {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
102
|
+
try {
|
|
103
|
+
const trimed = ans
|
|
104
|
+
.replace("\\text{cm}^2", "")
|
|
105
|
+
.replace("\\text{cm}^{2}", "");
|
|
106
|
+
const answerTrimed = answer
|
|
107
|
+
.replace("\\text{cm}^2", "")
|
|
108
|
+
.replace("\\text{cm}^{2}", "");
|
|
109
|
+
return rationalVEA(trimed, answerTrimed);
|
|
110
|
+
}
|
|
111
|
+
catch (err) {
|
|
112
|
+
return handleVEAError(err);
|
|
113
|
+
}
|
|
111
114
|
};
|
|
112
115
|
export const rightTriangleArea = {
|
|
113
116
|
id: "rightTriangleArea",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"squareArea.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/areas/squareArea.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"squareArea.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/areas/squareArea.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAMrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAuEF,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,WAAW,CAc5C,CAAC"}
|