math-exercises 3.0.198 → 3.0.200

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 (152) hide show
  1. package/lib/exercises/exercise.d.ts +14 -1
  2. package/lib/exercises/exercise.d.ts.map +1 -1
  3. package/lib/exercises/math/_debug/debugReorder1.d.ts +8 -0
  4. package/lib/exercises/math/_debug/debugReorder1.d.ts.map +1 -0
  5. package/lib/exercises/math/_debug/debugReorder1.js +81 -0
  6. package/lib/exercises/math/_debug/debugReorder2.d.ts +10 -0
  7. package/lib/exercises/math/_debug/debugReorder2.d.ts.map +1 -0
  8. package/lib/exercises/math/_debug/debugReorder2.js +88 -0
  9. package/lib/exercises/math/_debug/debugReorder3.d.ts +10 -0
  10. package/lib/exercises/math/_debug/debugReorder3.d.ts.map +1 -0
  11. package/lib/exercises/math/_debug/debugReorder3.js +81 -0
  12. package/lib/exercises/math/_debug/index.d.ts +3 -1
  13. package/lib/exercises/math/_debug/index.d.ts.map +1 -1
  14. package/lib/exercises/math/_debug/index.js +3 -1
  15. package/lib/exercises/math/calcul/factorial/index.d.ts +2 -0
  16. package/lib/exercises/math/calcul/factorial/index.d.ts.map +1 -0
  17. package/lib/exercises/math/calcul/factorial/index.js +1 -0
  18. package/lib/exercises/math/calcul/factorial/simplifyQuotientOfFactorialToProduct.d.ts +8 -0
  19. package/lib/exercises/math/calcul/factorial/simplifyQuotientOfFactorialToProduct.d.ts.map +1 -0
  20. package/lib/exercises/math/calcul/factorial/simplifyQuotientOfFactorialToProduct.js +199 -0
  21. package/lib/exercises/math/calculLitteral/equation/exp/expOfTrinomEquals1Equation.d.ts.map +1 -1
  22. package/lib/exercises/math/calculLitteral/equation/exp/expOfTrinomEquals1Equation.js +3 -0
  23. package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType3.d.ts.map +1 -1
  24. package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType3.js +58 -30
  25. package/lib/exercises/math/combinatory/combination/index.d.ts +3 -0
  26. package/lib/exercises/math/combinatory/combination/index.d.ts.map +1 -0
  27. package/lib/exercises/math/combinatory/combination/index.js +2 -0
  28. package/lib/exercises/math/combinatory/combination/mentalCalculateCombination.d.ts +11 -0
  29. package/lib/exercises/math/combinatory/combination/mentalCalculateCombination.d.ts.map +1 -0
  30. package/lib/exercises/math/combinatory/combination/mentalCalculateCombination.js +225 -0
  31. package/lib/exercises/math/combinatory/combination/writeCombinationFormulaUsingFactorial.d.ts +13 -0
  32. package/lib/exercises/math/combinatory/combination/writeCombinationFormulaUsingFactorial.d.ts.map +1 -0
  33. package/lib/exercises/math/combinatory/combination/writeCombinationFormulaUsingFactorial.js +285 -0
  34. package/lib/exercises/math/complex/addComplex.d.ts.map +1 -1
  35. package/lib/exercises/math/complex/addComplex.js +53 -7
  36. package/lib/exercises/math/complex/conjugateComplex.d.ts.map +1 -1
  37. package/lib/exercises/math/complex/conjugateComplex.js +48 -7
  38. package/lib/exercises/math/complex/mutiplyComplex.d.ts.map +1 -1
  39. package/lib/exercises/math/complex/mutiplyComplex.js +51 -18
  40. package/lib/exercises/math/complex/reAndIm.d.ts.map +1 -1
  41. package/lib/exercises/math/complex/reAndIm.js +35 -4
  42. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotInterpreting.d.ts.map +1 -1
  43. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotInterpreting.js +1 -1
  44. package/lib/exercises/math/derivation/derivative/trigo/cosSecondDegreeDerivative.d.ts.map +1 -1
  45. package/lib/exercises/math/derivation/derivative/trigo/cosSecondDegreeDerivative.js +47 -3
  46. package/lib/exercises/math/derivation/derivative/trigo/productOfSinAXPlusBCosCXPlusDDerivative.d.ts +9 -0
  47. package/lib/exercises/math/derivation/derivative/trigo/productOfSinAXPlusBCosCXPlusDDerivative.d.ts.map +1 -0
  48. package/lib/exercises/math/derivation/derivative/trigo/productOfSinAXPlusBCosCXPlusDDerivative.js +209 -0
  49. package/lib/exercises/math/derivation/derivative/trigo/sinAndCosMixedWithSquareDerivative.d.ts +9 -0
  50. package/lib/exercises/math/derivation/derivative/trigo/sinAndCosMixedWithSquareDerivative.d.ts.map +1 -0
  51. package/lib/exercises/math/derivation/derivative/trigo/sinAndCosMixedWithSquareDerivative.js +359 -0
  52. package/lib/exercises/math/derivation/derivative/trigo/sinCosDerivativeRewriteUsingCos2PlusSin2Equals1.d.ts +11 -0
  53. package/lib/exercises/math/derivation/derivative/trigo/sinCosDerivativeRewriteUsingCos2PlusSin2Equals1.d.ts.map +1 -0
  54. package/lib/exercises/math/derivation/derivative/trigo/sinCosDerivativeRewriteUsingCos2PlusSin2Equals1.js +445 -0
  55. package/lib/exercises/math/functions/affines/affineVarTableOnBoundedInterval.d.ts.map +1 -1
  56. package/lib/exercises/math/functions/affines/affineVarTableOnBoundedInterval.js +2 -3
  57. package/lib/exercises/math/functions/exponential/sign/expFunctionBasicSign.d.ts.map +1 -1
  58. package/lib/exercises/math/functions/exponential/sign/expFunctionBasicSign.js +3 -0
  59. package/lib/exercises/math/functions/sign/affineProductSign.d.ts.map +1 -1
  60. package/lib/exercises/math/functions/sign/affineProductSign.js +0 -4
  61. package/lib/exercises/math/index.d.ts +1 -0
  62. package/lib/exercises/math/index.d.ts.map +1 -1
  63. package/lib/exercises/math/index.js +1 -1
  64. package/lib/exercises/math/limits/sequenceGeometricLimit.d.ts.map +1 -1
  65. package/lib/exercises/math/limits/sequenceGeometricLimit.js +9 -0
  66. package/lib/exercises/math/primitive/constantPrimitive.d.ts +8 -5
  67. package/lib/exercises/math/primitive/constantPrimitive.d.ts.map +1 -1
  68. package/lib/exercises/math/primitive/constantPrimitive.js +40 -21
  69. package/lib/exercises/math/probaStat/stats2var/averagePoint.d.ts.map +1 -1
  70. package/lib/exercises/math/probaStat/stats2var/averagePoint.js +34 -2
  71. package/lib/exercises/math/sequences/geometric/graph/geometricFindThresholdFromGraph.d.ts +15 -0
  72. package/lib/exercises/math/sequences/geometric/graph/geometricFindThresholdFromGraph.d.ts.map +1 -0
  73. package/lib/exercises/math/sequences/geometric/graph/geometricFindThresholdFromGraph.js +255 -0
  74. package/lib/exercises/math/sequences/geometric/graph/geometricFindThresholdUsingCalculator.d.ts +15 -0
  75. package/lib/exercises/math/sequences/geometric/graph/geometricFindThresholdUsingCalculator.d.ts.map +1 -0
  76. package/lib/exercises/math/sequences/geometric/graph/geometricFindThresholdUsingCalculator.js +242 -0
  77. package/lib/exercises/math/sequences/geometric/graph/geometricPlaceFirstPoints.js +4 -4
  78. package/lib/exercises/math/sequences/geometric/graph/geometricSignOfReasonFromGraph.d.ts +12 -0
  79. package/lib/exercises/math/sequences/geometric/graph/geometricSignOfReasonFromGraph.d.ts.map +1 -0
  80. package/lib/exercises/math/sequences/geometric/graph/geometricSignOfReasonFromGraph.js +161 -0
  81. package/lib/exercises/math/sets/cartesianProduct/findCardinalOfCartesianProductOfFiniteSets.d.ts +10 -0
  82. package/lib/exercises/math/sets/cartesianProduct/findCardinalOfCartesianProductOfFiniteSets.d.ts.map +1 -0
  83. package/lib/exercises/math/sets/cartesianProduct/findCardinalOfCartesianProductOfFiniteSets.js +224 -0
  84. package/lib/exercises/math/sets/cartesianProduct/findCardinalOfCartesianProductOfFiniteSetsFromSituation.d.ts +18 -0
  85. package/lib/exercises/math/sets/cartesianProduct/findCardinalOfCartesianProductOfFiniteSetsFromSituation.d.ts.map +1 -0
  86. package/lib/exercises/math/sets/cartesianProduct/findCardinalOfCartesianProductOfFiniteSetsFromSituation.js +198 -0
  87. package/lib/exercises/math/sets/cartesianProduct/findCardinalOfPowEK.d.ts +10 -0
  88. package/lib/exercises/math/sets/cartesianProduct/findCardinalOfPowEK.d.ts.map +1 -0
  89. package/lib/exercises/math/sets/cartesianProduct/findCardinalOfPowEK.js +231 -0
  90. package/lib/exercises/math/sets/cartesianProduct/findNumberOfPasswordsWithLettersAndNumbers.d.ts +19 -0
  91. package/lib/exercises/math/sets/cartesianProduct/findNumberOfPasswordsWithLettersAndNumbers.d.ts.map +1 -0
  92. package/lib/exercises/math/sets/cartesianProduct/findNumberOfPasswordsWithLettersAndNumbers.js +187 -0
  93. package/lib/exercises/math/sets/cartesianProduct/index.d.ts +7 -0
  94. package/lib/exercises/math/sets/cartesianProduct/index.d.ts.map +1 -0
  95. package/lib/exercises/math/sets/cartesianProduct/index.js +6 -0
  96. package/lib/exercises/math/sets/cartesianProduct/proposeElementInCartesianProductOfFiniteSets.d.ts +15 -0
  97. package/lib/exercises/math/sets/cartesianProduct/proposeElementInCartesianProductOfFiniteSets.d.ts.map +1 -0
  98. package/lib/exercises/math/sets/cartesianProduct/proposeElementInCartesianProductOfFiniteSets.js +291 -0
  99. package/lib/exercises/math/sets/cartesianProduct/proposeElementInPowEK.d.ts +15 -0
  100. package/lib/exercises/math/sets/cartesianProduct/proposeElementInPowEK.d.ts.map +1 -0
  101. package/lib/exercises/math/sets/cartesianProduct/proposeElementInPowEK.js +274 -0
  102. package/lib/exercises/math/sets/combinations/findNumberOfCombinationsFromSituation.d.ts +17 -0
  103. package/lib/exercises/math/sets/combinations/findNumberOfCombinationsFromSituation.d.ts.map +1 -0
  104. package/lib/exercises/math/sets/combinations/findNumberOfCombinationsFromSituation.js +228 -0
  105. package/lib/exercises/math/sets/combinations/findNumberOfProductsOfCombinationsFromSituation.d.ts +17 -0
  106. package/lib/exercises/math/sets/combinations/findNumberOfProductsOfCombinationsFromSituation.d.ts.map +1 -0
  107. package/lib/exercises/math/sets/combinations/findNumberOfProductsOfCombinationsFromSituation.js +388 -0
  108. package/lib/exercises/math/sets/combinations/index.d.ts +4 -0
  109. package/lib/exercises/math/sets/combinations/index.d.ts.map +1 -0
  110. package/lib/exercises/math/sets/combinations/index.js +3 -0
  111. package/lib/exercises/math/sets/combinations/proposeCombination.d.ts +15 -0
  112. package/lib/exercises/math/sets/combinations/proposeCombination.d.ts.map +1 -0
  113. package/lib/exercises/math/sets/combinations/proposeCombination.js +347 -0
  114. package/lib/exercises/math/sets/partialPermutations/findNumberOfPartialPermutationsFromSituation.d.ts +16 -0
  115. package/lib/exercises/math/sets/partialPermutations/findNumberOfPartialPermutationsFromSituation.d.ts.map +1 -0
  116. package/lib/exercises/math/sets/partialPermutations/findNumberOfPartialPermutationsFromSituation.js +186 -0
  117. package/lib/exercises/math/sets/partialPermutations/findNumberOfPermutationsFromSituation.d.ts +17 -0
  118. package/lib/exercises/math/sets/partialPermutations/findNumberOfPermutationsFromSituation.d.ts.map +1 -0
  119. package/lib/exercises/math/sets/partialPermutations/findNumberOfPermutationsFromSituation.js +232 -0
  120. package/lib/exercises/math/sets/partialPermutations/index.d.ts +4 -0
  121. package/lib/exercises/math/sets/partialPermutations/index.d.ts.map +1 -0
  122. package/lib/exercises/math/sets/partialPermutations/index.js +3 -0
  123. package/lib/exercises/math/sets/partialPermutations/proposePartialPermutation.d.ts +15 -0
  124. package/lib/exercises/math/sets/partialPermutations/proposePartialPermutation.d.ts.map +1 -0
  125. package/lib/exercises/math/sets/partialPermutations/proposePartialPermutation.js +343 -0
  126. package/lib/exercises/math/spaceGeometry/vectors/spaceVectorLinearCombinationCoords.d.ts.map +1 -1
  127. package/lib/exercises/math/trigonometry/functions/parityOfCosAXTimesSinBX.d.ts +8 -0
  128. package/lib/exercises/math/trigonometry/functions/parityOfCosAXTimesSinBX.d.ts.map +1 -0
  129. package/lib/exercises/math/trigonometry/functions/parityOfCosAXTimesSinBX.js +193 -0
  130. package/lib/index.d.ts +15 -1
  131. package/lib/index.d.ts.map +1 -1
  132. package/lib/math/sets/setOperations.d.ts +9 -0
  133. package/lib/math/sets/setOperations.d.ts.map +1 -0
  134. package/lib/math/sets/setOperations.js +84 -0
  135. package/lib/math/sets/tuple.d.ts +12 -0
  136. package/lib/math/sets/tuple.d.ts.map +1 -0
  137. package/lib/math/sets/tuple.js +17 -0
  138. package/lib/server.js +28 -2
  139. package/lib/tests/pdfExo.test.js +2 -2
  140. package/lib/tests/pdfs/buildPDFForExercise.d.ts.map +1 -1
  141. package/lib/tests/pdfs/buildPDFForExercise.js +6 -0
  142. package/lib/tests/pdfs/quizPdfPreambule.d.ts.map +1 -1
  143. package/lib/tests/pdfs/quizPdfPreambule.js +1 -0
  144. package/lib/tests/pdfs/treeDiagramToLatex.d.ts +15 -0
  145. package/lib/tests/pdfs/treeDiagramToLatex.d.ts.map +1 -0
  146. package/lib/tests/pdfs/treeDiagramToLatex.js +49 -0
  147. package/lib/tests/questionTest.d.ts.map +1 -1
  148. package/lib/tests/questionTest.js +19 -0
  149. package/lib/tree/utilities/nodePrinter.d.ts +7 -0
  150. package/lib/tree/utilities/nodePrinter.d.ts.map +1 -0
  151. package/lib/tree/utilities/nodePrinter.js +36 -0
  152. package/package.json +1 -1
