math-exercises 3.0.37 → 3.0.39
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/fractions/fractionsSumsMultiplesDenominators.d.ts +4 -1
- package/lib/exercises/math/calcul/fractions/fractionsSumsMultiplesDenominators.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionsSumsMultiplesDenominators.js +71 -16
- package/lib/exercises/math/calcul/fractions/simplifyFraction.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/simplifyFraction.js +37 -0
- package/lib/exercises/math/calcul/rounding/rounding.d.ts +8 -5
- package/lib/exercises/math/calcul/rounding/rounding.d.ts.map +1 -1
- package/lib/exercises/math/calcul/rounding/rounding.js +63 -31
- package/lib/exercises/math/calculLitteral/simplifying/reduceExpression.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/simplifying/reduceExpression.js +64 -57
- package/lib/exercises/math/functions/affines/algebricExpressionOfAffine.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/algebricExpressionOfAffine.js +48 -5
- package/lib/exercises/math/functions/affines/leadingCoefficient.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/leadingCoefficient.js +42 -4
- package/lib/exercises/math/functions/integral/integralAffines.d.ts.map +1 -1
- package/lib/exercises/math/functions/integral/integralAffines.js +31 -15
- package/lib/exercises/math/functions/integral/integralTrinomials.d.ts.map +1 -1
- package/lib/exercises/math/functions/integral/integralTrinomials.js +31 -16
- package/lib/exercises/math/functions/trinoms/factoForm/factorizedFormFromRoots.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/factoForm/factorizedFormFromRoots.js +49 -0
- package/lib/exercises/math/functions/trinoms/parabole/trinomSymetryAxisFromFacto.js +1 -1
- package/lib/exercises/math/functions/trinoms/roots/findSecondRoot.js +1 -1
- package/lib/exercises/math/functions/trinoms/roots/rootsProduct.js +1 -1
- package/lib/exercises/math/functions/trinoms/roots/rootsSum.js +1 -1
- package/lib/exercises/math/geometry/cartesian/distanceBetweenTwoPoints.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/distanceBetweenTwoPoints.js +66 -18
- package/lib/exercises/math/geometry/cartesian/midpoint.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/midpoint.js +45 -3
- package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLine.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLine.js +1 -2
- package/lib/exercises/math/geometry/perimeters/rectanglePerimeter.d.ts.map +1 -1
- package/lib/exercises/math/geometry/perimeters/rectanglePerimeter.js +0 -2
- package/lib/exercises/math/geometry/pythagore/pythagoreCalcul.js +1 -1
- package/lib/exercises/math/geometry/thales/thalesCalcul.js +1 -1
- package/lib/exercises/math/geometry/vectors/chasles.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/chasles.js +0 -2
- package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductViaCoords.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductViaCoords.js +68 -15
- package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductViaCos.d.ts +1 -0
- package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductViaCos.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductViaCos.js +32 -14
- package/lib/exercises/math/probaStat/diceBasicProbas.js +1 -1
- package/lib/exercises/math/sequences/arithmetic/arithmeticFindReason.d.ts.map +1 -1
- package/lib/exercises/math/sequences/arithmetic/arithmeticFindReason.js +43 -8
- package/lib/exercises/math/sequences/arithmetic/arithmeticFindReasonRandomRange.d.ts.map +1 -1
- package/lib/exercises/math/sequences/arithmetic/arithmeticFindReasonRandomRange.js +0 -2
- package/lib/exercises/math/sequences/arithmetic/arithmeticReasonUsage.d.ts.map +1 -1
- package/lib/exercises/math/sequences/arithmetic/arithmeticReasonUsage.js +51 -8
- package/lib/exercises/math/sequences/arithmetic/recognizeReasonFromFirstTerms.d.ts.map +1 -1
- package/lib/exercises/math/sequences/arithmetic/recognizeReasonFromFirstTerms.js +36 -5
- package/lib/exercises/math/sequences/geometric/geometricRecognizeReasonFromFirstTerms.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/geometricRecognizeReasonFromFirstTerms.js +36 -5
- package/lib/exercises/math/trigonometry/associatePoint.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/associatePoint.js +5 -2
- package/lib/exercises/math/trigonometry/mainRemarkableValues.js +1 -1
- package/lib/exercises/math/trigonometry/remarkableValues.js +2 -2
- package/lib/geogebra/geogebraConstructor.d.ts +3 -1
- package/lib/geogebra/geogebraConstructor.d.ts.map +1 -1
- package/lib/geogebra/geogebraConstructor.js +5 -2
- package/lib/index.d.ts +8 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/latexTester.js +1 -0
- package/lib/math/geometry/point.d.ts +2 -0
- package/lib/math/geometry/point.d.ts.map +1 -1
- package/lib/math/geometry/point.js +10 -0
- package/lib/math/numbers/integer/integer.d.ts +1 -1
- package/lib/math/numbers/rationals/rational.d.ts +1 -0
- package/lib/math/numbers/rationals/rational.d.ts.map +1 -1
- package/lib/math/numbers/rationals/rational.js +3 -0
- package/lib/math/trigonometry/remarkableValue.d.ts +1 -4
- package/lib/math/trigonometry/remarkableValue.d.ts.map +1 -1
- package/lib/math/trigonometry/remarkableValue.js +5 -6
- package/lib/math/utils/stats/generateAffineCloud.js +1 -1
- package/lib/playground.d.ts.map +1 -1
- package/lib/playground.js +5 -0
- package/lib/tests/pdfExo.test.d.ts.map +1 -1
- package/lib/tests/pdfExo.test.js +2 -2
- package/lib/tree/nodes/functions/oppositeNode.d.ts +1 -2
- package/lib/tree/nodes/functions/oppositeNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/sqrtNode.d.ts +2 -1
- package/lib/tree/nodes/functions/sqrtNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/sqrtNode.js +47 -2
- package/lib/tree/nodes/node.d.ts +1 -0
- package/lib/tree/nodes/node.d.ts.map +1 -1
- package/lib/tree/nodes/numbers/numberNode.d.ts +1 -1
- package/lib/tree/nodes/numbers/numberNode.d.ts.map +1 -1
- package/lib/tree/nodes/numbers/numberNode.js +1 -1
- package/lib/tree/nodes/operators/addNode.d.ts +1 -0
- package/lib/tree/nodes/operators/addNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/addNode.js +6 -0
- package/lib/tree/nodes/operators/fractionNode.d.ts +1 -1
- package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/fractionNode.js +1 -1
- package/lib/tree/nodes/operators/multiplyNode.d.ts +1 -0
- package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/multiplyNode.js +7 -0
- package/lib/utils/iterators/dualReturn.d.ts +2 -0
- package/lib/utils/iterators/dualReturn.d.ts.map +1 -0
- package/lib/utils/iterators/dualReturn.js +19 -0
- package/package.json +1 -1
|
@@ -4,16 +4,56 @@ import { Affine, AffineConstructor } from "../../../../math/polynomials/affine.j
|
|
|
4
4
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
5
5
|
import { polynomialParser } from "../../../../tree/parsers/polynomialParser.js";
|
|
6
6
|
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
7
|
+
const getInstruction = (identifiers) => {
|
|
8
|
+
const { a, b } = identifiers;
|
|
9
|
+
return `Soit une fonction affine $f$ dont le coefficient directeur vaut $${a}$ et l'ordonnée à l'origine vaut $${b}$.
|
|
10
|
+
|
|
11
|
+
Écrire l'expression algébrique de $f(x)$.`;
|
|
12
|
+
};
|
|
13
|
+
const getAnswer = (identifiers) => {
|
|
14
|
+
const f = new Affine(identifiers.a, identifiers.b);
|
|
15
|
+
return f.toTex();
|
|
16
|
+
};
|
|
17
|
+
const getHint = (identifiers) => {
|
|
18
|
+
return `L'expression algébrique d'une fonction affine est :
|
|
19
|
+
|
|
20
|
+
$$
|
|
21
|
+
f(x) = ax+b
|
|
22
|
+
$$
|
|
23
|
+
|
|
24
|
+
où $a$ est le coefficient directeur et $b$ l'ordonnée à l'origine.`;
|
|
25
|
+
};
|
|
26
|
+
const getCorrection = (identifiers) => {
|
|
27
|
+
const { a, b } = identifiers;
|
|
28
|
+
return `L'expression algébrique d'une fonction affine est :
|
|
29
|
+
|
|
30
|
+
$$
|
|
31
|
+
f(x) = ax+b
|
|
32
|
+
$$
|
|
33
|
+
|
|
34
|
+
où $a$ est le coefficient directeur et $b$ l'ordonnée à l'origine.
|
|
35
|
+
|
|
36
|
+
Ici, $a = ${a}$ et $b = ${b}$.
|
|
37
|
+
|
|
38
|
+
Donc, l'expression algébrique de $f$ est :
|
|
39
|
+
|
|
40
|
+
$$
|
|
41
|
+
f(x)=${getAnswer(identifiers)}
|
|
42
|
+
$$`;
|
|
43
|
+
};
|
|
7
44
|
const getAlgebricExpressionOfAffineQuestion = () => {
|
|
8
45
|
const f = AffineConstructor.random();
|
|
9
46
|
const a = f.a;
|
|
10
47
|
const b = f.b;
|
|
48
|
+
const identifiers = { a, b };
|
|
11
49
|
const question = {
|
|
12
|
-
answer:
|
|
13
|
-
instruction:
|
|
50
|
+
answer: getAnswer(identifiers),
|
|
51
|
+
instruction: getInstruction(identifiers),
|
|
14
52
|
keys: ["x"],
|
|
15
53
|
answerFormat: "tex",
|
|
16
|
-
identifiers
|
|
54
|
+
identifiers,
|
|
55
|
+
hint: getHint(identifiers),
|
|
56
|
+
correction: getCorrection(identifiers),
|
|
17
57
|
};
|
|
18
58
|
return question;
|
|
19
59
|
};
|
|
@@ -52,13 +92,16 @@ const generatePropositions = (a, b) => {
|
|
|
52
92
|
export const algebricExpressionOfAffine = {
|
|
53
93
|
id: "algebricExpressionOfAffine",
|
|
54
94
|
label: "Écrire l'expression algébrique d'une fonction affine",
|
|
55
|
-
levels: ["2nde"],
|
|
56
95
|
isSingleStep: true,
|
|
57
|
-
sections: ["Fonctions affines"],
|
|
58
96
|
generator: (nb) => getDistinctQuestions(getAlgebricExpressionOfAffineQuestion, nb),
|
|
59
97
|
qcmTimer: 60,
|
|
60
98
|
freeTimer: 60,
|
|
61
99
|
getPropositions,
|
|
62
100
|
isAnswerValid,
|
|
63
101
|
subject: "Mathématiques",
|
|
102
|
+
getAnswer,
|
|
103
|
+
getInstruction,
|
|
104
|
+
getHint,
|
|
105
|
+
getCorrection,
|
|
106
|
+
hasHintAndCorrection: true,
|
|
64
107
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"leadingCoefficient.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/leadingCoefficient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"leadingCoefficient.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/leadingCoefficient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAiBrC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAkHF,KAAK,OAAO,GAAG;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAYF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAoB7D,CAAC"}
|
|
@@ -3,14 +3,35 @@ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQue
|
|
|
3
3
|
import { rationalVEA } from "../../../../exercises/vea/rationalVEA.js";
|
|
4
4
|
import { randomColor } from "../../../../geogebra/colors.js";
|
|
5
5
|
import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
|
|
6
|
-
import { Rational } from "../../../../math/numbers/rationals/rational.js";
|
|
6
|
+
import { Rational, RationalConstructor, } from "../../../../math/numbers/rationals/rational.js";
|
|
7
7
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
8
8
|
import { NumberNode } from "../../../../tree/nodes/numbers/numberNode.js";
|
|
9
9
|
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
10
|
+
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
11
|
+
import { coinFlip } from "../../../../utils/alea/coinFlip.js";
|
|
10
12
|
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
11
13
|
const getInstruction = (identifiers) => {
|
|
12
14
|
return "Déterminer le coefficient directeur de la droite représentée ci-dessous : ";
|
|
13
15
|
};
|
|
16
|
+
const getHint = (identifiers) => {
|
|
17
|
+
return `Le coefficient directeur d'une droite passant par deux points $A(x_A; y_A)$ et $B(x_B; y_B)$ est :
|
|
18
|
+
|
|
19
|
+
$$
|
|
20
|
+
\\frac{y_B - y_A}{x_B - x_A}
|
|
21
|
+
$$
|
|
22
|
+
|
|
23
|
+
Repère donc deux points appartenant à la droite, et utilise cette formule.`;
|
|
24
|
+
};
|
|
25
|
+
const getCorrection = (identifiers) => {
|
|
26
|
+
const { xA, yA, xB, yB } = identifiers;
|
|
27
|
+
return `On lit graphiquement que la droite passe par les deux points $A(${xA},${yA})$ et $B(${xB},${yB})$.
|
|
28
|
+
|
|
29
|
+
Le coefficient directeur est donc :
|
|
30
|
+
|
|
31
|
+
$$
|
|
32
|
+
${frac(substract(yB, yA), substract(xB, xA)).toSimplificationTex()}
|
|
33
|
+
$$`;
|
|
34
|
+
};
|
|
14
35
|
const getAnswer = (identifiers) => {
|
|
15
36
|
const { xA, yA, xB, yB } = identifiers;
|
|
16
37
|
const a = frac(yB - yA, xB - xA).simplify();
|
|
@@ -32,7 +53,13 @@ const getGGBOptions = (identifiers) => {
|
|
|
32
53
|
commands,
|
|
33
54
|
});
|
|
34
55
|
return ggb.getOptions({
|
|
35
|
-
coords: ggb.getAdaptedCoords({
|
|
56
|
+
coords: ggb.getAdaptedCoords({
|
|
57
|
+
xMin,
|
|
58
|
+
xMax,
|
|
59
|
+
yMin,
|
|
60
|
+
yMax,
|
|
61
|
+
ratio: 2,
|
|
62
|
+
}),
|
|
36
63
|
});
|
|
37
64
|
};
|
|
38
65
|
const getLeadingCoefficientQuestion = (opts) => {
|
|
@@ -43,8 +70,14 @@ const getLeadingCoefficientQuestion = (opts) => {
|
|
|
43
70
|
}
|
|
44
71
|
else
|
|
45
72
|
[xA, yA] = [1, 2].map((el) => randint(-5, 6));
|
|
46
|
-
|
|
47
|
-
|
|
73
|
+
const aIsInt = coinFlip();
|
|
74
|
+
const a = aIsInt
|
|
75
|
+
? [randint(-3, 3, [0])]
|
|
76
|
+
: RationalConstructor.randomIrreductible(5).toArray();
|
|
77
|
+
xB = xA + (aIsInt ? 1 : a[0]);
|
|
78
|
+
yB = yA + (aIsInt ? a[0] : a[1]);
|
|
79
|
+
// xB = xA > 0 ? randint(xA - 4, 6, [xA]) : randint(-4, xA + 5, [xA]); // l'écart entre les deux points ne soit pas grand
|
|
80
|
+
// yB = yA > 0 ? randint(yA - 4, 6) : randint(-4, yA + 5);
|
|
48
81
|
const identifiers = { xA, xB, yA, yB };
|
|
49
82
|
const question = {
|
|
50
83
|
instruction: getInstruction(identifiers),
|
|
@@ -53,6 +86,8 @@ const getLeadingCoefficientQuestion = (opts) => {
|
|
|
53
86
|
ggbOptions: getGGBOptions(identifiers),
|
|
54
87
|
answerFormat: "tex",
|
|
55
88
|
identifiers,
|
|
89
|
+
hint: getHint(identifiers),
|
|
90
|
+
correction: getCorrection(identifiers),
|
|
56
91
|
};
|
|
57
92
|
return question;
|
|
58
93
|
};
|
|
@@ -96,4 +131,7 @@ export const leadingCoefficient = {
|
|
|
96
131
|
getInstruction,
|
|
97
132
|
getGGBOptions,
|
|
98
133
|
options,
|
|
134
|
+
getHint,
|
|
135
|
+
getCorrection,
|
|
136
|
+
hasHintAndCorrection: true,
|
|
99
137
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integralAffines.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/integral/integralAffines.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"integralAffines.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/integral/integralAffines.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AA6FF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAajD,CAAC"}
|
|
@@ -1,31 +1,47 @@
|
|
|
1
1
|
import { addValidProp, 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 { Trinom, TrinomConstructor } from "../../../../math/polynomials/trinom.js";
|
|
4
5
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
5
6
|
import { IntegralNode } from "../../../../tree/nodes/functions/integralNode.js";
|
|
7
|
+
const getInstruction = (identifiers) => {
|
|
8
|
+
const { lowerBound, upperBound, trinomial } = identifiers;
|
|
9
|
+
const trinom = new Trinom(trinomial[0], trinomial[1], trinomial[2]);
|
|
10
|
+
const affine = trinom.derivate();
|
|
11
|
+
const integral = new IntegralNode(affine.toTree(), lowerBound.toTree(), upperBound.toTree(), "x").toTex();
|
|
12
|
+
return `Calculer :
|
|
13
|
+
|
|
14
|
+
$$
|
|
15
|
+
${integral}
|
|
16
|
+
$$`;
|
|
17
|
+
};
|
|
18
|
+
const getAnswer = (identifiers) => {
|
|
19
|
+
const { lowerBound, upperBound, trinomial } = identifiers;
|
|
20
|
+
const trinom = new Trinom(trinomial[0], trinomial[1], trinomial[2]);
|
|
21
|
+
const answer = (trinom.calculate(upperBound) - trinom.calculate(lowerBound))
|
|
22
|
+
.toTree()
|
|
23
|
+
.toTex();
|
|
24
|
+
return answer;
|
|
25
|
+
};
|
|
6
26
|
const getIntegralAffinesQuestion = () => {
|
|
7
27
|
const trinomial = TrinomConstructor.random();
|
|
8
|
-
const affine = trinomial.derivate();
|
|
9
28
|
let lowerBound = randint(-5, 5);
|
|
10
29
|
let upperBound = randint(-5, 5);
|
|
11
30
|
while (lowerBound >= upperBound) {
|
|
12
31
|
lowerBound = randint(-5, 5);
|
|
13
32
|
upperBound = randint(-5, 5);
|
|
14
33
|
}
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
.
|
|
34
|
+
const identifiers = {
|
|
35
|
+
lowerBound,
|
|
36
|
+
upperBound,
|
|
37
|
+
trinomial: [trinomial.a, trinomial.b, trinomial.c],
|
|
38
|
+
};
|
|
19
39
|
const question = {
|
|
20
|
-
answer:
|
|
21
|
-
instruction:
|
|
40
|
+
answer: getAnswer(identifiers),
|
|
41
|
+
instruction: getInstruction(identifiers),
|
|
22
42
|
keys: [],
|
|
23
43
|
answerFormat: "tex",
|
|
24
|
-
identifiers
|
|
25
|
-
lowerBound,
|
|
26
|
-
upperBound,
|
|
27
|
-
trinomial: [trinomial.a, trinomial.b, trinomial.c],
|
|
28
|
-
},
|
|
44
|
+
identifiers,
|
|
29
45
|
};
|
|
30
46
|
return question;
|
|
31
47
|
};
|
|
@@ -52,18 +68,18 @@ const getPropositions = (n, { answer, lowerBound, upperBound, trinomial }) => {
|
|
|
52
68
|
return shuffleProps(propositions, n);
|
|
53
69
|
};
|
|
54
70
|
const isAnswerValid = (ans, { answer }) => {
|
|
55
|
-
return ans
|
|
71
|
+
return numberVEA(ans, answer);
|
|
56
72
|
};
|
|
57
73
|
export const integralAffines = {
|
|
58
74
|
id: "integralAffines",
|
|
59
75
|
label: "Calcul d'intégrales de fonctions affines",
|
|
60
|
-
levels: ["TermSpé"],
|
|
61
76
|
isSingleStep: true,
|
|
62
|
-
sections: ["Intégration"],
|
|
63
77
|
generator: (nb) => getDistinctQuestions(getIntegralAffinesQuestion, nb),
|
|
64
78
|
qcmTimer: 60,
|
|
65
79
|
freeTimer: 60,
|
|
66
80
|
getPropositions,
|
|
67
81
|
isAnswerValid,
|
|
68
82
|
subject: "Mathématiques",
|
|
83
|
+
getAnswer,
|
|
84
|
+
getInstruction,
|
|
69
85
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integralTrinomials.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/integral/integralTrinomials.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"integralTrinomials.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/integral/integralTrinomials.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAoGF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAapD,CAAC"}
|
|
@@ -1,8 +1,28 @@
|
|
|
1
1
|
import { addValidProp, 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 { Polynomial, } from "../../../../math/polynomials/polynomial.js";
|
|
4
5
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
5
6
|
import { IntegralNode } from "../../../../tree/nodes/functions/integralNode.js";
|
|
7
|
+
const getInstruction = (identifiers) => {
|
|
8
|
+
const { lowerBound, upperBound, quadrinomial } = identifiers;
|
|
9
|
+
const quadrinomial1 = new Polynomial(quadrinomial);
|
|
10
|
+
const trinomial = quadrinomial1.derivate();
|
|
11
|
+
const integral = new IntegralNode(trinomial.toTree(), lowerBound.toTree(), upperBound.toTree(), "x").toTex();
|
|
12
|
+
return `Calculer :
|
|
13
|
+
|
|
14
|
+
$$
|
|
15
|
+
${integral}
|
|
16
|
+
$$`;
|
|
17
|
+
};
|
|
18
|
+
const getAnswer = (identifiers) => {
|
|
19
|
+
const { lowerBound, upperBound, quadrinomial } = identifiers;
|
|
20
|
+
const quadrinomial1 = new Polynomial(quadrinomial);
|
|
21
|
+
const answer = (quadrinomial1.calculate(upperBound) - quadrinomial1.calculate(lowerBound))
|
|
22
|
+
.toTree()
|
|
23
|
+
.toTex();
|
|
24
|
+
return answer;
|
|
25
|
+
};
|
|
6
26
|
const getIntegralTrinomialsQuestion = () => {
|
|
7
27
|
const quadCoeffs = [
|
|
8
28
|
randint(-5, 5),
|
|
@@ -10,28 +30,23 @@ const getIntegralTrinomialsQuestion = () => {
|
|
|
10
30
|
randint(-2, 3),
|
|
11
31
|
randint(-5, 5, [0]),
|
|
12
32
|
];
|
|
13
|
-
const quadrinomial = new Polynomial(quadCoeffs);
|
|
14
|
-
const trinomial = quadrinomial.derivate();
|
|
15
33
|
let lowerBound = randint(-3, 4);
|
|
16
34
|
let upperBound = randint(-3, 4);
|
|
17
35
|
while (lowerBound >= upperBound) {
|
|
18
36
|
lowerBound = randint(-3, 4);
|
|
19
37
|
upperBound = randint(-3, 4);
|
|
20
38
|
}
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
39
|
+
const identifiers = {
|
|
40
|
+
lowerBound,
|
|
41
|
+
upperBound,
|
|
42
|
+
quadrinomial: quadCoeffs,
|
|
43
|
+
};
|
|
25
44
|
const question = {
|
|
26
|
-
answer:
|
|
27
|
-
instruction:
|
|
45
|
+
answer: getAnswer(identifiers),
|
|
46
|
+
instruction: getInstruction(identifiers),
|
|
28
47
|
keys: [],
|
|
29
48
|
answerFormat: "tex",
|
|
30
|
-
identifiers
|
|
31
|
-
lowerBound,
|
|
32
|
-
upperBound,
|
|
33
|
-
quadrinomial: quadrinomial.coefficients,
|
|
34
|
-
},
|
|
49
|
+
identifiers,
|
|
35
50
|
};
|
|
36
51
|
return question;
|
|
37
52
|
};
|
|
@@ -58,18 +73,18 @@ const getPropositions = (n, { answer, lowerBound, upperBound, quadrinomial }) =>
|
|
|
58
73
|
return shuffleProps(propositions, n);
|
|
59
74
|
};
|
|
60
75
|
const isAnswerValid = (ans, { answer }) => {
|
|
61
|
-
return ans
|
|
76
|
+
return numberVEA(ans, answer);
|
|
62
77
|
};
|
|
63
78
|
export const integralTrinomials = {
|
|
64
79
|
id: "integralTrinomials",
|
|
65
80
|
label: "Calcul d'intégrales de fonctions trinômes",
|
|
66
|
-
levels: ["TermSpé"],
|
|
67
81
|
isSingleStep: true,
|
|
68
|
-
sections: ["Intégration"],
|
|
69
82
|
generator: (nb) => getDistinctQuestions(getIntegralTrinomialsQuestion, nb),
|
|
70
83
|
qcmTimer: 60,
|
|
71
84
|
freeTimer: 60,
|
|
72
85
|
getPropositions,
|
|
73
86
|
isAnswerValid,
|
|
74
87
|
subject: "Mathématiques",
|
|
88
|
+
getAnswer,
|
|
89
|
+
getInstruction,
|
|
75
90
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factorizedFormFromRoots.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/factoForm/factorizedFormFromRoots.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"factorizedFormFromRoots.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/factoForm/factorizedFormFromRoots.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAerC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAuJF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAiBzD,CAAC"}
|
|
@@ -8,6 +8,7 @@ import { substract } from "../../../../../tree/nodes/operators/substractNode.js"
|
|
|
8
8
|
import { parseAlgebraic } from "../../../../../tree/parsers/latexParser.js";
|
|
9
9
|
import { probaFlip } from "../../../../../utils/alea/probaFlip.js";
|
|
10
10
|
import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
|
|
11
|
+
import { alignTex } from "../../../../../utils/latex/alignTex.js";
|
|
11
12
|
const getAnswerNode = (identifiers) => {
|
|
12
13
|
const { a, roots } = identifiers;
|
|
13
14
|
const isSingleRoot = roots.length === 1;
|
|
@@ -28,6 +29,49 @@ const getInstruction = (identifiers) => {
|
|
|
28
29
|
|
|
29
30
|
Déterminer la forme factorisée de $f$.`;
|
|
30
31
|
};
|
|
32
|
+
const getHint = (identifiers) => {
|
|
33
|
+
return `Soit $f$ un polynôme du second degré de la forme
|
|
34
|
+
|
|
35
|
+
$$
|
|
36
|
+
f(x)=ax^2+bx+c
|
|
37
|
+
$$
|
|
38
|
+
|
|
39
|
+
Si $f$ admet deux racines $x_1$ et $x_2$, alors la forme factorisée de $f$ est :
|
|
40
|
+
|
|
41
|
+
$$
|
|
42
|
+
f(x)=a(x-x_1)(x-x_2)
|
|
43
|
+
$$
|
|
44
|
+
|
|
45
|
+
Si $f$ n'admet qu'une racine $x_0$, alors sa forme factorisée est :
|
|
46
|
+
|
|
47
|
+
$$
|
|
48
|
+
f(x) = a(x-x_0)^2
|
|
49
|
+
$$
|
|
50
|
+
|
|
51
|
+
Si $f$ n'admet pas de racine, alors il n'admet pas de forme factorisée.`;
|
|
52
|
+
};
|
|
53
|
+
const getCorrection = (identifiers) => {
|
|
54
|
+
const { a, roots } = identifiers;
|
|
55
|
+
const rawForm = roots.length === 1
|
|
56
|
+
? multiply(a, square(substract("x", roots[0])))
|
|
57
|
+
: multiply(a, multiply(substract("x", roots[0]), substract("x", roots[1])));
|
|
58
|
+
const simpForm = rawForm.simplify();
|
|
59
|
+
const hasSimplified = rawForm.toTex() !== simpForm.toTex();
|
|
60
|
+
return roots.length === 1
|
|
61
|
+
? `Puisque $f$ n'admet qu'une racine, sa forme factorisée est :
|
|
62
|
+
|
|
63
|
+
${alignTex([
|
|
64
|
+
["f(x)", "=", rawForm.toTex()],
|
|
65
|
+
hasSimplified ? ["", "=", simpForm.toTex()] : [],
|
|
66
|
+
])}
|
|
67
|
+
`
|
|
68
|
+
: `Puisque $f$ admet deux racines distinctes, sa forme factorisée est :
|
|
69
|
+
|
|
70
|
+
${alignTex([
|
|
71
|
+
["f(x)", "=", rawForm.toTex()],
|
|
72
|
+
hasSimplified ? ["", "=", simpForm.toTex()] : [],
|
|
73
|
+
])}`;
|
|
74
|
+
};
|
|
31
75
|
const getFactorizedFormFromRootsQuestion = () => {
|
|
32
76
|
const a = randint(-10, 10, [0]);
|
|
33
77
|
const firstRoot = randint(-10, 10);
|
|
@@ -43,6 +87,8 @@ const getFactorizedFormFromRootsQuestion = () => {
|
|
|
43
87
|
keys: ["x"],
|
|
44
88
|
answerFormat: "tex",
|
|
45
89
|
identifiers,
|
|
90
|
+
hint: getHint(identifiers),
|
|
91
|
+
correction: getCorrection(identifiers),
|
|
46
92
|
};
|
|
47
93
|
return question;
|
|
48
94
|
};
|
|
@@ -92,4 +138,7 @@ export const factorizedFormFromRoots = {
|
|
|
92
138
|
subject: "Mathématiques",
|
|
93
139
|
getInstruction,
|
|
94
140
|
getAnswer,
|
|
141
|
+
getHint,
|
|
142
|
+
getCorrection,
|
|
143
|
+
hasHintAndCorrection: true,
|
|
95
144
|
};
|
|
@@ -53,7 +53,7 @@ const getCorrection = (identifiers) => {
|
|
|
53
53
|
L'axe de symétrie de la parabole représentant $f$ a donc pour équation :
|
|
54
54
|
|
|
55
55
|
$$
|
|
56
|
-
x=${fraction.toTex()}=${frac(x1 + x2, 2).
|
|
56
|
+
x=${fraction.toTex()}=${frac(x1 + x2, 2).toSimplificationTex()}
|
|
57
57
|
$$`;
|
|
58
58
|
};
|
|
59
59
|
const getKeys = (identifiers) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"distanceBetweenTwoPoints.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/cartesian/distanceBetweenTwoPoints.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"distanceBetweenTwoPoints.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/cartesian/distanceBetweenTwoPoints.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAerC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAsKF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,CAiB1D,CAAC"}
|
|
@@ -4,25 +4,70 @@ import { Point } from "../../../../math/geometry/point.js";
|
|
|
4
4
|
import { SquareRoot, } from "../../../../math/numbers/reals/real.js";
|
|
5
5
|
import { distinctRandTupleInt } from "../../../../math/utils/random/randTupleInt.js";
|
|
6
6
|
import { round } from "../../../../math/utils/round.js";
|
|
7
|
-
import { SqrtNode } from "../../../../tree/nodes/functions/sqrtNode.js";
|
|
8
7
|
import { NumberNode } from "../../../../tree/nodes/numbers/numberNode.js";
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
9
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
10
|
+
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
11
|
+
const getInstruction = (identifiers) => {
|
|
12
|
+
const { coords1, coords2 } = identifiers;
|
|
13
|
+
let A = new Point("A", new NumberNode(coords1[0]), new NumberNode(coords1[1]));
|
|
14
|
+
let B = new Point("B", new NumberNode(coords2[0]), new NumberNode(coords2[1]));
|
|
15
|
+
return `Dans un repère orthonormé, soit deux points $${A.toTexWithCoords()}$ et $${B.toTexWithCoords()}$.
|
|
16
|
+
|
|
17
|
+
Calculer la distance $AB$.`;
|
|
18
|
+
};
|
|
19
|
+
const getAnswer = (identifiers) => {
|
|
20
|
+
const { coords1, coords2 } = identifiers;
|
|
11
21
|
let A = new Point("A", new NumberNode(coords1[0]), new NumberNode(coords1[1]));
|
|
12
22
|
let B = new Point("B", new NumberNode(coords2[0]), new NumberNode(coords2[1]));
|
|
13
23
|
const answer = new SquareRoot(round(A.distanceTo(B) ** 2, 0))
|
|
14
24
|
.simplify()
|
|
15
25
|
.toTree()
|
|
16
26
|
.toTex();
|
|
27
|
+
return answer;
|
|
28
|
+
};
|
|
29
|
+
const getHint = (identifiers) => {
|
|
30
|
+
const A = new Point("A", "x_A".toTree(), "y_A".toTree());
|
|
31
|
+
const B = new Point("B", "x_B".toTree(), "y_B".toTree());
|
|
32
|
+
return `Dans un repère orthonormé, la distance entre deux points $${A.toTexWithCoords()}$ et $${B.toTexWithCoords()}$ est :
|
|
33
|
+
|
|
34
|
+
$$
|
|
35
|
+
AB = ${A.distanceToNode(B).toTex()}
|
|
36
|
+
$$
|
|
37
|
+
`;
|
|
38
|
+
};
|
|
39
|
+
const getCorrection = (identifiers) => {
|
|
40
|
+
const { coords1, coords2 } = identifiers;
|
|
41
|
+
let A = new Point("A", new NumberNode(coords1[0]), new NumberNode(coords1[1]));
|
|
42
|
+
let B = new Point("B", new NumberNode(coords2[0]), new NumberNode(coords2[1]));
|
|
43
|
+
const Ax = new Point("A", "x_A".toTree(), "y_A".toTree());
|
|
44
|
+
const Bx = new Point("B", "x_B".toTree(), "y_B".toTree());
|
|
45
|
+
return `Dans un repère orthonormé, la distance entre deux points $${Ax.toTexWithCoords()}$ et $${Bx.toTexWithCoords()}$ est :
|
|
46
|
+
|
|
47
|
+
$$
|
|
48
|
+
AB = ${Ax.distanceToNode(Bx).toTex()}
|
|
49
|
+
$$
|
|
50
|
+
|
|
51
|
+
Ici, on a donc :
|
|
52
|
+
|
|
53
|
+
${alignTex([
|
|
54
|
+
["AB", "=", A.distanceToNode(B).toTex()],
|
|
55
|
+
["", "=", getAnswer(identifiers)],
|
|
56
|
+
])}
|
|
57
|
+
`;
|
|
58
|
+
};
|
|
59
|
+
const getDistanceBetweenTwoPoints = () => {
|
|
60
|
+
const [coords1, coords2] = distinctRandTupleInt(2, 2, { from: -9, to: 10 });
|
|
61
|
+
const identifiers = { coords1, coords2 };
|
|
17
62
|
const question = {
|
|
18
|
-
instruction:
|
|
19
|
-
|
|
20
|
-
Calculer la distance $AB$.`,
|
|
63
|
+
instruction: getInstruction(identifiers),
|
|
21
64
|
startStatement: "AB",
|
|
22
|
-
answer,
|
|
65
|
+
answer: getAnswer(identifiers),
|
|
23
66
|
keys: [],
|
|
24
67
|
answerFormat: "tex",
|
|
25
|
-
identifiers
|
|
68
|
+
identifiers,
|
|
69
|
+
hint: getHint(identifiers),
|
|
70
|
+
correction: getCorrection(identifiers),
|
|
26
71
|
};
|
|
27
72
|
return question;
|
|
28
73
|
};
|
|
@@ -69,21 +114,19 @@ const getPropositions = (n, { answer, coords1, coords2 }) => {
|
|
|
69
114
|
}
|
|
70
115
|
return shuffleProps(propositions, n);
|
|
71
116
|
};
|
|
72
|
-
const isAnswerValid = (ans, { coords1, coords2 }) => {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
117
|
+
const isAnswerValid = (ans, { answer, coords1, coords2 }) => {
|
|
118
|
+
try {
|
|
119
|
+
const parsed = parseAlgebraic(ans);
|
|
120
|
+
return parsed.simplify().toTex() === answer;
|
|
121
|
+
}
|
|
122
|
+
catch (err) {
|
|
123
|
+
return handleVEAError(err);
|
|
124
|
+
}
|
|
80
125
|
};
|
|
81
126
|
export const distanceBetweenTwoPoints = {
|
|
82
127
|
id: "distanceBetweenTwoPoints",
|
|
83
128
|
connector: "=",
|
|
84
129
|
label: "Distance entre deux points",
|
|
85
|
-
levels: ["2nde", "1reESM"],
|
|
86
|
-
sections: ["Géométrie cartésienne"],
|
|
87
130
|
isSingleStep: false,
|
|
88
131
|
generator: (nb) => getDistinctQuestions(getDistanceBetweenTwoPoints, nb),
|
|
89
132
|
qcmTimer: 60,
|
|
@@ -91,4 +134,9 @@ export const distanceBetweenTwoPoints = {
|
|
|
91
134
|
getPropositions,
|
|
92
135
|
isAnswerValid,
|
|
93
136
|
subject: "Mathématiques",
|
|
137
|
+
getAnswer,
|
|
138
|
+
getInstruction,
|
|
139
|
+
getCorrection,
|
|
140
|
+
getHint,
|
|
141
|
+
hasHintAndCorrection: true,
|
|
94
142
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"midpoint.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/cartesian/midpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"midpoint.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/cartesian/midpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AA2IF,eAAO,MAAM,QAAQ,EAAE,QAAQ,CAAC,WAAW,CAgB1C,CAAC"}
|