math-exercises 3.0.183 → 3.0.185

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 (99) 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/approxExpAPlusB.d.ts.map +1 -1
  4. package/lib/exercises/math/functions/exponential/algebraic/approxExpAPlusB.js +91 -38
  5. package/lib/exercises/math/functions/exponential/algebraic/rewriteExpUsingExpA.d.ts.map +1 -1
  6. package/lib/exercises/math/functions/exponential/algebraic/rewriteExpUsingExpA.js +18 -3
  7. package/lib/exercises/math/functions/exponential/expKT/derivativeOfAExpKT.d.ts +8 -0
  8. package/lib/exercises/math/functions/exponential/expKT/derivativeOfAExpKT.d.ts.map +1 -0
  9. package/lib/exercises/math/functions/exponential/expKT/derivativeOfAExpKT.js +108 -0
  10. package/lib/exercises/math/functions/exponential/expKT/drugConcentrationMaximum.d.ts +8 -0
  11. package/lib/exercises/math/functions/exponential/expKT/drugConcentrationMaximum.d.ts.map +1 -0
  12. package/lib/exercises/math/functions/exponential/expKT/drugConcentrationMaximum.js +144 -0
  13. package/lib/exercises/math/functions/exponential/expKT/index.d.ts +3 -0
  14. package/lib/exercises/math/functions/exponential/expKT/index.d.ts.map +1 -0
  15. package/lib/exercises/math/functions/exponential/expKT/index.js +2 -0
  16. package/lib/exercises/math/functions/exponential/expSimplifiying.d.ts.map +1 -1
  17. package/lib/exercises/math/functions/exponential/expSimplifiying.js +94 -4
  18. package/lib/exercises/math/functions/exponential/index.d.ts +3 -0
  19. package/lib/exercises/math/functions/exponential/index.d.ts.map +1 -1
  20. package/lib/exercises/math/functions/exponential/index.js +3 -0
  21. package/lib/exercises/math/functions/exponential/sign/expFunctionBasicSign.d.ts +9 -0
  22. package/lib/exercises/math/functions/exponential/sign/expFunctionBasicSign.d.ts.map +1 -0
  23. package/lib/exercises/math/functions/exponential/sign/expFunctionBasicSign.js +101 -0
  24. package/lib/exercises/math/functions/exponential/sign/index.d.ts +2 -0
  25. package/lib/exercises/math/functions/exponential/sign/index.d.ts.map +1 -0
  26. package/lib/exercises/math/functions/exponential/sign/index.js +1 -0
  27. package/lib/exercises/math/functions/exponential/variations/index.d.ts +3 -0
  28. package/lib/exercises/math/functions/exponential/variations/index.d.ts.map +1 -0
  29. package/lib/exercises/math/functions/exponential/variations/index.js +2 -0
  30. package/lib/exercises/math/functions/exponential/variations/varSignTableOfAffineTimesExp.d.ts +7 -0
  31. package/lib/exercises/math/functions/exponential/variations/varSignTableOfAffineTimesExp.d.ts.map +1 -0
  32. package/lib/exercises/math/functions/exponential/variations/varSignTableOfAffineTimesExp.js +144 -0
  33. package/lib/exercises/math/functions/exponential/variations/varSignTableOfExpMinusX.d.ts +7 -0
  34. package/lib/exercises/math/functions/exponential/variations/varSignTableOfExpMinusX.d.ts.map +1 -0
  35. package/lib/exercises/math/functions/exponential/variations/varSignTableOfExpMinusX.js +139 -0
  36. package/lib/exercises/math/probaStat/independancy/independantSuccessiveEventsComputeTwoSuccess.d.ts +7 -0
  37. package/lib/exercises/math/probaStat/independancy/independantSuccessiveEventsComputeTwoSuccess.d.ts.map +1 -0
  38. package/lib/exercises/math/probaStat/independancy/independantSuccessiveEventsComputeTwoSuccess.js +100 -0
  39. package/lib/exercises/math/probaStat/independancy/index.d.ts +1 -0
  40. package/lib/exercises/math/probaStat/independancy/index.d.ts.map +1 -1
  41. package/lib/exercises/math/probaStat/independancy/index.js +1 -0
  42. package/lib/exercises/math/probaStat/trees/index.d.ts +4 -1
  43. package/lib/exercises/math/probaStat/trees/index.d.ts.map +1 -1
  44. package/lib/exercises/math/probaStat/trees/index.js +4 -11
  45. package/lib/exercises/math/probaStat/trees/probabilityTree.d.ts +9 -3
  46. package/lib/exercises/math/probaStat/trees/probabilityTree.d.ts.map +1 -1
  47. package/lib/exercises/math/probaStat/trees/probabilityTree.js +419 -45
  48. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRankFromSituation.d.ts.map +1 -1
  49. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRankFromSituation.js +3 -3
  50. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindThresholdFromSituation.d.ts.map +1 -1
  51. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindThresholdFromSituation.js +2 -2
  52. package/lib/exercises/math/sequences/arithmetic/situations/index.d.ts +2 -0
  53. package/lib/exercises/math/sequences/arithmetic/situations/index.d.ts.map +1 -1
  54. package/lib/exercises/math/sequences/arithmetic/situations/index.js +2 -2
  55. package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoConsecutiveTerms.d.ts.map +1 -1
  56. package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoConsecutiveTerms.js +37 -39
  57. package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoTerms.d.ts.map +1 -1
  58. package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoTerms.js +14 -4
  59. package/lib/exercises/math/sequences/geometric/situations/geometricFindExplicitFormulaFromSituation.d.ts.map +1 -1
  60. package/lib/exercises/math/sequences/geometric/situations/geometricFindExplicitFormulaFromSituation.js +12 -3
  61. package/lib/exercises/vea/treeTableVEA.d.ts.map +1 -1
  62. package/lib/exercises/vea/treeTableVEA.js +3 -0
  63. package/lib/index.d.ts +46 -3
  64. package/lib/index.d.ts.map +1 -1
  65. package/lib/latexTester.js +1 -1
  66. package/lib/math/utils/sequences/situations/seqArithmeticSituations.d.ts +2 -0
  67. package/lib/math/utils/sequences/situations/seqArithmeticSituations.d.ts.map +1 -1
  68. package/lib/math/utils/sequences/situations/seqArithmeticSituations.js +150 -128
  69. package/lib/math/utils/sequences/situations/seqArithmeticUtils.d.ts +1 -1
  70. package/lib/math/utils/sequences/situations/seqArithmeticUtils.d.ts.map +1 -1
  71. package/lib/math/utils/sequences/situations/seqArithmeticUtils.js +4 -1
  72. package/lib/tests/questionTest.d.ts.map +1 -1
  73. package/lib/tests/questionTest.js +1 -0
  74. package/lib/tests/singleExo.test.js +2 -2
  75. package/lib/tree/nodes/functions/expNode.d.ts +1 -1
  76. package/lib/tree/nodes/functions/expNode.d.ts.map +1 -1
  77. package/lib/tree/nodes/functions/expNode.js +3 -6
  78. package/lib/tree/nodes/operators/addNode.d.ts +1 -1
  79. package/lib/tree/nodes/operators/addNode.d.ts.map +1 -1
  80. package/lib/tree/nodes/operators/addNode.js +2 -2
  81. package/lib/tree/nodes/operators/substractNode.d.ts +1 -1
  82. package/lib/tree/nodes/operators/substractNode.d.ts.map +1 -1
  83. package/lib/tree/nodes/operators/substractNode.js +2 -2
  84. package/lib/tree/utilities/nodeComparator.d.ts +7 -0
  85. package/lib/tree/utilities/nodeComparator.d.ts.map +1 -0
  86. package/lib/tree/utilities/nodeComparator.js +88 -0
  87. package/lib/tree/utilities/nodeInspector.d.ts +5 -0
  88. package/lib/tree/utilities/nodeInspector.d.ts.map +1 -0
  89. package/lib/tree/utilities/nodeInspector.js +15 -0
  90. package/lib/tree/utilities/nodeRewriter.d.ts +9 -0
  91. package/lib/tree/utilities/nodeRewriter.d.ts.map +1 -0
  92. package/lib/tree/utilities/nodeRewriter.js +172 -0
  93. package/lib/tree/utilities/nodeShuffler.d.ts +2 -4
  94. package/lib/tree/utilities/nodeShuffler.d.ts.map +1 -1
  95. package/lib/tree/utilities/nodeShuffler.js +13 -104
  96. package/lib/tree/utilities/nodeSimplifier.d.ts +1 -2
  97. package/lib/tree/utilities/nodeSimplifier.d.ts.map +1 -1
  98. package/lib/tree/utilities/nodeSimplifier.js +14 -88
  99. package/package.json +1 -1
