math-exercises 3.0.182 → 3.0.184

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 (85) hide show
  1. package/lib/exercises/math/functions/composition/functionComposition.d.ts.map +1 -1
  2. package/lib/exercises/math/functions/composition/functionComposition.js +11 -22
  3. package/lib/exercises/math/functions/exponential/algebraic/index.d.ts +1 -0
  4. package/lib/exercises/math/functions/exponential/algebraic/index.d.ts.map +1 -1
  5. package/lib/exercises/math/functions/exponential/algebraic/index.js +1 -1
  6. package/lib/exercises/math/functions/exponential/algebraic/rewriteExpUsingExpA.d.ts.map +1 -1
  7. package/lib/exercises/math/functions/exponential/algebraic/rewriteExpUsingExpA.js +18 -3
  8. package/lib/exercises/math/functions/exponential/expKT/derivativeOfAExpKT.d.ts +8 -0
  9. package/lib/exercises/math/functions/exponential/expKT/derivativeOfAExpKT.d.ts.map +1 -0
  10. package/lib/exercises/math/functions/exponential/expKT/derivativeOfAExpKT.js +108 -0
  11. package/lib/exercises/math/functions/exponential/expKT/drugConcentrationMaximum.d.ts +8 -0
  12. package/lib/exercises/math/functions/exponential/expKT/drugConcentrationMaximum.d.ts.map +1 -0
  13. package/lib/exercises/math/functions/exponential/expKT/drugConcentrationMaximum.js +144 -0
  14. package/lib/exercises/math/functions/exponential/expKT/index.d.ts +3 -0
  15. package/lib/exercises/math/functions/exponential/expKT/index.d.ts.map +1 -0
  16. package/lib/exercises/math/functions/exponential/expKT/index.js +2 -0
  17. package/lib/exercises/math/functions/exponential/expSimplifiying.d.ts.map +1 -1
  18. package/lib/exercises/math/functions/exponential/expSimplifiying.js +94 -4
  19. package/lib/exercises/math/functions/exponential/index.d.ts +3 -0
  20. package/lib/exercises/math/functions/exponential/index.d.ts.map +1 -1
  21. package/lib/exercises/math/functions/exponential/index.js +3 -0
  22. package/lib/exercises/math/functions/exponential/sign/expFunctionBasicSign.d.ts +9 -0
  23. package/lib/exercises/math/functions/exponential/sign/expFunctionBasicSign.d.ts.map +1 -0
  24. package/lib/exercises/math/functions/exponential/sign/expFunctionBasicSign.js +101 -0
  25. package/lib/exercises/math/functions/exponential/sign/index.d.ts +2 -0
  26. package/lib/exercises/math/functions/exponential/sign/index.d.ts.map +1 -0
  27. package/lib/exercises/math/functions/exponential/sign/index.js +1 -0
  28. package/lib/exercises/math/functions/exponential/variations/index.d.ts +3 -0
  29. package/lib/exercises/math/functions/exponential/variations/index.d.ts.map +1 -0
  30. package/lib/exercises/math/functions/exponential/variations/index.js +2 -0
  31. package/lib/exercises/math/functions/exponential/variations/varSignTableOfAffineTimesExp.d.ts +7 -0
  32. package/lib/exercises/math/functions/exponential/variations/varSignTableOfAffineTimesExp.d.ts.map +1 -0
  33. package/lib/exercises/math/functions/exponential/variations/varSignTableOfAffineTimesExp.js +144 -0
  34. package/lib/exercises/math/functions/exponential/variations/varSignTableOfExpMinusX.d.ts +7 -0
  35. package/lib/exercises/math/functions/exponential/variations/varSignTableOfExpMinusX.d.ts.map +1 -0
  36. package/lib/exercises/math/functions/exponential/variations/varSignTableOfExpMinusX.js +139 -0
  37. package/lib/exercises/math/probaStat/independancy/independantSuccessiveEventsComputeTwoSuccess.d.ts +7 -0
  38. package/lib/exercises/math/probaStat/independancy/independantSuccessiveEventsComputeTwoSuccess.d.ts.map +1 -0
  39. package/lib/exercises/math/probaStat/independancy/independantSuccessiveEventsComputeTwoSuccess.js +100 -0
  40. package/lib/exercises/math/probaStat/independancy/index.d.ts +1 -0
  41. package/lib/exercises/math/probaStat/independancy/index.d.ts.map +1 -1
  42. package/lib/exercises/math/probaStat/independancy/index.js +1 -0
  43. package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoConsecutiveTerms.d.ts.map +1 -1
  44. package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoConsecutiveTerms.js +37 -39
  45. package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoTerms.d.ts.map +1 -1
  46. package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoTerms.js +14 -4
  47. package/lib/exercises/math/sequences/geometric/index.d.ts +3 -0
  48. package/lib/exercises/math/sequences/geometric/index.d.ts.map +1 -1
  49. package/lib/exercises/math/sequences/geometric/index.js +3 -3
  50. package/lib/exercises/math/sequences/geometric/situations/geometricFindExplicitFormulaFromSituation.d.ts.map +1 -1
  51. package/lib/exercises/math/sequences/geometric/situations/geometricFindExplicitFormulaFromSituation.js +12 -3
  52. package/lib/exercises/math/sequences/geometric/situations/index.d.ts +1 -0
  53. package/lib/exercises/math/sequences/geometric/situations/index.d.ts.map +1 -1
  54. package/lib/exercises/math/sequences/geometric/situations/index.js +1 -1
  55. package/lib/exercises/vea/treeTableVEA.d.ts.map +1 -1
  56. package/lib/exercises/vea/treeTableVEA.js +3 -0
  57. package/lib/index.d.ts +50 -0
  58. package/lib/index.d.ts.map +1 -1
  59. package/lib/latexTester.js +1 -1
  60. package/lib/tests/singleExo.test.js +2 -2
  61. package/lib/tree/nodes/functions/expNode.d.ts +1 -1
  62. package/lib/tree/nodes/functions/expNode.d.ts.map +1 -1
  63. package/lib/tree/nodes/functions/expNode.js +3 -6
  64. package/lib/tree/nodes/operators/addNode.d.ts +1 -1
  65. package/lib/tree/nodes/operators/addNode.d.ts.map +1 -1
  66. package/lib/tree/nodes/operators/addNode.js +2 -2
  67. package/lib/tree/nodes/operators/substractNode.d.ts +1 -1
  68. package/lib/tree/nodes/operators/substractNode.d.ts.map +1 -1
  69. package/lib/tree/nodes/operators/substractNode.js +2 -2
  70. package/lib/tree/utilities/nodeComparator.d.ts +7 -0
  71. package/lib/tree/utilities/nodeComparator.d.ts.map +1 -0
  72. package/lib/tree/utilities/nodeComparator.js +88 -0
  73. package/lib/tree/utilities/nodeInspector.d.ts +5 -0
  74. package/lib/tree/utilities/nodeInspector.d.ts.map +1 -0
  75. package/lib/tree/utilities/nodeInspector.js +15 -0
  76. package/lib/tree/utilities/nodeRewriter.d.ts +9 -0
  77. package/lib/tree/utilities/nodeRewriter.d.ts.map +1 -0
  78. package/lib/tree/utilities/nodeRewriter.js +172 -0
  79. package/lib/tree/utilities/nodeShuffler.d.ts +2 -4
  80. package/lib/tree/utilities/nodeShuffler.d.ts.map +1 -1
  81. package/lib/tree/utilities/nodeShuffler.js +13 -104
  82. package/lib/tree/utilities/nodeSimplifier.d.ts +1 -2
  83. package/lib/tree/utilities/nodeSimplifier.d.ts.map +1 -1
  84. package/lib/tree/utilities/nodeSimplifier.js +14 -88
  85. package/package.json +1 -1
