math-exercises 3.0.197 → 3.0.199

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.
Files changed (78) hide show
  1. package/lib/exercises/math/calculLitteral/equation/exp/expOfTrinomEquals1Equation.d.ts.map +1 -1
  2. package/lib/exercises/math/calculLitteral/equation/exp/expOfTrinomEquals1Equation.js +3 -0
  3. package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType3.d.ts.map +1 -1
  4. package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType3.js +58 -30
  5. package/lib/exercises/math/complex/addComplex.d.ts.map +1 -1
  6. package/lib/exercises/math/complex/addComplex.js +53 -7
  7. package/lib/exercises/math/complex/conjugateComplex.d.ts.map +1 -1
  8. package/lib/exercises/math/complex/conjugateComplex.js +48 -7
  9. package/lib/exercises/math/complex/mutiplyComplex.d.ts.map +1 -1
  10. package/lib/exercises/math/complex/mutiplyComplex.js +51 -18
  11. package/lib/exercises/math/complex/reAndIm.d.ts.map +1 -1
  12. package/lib/exercises/math/complex/reAndIm.js +35 -4
  13. package/lib/exercises/math/derivation/convexity/convexityQuadrinomials.d.ts.map +1 -1
  14. package/lib/exercises/math/derivation/convexity/convexityQuadrinomials.js +46 -4
  15. package/lib/exercises/math/derivation/convexity/convexityQuadrinomialsGeo.d.ts +9 -0
  16. package/lib/exercises/math/derivation/convexity/convexityQuadrinomialsGeo.d.ts.map +1 -0
  17. package/lib/exercises/math/derivation/convexity/convexityQuadrinomialsGeo.js +160 -0
  18. package/lib/exercises/math/derivation/convexity/convexityTrinomials.d.ts.map +1 -1
  19. package/lib/exercises/math/derivation/convexity/convexityTrinomials.js +33 -2
  20. package/lib/exercises/math/derivation/convexity/convexityTrinomialsGeo.d.ts +7 -0
  21. package/lib/exercises/math/derivation/convexity/convexityTrinomialsGeo.d.ts.map +1 -0
  22. package/lib/exercises/math/derivation/convexity/convexityTrinomialsGeo.js +80 -0
  23. package/lib/exercises/math/derivation/convexity/index.d.ts +2 -0
  24. package/lib/exercises/math/derivation/convexity/index.d.ts.map +1 -1
  25. package/lib/exercises/math/derivation/convexity/index.js +2 -0
  26. package/lib/exercises/math/derivation/convexity/inflexionPointQuadrinomials.js +2 -2
  27. package/lib/exercises/math/derivation/derivative/exp/expDerivativeFour.d.ts.map +1 -1
  28. package/lib/exercises/math/derivation/derivative/exp/expDerivativeFour.js +39 -33
  29. package/lib/exercises/math/derivation/derivative/exp/secondDerivativeOfExpoFunction.d.ts.map +1 -1
  30. package/lib/exercises/math/derivation/derivative/exp/secondDerivativeOfExpoFunction.js +45 -3
  31. package/lib/exercises/math/derivation/derivative/ln/lnDerivativeOne.d.ts.map +1 -1
  32. package/lib/exercises/math/derivation/derivative/ln/lnDerivativeOne.js +53 -11
  33. package/lib/exercises/math/derivation/derivative/ln/lnDerivativeThree.d.ts.map +1 -1
  34. package/lib/exercises/math/derivation/derivative/ln/lnDerivativeThree.js +54 -3
  35. package/lib/exercises/math/derivation/derivative/ln/lnDerivativeTwo.d.ts.map +1 -1
  36. package/lib/exercises/math/derivation/derivative/ln/lnDerivativeTwo.js +23 -0
  37. package/lib/exercises/math/derivation/derivative/polynomial/secondDerivativeOfThirdDegreeFunction.d.ts.map +1 -1
  38. package/lib/exercises/math/derivation/derivative/polynomial/secondDerivativeOfThirdDegreeFunction.js +30 -0
  39. package/lib/exercises/math/derivation/derivative/polynomial/secondDerivativeOfTrinom.d.ts.map +1 -1
  40. package/lib/exercises/math/derivation/derivative/polynomial/secondDerivativeOfTrinom.js +25 -1
  41. package/lib/exercises/math/derivation/derivative/trigo/cosCompositionDerivation.d.ts.map +1 -1
  42. package/lib/exercises/math/derivation/derivative/trigo/cosCompositionDerivation.js +27 -0
  43. package/lib/exercises/math/derivation/derivative/trigo/cosSecondDegreeDerivative.d.ts.map +1 -1
  44. package/lib/exercises/math/derivation/derivative/trigo/cosSecondDegreeDerivative.js +47 -3
  45. package/lib/exercises/math/derivation/derivative/trigo/sinCompositionDerivation.d.ts.map +1 -1
  46. package/lib/exercises/math/derivation/derivative/trigo/sinCompositionDerivation.js +44 -5
  47. package/lib/exercises/math/derivation/derivative/trigo/sinSecondDegreeDerivative.d.ts.map +1 -1
  48. package/lib/exercises/math/derivation/derivative/trigo/sinSecondDegreeDerivative.js +65 -9
  49. package/lib/exercises/math/functions/exponential/sign/expFunctionBasicSign.d.ts.map +1 -1
  50. package/lib/exercises/math/functions/exponential/sign/expFunctionBasicSign.js +3 -0
  51. package/lib/exercises/math/functions/exponential/variations/varSignTableOfAffineTimesExp.js +1 -1
  52. package/lib/exercises/math/functions/exponential/variations/varSignTableOfExpMinusX.js +1 -1
  53. package/lib/exercises/math/functions/sign/affineProductSign.d.ts.map +1 -1
  54. package/lib/exercises/math/functions/sign/affineProductSign.js +0 -4
  55. package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitReading.d.ts.map +1 -1
  56. package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitReading.js +1 -0
  57. package/lib/exercises/math/geometry/index.d.ts +0 -1
  58. package/lib/exercises/math/geometry/index.d.ts.map +1 -1
  59. package/lib/exercises/math/geometry/index.js +0 -1
  60. package/lib/exercises/math/spaceGeometry/vectors/spaceVectorLinearCombinationCoords.d.ts.map +1 -1
  61. package/lib/index.d.ts +6 -6
  62. package/lib/math/utils/arithmetic/gcd.d.ts +5 -0
  63. package/lib/math/utils/arithmetic/gcd.d.ts.map +1 -1
  64. package/lib/math/utils/arithmetic/gcd.js +5 -0
  65. package/lib/playground.d.ts.map +1 -1
  66. package/lib/playground.js +6 -1
  67. package/lib/server.js +3 -2
  68. package/lib/tests/pdfExo.test.js +2 -2
  69. package/lib/tests/pdfs/buildPDFForExercise.d.ts.map +1 -1
  70. package/lib/tests/pdfs/buildPDFForExercise.js +6 -0
  71. package/lib/tests/pdfs/quizPdfPreambule.d.ts.map +1 -1
  72. package/lib/tests/pdfs/quizPdfPreambule.js +1 -0
  73. package/lib/tests/pdfs/treeDiagramToLatex.d.ts +15 -0
  74. package/lib/tests/pdfs/treeDiagramToLatex.d.ts.map +1 -0
  75. package/lib/tests/pdfs/treeDiagramToLatex.js +49 -0
  76. package/lib/tests/questionTest.d.ts.map +1 -1
  77. package/lib/tests/questionTest.js +19 -0
  78. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convexityQuadrinomialsGeo.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/convexity/convexityQuadrinomialsGeo.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAkBrC,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAwMF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAc3D,CAAC"}