@@ -2,13 +2,16 @@ import { addValidProp, propWhile, tryToAddWrongProp, } from "../../../../exercis
2
2
  import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
3
  import { Polynomial, PolynomialConstructor, } from "../../../../math/polynomials/polynomial.js";
4
4
  import { randint } from "../../../../math/utils/random/randint.js";
5
- import { ExpNode, isExpNode } from "../../../../tree/nodes/functions/expNode.js";
5
+ import { exp, ExpNode, isExpNode } from "../../../../tree/nodes/functions/expNode.js";
6
6
  import { isNumberNode } from "../../../../tree/nodes/numbers/numberNode.js";
7
- import { FractionNode } from "../../../../tree/nodes/operators/fractionNode.js";
7
+ import { add } from "../../../../tree/nodes/operators/addNode.js";
8
+ import { frac, FractionNode } from "../../../../tree/nodes/operators/fractionNode.js";
8
9
  import { MultiplyNode } from "../../../../tree/nodes/operators/multiplyNode.js";
10
+ import { substract } from "../../../../tree/nodes/operators/substractNode.js";
9
11
  import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
10
12
  import { shuffle } from "../../../../utils/alea/shuffle.js";
11
13
  import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
14
+ import { alignTex } from "../../../../utils/latex/alignTex.js";
12
15
  const getStatementNode = (identifiers) => {
13
16
  const { random, a, uCoeffs, vCoeffs } = identifiers;
14
17
  const u = new Polynomial(uCoeffs);
@@ -47,8 +50,92 @@ const getAnswer = (identifiers) => {
47
50
  })
