math-exercises 3.0.150 → 3.0.152
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/exercise.d.ts +5 -0
- package/lib/exercises/exercise.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/primeNumbersAffirmations.js +1 -1
- package/lib/exercises/math/calcul/fractions/fractionToPercentToDecimal.d.ts +5 -1
- package/lib/exercises/math/calcul/fractions/fractionToPercentToDecimal.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionToPercentToDecimal.js +92 -38
- package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.d.ts.map +1 -1
- package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.js +5 -1
- package/lib/exercises/math/calcul/proportionality/isTableProportional.d.ts.map +1 -1
- package/lib/exercises/math/calcul/proportionality/isTableProportional.js +7 -1
- package/lib/exercises/math/calcul/proportionality/isTableProportionalNonInteger.d.ts.map +1 -1
- package/lib/exercises/math/calcul/proportionality/isTableProportionalNonInteger.js +5 -1
- package/lib/exercises/math/calcul/proportionality/proportionalityTable.d.ts.map +1 -1
- package/lib/exercises/math/calcul/proportionality/proportionalityTable.js +5 -1
- package/lib/exercises/math/calcul/proportionality/proportionalityTableCoefficient.d.ts.map +1 -1
- package/lib/exercises/math/calcul/proportionality/proportionalityTableCoefficient.js +8 -2
- package/lib/exercises/math/calculLitteral/equation/equa1.d.ts +4 -1
- package/lib/exercises/math/calculLitteral/equation/equa1.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equa1.js +27 -7
- package/lib/exercises/math/calculLitteral/equation/equa2.d.ts +1 -0
- package/lib/exercises/math/calculLitteral/equation/equa2.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equa2.js +18 -1
- package/lib/exercises/math/calculLitteral/equation/equa3.d.ts +4 -1
- package/lib/exercises/math/calculLitteral/equation/equa3.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equa3.js +26 -6
- package/lib/exercises/math/calculLitteral/equation/equa4.d.ts +4 -1
- package/lib/exercises/math/calculLitteral/equation/equa4.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equa4.js +27 -7
- package/lib/exercises/math/calculLitteral/equation/firstDegree/equa1.d.ts +14 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/equa1.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/equa1.js +129 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/equa2.d.ts +18 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/equa2.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/equa2.js +167 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/equa3.d.ts +15 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/equa3.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/equa3.js +129 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/equa4.d.ts +16 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/equa4.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/equa4.js +124 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType1.d.ts +9 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType1.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType1.js +107 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType2.d.ts +10 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType2.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType2.js +108 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType3.d.ts +11 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType3.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType3.js +104 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/index.d.ts +8 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/index.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/index.js +7 -0
- package/lib/exercises/math/calculLitteral/equation/index.d.ts +1 -7
- package/lib/exercises/math/calculLitteral/equation/index.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/index.js +1 -7
- package/lib/exercises/math/dataRepresentations/histogram/etendueHistogram.d.ts +8 -0
- package/lib/exercises/math/dataRepresentations/histogram/etendueHistogram.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/histogram/etendueHistogram.js +175 -0
- package/lib/exercises/math/dataRepresentations/histogram/histogramCommenting.d.ts +9 -0
- package/lib/exercises/math/dataRepresentations/histogram/histogramCommenting.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/histogram/histogramCommenting.js +250 -0
- package/lib/exercises/math/dataRepresentations/histogram/histogramFillDataTableFromHistogramData.d.ts +9 -0
- package/lib/exercises/math/dataRepresentations/histogram/histogramFillDataTableFromHistogramData.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/histogram/histogramFillDataTableFromHistogramData.js +173 -0
- package/lib/exercises/math/dataRepresentations/histogram/histogramIsSameData.d.ts +14 -0
- package/lib/exercises/math/dataRepresentations/histogram/histogramIsSameData.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/histogram/histogramIsSameData.js +239 -0
- package/lib/exercises/math/dataRepresentations/histogram/histogramReading.d.ts +9 -0
- package/lib/exercises/math/dataRepresentations/histogram/histogramReading.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/histogram/histogramReading.js +163 -0
- package/lib/exercises/math/dataRepresentations/histogram/index.d.ts +6 -0
- package/lib/exercises/math/dataRepresentations/histogram/index.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/histogram/index.js +5 -0
- package/lib/exercises/math/dataRepresentations/index.d.ts +1 -1
- package/lib/exercises/math/dataRepresentations/index.d.ts.map +1 -1
- package/lib/exercises/math/dataRepresentations/index.js +1 -1
- package/lib/exercises/math/dataRepresentations/tableReading.d.ts.map +1 -1
- package/lib/exercises/math/dataRepresentations/tableReading.js +7 -0
- package/lib/exercises/math/functions/affines/affineAdjustment.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/affineAdjustment.js +7 -1
- package/lib/exercises/math/functions/affines/affineAdjustmentComplete.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/affineAdjustmentComplete.js +7 -1
- package/lib/exercises/math/functions/affines/affineAdjustmentRsquared.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/affineAdjustmentRsquared.js +7 -1
- package/lib/exercises/math/functions/affines/leadingCoeffAndOriginOrdinate.d.ts +4 -1
- package/lib/exercises/math/functions/affines/leadingCoeffAndOriginOrdinate.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/leadingCoeffAndOriginOrdinate.js +19 -4
- package/lib/exercises/math/functions/affines/leadingCoefficient.d.ts +1 -0
- package/lib/exercises/math/functions/affines/leadingCoefficient.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/leadingCoefficient.js +13 -1
- package/lib/exercises/math/functions/affines/recognizeAffineGraph.d.ts +4 -1
- package/lib/exercises/math/functions/affines/recognizeAffineGraph.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/recognizeAffineGraph.js +19 -4
- package/lib/exercises/math/functions/basics/inverseImageFunctionTable.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/inverseImageFunctionTable.js +7 -1
- package/lib/exercises/math/functions/basics/placePointsFromValueTable.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/placePointsFromValueTable.js +7 -0
- package/lib/exercises/math/geometry/euclidian/pythagoreOrThales.d.ts +4 -1
- package/lib/exercises/math/geometry/euclidian/pythagoreOrThales.d.ts.map +1 -1
- package/lib/exercises/math/geometry/euclidian/pythagoreOrThales.js +18 -3
- package/lib/exercises/math/geometry/triangles/index.d.ts +1 -0
- package/lib/exercises/math/geometry/triangles/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/triangles/index.js +1 -0
- package/lib/exercises/math/geometry/triangles/similar/index.d.ts +4 -0
- package/lib/exercises/math/geometry/triangles/similar/index.d.ts.map +1 -0
- package/lib/exercises/math/geometry/triangles/similar/index.js +3 -0
- package/lib/exercises/math/geometry/triangles/similar/isSimilarTrianglesWithAngles.d.ts +10 -0
- package/lib/exercises/math/geometry/triangles/similar/isSimilarTrianglesWithAngles.d.ts.map +1 -0
- package/lib/exercises/math/geometry/triangles/similar/isSimilarTrianglesWithAngles.js +122 -0
- package/lib/exercises/math/geometry/triangles/similar/isSimilarTrianglesWrtSideLengths.d.ts +15 -0
- package/lib/exercises/math/geometry/triangles/similar/isSimilarTrianglesWrtSideLengths.d.ts.map +1 -0
- package/lib/exercises/math/geometry/triangles/similar/isSimilarTrianglesWrtSideLengths.js +351 -0
- package/lib/exercises/math/geometry/triangles/similar/placeSegmentsOfSimilarTriangle.d.ts +11 -0
- package/lib/exercises/math/geometry/triangles/similar/placeSegmentsOfSimilarTriangle.d.ts.map +1 -0
- package/lib/exercises/math/geometry/triangles/similar/placeSegmentsOfSimilarTriangle.js +311 -0
- package/lib/exercises/math/probaStat/basicProbas/calculateProbaFromProbaLaw.d.ts +10 -0
- package/lib/exercises/math/probaStat/basicProbas/calculateProbaFromProbaLaw.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/basicProbas/calculateProbaFromProbaLaw.js +135 -0
- package/lib/exercises/math/probaStat/basicProbas/findEffectifFromProba.d.ts +9 -0
- package/lib/exercises/math/probaStat/basicProbas/findEffectifFromProba.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/basicProbas/findEffectifFromProba.js +109 -0
- package/lib/exercises/math/probaStat/basicProbas/getMissingProbabilityValue.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/basicProbas/getMissingProbabilityValue.js +7 -0
- package/lib/exercises/math/probaStat/basicProbas/getMissingProbabilityValueMiddleSchool.d.ts +9 -0
- package/lib/exercises/math/probaStat/basicProbas/getMissingProbabilityValueMiddleSchool.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/basicProbas/getMissingProbabilityValueMiddleSchool.js +120 -0
- package/lib/exercises/math/probaStat/basicProbas/index.d.ts +4 -0
- package/lib/exercises/math/probaStat/basicProbas/index.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/basicProbas/index.js +4 -0
- package/lib/exercises/math/probaStat/basicProbas/pickEquiprobableTo.d.ts +12 -0
- package/lib/exercises/math/probaStat/basicProbas/pickEquiprobableTo.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/basicProbas/pickEquiprobableTo.js +374 -0
- package/lib/exercises/math/probaStat/probaFromTableNoContext.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/probaFromTableNoContext.js +7 -0
- package/lib/exercises/math/probaStat/probaFromTableWithContext.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/probaFromTableWithContext.js +7 -0
- package/lib/exercises/math/probaStat/stats1var/averageWithTable.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/averageWithTable.js +7 -1
- package/lib/exercises/math/probaStat/stats1var/calculateMeanFromFrequencies.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/calculateMeanFromFrequencies.js +7 -0
- package/lib/exercises/math/probaStat/stats1var/cumulativeSum.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/cumulativeSum.js +7 -0
- package/lib/exercises/math/probaStat/stats1var/etendueTable.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/etendueTable.js +7 -1
- package/lib/exercises/math/probaStat/stats1var/getQuartileProportionQuestion.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/getQuartileProportionQuestion.js +7 -0
- package/lib/exercises/math/probaStat/stats1var/interquartilesTable.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/interquartilesTable.js +5 -1
- package/lib/exercises/math/probaStat/stats1var/marginalAndConditionalFrequency.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/marginalAndConditionalFrequency.js +7 -0
- package/lib/exercises/math/probaStat/stats1var/medianWithList.d.ts +2 -0
- package/lib/exercises/math/probaStat/stats1var/medianWithList.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/medianWithList.js +67 -14
- package/lib/exercises/math/probaStat/stats1var/medianWithTable.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/medianWithTable.js +7 -1
- package/lib/exercises/math/probaStat/stats1var/quartiles.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/quartiles.js +7 -1
- package/lib/exercises/math/probaStat/stats1var/standardDeviationTable.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/standardDeviationTable.js +5 -1
- package/lib/exercises/math/probaStat/stats1var/varianceTable.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/varianceTable.js +5 -1
- package/lib/exercises/math/probaStat/stats2var/averagePoint.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats2var/averagePoint.js +7 -1
- package/lib/exercises/math/probaStat/twoStepExperiments/headsOrTailsTwiceOutcomes.d.ts +7 -0
- package/lib/exercises/math/probaStat/twoStepExperiments/headsOrTailsTwiceOutcomes.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/twoStepExperiments/headsOrTailsTwiceOutcomes.js +171 -0
- package/lib/exercises/math/probaStat/twoStepExperiments/headsOrTailsTwiceProbas.d.ts +7 -0
- package/lib/exercises/math/probaStat/twoStepExperiments/headsOrTailsTwiceProbas.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/twoStepExperiments/headsOrTailsTwiceProbas.js +155 -0
- package/lib/exercises/math/probaStat/twoStepExperiments/index.d.ts +3 -0
- package/lib/exercises/math/probaStat/twoStepExperiments/index.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/twoStepExperiments/index.js +3 -0
- package/lib/exercises/math/probaStat/twoStepExperiments/numberPoolTwiceProbas.d.ts +7 -0
- package/lib/exercises/math/probaStat/twoStepExperiments/numberPoolTwiceProbas.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/twoStepExperiments/numberPoolTwiceProbas.js +189 -0
- package/lib/exercises/math/spaceGeometry/index.d.ts +1 -0
- package/lib/exercises/math/spaceGeometry/index.d.ts.map +1 -1
- package/lib/exercises/math/spaceGeometry/index.js +1 -0
- package/lib/exercises/math/spaceGeometry/sections/areaOfConeSection.d.ts +14 -0
- package/lib/exercises/math/spaceGeometry/sections/areaOfConeSection.d.ts.map +1 -0
- package/lib/exercises/math/spaceGeometry/sections/areaOfConeSection.js +439 -0
- package/lib/exercises/math/spaceGeometry/sections/areaOfCylinderSection.d.ts +14 -0
- package/lib/exercises/math/spaceGeometry/sections/areaOfCylinderSection.d.ts.map +1 -0
- package/lib/exercises/math/spaceGeometry/sections/areaOfCylinderSection.js +548 -0
- package/lib/exercises/math/spaceGeometry/sections/areaOfRectangularPrismSection.d.ts +11 -0
- package/lib/exercises/math/spaceGeometry/sections/areaOfRectangularPrismSection.d.ts.map +1 -0
- package/lib/exercises/math/spaceGeometry/sections/areaOfRectangularPrismSection.js +360 -0
- package/lib/exercises/math/spaceGeometry/sections/areaOfSphereSection.d.ts +9 -0
- package/lib/exercises/math/spaceGeometry/sections/areaOfSphereSection.d.ts.map +1 -0
- package/lib/exercises/math/spaceGeometry/sections/areaOfSphereSection.js +272 -0
- package/lib/exercises/math/spaceGeometry/sections/index.d.ts +9 -0
- package/lib/exercises/math/spaceGeometry/sections/index.d.ts.map +1 -0
- package/lib/exercises/math/spaceGeometry/sections/index.js +8 -0
- package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfCone.d.ts +11 -0
- package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfCone.d.ts.map +1 -0
- package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfCone.js +266 -0
- package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfCylinder.d.ts +11 -0
- package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfCylinder.d.ts.map +1 -0
- package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfCylinder.js +236 -0
- package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfRectangularPrism.d.ts +7 -0
- package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfRectangularPrism.d.ts.map +1 -0
- package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfRectangularPrism.js +92 -0
- package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfSphereOrBall.d.ts +9 -0
- package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfSphereOrBall.d.ts.map +1 -0
- package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfSphereOrBall.js +236 -0
- package/lib/exercises/pc/mathExosInPC.d.ts +4 -4
- package/lib/exercises/pc/mathExosInPC.d.ts.map +1 -1
- package/lib/exercises/pc/mathExosInPC.js +4 -4
- package/lib/index.d.ts +173 -45
- package/lib/index.d.ts.map +1 -1
- package/lib/math/geometry/spacePoint.d.ts +10 -0
- package/lib/math/geometry/spacePoint.d.ts.map +1 -1
- package/lib/math/geometry/spacePoint.js +13 -0
- package/lib/tree/nodes/operators/substractNode.d.ts +1 -0
- package/lib/tree/nodes/operators/substractNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/substractNode.js +6 -0
- package/package.json +1 -1
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { GeneratorOptionTarget, GeneratorOptionType, addValidProp, propWhile, tryToAddWrongProp, } from "../../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { Rational } from "../../../../../math/numbers/rationals/rational.js";
|
|
4
|
+
import { Affine } from "../../../../../math/polynomials/affine.js";
|
|
5
|
+
import { randint } from "../../../../../math/utils/random/randint.js";
|
|
6
|
+
import { EqualNode, equationResolutionTex, } from "../../../../../tree/nodes/equations/equalNode.js";
|
|
7
|
+
import { VariableNode } from "../../../../../tree/nodes/variables/variableNode.js";
|
|
8
|
+
import { shuffle } from "../../../../../utils/alea/shuffle.js";
|
|
9
|
+
import { equationVEA } from "../../../../../exercises/vea/equationVEA.js";
|
|
10
|
+
import { frac } from "../../../../../tree/nodes/operators/fractionNode.js";
|
|
11
|
+
import { equationKeys } from "../../../../../exercises/utils/keys/equationKeys.js";
|
|
12
|
+
const getStatementNode = (identifiers) => {
|
|
13
|
+
const { a, b, c, d } = identifiers;
|
|
14
|
+
const affines = [new Affine(a, b), new Affine(c, d)];
|
|
15
|
+
const statementTree = new EqualNode(affines[0].toTree(), affines[1].toTree());
|
|
16
|
+
return statementTree;
|
|
17
|
+
};
|
|
18
|
+
const getInstruction = (identifiers) => {
|
|
19
|
+
return `Résoudre :
|
|
20
|
+
|
|
21
|
+
$$
|
|
22
|
+
${getStatementNode(identifiers).toTex()}
|
|
23
|
+
$$`;
|
|
24
|
+
};
|
|
25
|
+
const getStartStatement = (identifiers) => {
|
|
26
|
+
return getStatementNode(identifiers).toTex();
|
|
27
|
+
};
|
|
28
|
+
const getAnswer = (identifiers) => {
|
|
29
|
+
const { a, b, c, d } = identifiers;
|
|
30
|
+
const solution = new Rational(d - b, a - c).simplify();
|
|
31
|
+
const answerTree = new EqualNode(new VariableNode("x"), solution.toTree());
|
|
32
|
+
const answer = answerTree.toTex();
|
|
33
|
+
return answer;
|
|
34
|
+
};
|
|
35
|
+
const getEquationType4ExerciseQuestion = (opts) => {
|
|
36
|
+
const a = randint(-10, 11, [0, 1]);
|
|
37
|
+
const b = randint(-10, 11, [0]);
|
|
38
|
+
const c = randint(-10, 11, [0, a]);
|
|
39
|
+
const d = randint(-10, 11, [0]);
|
|
40
|
+
const identifiers = {
|
|
41
|
+
a,
|
|
42
|
+
b,
|
|
43
|
+
c,
|
|
44
|
+
d,
|
|
45
|
+
};
|
|
46
|
+
return getQuestionFromIdentifiers(identifiers, opts);
|
|
47
|
+
};
|
|
48
|
+
const getKeys = (_identifiers, opts) => {
|
|
49
|
+
if (opts?.solutionFormat === "Ensemble") {
|
|
50
|
+
return ["S", "equal", "lbrace", "semicolon", "rbrace", "varnothing"];
|
|
51
|
+
}
|
|
52
|
+
if (opts?.solutionFormat === "$x=\\ldots$") {
|
|
53
|
+
return ["x", "equal"];
|
|
54
|
+
}
|
|
55
|
+
return equationKeys;
|
|
56
|
+
};
|
|
57
|
+
const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
58
|
+
const question = {
|
|
59
|
+
instruction: getInstruction(identifiers),
|
|
60
|
+
startStatement: getStartStatement(identifiers),
|
|
61
|
+
answer: getAnswer(identifiers),
|
|
62
|
+
keys: getKeys(identifiers, opts),
|
|
63
|
+
answerFormat: "tex",
|
|
64
|
+
identifiers,
|
|
65
|
+
hint: getHint(identifiers),
|
|
66
|
+
correction: getCorrection(identifiers),
|
|
67
|
+
};
|
|
68
|
+
return question;
|
|
69
|
+
};
|
|
70
|
+
const getHint = () => {
|
|
71
|
+
return `Commence par regrouper les termes en $x$ d'un même côté de l'équation. Puis isole $x$ en effectuant les bonnes opérations.`;
|
|
72
|
+
};
|
|
73
|
+
const getCorrection = (identifiers) => {
|
|
74
|
+
const { a, b, c, d } = identifiers;
|
|
75
|
+
return `On regroupe les nombres d'un côté, et les termes en $x$ de l'autre :
|
|
76
|
+
|
|
77
|
+
$$
|
|
78
|
+
${equationResolutionTex(a.toTree(), b.toTree(), c.toTree(), d.toTree())}
|
|
79
|
+
$$`;
|
|
80
|
+
};
|
|
81
|
+
const getPropositions = (n, { answer, a, b, c, d }) => {
|
|
82
|
+
const propositions = [];
|
|
83
|
+
addValidProp(propositions, answer);
|
|
84
|
+
propWhile(propositions, n, () => {
|
|
85
|
+
const wrongAnswer = new Rational(d - b + randint(-7, 8, [0, -d + b]), a - c + randint(-7, 8, [-a + c, 0])).simplify();
|
|
86
|
+
tryToAddWrongProp(propositions, new EqualNode(new VariableNode("x"), wrongAnswer.toTree()).toTex());
|
|
87
|
+
});
|
|
88
|
+
return shuffle(propositions);
|
|
89
|
+
};
|
|
90
|
+
const isAnswerValid = (ans, { a, b, c, d }) => {
|
|
91
|
+
const solution = frac(d - b, a - c)
|
|
92
|
+
.simplify()
|
|
93
|
+
.toTex();
|
|
94
|
+
return equationVEA(ans, solution);
|
|
95
|
+
};
|
|
96
|
+
const options = [
|
|
97
|
+
{
|
|
98
|
+
id: "solutionFormat",
|
|
99
|
+
label: "Donner la solution sous la forme :",
|
|
100
|
+
target: GeneratorOptionTarget.generation,
|
|
101
|
+
type: GeneratorOptionType.select,
|
|
102
|
+
values: ["Ensemble", "$x=\\ldots$", "Permettre les deux"],
|
|
103
|
+
defaultValue: "Permettre les deux",
|
|
104
|
+
},
|
|
105
|
+
];
|
|
106
|
+
export const equationType4Exercise = {
|
|
107
|
+
id: "equa4",
|
|
108
|
+
connector: "\\iff",
|
|
109
|
+
label: "Résoudre une équation du type $ax+b=cx+d$",
|
|
110
|
+
isSingleStep: false,
|
|
111
|
+
generator: (nb, opts) => getDistinctQuestions(() => getEquationType4ExerciseQuestion(opts), nb),
|
|
112
|
+
qcmTimer: 60,
|
|
113
|
+
freeTimer: 60,
|
|
114
|
+
getPropositions,
|
|
115
|
+
isAnswerValid,
|
|
116
|
+
subject: "Mathématiques",
|
|
117
|
+
getInstruction,
|
|
118
|
+
getAnswer,
|
|
119
|
+
getQuestionFromIdentifiers,
|
|
120
|
+
getHint,
|
|
121
|
+
getCorrection,
|
|
122
|
+
hasHintAndCorrection: true,
|
|
123
|
+
options,
|
|
124
|
+
};
|
package/lib/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType1.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Exercise } from "../../../../../exercises/exercise.js";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
a: number;
|
|
4
|
+
b: number;
|
|
5
|
+
x: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const firstDegreeEquationIntType1: Exercise<Identifiers>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=firstDegreeEquationIntType1.d.ts.map
|
package/lib/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType1.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"firstDegreeEquationIntType1.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType1.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;CACX,CAAC;AAqHF,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,WAAW,CAa7D,CAAC"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { addValidProp, propWhile, shuffleProps, tryToAddWrongProp, } from "../../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { equationVEA } from "../../../../../exercises/vea/equationVEA.js";
|
|
4
|
+
import { Affine } from "../../../../../math/polynomials/affine.js";
|
|
5
|
+
import { randint } from "../../../../../math/utils/random/randint.js";
|
|
6
|
+
import { EqualNode } from "../../../../../tree/nodes/equations/equalNode.js";
|
|
7
|
+
import { NumberNode } from "../../../../../tree/nodes/numbers/numberNode.js";
|
|
8
|
+
import { FractionNode } from "../../../../../tree/nodes/operators/fractionNode.js";
|
|
9
|
+
import { VariableNode } from "../../../../../tree/nodes/variables/variableNode.js";
|
|
10
|
+
import { alignTex } from "../../../../../utils/latex/alignTex.js";
|
|
11
|
+
//ax = b
|
|
12
|
+
const getAnswer = (identifiers) => {
|
|
13
|
+
const { x } = identifiers;
|
|
14
|
+
const answer = new EqualNode(new VariableNode("x"), x.toTree()).toTex();
|
|
15
|
+
return answer;
|
|
16
|
+
};
|
|
17
|
+
const getCorrection = (identifiers) => {
|
|
18
|
+
const { a, b } = identifiers;
|
|
19
|
+
const answer = getAnswer(identifiers);
|
|
20
|
+
const aMonom = new Affine(a, 0).toTree();
|
|
21
|
+
const statementTex = new EqualNode(aMonom, new NumberNode(b)).toTex();
|
|
22
|
+
return `Pour isoler $x$ à gauche, on divise les deux côtés de l'équation par $${a}$:
|
|
23
|
+
|
|
24
|
+
${alignTex([
|
|
25
|
+
[
|
|
26
|
+
`${statementTex}`,
|
|
27
|
+
"\\iff",
|
|
28
|
+
new EqualNode(new FractionNode(aMonom, new NumberNode(a)), new FractionNode(b.toTree(), new NumberNode(a))).toTex(),
|
|
29
|
+
],
|
|
30
|
+
["", "\\iff", answer],
|
|
31
|
+
])}
|
|
32
|
+
`;
|
|
33
|
+
};
|
|
34
|
+
const getInstruction = (identifiers) => {
|
|
35
|
+
const { a, b } = identifiers;
|
|
36
|
+
const aMonom = new Affine(a, 0).toTree();
|
|
37
|
+
const statementTex = new EqualNode(aMonom, new NumberNode(b)).toTex();
|
|
38
|
+
return `Résoudre l'équation suivante :
|
|
39
|
+
|
|
40
|
+
$$
|
|
41
|
+
${statementTex}
|
|
42
|
+
$$`;
|
|
43
|
+
};
|
|
44
|
+
const getHint = (identifiers) => {
|
|
45
|
+
const { a } = identifiers;
|
|
46
|
+
return `Il faut isoler $x$ à gauche. Pour cela, effectue des deux côtés de l'équation l'opération qui permet de supprimer la multiplication par $${a}$.`;
|
|
47
|
+
};
|
|
48
|
+
const getFirstDegreeEquationIntQuestion = () => {
|
|
49
|
+
const a = randint(-15, 15, [0, 1]);
|
|
50
|
+
const x = randint(-15, 15, [0]);
|
|
51
|
+
const b = a * x;
|
|
52
|
+
const identifiers = { a: a, x: x, b: b };
|
|
53
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
54
|
+
};
|
|
55
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
56
|
+
const question = {
|
|
57
|
+
answer: getAnswer(identifiers),
|
|
58
|
+
instruction: getInstruction(identifiers),
|
|
59
|
+
keys: ["x", "equal"],
|
|
60
|
+
answerFormat: "tex",
|
|
61
|
+
identifiers,
|
|
62
|
+
hint: getHint(identifiers),
|
|
63
|
+
correction: getCorrection(identifiers),
|
|
64
|
+
};
|
|
65
|
+
return question;
|
|
66
|
+
};
|
|
67
|
+
const getPropositions = (n, { answer, a, b }) => {
|
|
68
|
+
const propositions = [];
|
|
69
|
+
addValidProp(propositions, answer);
|
|
70
|
+
const w1 = b - a;
|
|
71
|
+
const w2 = b + a;
|
|
72
|
+
let w3 = 0;
|
|
73
|
+
if (b !== 0) {
|
|
74
|
+
w3 = Math.floor(a / b);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
w3 = Math.floor(randint(-10, 10));
|
|
78
|
+
}
|
|
79
|
+
const wrongAnswer1 = new EqualNode(new VariableNode("x"), w1.toTree()).toTex();
|
|
80
|
+
const wrongAnswer2 = new EqualNode(new VariableNode("x"), w2.toTree()).toTex();
|
|
81
|
+
const wrongAnswer3 = new EqualNode(new VariableNode("x"), w3.toTree()).toTex();
|
|
82
|
+
tryToAddWrongProp(propositions, wrongAnswer1);
|
|
83
|
+
tryToAddWrongProp(propositions, wrongAnswer2);
|
|
84
|
+
tryToAddWrongProp(propositions, wrongAnswer3);
|
|
85
|
+
propWhile(propositions, n, () => {
|
|
86
|
+
const random = randint(-10, 10);
|
|
87
|
+
const wrongAnswer = new EqualNode(new VariableNode("x"), random.toTree()).toTex();
|
|
88
|
+
tryToAddWrongProp(propositions, wrongAnswer);
|
|
89
|
+
});
|
|
90
|
+
return shuffleProps(propositions, n);
|
|
91
|
+
};
|
|
92
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
93
|
+
return equationVEA(ans, answer.split("=")[1]);
|
|
94
|
+
};
|
|
95
|
+
export const firstDegreeEquationIntType1 = {
|
|
96
|
+
id: "firstDegreeEquationIntType1",
|
|
97
|
+
label: "Résoudre une équation du type $ax = b$ (solution entière)",
|
|
98
|
+
isSingleStep: true,
|
|
99
|
+
generator: (nb) => getDistinctQuestions(getFirstDegreeEquationIntQuestion, nb),
|
|
100
|
+
qcmTimer: 60,
|
|
101
|
+
freeTimer: 60,
|
|
102
|
+
getPropositions,
|
|
103
|
+
isAnswerValid,
|
|
104
|
+
subject: "Mathématiques",
|
|
105
|
+
hasHintAndCorrection: true,
|
|
106
|
+
getQuestionFromIdentifiers,
|
|
107
|
+
};
|
package/lib/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType2.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Exercise } from "../../../../../exercises/exercise.js";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
a: number;
|
|
4
|
+
x: number;
|
|
5
|
+
b: number;
|
|
6
|
+
c: number;
|
|
7
|
+
};
|
|
8
|
+
export declare const firstDegreeEquationIntType2: Exercise<Identifiers>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=firstDegreeEquationIntType2.d.ts.map
|
package/lib/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType2.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"firstDegreeEquationIntType2.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType2.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAkIF,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,WAAW,CAa7D,CAAC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { addValidProp, propWhile, shuffleProps, tryToAddWrongProp, } from "../../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { equationVEA } from "../../../../../exercises/vea/equationVEA.js";
|
|
4
|
+
import { randint } from "../../../../../math/utils/random/randint.js";
|
|
5
|
+
import { EqualNode } from "../../../../../tree/nodes/equations/equalNode.js";
|
|
6
|
+
import { AddNode } from "../../../../../tree/nodes/operators/addNode.js";
|
|
7
|
+
import { FractionNode } from "../../../../../tree/nodes/operators/fractionNode.js";
|
|
8
|
+
import { MultiplyNode } from "../../../../../tree/nodes/operators/multiplyNode.js";
|
|
9
|
+
import { VariableNode } from "../../../../../tree/nodes/variables/variableNode.js";
|
|
10
|
+
import { alignTex } from "../../../../../utils/latex/alignTex.js";
|
|
11
|
+
//ax +b = c
|
|
12
|
+
const getInstruction = (identifiers) => {
|
|
13
|
+
const { a, b, c } = identifiers;
|
|
14
|
+
const equation = new EqualNode(new AddNode(new MultiplyNode(a.toTree(), new VariableNode("x")), b.toTree()).simplify({ forbidFactorize: true }), c.toTree());
|
|
15
|
+
const statementTex = equation.toTex();
|
|
16
|
+
return `Résoudre l'équation suivante :
|
|
17
|
+
|
|
18
|
+
$$
|
|
19
|
+
${statementTex}
|
|
20
|
+
$$`;
|
|
21
|
+
};
|
|
22
|
+
const getHint = () => {
|
|
23
|
+
return "Isole le terme $x$ dans le membre gauche de l'équation.";
|
|
24
|
+
};
|
|
25
|
+
const getCorrection = (identifiers) => {
|
|
26
|
+
const { a, b, c } = identifiers;
|
|
27
|
+
const equation = new EqualNode(new AddNode(new MultiplyNode(a.toTree(), new VariableNode("x")), b.toTree()).simplify({ forbidFactorize: true }), c.toTree());
|
|
28
|
+
const statementTex = equation.toTex();
|
|
29
|
+
const answer = getAnswer(identifiers);
|
|
30
|
+
return `On commence par soustraire $${b}$ des deux côtés de l'équation pour l'éliminer du côté gauche. Ensuite, on divise les deux côtés de l'équation par $${a}$ pour isoler $x$.
|
|
31
|
+
|
|
32
|
+
${alignTex([
|
|
33
|
+
[
|
|
34
|
+
statementTex,
|
|
35
|
+
"\\iff",
|
|
36
|
+
new EqualNode(new MultiplyNode(a.toTree(), new VariableNode("x")), (c - b).toTree()).toTex(),
|
|
37
|
+
],
|
|
38
|
+
["", "\\iff", answer],
|
|
39
|
+
])}`;
|
|
40
|
+
};
|
|
41
|
+
const getAnswer = (identifiers) => {
|
|
42
|
+
const { x } = identifiers;
|
|
43
|
+
const answer = new EqualNode(new VariableNode("x"), x.toTree()).toTex();
|
|
44
|
+
return answer;
|
|
45
|
+
};
|
|
46
|
+
const getFirstDegreeEquationIntQuestion = () => {
|
|
47
|
+
const a = randint(-15, 15, [0, 1]);
|
|
48
|
+
const x = randint(-15, 15, [0]);
|
|
49
|
+
const c = randint(-15, 15, [0, a * x]);
|
|
50
|
+
const b = c - a * x;
|
|
51
|
+
const identifiers = { a, b, c, x };
|
|
52
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
53
|
+
};
|
|
54
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
55
|
+
const question = {
|
|
56
|
+
answer: getAnswer(identifiers),
|
|
57
|
+
instruction: getInstruction(identifiers),
|
|
58
|
+
keys: ["x", "equal"],
|
|
59
|
+
answerFormat: "tex",
|
|
60
|
+
identifiers,
|
|
61
|
+
hint: getHint(identifiers),
|
|
62
|
+
correction: getCorrection(identifiers),
|
|
63
|
+
};
|
|
64
|
+
return question;
|
|
65
|
+
};
|
|
66
|
+
const getPropositions = (n, { answer, a, b, c }) => {
|
|
67
|
+
const propositions = [];
|
|
68
|
+
addValidProp(propositions, answer);
|
|
69
|
+
const w1 = b - c - a;
|
|
70
|
+
let wrongAnswer2 = "";
|
|
71
|
+
if (b !== c) {
|
|
72
|
+
// Assurez-vous que b - c n'est pas zéro
|
|
73
|
+
const w2 = new FractionNode(a.toTree(), (b - c).toTree()).simplify();
|
|
74
|
+
wrongAnswer2 = new EqualNode(new VariableNode("x"), w2).toTex();
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
// Fournir une réponse alternative ou invalide si b - c est zéro
|
|
78
|
+
wrongAnswer2 = new EqualNode(new VariableNode("x"), randint(-10, 10).toTree()).toTex();
|
|
79
|
+
}
|
|
80
|
+
const w3 = b !== 0 ? Math.floor(c / b - a) : Math.floor(randint(-10, 10));
|
|
81
|
+
const wrongAnswer1 = new EqualNode(new VariableNode("x"), w1.toTree()).toTex();
|
|
82
|
+
const wrongAnswer3 = new EqualNode(new VariableNode("x"), w3.toTree()).toTex();
|
|
83
|
+
tryToAddWrongProp(propositions, wrongAnswer1);
|
|
84
|
+
tryToAddWrongProp(propositions, wrongAnswer2);
|
|
85
|
+
tryToAddWrongProp(propositions, wrongAnswer3);
|
|
86
|
+
propWhile(propositions, n, () => {
|
|
87
|
+
const random = randint(-15, 15);
|
|
88
|
+
const wrongAnswer = new EqualNode(new VariableNode("x"), random.toTree()).toTex();
|
|
89
|
+
tryToAddWrongProp(propositions, wrongAnswer);
|
|
90
|
+
});
|
|
91
|
+
return shuffleProps(propositions, n);
|
|
92
|
+
};
|
|
93
|
+
const isAnswerValid = (ans, { x }) => {
|
|
94
|
+
return equationVEA(ans, x.toTree().toTex());
|
|
95
|
+
};
|
|
96
|
+
export const firstDegreeEquationIntType2 = {
|
|
97
|
+
id: "firstDegreeEquationIntType2",
|
|
98
|
+
label: "Résoudre une équation du type $ax + b = c$ (solution entière)",
|
|
99
|
+
isSingleStep: true,
|
|
100
|
+
generator: (nb) => getDistinctQuestions(getFirstDegreeEquationIntQuestion, nb),
|
|
101
|
+
qcmTimer: 60,
|
|
102
|
+
freeTimer: 60,
|
|
103
|
+
getPropositions,
|
|
104
|
+
isAnswerValid,
|
|
105
|
+
subject: "Mathématiques",
|
|
106
|
+
hasHintAndCorrection: true,
|
|
107
|
+
getQuestionFromIdentifiers,
|
|
108
|
+
};
|
package/lib/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType3.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Exercise } from "../../../../../exercises/exercise.js";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
a: number;
|
|
4
|
+
x: number;
|
|
5
|
+
b: number;
|
|
6
|
+
c: number;
|
|
7
|
+
d: number;
|
|
8
|
+
};
|
|
9
|
+
export declare const firstDegreeEquationIntType3: Exercise<Identifiers>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=firstDegreeEquationIntType3.d.ts.map
|
package/lib/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType3.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"firstDegreeEquationIntType3.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType3.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;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAyHF,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,WAAW,CAa7D,CAAC"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { addValidProp, propWhile, shuffleProps, tryToAddWrongProp, } from "../../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { equationVEA } from "../../../../../exercises/vea/equationVEA.js";
|
|
4
|
+
import { randint } from "../../../../../math/utils/random/randint.js";
|
|
5
|
+
import { EqualNode, equationResolutionTex, } from "../../../../../tree/nodes/equations/equalNode.js";
|
|
6
|
+
import { AddNode } from "../../../../../tree/nodes/operators/addNode.js";
|
|
7
|
+
import { FractionNode } from "../../../../../tree/nodes/operators/fractionNode.js";
|
|
8
|
+
import { MultiplyNode } from "../../../../../tree/nodes/operators/multiplyNode.js";
|
|
9
|
+
import { VariableNode } from "../../../../../tree/nodes/variables/variableNode.js";
|
|
10
|
+
//ax+b = cx+d
|
|
11
|
+
const getInstruction = (identifiers) => {
|
|
12
|
+
const { a, b, c, d } = identifiers;
|
|
13
|
+
const equation = new EqualNode(new AddNode(new MultiplyNode(a.toTree(), new VariableNode("x")), b.toTree()).simplify({ forbidFactorize: true }), new AddNode(new MultiplyNode(c.toTree(), new VariableNode("x")), d.toTree()).simplify({ forbidFactorize: true }));
|
|
14
|
+
return `Résoudre l'équation suivante :
|
|
15
|
+
|
|
16
|
+
$$
|
|
17
|
+
${equation.toTex()}
|
|
18
|
+
$$`;
|
|
19
|
+
};
|
|
20
|
+
const getAnswer = (identifiers) => {
|
|
21
|
+
const { x } = identifiers;
|
|
22
|
+
const answer = new EqualNode(new VariableNode("x"), x.toTree()).toTex();
|
|
23
|
+
return answer;
|
|
24
|
+
};
|
|
25
|
+
const getHint = () => {
|
|
26
|
+
return `Commence par regrouper les termes en $x$ d'un même côté de l'équation. Puis isole $x$ en effectuant les bonnes opérations.`;
|
|
27
|
+
};
|
|
28
|
+
const getCorrection = (identifiers) => {
|
|
29
|
+
const { a, b, c, d } = identifiers;
|
|
30
|
+
return `On regroupe les nombres d'un côté, et les termes en $x$ de l'autre :
|
|
31
|
+
|
|
32
|
+
$$
|
|
33
|
+
${equationResolutionTex(a.toTree(), b.toTree(), c.toTree(), d.toTree())}
|
|
34
|
+
$$`;
|
|
35
|
+
};
|
|
36
|
+
const getFirstDegreeEquationIntQuestion = () => {
|
|
37
|
+
const a = randint(-15, 15, [0]);
|
|
38
|
+
const x = randint(-15, 15, [0]);
|
|
39
|
+
const c = randint(-15, 15, [0, a]);
|
|
40
|
+
const d = randint(-15, 15, [0]);
|
|
41
|
+
const b = d - (a - c) * x;
|
|
42
|
+
const identifiers = { a: a, x: x, b: b, c: c, d: d };
|
|
43
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
44
|
+
};
|
|
45
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
46
|
+
const question = {
|
|
47
|
+
answer: getAnswer(identifiers),
|
|
48
|
+
instruction: getInstruction(identifiers),
|
|
49
|
+
keys: ["x", "equal"],
|
|
50
|
+
answerFormat: "tex",
|
|
51
|
+
identifiers,
|
|
52
|
+
hint: getHint(identifiers),
|
|
53
|
+
correction: getCorrection(identifiers),
|
|
54
|
+
};
|
|
55
|
+
return question;
|
|
56
|
+
};
|
|
57
|
+
const getPropositions = (n, { answer, a, b, c, d }) => {
|
|
58
|
+
const propositions = [];
|
|
59
|
+
addValidProp(propositions, answer);
|
|
60
|
+
const denomW1 = a - c;
|
|
61
|
+
let wrongAnswer1 = "";
|
|
62
|
+
if (denomW1 !== 0) {
|
|
63
|
+
const w1 = new FractionNode((d - b).toTree(), denomW1.toTree()).simplify();
|
|
64
|
+
wrongAnswer1 = new EqualNode(new VariableNode("x"), w1).toTex();
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
wrongAnswer1 = new EqualNode(new VariableNode("x"), randint(-10, 10).toTree()).toTex();
|
|
68
|
+
}
|
|
69
|
+
const denomW2 = b + d;
|
|
70
|
+
let wrongAnswer2 = "";
|
|
71
|
+
if (denomW2 !== 0) {
|
|
72
|
+
const w2 = new FractionNode((a + c).toTree(), denomW2.toTree()).simplify();
|
|
73
|
+
wrongAnswer2 = new EqualNode(new VariableNode("x"), w2).toTex();
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
wrongAnswer2 = new EqualNode(new VariableNode("x"), randint(-10, 10).toTree()).toTex();
|
|
77
|
+
}
|
|
78
|
+
const wrongAnswer3 = new EqualNode(new VariableNode("x"), Math.floor((a + c) / (denomW1 === 0 ? 1 : denomW1)).toTree()).toTex();
|
|
79
|
+
tryToAddWrongProp(propositions, wrongAnswer1);
|
|
80
|
+
tryToAddWrongProp(propositions, wrongAnswer2);
|
|
81
|
+
tryToAddWrongProp(propositions, wrongAnswer3);
|
|
82
|
+
propWhile(propositions, n, () => {
|
|
83
|
+
const random = randint(-10, 10);
|
|
84
|
+
const wrongAnswer = new EqualNode(new VariableNode("x"), random.toTree()).toTex();
|
|
85
|
+
tryToAddWrongProp(propositions, wrongAnswer);
|
|
86
|
+
});
|
|
87
|
+
return shuffleProps(propositions, n);
|
|
88
|
+
};
|
|
89
|
+
const isAnswerValid = (ans, { x }) => {
|
|
90
|
+
return equationVEA(ans, x.toTree().toTex());
|
|
91
|
+
};
|
|
92
|
+
export const firstDegreeEquationIntType3 = {
|
|
93
|
+
id: "firstDegreeEquationIntType3",
|
|
94
|
+
label: "Résoudre une équation du type $ax + b = cx + d$ (solution entière)",
|
|
95
|
+
isSingleStep: true,
|
|
96
|
+
generator: (nb) => getDistinctQuestions(getFirstDegreeEquationIntQuestion, nb),
|
|
97
|
+
qcmTimer: 60,
|
|
98
|
+
freeTimer: 60,
|
|
99
|
+
getPropositions,
|
|
100
|
+
isAnswerValid,
|
|
101
|
+
subject: "Mathématiques",
|
|
102
|
+
getQuestionFromIdentifiers,
|
|
103
|
+
hasHintAndCorrection: true,
|
|
104
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from "./equa1.js";
|
|
2
|
+
export * from "./equa2.js";
|
|
3
|
+
export * from "./equa3.js";
|
|
4
|
+
export * from "./equa4.js";
|
|
5
|
+
export * from "./firstDegreeEquationIntType1.js";
|
|
6
|
+
export * from "./firstDegreeEquationIntType2.js";
|
|
7
|
+
export * from "./firstDegreeEquationIntType3.js";
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/calculLitteral/equation/firstDegree/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from "./equa1.js";
|
|
2
|
+
export * from "./equa2.js";
|
|
3
|
+
export * from "./equa3.js";
|
|
4
|
+
export * from "./equa4.js";
|
|
5
|
+
export * from "./firstDegreeEquationIntType1.js";
|
|
6
|
+
export * from "./firstDegreeEquationIntType2.js";
|
|
7
|
+
export * from "./firstDegreeEquationIntType3.js";
|
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
export * from "./equationSimpleSquare.js";
|
|
2
|
-
export * from "./equa1.js";
|
|
3
|
-
export * from "./equa2.js";
|
|
4
|
-
export * from "./equa3.js";
|
|
5
|
-
export * from "./equa4.js";
|
|
6
2
|
export * from "./fractionEquation.js";
|
|
7
3
|
export * from "./multiplicationEquation.js";
|
|
8
4
|
export * from "./firstDegreeEquation.js";
|
|
9
|
-
export * from "./firstDegreeEquationIntType1.js";
|
|
10
|
-
export * from "./firstDegreeEquationIntType2.js";
|
|
11
|
-
export * from "./firstDegreeEquationIntType3.js";
|
|
12
5
|
export * from "./equationFromSentenceExercise.js";
|
|
13
6
|
export * from "./binomialsTrinomialsProposedSolutions.js";
|
|
14
7
|
export * from "./equationWithDistributivity.js";
|
|
@@ -19,4 +12,5 @@ export * from "./isEqualityTrue.js";
|
|
|
19
12
|
export * from "./proportionEquation.js";
|
|
20
13
|
export * from "./solveByFactorizingWithIdRmq3.js";
|
|
21
14
|
export * from "./equationFromFrenchDescription.js";
|
|
15
|
+
export * from "./firstDegree/index.js";
|
|
22
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC;AACzC,cAAc,mCAAmC,CAAC;AAClD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,iCAAiC,CAAC;AAChD,cAAc,oCAAoC,CAAC;AACnD,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mCAAmC,CAAC;AAClD,cAAc,oCAAoC,CAAC;AACnD,cAAc,wBAAwB,CAAC"}
|
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
export * from "./equationSimpleSquare.js";
|
|
2
|
-
export * from "./equa1.js";
|
|
3
|
-
export * from "./equa2.js";
|
|
4
|
-
export * from "./equa3.js";
|
|
5
|
-
export * from "./equa4.js";
|
|
6
2
|
export * from "./fractionEquation.js";
|
|
7
3
|
export * from "./multiplicationEquation.js";
|
|
8
4
|
export * from "./firstDegreeEquation.js";
|
|
9
|
-
export * from "./firstDegreeEquationIntType1.js";
|
|
10
|
-
export * from "./firstDegreeEquationIntType2.js";
|
|
11
|
-
export * from "./firstDegreeEquationIntType3.js";
|
|
12
5
|
export * from "./equationFromSentenceExercise.js";
|
|
13
6
|
export * from "./binomialsTrinomialsProposedSolutions.js";
|
|
14
7
|
export * from "./equationWithDistributivity.js";
|
|
@@ -19,3 +12,4 @@ export * from "./isEqualityTrue.js";
|
|
|
19
12
|
export * from "./proportionEquation.js";
|
|
20
13
|
export * from "./solveByFactorizingWithIdRmq3.js";
|
|
21
14
|
export * from "./equationFromFrenchDescription.js";
|
|
15
|
+
export * from "./firstDegree/index.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"etendueHistogram.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/dataRepresentations/histogram/etendueHistogram.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB,CAAC;AA4MF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAmBlD,CAAC"}
|