@@ -0,0 +1,160 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { blueMain } from "../../../../geogebra/colors.js";
4
+ import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
5
+ import { Polynomial } from "../../../../math/polynomials/polynomial.js";
6
+ import { randint } from "../../../../math/utils/random/randint.js";
7
+ import { MinusInfinityNode, PlusInfinityNode, } from "../../../../tree/nodes/numbers/infiniteNode.js";
8
+ import { NumberNode } from "../../../../tree/nodes/numbers/numberNode.js";
9
+ import { ClosureType } from "../../../../tree/nodes/sets/closure.js";
10
+ import { IntervalNode } from "../../../../tree/nodes/sets/intervalNode.js";
11
+ import { intervalParser } from "../../../../tree/parsers/intervalParser.js";
12
+ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
13
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
14
+ function generatePolynomialWithIntegerInflexionPoint(degree, inflexionPointX) {
15
+ let a, b, c, discriminant;
16
+ let counter = 0;
17
+ do {
18
+ counter++;
19
+ if (counter > 1000)
20
+ throw new Error("Too many iterations in convexityQuadrinomialsGeo");
21
+ a = randint(-5, 5, [0]);
22
+ c = randint(-5, 5, [0]);
23
+ b = -3 * a * inflexionPointX;
24
+ discriminant = b * b - 4 * a * c;
25
+ } while (discriminant < 0);
26
+ const d = degree === 3 ? randint(-5, 5, [0]) : 0;
27
+ const coeffs = degree === 3
28
+ ? [d * 0.1, c * 0.1, b * 0.1, a * 0.1]
29
+ : [c * 0.1, b * 0.1, a * 0.1];
30
+ return new Polynomial(coeffs);
31
+ }
32
+ function generateEvenInflexionPoint() {
33
+ let inflexionPointX;
34
+ let counter = 0;
35
+ do {
36
+ counter++;
37
+ if (counter > 1000)
38
+ throw new Error("Too many iterations in convexityQuadrinomialsGeo");
39
+ inflexionPointX = randint(-50, 51);
40
+ } while (inflexionPointX % 10 !== 0);
41
+ return inflexionPointX;
42
+ }
43
+ const getInstruction = (identifiers) => {
44
+ const { askConvex } = identifiers;
45
+ const questionType = askConvex ? "convexe" : "concave";
46
+ const instruction = `Ci-dessous est tracée la courbe représentative $\\mathcal C_f$ d'une fonction $f$. Sur quel intervalle $f$ est-elle strictement ${questionType} ?`;
47
+ return instruction;
48
+ };
49
+ const getAnswer = (identifiers) => {
50
+ const { askConvex, inflexionPoint, quadcoeffs } = identifiers;
51
+ let interval;
52
+ if (askConvex) {
53
+ interval =
54
+ quadcoeffs[3] > 0
55
+ ? new IntervalNode(inflexionPoint.toTree(), PlusInfinityNode, ClosureType.OO).toTex()
56
+ : new IntervalNode(MinusInfinityNode, inflexionPoint.toTree(), ClosureType.OO).toTex();
57
+ }
58
+ else {
59
+ interval =
60
+ quadcoeffs[3] <= 0
61
+ ? new IntervalNode(inflexionPoint.toTree(), PlusInfinityNode, ClosureType.OO).toTex()
62
+ : new IntervalNode(MinusInfinityNode, inflexionPoint.toTree(), ClosureType.OO).toTex();
63
+ }
64
+ return interval;
65
+ };
66
+ const getGGBOptions = (identifiers) => {
67
+ const { quadcoeffs } = identifiers;
68
+ const quadrinomial = new Polynomial(quadcoeffs);
69
+ const trinomial = quadrinomial.derivate();
70
+ const criticalPoints = trinomial.getRoots();
71
+ const yValues = criticalPoints.map((x) => quadrinomial.calculate(x));
72
+ const xMin = Math.min(...criticalPoints) - 5;
73
+ const xMax = Math.max(...criticalPoints) + 5;
74
+ const yMin = Math.min(...yValues, 0) - 5;
75
+ const yMax = Math.max(...yValues, 0) + 5;
76
+ const commands = [
77
+ `f(x) = ${quadrinomial.toMathString()}`,
78
+ `SetColor(f, "${blueMain}")`,
79
+ `SetCaption(f, "$\\mathcal C_f$")`,
80
+ `ShowLabel(f, true)`,
81
+ ];
82
+ const ggb = new GeogebraConstructor({
83
+ commands,
84
+ lockedAxesRatio: false,
85
+ });
86
+ return ggb.getOptions({
87
+ coords: [xMin, xMax, yMin, yMax],
88
+ });
89
+ };
90
+ const getConvexityQuadrinomialsGeoQuestion = () => {
91
+ const inflexionPointX = generateEvenInflexionPoint() * 0.1;
92
+ const quadrinomial = generatePolynomialWithIntegerInflexionPoint(3, inflexionPointX);
93
+ const quadcoeffs = quadrinomial.coefficients;
94
+ const askConvex = coinFlip();
95
+ const identifiers = {
96
+ askConvex,
97
+ quadcoeffs,
98
+ inflexionPoint: inflexionPointX,
99
+ };
100
+ return getQuestionFromIdentifiers(identifiers);
101
+ };
102
+ const getHint = () => `Visualise deux points de la courbe et la droite qui les relie (appelée "sécante"). Si pour tout couple de points, la sécante est au-dessous de la courbe, alors la fonction est convexe sur cet intervalle. Si elle est en-dessous de la courbe, alors la fonction est concave sur cet intervalle.`;
103
+ const getCorrection = (identifiers) => {
104
+ const { askConvex } = identifiers;
105
+ const word = askConvex ? "convexe" : "concave";
106
+ const inter = getAnswer(identifiers);
107
+ const placement = askConvex ? "au-dessus" : "en-dessous";
108
+ return `La fonction $f$ semble ${word} sur l'intervalle $${inter}$, car toute sécante formée par deux points de la courbe semble être ${placement} de la courbe.`;
109
+ };
110
+ const getQuestionFromIdentifiers = (identifiers) => {
111
+ const question = {
112
+ answer: getAnswer(identifiers),
113
+ instruction: getInstruction(identifiers),
114
+ ggbOptions: getGGBOptions(identifiers),
115
+ keys: ["rbracket", "lbracket", "semicolon", "infty", "reals"],
116
+ answerFormat: "tex",
117
+ identifiers,
118
+ hint: getHint(identifiers),
119
+ correction: getCorrection(identifiers),
120
+ };
121
+ return question;
122
+ };
123
+ const getPropositions = (n, { answer, inflexionPoint }) => {
124
+ const propositions = [];
125
+ addValidProp(propositions, answer, "tex");
126
+ const wrongInterval1 = new IntervalNode(inflexionPoint.toTree(), PlusInfinityNode, ClosureType.OO).toTex();
127
+ const wrongInterval2 = new IntervalNode(MinusInfinityNode, inflexionPoint.toTree(), ClosureType.OO).toTex();
128
+ const wrongInterval3 = new IntervalNode(MinusInfinityNode, PlusInfinityNode, ClosureType.OO).toTex();
129
+ const wrongInterval4 = new IntervalNode(new NumberNode(randint(-10, 10)), PlusInfinityNode, ClosureType.OO).toTex();
130
+ tryToAddWrongProp(propositions, wrongInterval1);
131
+ tryToAddWrongProp(propositions, wrongInterval2);
132
+ tryToAddWrongProp(propositions, wrongInterval3);
133
+ tryToAddWrongProp(propositions, wrongInterval4);
134
+ return shuffleProps(propositions, n);
135
+ };
136
+ const isAnswerValid = (ans, { answer }) => {
137
+ try {
138
+ const parsed = intervalParser(ans, { expectedClosure: ClosureType.OO });
139
+ if (!parsed)
140
+ return false;
141
+ return parsed.simplify().toTex() === answer;
142
+ }
143
+ catch (err) {
144
+ return handleVEAError(err);
145
+ }
146
+ };
147
+ export const convexityQuadrinomialsGeo = {
148
+ id: "convexityQuadrinomialsGeo",
149
+ label: "Déterminer graphiquement la convexité d'un polynôme de degré $3$",
150
+ isSingleStep: true,
151
+ generator: (nb) => getDistinctQuestions(getConvexityQuadrinomialsGeoQuestion, nb),
152
+ qcmTimer: 60,
153
+ freeTimer: 60,
154
+ getPropositions,
155
+ isAnswerValid,
156
+ subject: "Mathématiques",
157
+ hasGeogebra: true,
158
+ getQuestionFromIdentifiers,
159
+ hasHintAndCorrection: true,
160
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"convexityTrinomials.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/convexity/convexityTrinomials.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AAIrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAgDF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAcrD,CAAC"}
1
+ {"version":3,"file":"convexityTrinomials.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/convexity/convexityTrinomials.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAIrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAwFF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAerD,CAAC"}
@@ -3,7 +3,7 @@ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQue
3
3
  import { TrinomConstructor } from "../../../../math/polynomials/trinom.js";