48
51
  .toTex();
49
52
  };
50
- // const getHint: GetHint<Identifiers> = (identifiers) => {};
51
- // const getCorrection: GetCorrection<Identifiers> = (identifiers) => {};
53
+ const getHint = () => {
54
+ return `Utilise les propriétés suivantes : pour tout $x$, $y$ réels, on a :
55
+
56
+ $$
57
+ e^x \\times e^y = e^{x+y}
58
+ $$
59
+
60
+ et
61
+
62
+ $$
63
+ \\frac{e^x}{e^y} = e^{x-y}
64
+ $$`;
65
+ };
66
+ const getCorrection = (identifiers) => {
67
+ const { random, uCoeffs, vCoeffs, a } = identifiers;
68
+ const u = new Polynomial(uCoeffs).toTree();
69
+ const v = new Polynomial(vCoeffs).toTree();
70
+ const statement = getStatementNode(identifiers);
71
+ switch (random) {
72
+ case 1:
73
+ //e^u*e^a / e^v
74
+ return `Pour tout $x$ et $y$ réels, on a :
75
+
76
+ $$
77
+ e^x \\times e^y = e^{x+y}
78
+ $$
79
+
80
+ et
81
+
82
+ $$
83
+ \\frac{e^x}{e^y} = e^{x-y}
84
+ $$
85
+
86
+ Ici, on peut donc simplifier de la sorte :
87
+
88
+ ${alignTex([
89
+ [
90
+ statement.toTex(),
91
+ "=",
92
+ frac(exp(add(u, a)).simplify({ forbidFactorize: true }), exp(v)).toTex(),
93
+ ],
94
+ [
95
+ "",
96
+ "=",
97
+ exp(substract(add(u, a).simplify({ forbidFactorize: true }), v)).toTex(),
98
+ ],
99
+ ["", "=", getAnswer(identifiers)],
100
+ ])}
101
+ `;
102
+ break;
103
+ case 2:
104
+ //e^u * e^v
105
+ {
106
+ return `Pour tous $x$ et $y$ réels, on a :
107
+
108
+ $$
109
+ e^x \\times e^y = e^{x+y}
110
+ $$
111
+
112
+ Ici, on peut donc simplifier de la sorte :
113
+
114
+ ${alignTex([
115
+ [statement.toTex(), "=", exp(add(u, v)).toTex()],
116
+ ["", "=", getAnswer(identifiers)],
117
+ ])}`;
118
+ }
119
+ break;
120
+ case 3:
121
+ default: {
122
+ //e^u / e^v
123
+ return `Pour tous $x$ et $y$ réels, on a :
124
+
125
+ $$
126
+ \\frac{e^x}{e^y} = e^{x-y}
127
+ $$
128
+
129
+ Ici, on peut donc simplifier de la sorte :
130
+
131
+ ${alignTex([
132
+ [statement.toTex(), "=", exp(substract(u, v)).toTex()],
133
+ ["", "=", getAnswer(identifiers)],
134
+ ])}`;
135
+ }
136
+ }
137
+ return ``;
138
+ };
52
139
  const getQuestionFromIdentifiers = (identifiers) => {
53
140
  const question = {
54
141
  instruction: getInstruction(identifiers),
@@ -56,6 +143,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
56
143
  keys: ["x", "epower", "exp"],
57
144
  answerFormat: "tex",
58
145
  identifiers,
146
+ hint: getHint(identifiers),
147
+ correction: getCorrection(identifiers),
59
148
  };
60
149
  return question;
61
150
  };