@@ -0,0 +1,101 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { randint } from "../../../../../math/utils/random/randint.js";
4
+ import { exp } from "../../../../../tree/nodes/functions/expNode.js";
5
+ import { multiply } from "../../../../../tree/nodes/operators/multiplyNode.js";
6
+ import { square } from "../../../../../tree/nodes/operators/powerNode.js";
7
+ const getFunc = (identifiers) => {
8
+ const { a, k, type } = identifiers;
9
+ if (type === 0) {
10
+ return multiply(multiply(a, square("x")), exp(multiply(k, "x")));
11
+ }
12
+ return multiply(a, exp(multiply(k, "x")));
13
+ };
14
+ const getPropositions = (n, { answer }) => {
15
+ const propositions = [];
16
+ addValidProp(propositions, answer, "raw");
17
+ [
18
+ "Positive sur $\\mathbb{R}$",
19
+ "Négative sur $\\mathbb{R}$",
20
+ "Change de signe sur $\\mathbb{R}$",
21
+ ].forEach((p) => tryToAddWrongProp(propositions, p, "raw"));
22
+ return shuffleProps(propositions, n);
23
+ };
24
+ const getAnswer = (identifiers) => {
25
+ return identifiers.a < 0
26
+ ? "Négative sur $\\mathbb{R}$"
27
+ : "Positive sur $\\mathbb{R}$";
28
+ };
29
+ const getInstruction = (identifiers) => {
30
+ return `Soit $f$ la fonction définie sur $\\mathbb{R}$ par :
31
+
32
+ $$
33
+ f(x) = ${getFunc(identifiers).toTex()}
34
+ $$
35
+
36
+ Quel est le signe de $f$ sur $\\mathbb{R}$ ?`;
37
+ };
38
+ const getHint = () => {
39
+ return `Rappelle toi que pour tout $x$ réel, on a :
40
+
41
+ $$
42
+ e^x > 0
43
+ $$`;
44
+ };
45
+ const getCorrection = (identifiers) => {
46
+ const { a, type, k } = identifiers;
47
+ const prev = type === 0 ? multiply(a, square("x")) : a.toTree();
48
+ return `On sait que pour tout $x$ réel, on a :
49
+
50
+ $$
51
+ e^x > 0
52
+ $$
53
+
54
+ Ici, on a donc $${exp(multiply(k, "x")).toTex()} > 0$.
55
+
56
+ $f$ est donc du signe de $${prev.toTex()}$.
57
+
58
+ ${type === 0 ? `Or, un carré est toujours positif.` : ""}
59
+
60
+ $f$ est donc ${getAnswer(identifiers).toLocaleLowerCase()}.
61
+ `;
62
+ };
63
+ const getExpFunctionBasicSignQuestion = () => {
64
+ const type = randint(0, 2);
65
+ const a = randint(-10, 10, [0, 1]);
66
+ const k = randint(-10, 10, [0]);
67
+ const identifiers = {
68
+ a,
69
+ k,
70
+ type,
71
+ };
72
+ return getQuestionFromIdentifiers(identifiers);
73
+ };
74
+ const getQuestionFromIdentifiers = (identifiers) => {
75
+ return {
76
+ answer: getAnswer(identifiers),
77
+ instruction: getInstruction(identifiers),
78
+ keys: [],
79
+ answerFormat: "raw",
80
+ identifiers,
81
+ hint: getHint(identifiers),
82
+ correction: getCorrection(identifiers),
83
+ };
84
+ };
85
+ export const expFunctionBasicSign = {
86
+ id: "expFunctionBasicSign",
87
+ label: "Déterminer le signe d'une fonction avec exponentielle",
88
+ isSingleStep: true,
89
+ generator: (nb, opts) => getDistinctQuestions(() => getExpFunctionBasicSignQuestion(opts), nb),
90
+ qcmTimer: 60,
91
+ freeTimer: 60,
92
+ getPropositions,
93
+ answerType: "QCU",
94
+ subject: "Mathématiques",
95
+ getInstruction,
96
+ getHint,
97
+ getCorrection,
98
+ getAnswer,
99
+ getQuestionFromIdentifiers,
100
+ hasHintAndCorrection: true,
101
+ };
@@ -0,0 +1,2 @@
1
+ export * from "./expFunctionBasicSign.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/exponential/sign/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC"}
@@ -0,0 +1 @@
1
+ export * from "./expFunctionBasicSign.js";
@@ -0,0 +1,3 @@
1
+ export * from "./varSignTableOfAffineTimesExp.js";
2
+ export * from "./varSignTableOfExpMinusX.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/exponential/variations/index.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC;AAClD,cAAc,8BAA8B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./varSignTableOfAffineTimesExp.js";
2
+ export * from "./varSignTableOfExpMinusX.js";
@@ -0,0 +1,7 @@
1
+ import { Exercise } from "../../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ coeffs: number[];
4
+ };
5
+ export declare const varSignTableOfAffineTimesExp: Exercise<Identifiers>;
6
+ export {};
7
+ //# sourceMappingURL=varSignTableOfAffineTimesExp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"varSignTableOfAffineTimesExp.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/exponential/variations/varSignTableOfAffineTimesExp.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAuIF,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,WAAW,CAqB9D,CAAC"}
@@ -0,0 +1,144 @@
1
+ import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
2
+ import { varSignTableVEA } from "../../../../../exercises/vea/varSignTableVEA.js";
3
+ import { Affine, AffineConstructor } from "../../../../../math/polynomials/affine.js";
4
+ import { exp } from "../../../../../tree/nodes/functions/expNode.js";
5
+ import { add } from "../../../../../tree/nodes/operators/addNode.js";
6
+ import { multiply } from "../../../../../tree/nodes/operators/multiplyNode.js";
7
+ import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
8
+ import { alignTex } from "../../../../../utils/latex/alignTex.js";
9
+ const getAnswerTable = (identifiers) => {
10
+ const { coeffs } = identifiers;
11
+ const firstAffine = AffineConstructor.fromCoeffs(coeffs);
12
+ //f'(x) = e^x(ax+a+b)
13
+ const affine = new Affine(firstAffine.a, firstAffine.b + firstAffine.a);
14
+ const root = affine.getRoot().toTree();
15
+ const signs = affine.a > 0 ? ["-", "+"] : ["+", "-"];
16
+ // const img = multiply(-affine.a, exp(root)).toTex();
17
+ const vars = affine.a > 0 ? ["\\searrow", "\\nearrow"] : ["\\nearrow", "\\searrow"];
18
+ return [
19
+ ["$x$", "-\\infty", "\\ ", root.toTex(), "\\ ", "+\\infty"],
20
+ ["$f'(x)$", "\\ ", signs[0], "0", signs[1], "\\ "],
21
+ [
22
+ "$\\ $",
23
+ "\\ ",
24
+ "\\ ",
25
+ // vars[0] === "\\nearrow" ? img : "\\ ",
26
+ "\\ ",
27
+ "\\ ",
28
+ "\\ ",
29
+ ],
30
+ ["$f(x)$", "\\ ", vars[0], "\\ ", vars[1], "\\ "],
31
+ [
32
+ "$\\ $",
33
+ "\\ ",
34
+ "\\ ",
35
+ // vars[0] === "\\searrow" ? img : "\\ ",
36
+ "\\ ",
37
+ "\\ ",
38
+ "\\ ",
39
+ ],
40
+ ];
41
+ };
42
+ const getInstruction = (identifiers) => {
43
+ const { coeffs } = identifiers;
44
+ const affine = AffineConstructor.fromCoeffs(coeffs);
45
+ return `Soit $f$ la fonction définie par :
46
+
47
+ $$
48
+ f(x) = ${multiply(exp("x"), affine.toTree())
49
+ .simplify({
50
+ forbidFactorize: true,
51
+ })
52
+ .toTex()}
53
+ $$
54
+
55
+ Dresser le tableau de signes de $f'$ et de variations de $f$.`;
56
+ };
57
+ const getHint = () => {
58
+ return `Calcule la dérivée de $f$, puis étudie son signe.`;
59
+ };
60
+ const getCorrection = (identifiers) => {
61
+ const { coeffs } = identifiers;
62
+ const firstAffine = AffineConstructor.fromCoeffs(coeffs);
63
+ //f'(x) = e^x(ax+a+b)
64
+ const a = firstAffine.a;
65
+ const affine = new Affine(firstAffine.a, firstAffine.b + firstAffine.a);
66
+ const root = affine.getRoot().toTree();
67
+ const ineq = affine.a > 0 ? "\\ge" : "\\le";
68
+ const vars = affine.a > 0
69
+ ? ["décroissante", "croissante"]
70
+ : ["croissante", "décroissante"];
71
+ return `On calcule la dérivée de $f$ :
72
+
73
+ ${alignTex([
74
+ [
75
+ "f'(x)",
76
+ "=",
77
+ add(multiply(exp("x"), firstAffine.toTree()), multiply(a, exp("x"))).toTex(),
78
+ ],
79
+ ["", "=", multiply(exp("x"), affine.toTree()).toTex()],
80
+ ])}
81
+
82
+ Puisque $e^x\\geq 0$ pour tout $x$ réel, $f'(x)$ est du signe de $${affine
83
+ .toTree()
84
+ .toTex()}$.
85
+
86
+ Donc, $f'(x)\\geq 0 \\iff x ${ineq} ${root.toTex()}$.
87
+
88
+ On en conclut que $f$ est ${vars[0]} puis ${vars[1]}.
89
+
90
+ `;
91
+ };
92
+ const getKeys = () => {
93
+ return ["epower"];
94
+ };
95
+ const isAnswerTableValid = (ans, { answerTable }) => {
96
+ try {
97
+ return varSignTableVEA(ans, answerTable);
98
+ }
99
+ catch (err) {
100
+ return handleVEAError(err);
101
+ }
102
+ };
103
+ const getVarSignTableOfAffineTimesExpQuestion = () => {
104
+ const affine = AffineConstructor.random();
105
+ const identifiers = {
106
+ coeffs: affine.coefficients,
107
+ };
108
+ return getQuestionFromIdentifiers(identifiers);
109
+ };
110
+ const getQuestionFromIdentifiers = (identifiers) => {
111
+ return {
112
+ answerTable: getAnswerTable(identifiers),
113
+ instruction: getInstruction(identifiers),
114
+ keys: getKeys(identifiers),
115
+ answerFormat: "tex",
116
+ identifiers,
117
+ hint: getHint(identifiers),
118
+ correction: getCorrection(identifiers),
119
+ initTable: [
120
+ ["$x$", "", "\\ ", "", "\\ ", ""],
121
+ ["$f'(x)$", "\\ ", "", "", "", "\\ "],
122
+ ["$\\ $", "\\ ", "\\ ", "\\ ", "\\ ", "\\ "],
123
+ ["$f(x)$", "\\ ", "", "\\ ", "", "\\ "],
124
+ ["$\\ $", "\\ ", "\\ ", "\\ ", "\\ ", "\\ "],
125
+ ],
126
+ };
127
+ };
128
+ export const varSignTableOfAffineTimesExp = {
129
+ id: "varSignTableOfAffineTimesExp",
130
+ label: "Dresser le tableau de variations d'une fonction avec exponentielle de type $e^x(ax+b)$",
131
+ isSingleStep: true,
132
+ generator: (nb, opts) => getDistinctQuestions(() => getVarSignTableOfAffineTimesExpQuestion(opts), nb),
133
+ qcmTimer: 60,
134
+ freeTimer: 60,
135
+ isAnswerTableValid,
136
+ subject: "Mathématiques",
137
+ getInstruction,
138
+ getHint,
139
+ getCorrection,
140
+ getAnswerTable,
141
+ getQuestionFromIdentifiers,
142
+ hasHintAndCorrection: true,
143
+ answerType: "signVarTable",
144
+ };
@@ -0,0 +1,7 @@
1
+ import { Exercise } from "../../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ a: number;
4
+ };
5
+ export declare const varSignTableOfExpMinusX: Exercise<Identifiers>;
6
+ export {};
7
+ //# sourceMappingURL=varSignTableOfExpMinusX.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"varSignTableOfExpMinusX.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/exponential/variations/varSignTableOfExpMinusX.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA+HF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAqBzD,CAAC"}
@@ -0,0 +1,139 @@
1
+ import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
2
+ import { varSignTableVEA } from "../../../../../exercises/vea/varSignTableVEA.js";
3
+ import { randint } from "../../../../../math/utils/random/randint.js";
4
+ import { exp } from "../../../../../tree/nodes/functions/expNode.js";
5
+ import { multiply } from "../../../../../tree/nodes/operators/multiplyNode.js";
6
+ import { substract } from "../../../../../tree/nodes/operators/substractNode.js";
7
+ import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
8
+ import { alignTex } from "../../../../../utils/latex/alignTex.js";
9
+ const getAnswerTable = (identifiers) => {
10
+ const { a } = identifiers;
11
+ //f'(x) = a(e^x-1)
12
+ const signs = a > 0 ? ["-", "+"] : ["+", "-"];
13
+ // const img = multiply(-affine.a, exp(root)).toTex();
14
+ const vars = a > 0 ? ["\\searrow", "\\nearrow"] : ["\\nearrow", "\\searrow"];
15
+ return [
16
+ ["$x$", "-\\infty", "\\ ", "0", "\\ ", "+\\infty"],
17
+ ["$f'(x)$", "\\ ", signs[0], "0", signs[1], "\\ "],
18
+ [
19
+ "$\\ $",
20
+ "\\ ",
21
+ "\\ ",
22
+ vars[0] === "\\nearrow" ? a.frenchify() : "\\ ",
23
+ "\\ ",
24
+ "\\ ",
25
+ ],
26
+ ["$f(x)$", "\\ ", vars[0], "\\ ", vars[1], "\\ "],
27
+ [
28
+ "$\\ $",
29
+ "\\ ",
30
+ "\\ ",
31
+ vars[0] === "\\searrow" ? a.frenchify() : "\\ ",
32
+ "\\ ",
33
+ "\\ ",
34
+ ],
35
+ ];
36
+ };
37
+ const getInstruction = (identifiers) => {
38
+ const { a } = identifiers;
39
+ return `Soit $f$ la fonction définie par :
40
+
41
+ $$
42
+ f(x) = ${substract(multiply(a, exp("x")), multiply(a, "x"))
43
+ .simplify({ forbidFactorize: true })
44
+ .toTex()}
45
+ $$
46
+
47
+ Dresser le tableau de signes de $f'$ et de variations de $f$.`;
48
+ };
49
+ const getHint = () => {
50
+ return `Calcule la dérivée de $f$, puis étudie son signe.`;
51
+ };
52
+ const getCorrection = (identifiers) => {
53
+ const { a } = identifiers;
54
+ //f'(x) = a(e^x-1)
55
+ const ineq = a > 0 ? "\\ge" : "\\le";
56
+ const vars = a > 0 ? ["décroissante", "croissante"] : ["croissante", "décroissante"];
57
+ return `On calcule la dérivée de $f$ :
58
+
59
+ ${alignTex([
60
+ [
61
+ "f'(x)",
62
+ "=",
63
+ substract(multiply(a, exp("x")), a)
64
+ .simplify({
65
+ forbidFactorize: true,
66
+ })
67
+ .toTex(),
68
+ ],
69
+ ["", "=", multiply(a, substract(exp("x"), 1)).toTex()],
70
+ ])}
71
+
72
+ Or, $e^x -1\\geq 0 \\iff x\\geq 0$.
73
+
74
+ Donc, $f'(x)\\geq 0 \\iff x ${ineq} 0$.
75
+
76
+ On en conclut que $f$ est ${vars[0]} puis ${vars[1]}.
77
+
78
+ D'autre part :
79
+
80
+ $$
81
+ f(0) = ${multiply(a, exp(0)).toTex()} = ${a.frenchify()}
82
+ $$
83
+
84
+ car $e^0 = 1$.
85
+ `;
86
+ };
87
+ const getKeys = () => {
88
+ return ["epower"];
89
+ };
90
+ const isAnswerTableValid = (ans, { answerTable }) => {
91
+ try {
92
+ return varSignTableVEA(ans, answerTable);
93
+ }
94
+ catch (err) {
95
+ return handleVEAError(err);
96
+ }
97
+ };
98
+ const getVarSignTableOfAffineTimesExpQuestion = () => {
99
+ const a = randint(-20, 20, [0]);
100
+ const identifiers = {
101
+ a,
102
+ };
103
+ return getQuestionFromIdentifiers(identifiers);
104
+ };
105
+ const getQuestionFromIdentifiers = (identifiers) => {
106
+ return {
107
+ answerTable: getAnswerTable(identifiers),
108
+ instruction: getInstruction(identifiers),
109
+ keys: getKeys(identifiers),
110
+ answerFormat: "tex",
111
+ identifiers,
112
+ hint: getHint(identifiers),
113
+ correction: getCorrection(identifiers),
114
+ initTable: [
115
+ ["$x$", "", "\\ ", "", "\\ ", ""],
116
+ ["$f'(x)$", "\\ ", "", "", "", "\\ "],
117
+ ["$\\ $", "\\ ", "\\ ", "\\ ", "\\ ", "\\ "],
118
+ ["$f(x)$", "\\ ", "", "", "", "\\ "],
119
+ ["$\\ $", "\\ ", "\\ ", "\\ ", "\\ ", "\\ "],
120
+ ],
121
+ };
122
+ };
123
+ export const varSignTableOfExpMinusX = {
124
+ id: "varSignTableOfExpMinusX",
125
+ label: "Dresser le tableau de variations d'une fonction avec exponentielle de type $ae^x-ax$",
126
+ isSingleStep: true,
127
+ generator: (nb, opts) => getDistinctQuestions(() => getVarSignTableOfAffineTimesExpQuestion(opts), nb),
128
+ qcmTimer: 60,
129
+ freeTimer: 60,
130
+ isAnswerTableValid,
131
+ subject: "Mathématiques",
132
+ getInstruction,
133
+ getHint,
134
+ getCorrection,
135
+ getAnswerTable,
136
+ getQuestionFromIdentifiers,
137
+ hasHintAndCorrection: true,
138
+ answerType: "signVarTable",
139
+ };
@@ -0,0 +1,7 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ percent: number;
4
+ };
5
+ export declare const independantSuccessiveEventsComputeTwoSuccess: Exercise<Identifiers>;
6
+ export {};
7
+ //# sourceMappingURL=independantSuccessiveEventsComputeTwoSuccess.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"independantSuccessiveEventsComputeTwoSuccess.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/independancy/independantSuccessiveEventsComputeTwoSuccess.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAsFF,eAAO,MAAM,4CAA4C,EAAE,QAAQ,CAAC,WAAW,CAuB5E,CAAC"}
@@ -0,0 +1,100 @@
1
+ import { addValidProp, shuffleProps, propWhile, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { rationalVEA } from "../../../../exercises/vea/rationalVEA.js";
4
+ import { randfloat } from "../../../../math/utils/random/randfloat.js";
5
+ import { randint } from "../../../../math/utils/random/randint.js";
6
+ import { round } from "../../../../math/utils/round.js";
7
+ import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
8
+ import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
9
+ import { square } from "../../../../tree/nodes/operators/powerNode.js";
10
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
11
+ import { alignTex } from "../../../../utils/latex/alignTex.js";
12
+ const getPropositions = (n, { answer }) => {
13
+ const propositions = [];
14
+ addValidProp(propositions, answer);
15
+ propWhile(propositions, n, () => {
16
+ tryToAddWrongProp(propositions, randfloat(0.1, 0.9, 4).frenchify());
17
+ });
18
+ return shuffleProps(propositions, n);
19
+ };
20
+ const getAnswer = (identifiers) => {
21
+ const { percent } = identifiers;
22
+ return round(square(frac(percent, 100)).evaluate(), 5).frenchify();
23
+ };
24
+ const getInstruction = (identifiers) => {
25
+ const { percent } = identifiers;
26
+ return `Dans une population, $${percent}\\%$ des personnes sont gauchères. On interroge au hasard deux individus et on suppose la population suffisamment importante pour considérer ces deux épreuves indépendantes.
27
+
28
+ Quelle est la probabilité que les deux personnes interrogées soient gauchères ?`;
29
+ };
30
+ const getHint = () => {
31
+ return `Si $A$ et $B$ sont deux évènements indépendants, alors :
32
+
33
+ $$
34
+ P(A\\cap B) = P(A)\\times P(B)
35
+ $$`;
36
+ };
37
+ const getCorrection = (identifiers) => {
38
+ const { percent } = identifiers;
39
+ const dec = round(frac(percent, 100).evaluate(), 5);
40
+ return `On note $G_1$ l'évènement "la première personne est gauchère" et $G_2$ l'évènement "la deuxième personne est gauchère". La probabilité recherchée s'écrit alors : $P(G_1\\cap G_2)$.
41
+
42
+ D'après l'énoncé, les évènements $G_1$ et $G_2$ sont indépendants.
43
+
44
+ On a donc :
45
+
46
+ ${alignTex([
47
+ ["P(G_1\\cap G_2)", "=", "P(G_1)\\times P(G_2)"],
48
+ ["", "=", multiply(dec, dec).toTex()],
49
+ ["", "=", multiply(dec, dec).simplify().toTex()],
50
+ ])}
51
+
52
+ `;
53
+ };
54
+ const getKeys = () => {
55
+ return ["percent"];
56
+ };
57
+ const isAnswerValid = (ans, { answer }) => {
58
+ try {
59
+ return rationalVEA(ans, answer);
60
+ }
61
+ catch (err) {
62
+ return handleVEAError(err);
63
+ }
64
+ };
65
+ const getIndependantSuccessiveEventsComputeTwoSuccessQuestion = () => {
66
+ const percent = randint(2, 50);
67
+ const identifiers = {
68
+ percent,
69
+ };
70
+ return getQuestionFromIdentifiers(identifiers);
71
+ };
72
+ const getQuestionFromIdentifiers = (identifiers) => {
73
+ return {
74
+ answer: getAnswer(identifiers),
75
+ instruction: getInstruction(identifiers),
76
+ keys: getKeys(identifiers),
77
+ answerFormat: "tex",
78
+ identifiers,
79
+ hint: getHint(identifiers),
80
+ correction: getCorrection(identifiers),
81
+ };
82
+ };
83
+ export const independantSuccessiveEventsComputeTwoSuccess = {
84
+ id: "independantSuccessiveEventsComputeTwoSuccess",
85
+ connector: "=",
86
+ label: "Utiliser l'indépendance pour calculer $P(S=2)$ dans le cas de la répétition de $2$ épreuves indépendantes",
87
+ isSingleStep: true,
88
+ generator: (nb, opts) => getDistinctQuestions(() => getIndependantSuccessiveEventsComputeTwoSuccessQuestion(opts), nb),
89
+ qcmTimer: 60,
90
+ freeTimer: 60,
91
+ getPropositions,
92
+ isAnswerValid,
93
+ subject: "Mathématiques",
94
+ getInstruction,
95
+ getHint,
96
+ getCorrection,
97
+ getAnswer,
98
+ getQuestionFromIdentifiers,
99
+ hasHintAndCorrection: true,
100
+ };
@@ -4,4 +4,5 @@ export * from "./independancyFindCap.js";
4
4
  export * from "./independancyFindCup.js";
5
5
  export * from "./independancyFromEffectifTable.js";
6
6
  export * from "./independancyFromProbaTree.js";
7
+ export * from "./independantSuccessiveEventsComputeTwoSuccess.js";
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/independancy/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,kCAAkC,CAAC;AACjD,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oCAAoC,CAAC;AACnD,cAAc,gCAAgC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/independancy/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,kCAAkC,CAAC;AACjD,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oCAAoC,CAAC;AACnD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mDAAmD,CAAC"}
@@ -4,3 +4,4 @@ export * from "./independancyFindCap.js";
4
4
  export * from "./independancyFindCup.js";
5
5
  export * from "./independancyFromEffectifTable.js";
6
6
  export * from "./independancyFromProbaTree.js";
7
+ export * from "./independantSuccessiveEventsComputeTwoSuccess.js";
@@ -1 +1 @@
1
- {"version":3,"file":"geometricFindExplicitFormulaFromTwoConsecutiveTerms.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoConsecutiveTerms.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,sBAAsB,EACvB,MAAM,mDAAmD,CAAC;AAiB3D,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAwVF,KAAK,OAAO,GAAG,sBAAsB,CAAC;AAMtC,eAAO,MAAM,mDAAmD,EAAE,QAAQ,CACxE,WAAW,EACX,OAAO,CAqBR,CAAC"}
1
+ {"version":3,"file":"geometricFindExplicitFormulaFromTwoConsecutiveTerms.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoConsecutiveTerms.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,sBAAsB,EACvB,MAAM,mDAAmD,CAAC;AAsB3D,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAoWF,KAAK,OAAO,GAAG,sBAAsB,CAAC;AAMtC,eAAO,MAAM,mDAAmD,EAAE,QAAQ,CACxE,WAAW,EACX,OAAO,CAqBR,CAAC"}