4
4
  const getInstruction = (identifiers) => {
5
5
  const trinom = TrinomConstructor.fromCoeffs(identifiers.coeffs);
6
- return `Soit la fonction $f$ définie par :
6
+ return `Soit la fonction $f$ définie sur $\\mathbb{R}$ par :
7
7
 
8
8
  $$
9
9
  f(x) = ${trinom.toTex()}
@@ -11,6 +11,34 @@ $$
11
11
 
12
12
  Sur $\\mathbb{R}$, $f$ est :`;
13
13
  };
14
+ const getHint = () => `Soit $f$ une fonction deux fois dérivable et soit $f''$ sa dérivée seconde.
15
+
16
+ Alors :
17
+
18
+ - $f$ est convexe sur un intervalle $I$ si et seulement si $f''$ est positive sur $I$ ;
19
+ - $f$ est concave sur un intervalle $I$ si et seulement si $f''$ est négative sur $I$.
20
+
21
+ Ici, il faut donc calculer $f''$.`;
22
+ const getCorrection = (identifiers) => {
23
+ const { coeffs } = identifiers;
24
+ const trinom = TrinomConstructor.fromCoeffs(coeffs);
25
+ return `On calcule la dérivée seconde $f''$ de $f$. On a, pour tout $x\\in \\mathbb{R}$ :
26
+
27
+ $$
28
+ f'(x) = ${trinom.derivate().toTree().simplify().toTex()}
29
+ $$
30
+
31
+ Donc :
32
+
33
+ $$
34
+ f''(x) = ${trinom.derivate().derivate().toTree().simplify().toTex()}
35
+ $$
36
+
37
+ On a donc, pour tout $x\\in \\mathbb{R}$, $f''(x) ${trinom.a > 0 ? "\\geq 0" : "\\leq 0"}$.
38
+
39
+ La fonction $f$ est donc ${trinom.a > 0 ? "convexe" : "concave"} sur $\\mathbb{R}$.
40
+ `;
41
+ };
14
42
  const getAnswer = (identifiers) => {
15
43
  const trinom = TrinomConstructor.fromCoeffs(identifiers.coeffs);
16
44
  const isConvex = trinom.a > 0 ? "Convexe" : "Concave";
@@ -28,6 +56,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
28
56
  keys: [],
29
57
  answerFormat: "raw",
30
58
  identifiers,
59
+ hint: getHint(identifiers),
60
+ correction: getCorrection(identifiers),
31
61
  };
32
62
  return question;
33
63
  };
@@ -42,7 +72,7 @@ const getPropositions = (n, { answer }) => {
42
72
  };
43
73
  export const convexityTrinomials = {
44
74
  id: "convexityTrinomials",
45
- label: "Déterminer la convexité d'un trinôme",
75
+ label: "Déterminer la convexité d'une fonction polynôme du second degré",
46
76
  isSingleStep: true,
47
77
  generator: (nb) => getDistinctQuestions(getConvexityTrinomialsQuestion, nb),
48
78
  qcmTimer: 60,
@@ -53,4 +83,5 @@ export const convexityTrinomials = {
53
83
  getAnswer,
54
84
  getInstruction,
55
85
  getQuestionFromIdentifiers,
86
+ hasHintAndCorrection: true,
56
87
  };
@@ -0,0 +1,7 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ trinom: number[];
4
+ };
5
+ export declare const convexityTrinomialsGeo: Exercise<Identifiers>;
6
+ export {};
7
+ //# sourceMappingURL=convexityTrinomialsGeo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convexityTrinomialsGeo.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/convexity/convexityTrinomialsGeo.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAQrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAiFF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAexD,CAAC"}
@@ -0,0 +1,80 @@
1
+ import { addValidProp, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { blueMain } from "../../../../geogebra/colors.js";
4
+ import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
5
+ import { Trinom, TrinomConstructor } from "../../../../math/polynomials/trinom.js";
6
+ import { shuffle } from "../../../../utils/alea/shuffle.js";
7
+ const getInstruction = () => {
8
+ return `Ci-dessous est tracée la courbe représentative $\\mathcal C_f$ d'une fonction $f$. Sur $\\mathbb{R}$, la fonction $f$ est :`;
9
+ };
10
+ const getAnswer = (identifiers) => {
11
+ const trinom = new Trinom(identifiers.trinom[0], identifiers.trinom[1], identifiers.trinom[2]);
12
+ const isConvex = trinom.a > 0 ? "Convexe" : "Concave";
13
+ return isConvex;
14
+ };
15
+ const getGGBOptions = (identifiers) => {
16
+ const trinom = new Trinom(identifiers.trinom[0], identifiers.trinom[1], identifiers.trinom[2]);
17
+ const commands = [
18
+ `f(x) = ${trinom.toMathString()}`,
19
+ `SetColor(f, "${blueMain}")`,
20
+ `SetCaption(f, "$\\mathcal C_f$")`,
21
+ `ShowLabel(f, true)`,
22
+ ];
23
+ const ggb = new GeogebraConstructor({
24
+ commands,
25
+ lockedAxesRatio: false,
26
+ });
27
+ return ggb.getOptions({
28
+ coords: trinom.getCoords(),
29
+ });
30
+ };
31
+ const getHint = () => `Visualise deux points de la courbe et la droite qui les relie (appelée "sécante"). Si pour tout couple de points, la sécante est au-dessous de la courbe, alors la fonction est convexe. Si elle est en-dessous de la courbe, alors la fonction est concave.`;
32
+ const getCorrection = (identifiers) => {
33
+ const { trinom } = identifiers;
34
+ const a = trinom[0];
35
+ const word = a > 0 ? "convexe" : "concave";
36
+ const placement = a > 0 ? "au-dessus" : "en-dessous";
37
+ return `La fonction $f$ semble ${word} sur $\\mathbb{R}$, car toute sécante formée par deux points de la courbe semble être ${placement} de la courbe.`;
38
+ };
39
+ const getConvexityTrinomialsGeoQuestion = () => {
40
+ const trinom = TrinomConstructor.random();
41
+ const identifiers = { trinom: [trinom.a, trinom.b, trinom.c] };
42
+ return getQuestionFromIdentifiers(identifiers);
43
+ };
44
+ const getQuestionFromIdentifiers = (identifiers) => {
45
+ const question = {
46
+ answer: getAnswer(identifiers),
47
+ instruction: getInstruction(identifiers),
48
+ ggbOptions: getGGBOptions(identifiers),
49
+ keys: [],
50
+ answerFormat: "raw",
51
+ identifiers,
52
+ hint: getHint(identifiers),
53
+ correction: getCorrection(identifiers),
54
+ };
55
+ return question;
56
+ };
57
+ const getPropositions = (_n, { answer }) => {
58
+ const propositions = [];
59
+ addValidProp(propositions, answer, "raw");
60
+ tryToAddWrongProp(propositions, "Concave", "raw");
61
+ tryToAddWrongProp(propositions, "Convexe", "raw");
62
+ shuffle(propositions);
63
+ tryToAddWrongProp(propositions, "Ni l'un ni l'autre", "raw");
64
+ tryToAddWrongProp(propositions, "On ne peut pas savoir", "raw");
65
+ return propositions;
66
+ };
67
+ export const convexityTrinomialsGeo = {
68
+ id: "convexityTrinomialsGeo",
69
+ label: "Déterminer graphiquement la convexité d'une fonction polynôme du second degré",
70
+ isSingleStep: true,
71
+ generator: (nb) => getDistinctQuestions(getConvexityTrinomialsGeoQuestion, nb),
72
+ qcmTimer: 60,
73
+ freeTimer: 60,
74
+ answerType: "QCU",
75
+ getPropositions,
76
+ hasGeogebra: true,
77
+ subject: "Mathématiques",
78
+ getQuestionFromIdentifiers,
79
+ hasHintAndCorrection: true,
80
+ };
@@ -1,4 +1,6 @@
1
1
  export * from "./convexityTrinomials.js";