@@ -0,0 +1,242 @@
1
+ import { addValidProp, tryToAddWrongProp, shuffleProps, propWhile, } from "../../../../../exercises/exercise.js";
2
+ import { getOptionFirstTermRankOneStuff, } from "../../../../../exercises/options/optionFirstTermRankOne.js";
3
+ import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
4
+ import { numberVEA } from "../../../../../exercises/vea/numberVEA.js";
5
+ import { Point } from "../../../../../math/geometry/point.js";
6
+ import { InequationSymbol, } from "../../../../../math/inequations/inequation.js";
7
+ import { randfloat } from "../../../../../math/utils/random/randfloat.js";
8
+ import { randint } from "../../../../../math/utils/random/randint.js";
9
+ import { round } from "../../../../../math/utils/round.js";
10
+ import { InequationNode } from "../../../../../tree/nodes/inequations/inequationNode.js";
11
+ import { NodeConstructor, } from "../../../../../tree/nodes/nodeConstructor.js";
12
+ import { multiply } from "../../../../../tree/nodes/operators/multiplyNode.js";
13
+ import { power } from "../../../../../tree/nodes/operators/powerNode.js";
14
+ import { coinFlip } from "../../../../../utils/alea/coinFlip.js";
15
+ import { random } from "../../../../../utils/alea/random.js";
16
+ import { mdTable } from "../../../../../utils/markdown/mdTable.js";
17
+ const getArrPoint = (nodeInitial, nodeReason, firstRank) => {
18
+ const arrNodeTerm = [...Array(nbPoints).keys()].map((i) => multiply(nodeInitial, power(nodeReason, i))
19
+ .simplify({
20
+ towardsDistribute: true,
21
+ calculatePowers: true,
22
+ distributePowersOnFrac: true,
23
+ })
24
+ .simplify({ towardsDistribute: false }));
25
+ const arrPoint = arrNodeTerm.map((nodeTerm, i) => {
26
+ const nodeX = (firstRank + i).toTree();
27
+ return new Point(`P${firstRank + i}`, nodeX, nodeTerm);
28
+ });
29
+ return arrPoint;
30
+ };
31
+ const nbPoints = 15;
32
+ const getInstruction = (identifiers) => {
33
+ const { nodeIdsValueThreshold, inegSymbol, firstRank, nodeIdsInitial, nodeIdsReason, } = identifiers;
34
+ const [nodeInitial, nodeReason, nodeValueThreshold] = [
35
+ nodeIdsInitial,
36
+ nodeIdsReason,
37
+ nodeIdsValueThreshold,
38
+ ].map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
39
+ return `Soit une suite géométrique $u$ de premier terme $u_{${firstRank}}=${nodeInitial.toTex()}$ et de raison $${nodeReason.toTex()}$.
40
+
41
+ À l'aide de la calculatrice, déterminer le rang $N$, tel que pour tout $n \\geq N$, on a :
42
+
43
+ $$
44
+ u_{n} ${inegSymbol} ${nodeValueThreshold.toTex()}
45
+ $$
46
+
47
+ `;
48
+ };
49
+ const getAnswerStuff = (identifiers) => {
50
+ const { nodeIdsInitial, nodeIdsReason, nodeIdsValueThreshold, firstRank, inegSymbol, } = identifiers;
51
+ const [nodeInitial, nodeReason, nodeValueThreshold] = [
52
+ nodeIdsInitial,
53
+ nodeIdsReason,
54
+ nodeIdsValueThreshold,
55
+ ].map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
56
+ const arrPoint = getArrPoint(nodeInitial, nodeReason, firstRank);
57
+ const [pointValid, indexPointValid] = arrPoint
58
+ .map((point, i) => [point, i])
59
+ .find(([point, _i]) => {
60
+ const inequationNode = new InequationNode([point.y, nodeValueThreshold], inegSymbol);
61
+ return inequationNode.isVerified();
62
+ });
63
+ return { arrPoint, pointValid, indexPointValid };
64
+ };
65
+ const getAnswer = (identifiers) => {
66
+ return getAnswerStuff(identifiers).pointValid.x.toTex();
67
+ };
68
+ const getHint = (identifiers) => {
69
+ const { nodeIdsValueThreshold, nodeIdsInitial, nodeIdsReason, inegSymbol, firstRank, } = identifiers;
70
+ const [nodeInitial, nodeReason, nodeValueThreshold] = [
71
+ nodeIdsInitial,
72
+ nodeIdsReason,
73
+ nodeIdsValueThreshold,
74
+ ].map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
75
+ return `Avec la calculatrice, à partir du menu, sélectionne le mode correspondant aux suites.
76
+ Entre les paramètres de la suite : $u_{${firstRank}}=${nodeInitial.toTex()}$ et raison: $${nodeReason.toTex()}$.
77
+ Demande d'afficher le tableau de valeurs.
78
+ Cherche alors le rang du premier terme ${(() => {
79
+ switch (inegSymbol) {
80
+ case "\\ge":
81
+ return `supérieur ou égal`;
82
+ case ">":
83
+ return `supérieur`;
84
+ case "\\le":
85
+ return `inférieur ou égal`;
86
+ case "<":
87
+ return `inférieur`;
88
+ }
89
+ })()} à $${nodeValueThreshold.toTex()}$.
90
+ `;
91
+ };
92
+ const getCorrection = (identifiers) => {
93
+ const { nodeIdsValueThreshold, nodeIdsInitial, nodeIdsReason, inegSymbol, firstRank, } = identifiers;
94
+ const [nodeInitial, nodeReason, nodeValueThreshold] = [
95
+ nodeIdsInitial,
96
+ nodeIdsReason,
97
+ nodeIdsValueThreshold,
98
+ ].map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
99
+ const { arrPoint, pointValid, indexPointValid } = getAnswerStuff(identifiers);
100
+ function highlighted(str) {
101
+ return `{ \\color{green} ${str} }`;
102
+ }
103
+ return `On cherche le rang du premier terme ${(() => {
104
+ switch (inegSymbol) {
105
+ case "\\ge":
106
+ return `supérieur ou égal`;
107
+ case ">":
108
+ return `supérieur`;
109
+ case "\\le":
110
+ return `inférieur ou égal`;
111
+ case "<":
112
+ return `inférieur`;
113
+ }
114
+ })()} à $${nodeValueThreshold.toTex()}$.
115
+
116
+ Avec la calculatrice, à partir du menu, on sélectionne le mode correspondant aux suites.
117
+ On entre les paramètres de la suite : $u_{${firstRank}}=${nodeInitial.toTex()}$ et raison: $${nodeReason.toTex()}$.
118
+ On demande d'afficher le tableau de valeurs.
119
+ On obtient alors :
120
+
121
+ ${mdTable([
122
+ ["n", "u_{n}"],
123
+ ...arrPoint.map((point, i) => i === indexPointValid
124
+ ? [point.x.toTex(), round(point.y.evaluate(), 2).frenchify()].map((tex) => highlighted(tex))
125
+ : [point.x.toTex(), round(point.y.evaluate(), 2).frenchify()]),
126
+ ], true)}
127
+
128
+ Le rang recherché est $${pointValid.x.toTex()}$.
129
+
130
+ `;
131
+ };
132
+ const getPropositions = (n, { answer }) => {
133
+ const propositions = [];
134
+ addValidProp(propositions, answer);
135
+ propWhile(propositions, n, () => {
136
+ const indexThreshold = randint(7, 15);
137
+ tryToAddWrongProp(propositions, indexThreshold.frenchify());
138
+ });
139
+ return shuffleProps(propositions, n);
140
+ };
141
+ const isAnswerValid = (ans, { answer }) => {
142
+ return numberVEA(ans, answer);
143
+ };
144
+ const getGeometricFindThresholdUsingCalculatorQuestion = (optsIn) => {
145
+ const opts = optsIn ?? optsDefault;
146
+ const firstRank = opts?.firstTermRankOne ? 1 : 0;
147
+ const { isDivergent: _isDivergent, nodeInitialAbs, nodeReasonAbs, nodeValueThresholdAbs, inegSymbolAbs, } = (() => {
148
+ const isDivergent = coinFlip();
149
+ const { nodeInitialAbs, nodeReasonAbs } = (() => {
150
+ if (isDivergent) {
151
+ return {
152
+ nodeInitialAbs: randfloat(1, 10, 1).toTree(),
153
+ nodeReasonAbs: randfloat(2, 3, 1).toTree(),
154
+ };
155
+ }
156
+ else {
157
+ return {
158
+ nodeInitialAbs: randfloat(1000, 2000, 0).toTree(),
159
+ nodeReasonAbs: randfloat(0.5, 0.85, 1).toTree(),
160
+ };
161
+ }
162
+ })();
163
+ const arrPointAbs = getArrPoint(nodeInitialAbs, nodeReasonAbs, firstRank);
164
+ const { nodeValueThresholdAbs, inegSymbolAbs } = (() => {
165
+ const isValueThresholdEqualToTerm = coinFlip();
166
+ const nodeValueThresholdAbs = (() => {
167
+ const indexThresholdLow = randint(8, 14);
168
+ const progress = randfloat(0.3, 0.7, 1);
169
+ const [v1, v2] = [indexThresholdLow, indexThresholdLow + 1].map((index) => arrPointAbs[index].y.evaluate());
170
+ return round(v1 + (v2 - v1) * progress, 2).toTree();
171
+ })();
172
+ const inegSymbolAbs = (() => {
173
+ if (isDivergent) {
174
+ return isValueThresholdEqualToTerm ? "\\ge" : random(["\\ge", ">"]);
175
+ }
176
+ else {
177
+ return isValueThresholdEqualToTerm ? "\\le" : random(["\\le", "<"]);
178
+ }
179
+ })();
180
+ return { nodeValueThresholdAbs, inegSymbolAbs };
181
+ })();
182
+ return {
183
+ isDivergent,
184
+ nodeInitialAbs,
185
+ nodeReasonAbs,
186
+ nodeValueThresholdAbs,
187
+ inegSymbolAbs,
188
+ };
189
+ })();
190
+ const { nodeInitial, nodeReason, nodeValueThreshold, inegSymbol } = (() => {
191
+ const signInitial = coinFlip() ? +1 : -1;
192
+ const nodeInitial = multiply(signInitial, nodeInitialAbs).simplify({
193
+ towardsDistribute: true,
194
+ });
195
+ const nodeReason = nodeReasonAbs; //reason is always positive
196
+ const nodeValueThreshold = multiply(signInitial, nodeValueThresholdAbs).simplify({
197
+ towardsDistribute: true,
198
+ });
199
+ const inegSymbol = signInitial === +1
200
+ ? inegSymbolAbs
201
+ : new InequationSymbol(inegSymbolAbs).reversed();
202
+ return { nodeInitial, nodeReason, nodeValueThreshold, inegSymbol };
203
+ })();
204
+ const identifiers = {
205
+ firstRank,
206
+ nodeIdsInitial: nodeInitial.toIdentifiers(),
207
+ nodeIdsReason: nodeReason.toIdentifiers(),
208
+ nodeIdsValueThreshold: nodeValueThreshold.toIdentifiers(),
209
+ inegSymbol: inegSymbol,
210
+ };
211
+ return getQuestionFromIdentifiers(identifiers, opts);
212
+ };
213
+ const getQuestionFromIdentifiers = (identifiers) => {
214
+ return {
215
+ answer: getAnswer(identifiers),
216
+ instruction: getInstruction(identifiers),
217
+ keys: [],
218
+ identifiers,
219
+ hint: getHint(identifiers),
220
+ correction: getCorrection(identifiers),
221
+ };
222
+ };
223
+ const { optsDefaultFirstTermRankOne, generatorOptionFirstTermRankOne } = getOptionFirstTermRankOneStuff(false);
224
+ const optsDefault = Object.assign({}, optsDefaultFirstTermRankOne, {});
225
+ const options = [generatorOptionFirstTermRankOne];
226
+ export const geometricFindThresholdUsingCalculator = {
227
+ id: "geometricFindThresholdUsingCalculator",
228
+ label: "Déterminer un seuil d'une suite géométrique en utilisant la calculatrice",
229
+ isSingleStep: true,
230
+ generator: (nb, opts) => getDistinctQuestions(() => getGeometricFindThresholdUsingCalculatorQuestion(opts), nb),
231
+ ggbTimer: 60,
232
+ subject: "Mathématiques",
233
+ getHint,
234
+ getCorrection,
235
+ hasHintAndCorrection: true,
236
+ getInstruction,
237
+ isAnswerValid,
238
+ getAnswer,
239
+ getPropositions,
240
+ getQuestionFromIdentifiers,
241
+ options,
242
+ };
@@ -20,7 +20,7 @@ const getInstruction = (identifiers) => {
20
20
  const { firstRank, nodeIdsInitial, nodeIdsReason } = identifiers;
21
21
  const [nodeInitial, nodeReason] = [nodeIdsInitial, nodeIdsReason].map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
22
22
  return `On considère une suite géométrique $u$ de premier rang $u_{${firstRank}}=${nodeInitial.toTex()}$ et de raison $${nodeReason.toTex()}$.
23
- Dans le repère ci-dessous, placer les points représentant les $${nbPoints}$ premiers termes de de $u$.`;
23
+ Dans le repère ci-dessous, placer les points représentant les $${nbPoints}$ premiers termes de $u$.`;
24
24
  };
25
25
  const getAnswerStuff = (identifiers) => {
26
26
  const { firstRank, nodeIdsInitial, nodeIdsReason } = identifiers;
@@ -99,7 +99,7 @@ const isGGBAnswerValid = (ans, { ggbAnswer: _ggbAnswer, ...identifiers }) => {
99
99
  return points.every((p, i) => Math.abs(p.x - validPoints[i].x.evaluate()) < 0.4 &&
100
100
  Math.abs(p.y - validPoints[i].y.evaluate()) < 0.4);
101
101
  };
102
- const getPlaceFirstSequencePointsQuestion = (optsIn) => {
102
+ const getGeometricPlaceFirstPointsQuestion = (optsIn) => {
103
103
  const opts = optsIn ?? optsDefault;
104
104
  const firstRank = opts?.firstTermRankOne ? 1 : 0;
105
105
  const typeSignReason = opts?.typeSignReason
@@ -172,8 +172,8 @@ export const geometricPlaceFirstPoints = {
172
172
  label: "Placer les premiers termes d'une suite géométrique dans un repère",
173
173
  isSingleStep: true,
174
174
  generator: (nb, opts) =>
175
- // getDistinctQuestions(() => getPlaceFirstSequencePointsQuestion(opts), nb),
176
- [...Array(nb).keys()].map(() => getPlaceFirstSequencePointsQuestion(opts)),
175
+ // getDistinctQuestions(() => getGeometricPlaceFirstPointsQuestion(opts), nb),
176
+ [...Array(nb).keys()].map(() => getGeometricPlaceFirstPointsQuestion(opts)),
177
177
  ggbTimer: 60,
178
178
  isGGBAnswerValid,
179
179
  subject: "Mathématiques",
@@ -0,0 +1,12 @@
1
+ import { Exercise } from "../../../../../exercises/exercise.js";
2
+ import { OptionFirstTermRankOne } from "../../../../../exercises/options/optionFirstTermRankOne.js";
3
+ import { NodeIdentifiers } from "../../../../../tree/nodes/nodeConstructor.js";
4
+ type Identifiers = {
5
+ nodeIdsInitial: NodeIdentifiers;
6
+ nodeIdsReason: NodeIdentifiers;
7
+ firstRank: number;
8
+ };
9
+ type Options = OptionFirstTermRankOne;
10
+ export declare const geometricSignOfReasonFromGraph: Exercise<Identifiers, Options>;
11
+ export {};
12
+ //# sourceMappingURL=geometricSignOfReasonFromGraph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geometricSignOfReasonFromGraph.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/sequences/geometric/graph/geometricSignOfReasonFromGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,sBAAsB,EACvB,MAAM,mDAAmD,CAAC;AAM3D,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAS7C,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,eAAe,CAAC;IAChC,aAAa,EAAE,eAAe,CAAC;IAC/B,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAiKF,KAAK,OAAO,GAAG,sBAAsB,CAAC;AAMtC,eAAO,MAAM,8BAA8B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAuBzE,CAAC"}
@@ -0,0 +1,161 @@
1
+ import { addValidProp, tryToAddWrongProp, } from "../../../../../exercises/exercise.js";
2
+ import { getOptionFirstTermRankOneStuff, } from "../../../../../exercises/options/optionFirstTermRankOne.js";
3
+ import { toolBarConstructor } from "../../../../../exercises/utils/geogebra/toolBarConstructor.js";
4
+ import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
5
+ import { GeogebraConstructor } from "../../../../../geogebra/geogebraConstructor.js";
6
+ import { Point } from "../../../../../math/geometry/point.js";
7
+ import { NodeConstructor, } from "../../../../../tree/nodes/nodeConstructor.js";
8
+ import { frac } from "../../../../../tree/nodes/operators/fractionNode.js";
9
+ import { multiply } from "../../../../../tree/nodes/operators/multiplyNode.js";
10
+ import { power } from "../../../../../tree/nodes/operators/powerNode.js";
11
+ import { coinFlip } from "../../../../../utils/alea/coinFlip.js";
12
+ import { random } from "../../../../../utils/alea/random.js";
13
+ const nbPoints = 4;
14
+ const getArrPoint = (identifiers) => {
15
+ const { firstRank, nodeIdsInitial, nodeIdsReason } = identifiers;
16
+ const [nodeInitial, nodeReason] = [nodeIdsInitial, nodeIdsReason].map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds));
17
+ const arrNodeTerm = [...Array(nbPoints).keys()].map((i) => multiply(nodeInitial, power(nodeReason, i))
18
+ .simplify({
19
+ towardsDistribute: true,
20
+ calculatePowers: true,
21
+ distributePowersOnFrac: true,
22
+ })
23
+ .simplify({ towardsDistribute: false }));
24
+ const arrPoint = arrNodeTerm.map((nodeTerm, i) => {
25
+ const nodeX = (firstRank + i).toTree();
26
+ return new Point(`P${firstRank + i}`, nodeX, nodeTerm);
27
+ });
28
+ return arrPoint;
29
+ };
30
+ const getInstruction = () => {
31
+ return `Dans le repère ci-dessous, on a placé les points représentant les $${nbPoints}$ premiers termes d'une suite géométrique $u$.
32
+ Que peut-on en déduire quant au signe de sa raison ?`;
33
+ };
34
+ const getAnswer = (identifiers) => {
35
+ const { nodeIdsReason } = identifiers;
36
+ const nodeReason = NodeConstructor.fromIdentifiers(nodeIdsReason);
37
+ const indexAnswer = nodeReason.evaluate() > 0 ? 0 : 1;
38
+ return ["La raison est positive.", "La raison est négative."][indexAnswer];
39
+ };
40
+ const getHint = () => {
41
+ return `Dans le nuage de point qui représente la suite, l'abscisse de chaque point est le rang du terme, et l'ordonnée est le terme en lui-même.
42
+
43
+
44
+ Dans une suite géométrique, pour calculer le terme suivant, on multiplie par la raison.
45
+ Si la raison est positive, le signe sera conservé.
46
+ Si la raison est négative, les deux termes seront de signes différents.`;
47
+ };
48
+ const getCorrection = (identifiers) => {
49
+ const answer = getAnswer(identifiers);
50
+ return `Dans le nuage de point qui représente la suite, l'abscisse de chaque point est le rang du terme, et l'ordonnée est le terme en lui-même.
51
+
52
+ Dans une suite géométrique, pour calculer le terme suivant, on multiplie par la raison.
53
+ Si la raison est positive, le signe sera conservé.
54
+ Si la raison est négative, les deux termes seront de signes différents.
55
+
56
+ Ici, deux termes consécutifs sont toujours de ${answer === "La raison est positive." ? "même signe" : "signes opposés"}.
57
+ Par conséquent, ${answer.toLocaleLowerCase()}.
58
+
59
+ `;
60
+ };
61
+ const getGGBOptions = (identifiers) => {
62
+ const arrPoint = getArrPoint(identifiers);
63
+ const values = arrPoint.map((point) => point.y.evaluate());
64
+ const ggb = new GeogebraConstructor({
65
+ commands: [
66
+ ...arrPoint.flatMap((point) => point.toGGBCommand({ color: `#000000`, showLabel: false })),
67
+ ],
68
+ customToolBar: toolBarConstructor({
69
+ point: true,
70
+ }),
71
+ });
72
+ const yMin = Math.min(...values);
73
+ const yMax = Math.max(...values);
74
+ return ggb.getOptions({
75
+ coords: [-1, 6, Math.min(yMin, 0) - 1, Math.max(yMax, 1) + 1],
76
+ });
77
+ };
78
+ const getPropositions = (_, { answer }) => {
79
+ const propositions = [];
80
+ ["La raison est positive.", "La raison est négative."].forEach((strYN) => {
81
+ if (strYN === answer) {
82
+ addValidProp(propositions, strYN, "raw");
83
+ }
84
+ else {
85
+ tryToAddWrongProp(propositions, strYN, "raw");
86
+ }
87
+ });
88
+ return propositions;
89
+ };
90
+ const getGeometricSignOfReasonFromGraphQuestion = (optsIn) => {
91
+ const opts = optsIn ?? optsDefault;
92
+ const firstRank = opts?.firstTermRankOne ? 1 : 0;
93
+ const [nodeInitialAbs, nodeReasonAbs] = random([
94
+ //increasing
95
+ [(1).toTree(), (2).toTree()],
96
+ [(1).toTree(), frac(3, 2)],
97
+ [(1).toTree(), frac(4, 3)],
98
+ // [(1).toTree(), frac(5, 3)],
99
+ [frac(1, 2), (2).toTree()],
100
+ [frac(1, 2), frac(3, 2)],
101
+ [frac(1, 3), (3).toTree()],
102
+ [(2).toTree(), frac(3, 2)],
103
+ [(2).toTree(), frac(4, 3)],
104
+ //decreasing
105
+ [(8).toTree(), frac(1, 2)],
106
+ [(9).toTree(), frac(1, 3)],
107
+ [(9).toTree(), frac(2, 3)],
108
+ [(8).toTree(), frac(3, 4)],
109
+ // [(10).toTree(), frac(3, 5)],
110
+ ]);
111
+ const nodeInitial = (() => {
112
+ const sign = coinFlip() ? +1 : -1;
113
+ return multiply(sign, nodeInitialAbs).simplify({
114
+ towardsDistribute: true,
115
+ });
116
+ })();
117
+ const nodeReason = (() => {
118
+ const sign = coinFlip() ? +1 : -1;
119
+ return multiply(sign, nodeReasonAbs).simplify({
120
+ towardsDistribute: true,
121
+ });
122
+ })();
123
+ const identifiers = {
124
+ firstRank,
125
+ nodeIdsInitial: nodeInitial.toIdentifiers(),
126
+ nodeIdsReason: nodeReason.toIdentifiers(),
127
+ };
128
+ return getQuestionFromIdentifiers(identifiers, opts);
129
+ };
130
+ const getQuestionFromIdentifiers = (identifiers) => {
131
+ return {
132
+ answer: getAnswer(identifiers),
133
+ instruction: getInstruction(identifiers),
134
+ ggbOptions: getGGBOptions(identifiers),
135
+ identifiers,
136
+ hint: getHint(identifiers),
137
+ correction: getCorrection(identifiers),
138
+ };
139
+ };
140
+ const { optsDefaultFirstTermRankOne, generatorOptionFirstTermRankOne } = getOptionFirstTermRankOneStuff(false);
141
+ const optsDefault = Object.assign({}, optsDefaultFirstTermRankOne, {});
142
+ const options = [generatorOptionFirstTermRankOne];
143
+ export const geometricSignOfReasonFromGraph = {
144
+ id: "geometricSignOfReasonFromGraph",
145
+ label: "À partir d'un nuage de point d'une suite géométrique, retrouver le signe de sa raison",
146
+ isSingleStep: true,
147
+ generator: (nb, opts) => getDistinctQuestions(() => getGeometricSignOfReasonFromGraphQuestion(opts), nb),
148
+ ggbTimer: 60,
149
+ subject: "Mathématiques",
150
+ getHint,
151
+ getCorrection,
152
+ hasHintAndCorrection: true,
153
+ getInstruction,
154
+ getGGBOptions,
155
+ hasGeogebra: true,
156
+ answerType: "QCU",
157
+ getAnswer,
158
+ getPropositions,
159
+ getQuestionFromIdentifiers,
160
+ options,
161
+ };
@@ -0,0 +1,10 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
3
+ type Identifiers = {
4
+ nodeIdsSetA: NodeIdentifiers;
5
+ nodeIdsSetB: NodeIdentifiers;
6
+ isAskedACrossB: boolean;
7
+ };
8
+ export declare const findCardinalOfCartesianProductOfFiniteSets: Exercise<Identifiers>;
9
+ export {};
10
+ //# sourceMappingURL=findCardinalOfCartesianProductOfFiniteSets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findCardinalOfCartesianProductOfFiniteSets.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sets/cartesianProduct/findCardinalOfCartesianProductOfFiniteSets.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAKrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAsC7C,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,eAAe,CAAC;IAC7B,WAAW,EAAE,eAAe,CAAC;IAC7B,cAAc,EAAE,OAAO,CAAC;CACzB,CAAC;AA8OF,eAAO,MAAM,0CAA0C,EAAE,QAAQ,CAAC,WAAW,CAkB1E,CAAC"}