@@ -148,4 +237,5 @@ export const expSimplifiying = {
148
237
  isAnswerValid,
149
238
  subject: "Mathématiques",
150
239
  getQuestionFromIdentifiers,
240
+ hasHintAndCorrection: true,
151
241
  };
@@ -3,4 +3,7 @@ export * from "./expSimplifiying.js";
3
3
  export * from "./expFactorization.js";
4
4
  export * from "./algebraic/index.js";
5
5
  export * from "./definition/index.js";
6
+ export * from "./expKT/index.js";
7
+ export * from "./variations/index.js";
8
+ export * from "./sign/index.js";
6
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/exponential/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/exponential/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC"}
@@ -3,3 +3,6 @@ export * from "./expSimplifiying.js";
3
3
  export * from "./expFactorization.js";
4
4
  export * from "./algebraic/index.js";
5
5
  export * from "./definition/index.js";
6
+ export * from "./expKT/index.js";
7
+ export * from "./variations/index.js";
8
+ export * from "./sign/index.js";
@@ -0,0 +1,9 @@
1
+ import { Exercise } from "../../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ a: number;
4
+ k: number;
5
+ type: number;
6
+ };
7
+ export declare const expFunctionBasicSign: Exercise<Identifiers>;
8
+ export {};
9
+ //# sourceMappingURL=expFunctionBasicSign.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expFunctionBasicSign.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/exponential/sign/expFunctionBasicSign.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAOrC,KAAK,WAAW,GAAG;IAGjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAwFF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAkBtD,CAAC"}
@@ -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"}