2
2
  export * from "./convexityQuadrinomials.js";
3
3
  export * from "./inflexionPointQuadrinomials.js";
4
+ export * from "./convexityTrinomialsGeo.js";
5
+ export * from "./convexityQuadrinomialsGeo.js";
4
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/convexity/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kCAAkC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/convexity/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gCAAgC,CAAC"}
@@ -1,3 +1,5 @@
1
1
  export * from "./convexityTrinomials.js";
2
2
  export * from "./convexityQuadrinomials.js";
3
3
  export * from "./inflexionPointQuadrinomials.js";
4
+ export * from "./convexityTrinomialsGeo.js";
5
+ export * from "./convexityQuadrinomialsGeo.js";
@@ -99,7 +99,7 @@ const getCorrection = ({ quadcoeffs }) => {
99
99
  const secondDerivative = firstDerivative.derivate();
100
100
  const seconddcoeffs = secondDerivative.coefficients;
101
101
  const inflexionPoint = new FractionNode(new MultiplyNode(seconddcoeffs[0].toTree(), new NumberNode(-1)), seconddcoeffs[1].toTree()).simplify();
102
- return `Le point d'inflexion est l'abscisse la dérivée seconde s'annule.
102
+ return `L'abscisse du point d'inflexion est la valeur de $x$ pour laquelle $f''(x)$ s'annule et change de signe.
103
103
 
104
104
  - La dérivée première est :
105
105
 
@@ -123,7 +123,7 @@ L'abscisse du point d'inflexion est donc $${inflexionPoint.toTex()}$.`;
123
123
  };
124
124
  export const inflexionPointQuadrinomials = {
125
125
  id: "inflexionPointQuadrinomials",
126
- label: "Calculer l'abscisse du point d'inflexion",
126
+ label: "Calculer l'abscisse du point d'inflexion (polynôme de degré $3$)",
127
127
  isSingleStep: true,
128
128
  generator: (nb) => getDistinctQuestions(getInflexionPointQuadrinomialsQuestion, nb),
129
129
  qcmTimer: 60,
@@ -1 +1 @@
1
- {"version":3,"file":"expDerivativeFour.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/derivation/derivative/exp/expDerivativeFour.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB,CAAC;AAiKF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAgBnD,CAAC"}
1
+ {"version":3,"file":"expDerivativeFour.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/derivation/derivative/exp/expDerivativeFour.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAarC,KAAK,WAAW,GAAG;IACjB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB,CAAC;AAyKF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAgBnD,CAAC"}
@@ -1,11 +1,12 @@
1
1
  import { addValidProp, propWhile, shuffleProps, tryToAddWrongProp, } from "../../../../../exercises/exercise.js";
2
2
  import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
3
3
  import { Affine, AffineConstructor } from "../../../../../math/polynomials/affine.js";
4
- import { ExpNode } from "../../../../../tree/nodes/functions/expNode.js";
5
- import { MultiplyNode } from "../../../../../tree/nodes/operators/multiplyNode.js";
6
- import { substract } from "../../../../../tree/nodes/operators/substractNode.js";
4
+ import { exp, ExpNode } from "../../../../../tree/nodes/functions/expNode.js";
5
+ import { add } from "../../../../../tree/nodes/operators/addNode.js";
6
+ import { multiply, MultiplyNode, } from "../../../../../tree/nodes/operators/multiplyNode.js";
7
7
  import { parseAlgebraic } from "../../../../../tree/parsers/latexParser.js";
8
8
  import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
9
+ import { alignTex } from "../../../../../utils/latex/alignTex.js";
9
10
  const getInstruction = (identifiers) => {
10
11
  const { affine1Coeffs, affine2Coeffs } = identifiers;
11
12
  const affine1 = new Affine(affine1Coeffs[1], affine1Coeffs[0]);
@@ -33,66 +34,60 @@ const getHint = () => {
33
34
  return `Si $u$ et $v$ sont deux fonctions dérivables, alors :
34
35
 
35
36
  $$
36
- (uv)'(x) = u'(x)v(x) + u(x)v'(x)
37
+ (uv)' = u'v + uv'
37
38
  $$
38
39
 
39
40
  Si $w$ est une fonction dérivable alors :
40
41
 
41
42
  $$
42
- (e^{w(x)})'(x) = w'(x) \\times e^{w(x)}
43
+ (e^{w})' = w' \\times e^{w}
43
44
  $$
44
45
 
45
46
  `;
46
47
  };
47
48
  const getCorrection = (identifiers) => {
48
49
  const { affine1Coeffs, affine2Coeffs } = identifiers;
49
- const affine1 = new Affine(affine1Coeffs[1], affine1Coeffs[0]);
50
+ const u = new Affine(affine1Coeffs[1], affine1Coeffs[0]);
50
51
  const affine2 = new Affine(affine2Coeffs[1], affine2Coeffs[0]);
52
+ const v = exp(affine2.toTree());
53
+ const uPrime = u.toTree().derivative().simplify();
54
+ const vPrime = v.derivative().simplify();
51
55
  return `Si $u$ et $v$ sont deux fonctions dérivables, alors :
52
56
 
53
57
  $$
54
- (uv)'(x) = u'(x)v(x) + u(x)v'(x)
58
+ (uv)' = u'v + uv'
55
59
  $$
56
60
 
57
- Ici :
61
+ Ici, on note :
58
62
 
59
63
  $$
60
- u(x) = ${affine1.toTex()}
64
+ u(x) = ${u.toTree().toTex()}
61
65
  $$
62
66
 
63
67
  $$
64
- v(x) = e^{${affine2.toTex()}}
68
+ v(x) = ${v.toTex()}
65
69
  $$
66
70
 
71
+ On a donc :
72
+
67
73
  $$
68
- u'(x) = ${affine1.toTree().derivative().simplify().toTex()}
74
+ u'(x) = ${uPrime.toTex()}
69
75
  $$
70
76
 
71
77
  $$
72
- v'(x) = ${affine2
73
- .toTree()
74
- .derivative()
75
- .simplify()
76
- .toTex()} \\times e^{${affine2.toTex()}}
78
+ v'(x) = ${vPrime.toTex()}
77
79
  $$
78
80
 
79
81
  Donc :
80
82
 
81
- $$
82
- f'(x) = ${affine1
83
- .toTree()
84
- .derivative()
85
- .simplify()
86
- .toTex()} \\times e^{${affine2.toTex()}} + (${affine1.toTex()}) \\times (${affine2
87
- .toTree()
88
- .derivative()
89
- .simplify()
90
- .toTex()} \\times e^{${affine2.toTex()}})
91
- $$
92
-
93
- $$
94
- f'(x) = ${getAnswer(identifiers)}
95
- $$
83
+ ${alignTex([
84
+ [
85
+ "f'(x)",
86
+ "=",
87
+ add(multiply(uPrime, v), multiply(u.toTree(), vPrime)).toTex(),
88
+ ],
89
+ ["", "=", getAnswer(identifiers)],
90
+ ])}
96
91
 
97
92
  `;
98
93
  };
@@ -110,7 +105,18 @@ const isAnswerValid = (ans, { answer, ...identifiers }) => {
110
105
  if (!ansNode)
111
106
  return false;
112
107
  const answerNode = getAnswerNode(identifiers);
113
- return substract(ansNode, answerNode).simplify().evaluate() === 0;
108
+ return (ansNode
109
+ .simplify({
110
+ towardsDistribute: true,
111
+ forbidFactorize: true,
112
+ })
113
+ .toTex() ===
114
+ answerNode
115
+ .simplify({
116
+ towardsDistribute: true,
117
+ forbidFactorize: true,
118
+ })
119
+ .toTex());
114
120
  }
115
121
  catch (err) {
116
122
  return handleVEAError(err);
@@ -130,7 +136,7 @@ const getQuestionFromIdentifiers = (identifiers) => {
130
136
  const question = {
131
137
  answer: getAnswer(identifiers),
132
138
  instruction: getInstruction(identifiers),
133
- keys: ["x", "epower", "exp"],
139
+ keys: ["x", "epower"],
134
140
  answerFormat: "tex",
135
141
  identifiers,
136
142
  hint: getHint(identifiers),
@@ -1 +1 @@
1
- {"version":3,"file":"secondDerivativeOfExpoFunction.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/derivation/derivative/exp/secondDerivativeOfExpoFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAcrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAsFF,eAAO,MAAM,8BAA8B,EAAE,QAAQ,CAAC,WAAW,CAYhE,CAAC"}
1
+ {"version":3,"file":"secondDerivativeOfExpoFunction.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/derivation/derivative/exp/secondDerivativeOfExpoFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAmBrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AA+HF,eAAO,MAAM,8BAA8B,EAAE,QAAQ,CAAC,WAAW,CAahE,CAAC"}
@@ -1,12 +1,14 @@
1
1
  import { addValidProp, propWhile, shuffleProps, tryToAddWrongProp, } from "../../../../../exercises/exercise.js";
2
2
  import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { Affine, AffineConstructor } from "../../../../../math/polynomials/affine.js";
3
4
  import { Polynomial, PolynomialConstructor, } from "../../../../../math/polynomials/polynomial.js";
4
5
  import { expUDerivate } from "../../../../../math/utils/functions/expUDerivate.js";
5
- import { ExpNode } from "../../../../../tree/nodes/functions/expNode.js";
6
+ import { exp, ExpNode } from "../../../../../tree/nodes/functions/expNode.js";
6
7
  import { AddNode } from "../../../../../tree/nodes/operators/addNode.js";
7
- import { MultiplyNode } from "../../../../../tree/nodes/operators/multiplyNode.js";
8
+ import { multiply, MultiplyNode, } from "../../../../../tree/nodes/operators/multiplyNode.js";
8
9
  import { parseAlgebraic } from "../../../../../tree/parsers/latexParser.js";
9
10
  import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
11
+ import { alignTex } from "../../../../../utils/latex/alignTex.js";
10
12
  const getInstruction = (identifiers) => {
11
13
  const { coeffs } = identifiers;
12
14
  const polynom = new Polynomial(coeffs);
@@ -28,10 +30,47 @@ const getAnswer = (identifiers) => {
28
30
  .toTex();
29
31
  };
30
32
  const getSecondDerivativeOfExpoFunctionQuestion = () => {
31
- const polynom = PolynomialConstructor.randomWithOrder(1, "x");
33
+ const polynom = AffineConstructor.random({
34
+ excludes: [0, 1],
35
+ });
32
36
  const identifiers = { coeffs: polynom.coefficients };
33
37
  return getQuestionFromIdentifiers(identifiers);
34
38
  };
39
+ const getHint = () => {
40
+ return `Pour toute fonction dérivable $u$, on a :
41
+
42
+ $$
43
+ \\left(e^{u}\\right)' = u' \\times e^u
44
+ $$
45
+
46
+ Ici, commence par calculer $f'(x)$ en utilisant cette propriété.
47
+
48
+ Puis, calcule la dérivée de $f'(x)$ : tu obtiendras alors la dérivée seconde $f''$ de $f$.`;
49
+ };
50
+ const getCorrection = (identifiers) => {
51
+ const { coeffs } = identifiers;
52
+ const a = coeffs[1];
53
+ const aff = new Affine(coeffs[1], coeffs[0]).toTree();
54
+ return `Pour toute fonction dérivable $u$, on a :
55
+
56
+ $$
57
+ \\left(e^{u}\\right)' = u' \\times e^u
58
+ $$
59
+
60
+ On commence donc par calculer $f'(x)$ :
61
+
62
+ $$
63
+ f'(x) = ${multiply(a, exp(aff)).toTex()}
64
+ $$
65
+
66
+ On dérive alors de nouveau :
67
+
68
+ ${alignTex([
69
+ ["f'(x)", "=", multiply(multiply(a, a), exp(aff)).toTex()],
70
+ ["", "=", getAnswer(identifiers)],
71
+ ])}
72
+ `;
73
+ };
35
74
  const getQuestionFromIdentifiers = (identifiers) => {
36
75
  const question = {
37
76
  answer: getAnswer(identifiers),
@@ -39,6 +78,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
39
78
  keys: ["epower", "x", "lnBrackets"],
40
79
  answerFormat: "tex",
41
80
  identifiers,
81
+ hint: getHint(identifiers),
82
+ correction: getCorrection(identifiers),
42
83
  };
43
84
  return question;
44
85
  };
@@ -83,4 +124,5 @@ export const secondDerivativeOfExpoFunction = {
83
124
  isAnswerValid,
84
125
  subject: "Mathématiques",
85
126
  getQuestionFromIdentifiers,
127
+ hasHintAndCorrection: true,
86
128
  };
@@ -1 +1 @@
1
- {"version":3,"file":"lnDerivativeOne.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/derivation/derivative/ln/lnDerivativeOne.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAiBrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAoFF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAYjD,CAAC"}
1
+ {"version":3,"file":"lnDerivativeOne.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/derivation/derivative/ln/lnDerivativeOne.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAmBrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA2HF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAajD,CAAC"}