math-exercises 2.0.34 → 2.0.35

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 (97) hide show
  1. package/lib/exercises/calculLitteral/simplifying/distributeAndSimplify.d.ts +14 -0
  2. package/lib/exercises/calculLitteral/simplifying/distributeAndSimplify.d.ts.map +1 -0
  3. package/lib/exercises/calculLitteral/simplifying/distributeAndSimplify.js +67 -0
  4. package/lib/exercises/calculLitteral/simplifying/index.d.ts +1 -0
  5. package/lib/exercises/calculLitteral/simplifying/index.d.ts.map +1 -1
  6. package/lib/exercises/calculLitteral/simplifying/index.js +1 -0
  7. package/lib/exercises/equaDiff/equaDiffCheckSolutionFirstOrder.d.ts +10 -0
  8. package/lib/exercises/equaDiff/equaDiffCheckSolutionFirstOrder.d.ts.map +1 -0
  9. package/lib/exercises/equaDiff/equaDiffCheckSolutionFirstOrder.js +101 -0
  10. package/lib/exercises/equaDiff/index.d.ts +1 -0
  11. package/lib/exercises/equaDiff/index.d.ts.map +1 -1
  12. package/lib/exercises/equaDiff/index.js +1 -0
  13. package/lib/exercises/exercise.d.ts +1 -0
  14. package/lib/exercises/exercise.d.ts.map +1 -1
  15. package/lib/exercises/functions/trinoms/factorizedFormFromRoots.d.ts +8 -0
  16. package/lib/exercises/functions/trinoms/factorizedFormFromRoots.d.ts.map +1 -0
  17. package/lib/exercises/functions/trinoms/factorizedFormFromRoots.js +67 -0
  18. package/lib/exercises/functions/trinoms/index.d.ts +3 -0
  19. package/lib/exercises/functions/trinoms/index.d.ts.map +1 -1
  20. package/lib/exercises/functions/trinoms/index.js +3 -0
  21. package/lib/exercises/functions/trinoms/rootsReading.d.ts +9 -0
  22. package/lib/exercises/functions/trinoms/rootsReading.d.ts.map +1 -0
  23. package/lib/exercises/functions/trinoms/rootsReading.js +67 -0
  24. package/lib/exercises/functions/trinoms/summitReading.d.ts +9 -0
  25. package/lib/exercises/functions/trinoms/summitReading.d.ts.map +1 -0
  26. package/lib/exercises/functions/trinoms/summitReading.js +59 -0
  27. package/lib/exercises/geometry/vectors/equalCaracteristicFromGraph.d.ts +9 -0
  28. package/lib/exercises/geometry/vectors/equalCaracteristicFromGraph.d.ts.map +1 -0
  29. package/lib/exercises/geometry/vectors/equalCaracteristicFromGraph.js +194 -0
  30. package/lib/exercises/geometry/vectors/index.d.ts +1 -0
  31. package/lib/exercises/geometry/vectors/index.d.ts.map +1 -1
  32. package/lib/exercises/geometry/vectors/index.js +1 -0
  33. package/lib/exercises/matrices/index.d.ts +1 -0
  34. package/lib/exercises/matrices/index.d.ts.map +1 -1
  35. package/lib/exercises/matrices/index.js +1 -0
  36. package/lib/exercises/matrices/productCell.d.ts +10 -0
  37. package/lib/exercises/matrices/productCell.d.ts.map +1 -0
  38. package/lib/exercises/matrices/productCell.js +57 -0
  39. package/lib/exercises/probaStat/index.d.ts +3 -0
  40. package/lib/exercises/probaStat/index.d.ts.map +1 -1
  41. package/lib/exercises/probaStat/index.js +3 -0
  42. package/lib/exercises/probaStat/issuesCountingForCards.d.ts +7 -0
  43. package/lib/exercises/probaStat/issuesCountingForCards.d.ts.map +1 -0
  44. package/lib/exercises/probaStat/issuesCountingForCards.js +78 -0
  45. package/lib/exercises/probaStat/probaFromTableNoContext.d.ts +13 -0
  46. package/lib/exercises/probaStat/probaFromTableNoContext.d.ts.map +1 -0
  47. package/lib/exercises/probaStat/probaFromTableNoContext.js +115 -0
  48. package/lib/exercises/probaStat/probaFromTableWithContext.d.ts +13 -0
  49. package/lib/exercises/probaStat/probaFromTableWithContext.d.ts.map +1 -0
  50. package/lib/exercises/probaStat/probaFromTableWithContext.js +121 -0
  51. package/lib/exercises/python/index.d.ts +1 -0
  52. package/lib/exercises/python/index.d.ts.map +1 -0
  53. package/lib/exercises/python/index.js +1 -0
  54. package/lib/exercises/sequences/arithmetic/index.d.ts +4 -0
  55. package/lib/exercises/sequences/arithmetic/index.d.ts.map +1 -1
  56. package/lib/exercises/sequences/arithmetic/index.js +4 -0
  57. package/lib/exercises/sequences/arithmetic/recognizeArithmeticFromFirstTerms.d.ts +8 -0
  58. package/lib/exercises/sequences/arithmetic/recognizeArithmeticFromFirstTerms.d.ts.map +1 -0
  59. package/lib/exercises/sequences/arithmetic/recognizeArithmeticFromFirstTerms.js +71 -0
  60. package/lib/exercises/sequences/arithmetic/recognizeArithmeticFromGraph.d.ts +8 -0
  61. package/lib/exercises/sequences/arithmetic/recognizeArithmeticFromGraph.d.ts.map +1 -0
  62. package/lib/exercises/sequences/arithmetic/recognizeArithmeticFromGraph.js +87 -0
  63. package/lib/exercises/sequences/arithmetic/recognizeReasonFromFirstTerms.d.ts +8 -0
  64. package/lib/exercises/sequences/arithmetic/recognizeReasonFromFirstTerms.d.ts.map +1 -0
  65. package/lib/exercises/sequences/arithmetic/recognizeReasonFromFirstTerms.js +44 -0
  66. package/lib/exercises/sequences/arithmetic/recognizeReasonFromGraph.d.ts +8 -0
  67. package/lib/exercises/sequences/arithmetic/recognizeReasonFromGraph.d.ts.map +1 -0
  68. package/lib/exercises/sequences/arithmetic/recognizeReasonFromGraph.js +58 -0
  69. package/lib/exercises/utils/getDistinctQuestions.d.ts.map +1 -1
  70. package/lib/exercises/utils/getDistinctQuestions.js +1 -0
  71. package/lib/geogebra/geogebraConstructor.d.ts +2 -0
  72. package/lib/geogebra/geogebraConstructor.d.ts.map +1 -1
  73. package/lib/geogebra/geogebraConstructor.js +2 -0
  74. package/lib/index.d.ts +64 -0
  75. package/lib/index.d.ts.map +1 -1
  76. package/lib/math/geometry/point.d.ts +1 -0
  77. package/lib/math/geometry/point.d.ts.map +1 -1
  78. package/lib/math/geometry/point.js +3 -0
  79. package/lib/math/polynomials/trinom.d.ts +2 -0
  80. package/lib/math/polynomials/trinom.d.ts.map +1 -1
  81. package/lib/math/polynomials/trinom.js +29 -0
  82. package/lib/math/utils/random/randTupleInt.d.ts +1 -1
  83. package/lib/math/utils/random/randTupleInt.js +1 -1
  84. package/lib/math/utils/random/randfloat.d.ts +5 -0
  85. package/lib/math/utils/random/randfloat.d.ts.map +1 -0
  86. package/lib/math/utils/random/randfloat.js +18 -0
  87. package/lib/math/utils/sum.d.ts +8 -0
  88. package/lib/math/utils/sum.d.ts.map +1 -0
  89. package/lib/math/utils/sum.js +17 -0
  90. package/lib/tree/nodes/algebraicNode.d.ts +1 -0
  91. package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
  92. package/lib/tree/nodes/operators/powerNode.d.ts.map +1 -1
  93. package/lib/tree/nodes/operators/powerNode.js +3 -1
  94. package/lib/utils/doWhile.d.ts +2 -0
  95. package/lib/utils/doWhile.d.ts.map +1 -0
  96. package/lib/utils/doWhile.js +11 -0
  97. package/package.json +1 -1
@@ -0,0 +1,194 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.equalCaracteristicFromGraph = void 0;
4
+ const exercise_1 = require("../../../exercises/exercise");
5
+ const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
6
+ const geogebraConstructor_1 = require("../../../geogebra/geogebraConstructor");
7
+ const randfloat_1 = require("../../../math/utils/random/randfloat");
8
+ const coinFlip_1 = require("../../../utils/coinFlip");
9
+ const random_1 = require("../../../utils/random");
10
+ /**
11
+ *
12
+ * Soient deux cercles C1 et C2 de rayon 3 et de centres (-4,0) et (4,0)
13
+ * on construit u dans C1 et v dans C2
14
+ */
15
+ const getEqualCaracteristicFromGraphQuestion = () => {
16
+ let points = [];
17
+ // const caracAsked = random(["sens", "direction", "norme"]);
18
+ let instruction = "";
19
+ const caracAsked = (0, random_1.random)(["opposes"]);
20
+ // ["sens", "norme", "direction", "egaux", "opposes"]
21
+ const isTrue = (0, coinFlip_1.coinFlip)();
22
+ let uPoints = [];
23
+ let vPoints = [];
24
+ //On construit u dans C1
25
+ const theta = Math.random() * 2 * Math.PI;
26
+ uPoints.push([3 * Math.cos(theta) - 4, 3 * Math.sin(theta)]);
27
+ uPoints.push([
28
+ 3 * Math.cos(theta + Math.PI) - 4,
29
+ 3 * Math.sin(theta + Math.PI),
30
+ ]);
31
+ let thetaPrime;
32
+ let sameDirection;
33
+ let sameNorm;
34
+ let sameSens;
35
+ let rho;
36
+ switch (caracAsked) {
37
+ case "direction":
38
+ instruction = "avoir la même direction";
39
+ thetaPrime = isTrue
40
+ ? theta
41
+ : theta + (0, randfloat_1.randfloat)(1 / 4, 1 / 3) * Math.PI * 2;
42
+ sameNorm = (0, coinFlip_1.coinFlip)();
43
+ rho = sameNorm ? 3 : (0, randfloat_1.randfloat)(1, 2.5);
44
+ vPoints.push([
45
+ rho * Math.cos(thetaPrime) + 4,
46
+ rho * Math.sin(thetaPrime),
47
+ ]);
48
+ vPoints.push([
49
+ rho * Math.cos(thetaPrime + Math.PI) + 4,
50
+ rho * Math.sin(thetaPrime + Math.PI),
51
+ ]);
52
+ if ((0, coinFlip_1.coinFlip)())
53
+ uPoints = [uPoints[1], uPoints[0]];
54
+ if ((0, coinFlip_1.coinFlip)())
55
+ [uPoints, vPoints] = [vPoints, uPoints];
56
+ break;
57
+ case "norme":
58
+ instruction = "avoir la même norme";
59
+ sameDirection = (0, coinFlip_1.coinFlip)();
60
+ thetaPrime = sameDirection ? theta : Math.random() * 2 * Math.PI;
61
+ if (isTrue) {
62
+ vPoints.push([3 * Math.cos(thetaPrime) + 4, 3 * Math.sin(thetaPrime)]);
63
+ vPoints.push([
64
+ 3 * Math.cos(thetaPrime + Math.PI) + 4,
65
+ 3 * Math.sin(thetaPrime + Math.PI),
66
+ ]);
67
+ }
68
+ else {
69
+ vPoints.push([Math.cos(thetaPrime) + 4, Math.sin(thetaPrime)]);
70
+ vPoints.push([
71
+ Math.cos(thetaPrime + Math.PI) + 4,
72
+ Math.sin(thetaPrime + Math.PI),
73
+ ]);
74
+ }
75
+ if ((0, coinFlip_1.coinFlip)())
76
+ uPoints = [uPoints[1], uPoints[0]];
77
+ if ((0, coinFlip_1.coinFlip)())
78
+ [uPoints, vPoints] = [vPoints, uPoints];
79
+ break;
80
+ case "sens":
81
+ instruction = "avoir le même sens";
82
+ sameDirection = (0, coinFlip_1.coinFlip)();
83
+ sameNorm = (0, coinFlip_1.coinFlip)();
84
+ thetaPrime =
85
+ isTrue || sameDirection
86
+ ? theta
87
+ : theta + (0, randfloat_1.randfloat)(1 / 4, 1 / 3) * Math.PI * 2;
88
+ rho = sameNorm ? 3 : (0, randfloat_1.randfloat)(1, 2.5);
89
+ vPoints.push([
90
+ rho * Math.cos(thetaPrime) + 4,
91
+ rho * Math.sin(thetaPrime),
92
+ ]);
93
+ vPoints.push([
94
+ rho * Math.cos(thetaPrime + Math.PI) + 4,
95
+ rho * Math.sin(thetaPrime + Math.PI),
96
+ ]);
97
+ if (!isTrue)
98
+ vPoints = [vPoints[1], vPoints[0]];
99
+ if ((0, coinFlip_1.coinFlip)())
100
+ [uPoints, vPoints] = [vPoints, uPoints];
101
+ break;
102
+ case "egaux":
103
+ instruction = "être égaux";
104
+ sameDirection = isTrue || (0, coinFlip_1.coinFlip)();
105
+ sameNorm = isTrue || (0, coinFlip_1.coinFlip)();
106
+ sameSens = isTrue || (sameDirection && sameNorm ? false : (0, coinFlip_1.coinFlip)());
107
+ thetaPrime = sameDirection
108
+ ? theta
109
+ : theta + (0, randfloat_1.randfloat)(1 / 4, 1 / 3) * Math.PI * 2;
110
+ rho = sameNorm ? 3 : (0, randfloat_1.randfloat)(1, 2);
111
+ vPoints.push([
112
+ rho * Math.cos(thetaPrime) + 4,
113
+ rho * Math.sin(thetaPrime),
114
+ ]);
115
+ vPoints.push([
116
+ rho * Math.cos(thetaPrime + Math.PI) + 4,
117
+ rho * Math.sin(thetaPrime + Math.PI),
118
+ ]);
119
+ if (!sameSens)
120
+ vPoints = [vPoints[1], vPoints[0]];
121
+ if ((0, coinFlip_1.coinFlip)())
122
+ [uPoints, vPoints] = [vPoints, uPoints];
123
+ break;
124
+ case "opposes":
125
+ instruction = "être opposés";
126
+ sameDirection = isTrue || (0, coinFlip_1.coinFlip)();
127
+ sameNorm = isTrue || (0, coinFlip_1.coinFlip)();
128
+ sameSens = !isTrue || (sameDirection && sameNorm ? false : (0, coinFlip_1.coinFlip)());
129
+ thetaPrime = sameDirection
130
+ ? theta
131
+ : theta + (0, randfloat_1.randfloat)(1 / 4, 1 / 3) * Math.PI * 2;
132
+ rho = sameNorm ? 3 : (0, randfloat_1.randfloat)(1, 2.5);
133
+ vPoints.push([
134
+ rho * Math.cos(thetaPrime) + 4,
135
+ rho * Math.sin(thetaPrime),
136
+ ]);
137
+ vPoints.push([
138
+ rho * Math.cos(thetaPrime + Math.PI) + 4,
139
+ rho * Math.sin(thetaPrime + Math.PI),
140
+ ]);
141
+ if (!sameSens)
142
+ vPoints = [vPoints[1], vPoints[0]];
143
+ if ((0, coinFlip_1.coinFlip)())
144
+ [uPoints, vPoints] = [vPoints, uPoints];
145
+ break;
146
+ }
147
+ const commands = [
148
+ `u = Vector((${uPoints[0][0]},${uPoints[0][1]}), (${uPoints[1][0]},${uPoints[1][1]}))`,
149
+ `v = Vector((${vPoints[0][0]},${vPoints[0][1]}), (${vPoints[1][0]},${vPoints[1][1]}))`,
150
+ 'SetCaption(u, "$\\overrightarrow u$")',
151
+ 'SetCaption(v, "$\\overrightarrow v$")',
152
+ "ShowLabel(u, true)",
153
+ "ShowLabel(v,true)",
154
+ ];
155
+ const ggb = new geogebraConstructor_1.GeogebraConstructor(commands, {
156
+ isGridSimple: true,
157
+ hideAxes: true,
158
+ });
159
+ const answer = isTrue ? "Oui" : "Non";
160
+ const question = {
161
+ answer,
162
+ instruction: `Les vecteurs $\\overrightarrow{u}$ et $\\overrightarrow{v}$ suivants semblent-ils ${instruction} ?`,
163
+ keys: [],
164
+ commands: ggb.commands,
165
+ options: ggb.getOptions(),
166
+ coords: [-8, 8, -4, 4],
167
+ answerFormat: "tex",
168
+ identifiers: { caracAsked, uPoints, vPoints },
169
+ };
170
+ return question;
171
+ };
172
+ const getPropositions = (n, { answer }) => {
173
+ const propositions = [];
174
+ (0, exercise_1.addValidProp)(propositions, answer, "raw");
175
+ (0, exercise_1.tryToAddWrongProp)(propositions, "Oui", "raw");
176
+ (0, exercise_1.tryToAddWrongProp)(propositions, "Non", "raw");
177
+ return (0, exercise_1.shuffleProps)(propositions, n);
178
+ };
179
+ const isAnswerValid = (ans, { answer }) => {
180
+ return ans === answer;
181
+ };
182
+ exports.equalCaracteristicFromGraph = {
183
+ id: "equalCaracteristicFromGraph",
184
+ label: "Direction, sens, norme, égalité, opposés",
185
+ levels: ["2nde"],
186
+ isSingleStep: true,
187
+ sections: ["Vecteurs"],
188
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getEqualCaracteristicFromGraphQuestion, nb),
189
+ qcmTimer: 60,
190
+ freeTimer: 60,
191
+ getPropositions,
192
+ isAnswerValid,
193
+ answerType: "QCM",
194
+ };
@@ -9,4 +9,5 @@ export * from "./alignementViaColinearity";
9
9
  export * from "./paralellismViaColinearity";
10
10
  export * from "./parallelogramViaEqualVectors";
11
11
  export * from "./fourthParallelogramPoint";
12
+ export * from "./equalCaracteristicFromGraph";
12
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/geometry/vectors/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,0BAA0B,CAAC;AACzC,cAAc,kCAAkC,CAAC;AACjD,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/geometry/vectors/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,0BAA0B,CAAC;AACzC,cAAc,kCAAkC,CAAC;AACjD,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,+BAA+B,CAAC"}
@@ -25,3 +25,4 @@ __exportStar(require("./alignementViaColinearity"), exports);
25
25
  __exportStar(require("./paralellismViaColinearity"), exports);
26
26
  __exportStar(require("./parallelogramViaEqualVectors"), exports);
27
27
  __exportStar(require("./fourthParallelogramPoint"), exports);
28
+ __exportStar(require("./equalCaracteristicFromGraph"), exports);
@@ -1,2 +1,3 @@
1
1
  export * from "./matrixInversibilityDomain";
2
+ export * from "./productCell";
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/exercises/matrices/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/exercises/matrices/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,eAAe,CAAC"}
@@ -15,3 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./matrixInversibilityDomain"), exports);
18
+ __exportStar(require("./productCell"), exports);
@@ -0,0 +1,10 @@
1
+ import { MathExercise } from "../../exercises/exercise";
2
+ type Identifiers = {
3
+ AiCoeff: number;
4
+ AjCoeff: number;
5
+ BiCoeff: number;
6
+ BjCoeff: number;
7
+ };
8
+ export declare const productCell: MathExercise<Identifiers>;
9
+ export {};
10
+ //# sourceMappingURL=productCell.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"productCell.d.ts","sourceRoot":"","sources":["../../../src/exercises/matrices/productCell.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EASb,MAAM,0BAA0B,CAAC;AASlC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAqDF,eAAO,MAAM,WAAW,EAAE,YAAY,CAAC,WAAW,CAYjD,CAAC"}
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.productCell = void 0;
4
+ const exercise_1 = require("../../exercises/exercise");
5
+ const getDistinctQuestions_1 = require("../../exercises/utils/getDistinctQuestions");
6
+ const randint_1 = require("../../math/utils/random/randint");
7
+ const sum_1 = require("../../math/utils/sum");
8
+ const addNode_1 = require("../../tree/nodes/operators/addNode");
9
+ const multiplyNode_1 = require("../../tree/nodes/operators/multiplyNode");
10
+ const variableNode_1 = require("../../tree/nodes/variables/variableNode");
11
+ const doWhile_1 = require("../../utils/doWhile");
12
+ //$A=(a_{i,j})$ avec $a_{i,j}=2i-j$ et $B=(b_{i,j})$ avec $b_{i,j}=i+j$ calculer $c_{2,3}$ Réponse: $c_{2,3} = \sum_{k=1}^{3} (2 \cdot 2 - k) \cdot (k + 3)$ $ c_{2,3} = (2 \cdot 2 - 1) \cdot (1 + 3) + (2 \cdot 2 - 2) \cdot (2 + 3) + (2 \cdot 2 - 3) \cdot (3 + 3)$ $c_{2,3}=3\times 4+2\times 5+1\times 6 =28$. Si l'élève détermine l'expression des matrices A et B puis effectue le calcul des bons blocs pour obtenir le coefficient cela est intéressant aussi ! Bonne journée merci
13
+ // Les matrices A et B sont définies par combinaisons linéaires de leurs lignes/colonnes
14
+ // exp a_(i,j) = 2i+j
15
+ const getProductCellQuestion = () => {
16
+ const i = (0, randint_1.randint)(1, 4);
17
+ const j = (0, randint_1.randint)(1, 4);
18
+ const AiCoeff = (0, randint_1.randint)(-3, 4, [0]);
19
+ const AjCoeff = (0, randint_1.randint)(-3, 4, [0]);
20
+ const BiCoeff = (0, randint_1.randint)(-3, 4, [0]);
21
+ const BjCoeff = (0, doWhile_1.doWhile)(() => (0, randint_1.randint)(-3, 4, [0]), (x) => BiCoeff === AiCoeff && x === AjCoeff);
22
+ const aij = new addNode_1.AddNode(new multiplyNode_1.MultiplyNode(AiCoeff.toTree(), new variableNode_1.VariableNode("i")), new multiplyNode_1.MultiplyNode(AjCoeff.toTree(), new variableNode_1.VariableNode("j"))).simplify();
23
+ const bij = new addNode_1.AddNode(new multiplyNode_1.MultiplyNode(BiCoeff.toTree(), new variableNode_1.VariableNode("i")), new multiplyNode_1.MultiplyNode(BjCoeff.toTree(), new variableNode_1.VariableNode("j"))).simplify();
24
+ const answer = (0, sum_1.sum)(1, 3, (k) => (AiCoeff * i + AjCoeff * k) * (BiCoeff * k + BjCoeff * j)) + "";
25
+ const question = {
26
+ answer,
27
+ instruction: `Soient $A = \\left(a_{i,j}\\right)$ et $B = \\left(b_{i,j}\\right)$ deux matrices carrées d'ordre $3$, avec $a_{i,j} = ${aij.toTex()}$ et $b_{i,j} = ${bij.toTex()}$. Soit $C = AB$. Calculer $c_{${i},${j}}$.`,
28
+ keys: [],
29
+ answerFormat: "tex",
30
+ identifiers: { AiCoeff, AjCoeff, BiCoeff, BjCoeff },
31
+ };
32
+ return question;
33
+ };
34
+ const getPropositions = (n, { answer }) => {
35
+ const propositions = [];
36
+ (0, exercise_1.addValidProp)(propositions, answer);
37
+ while (propositions.length < n) {
38
+ (0, exercise_1.tryToAddWrongProp)(propositions, (0, randint_1.randint)(-100, 100) + "");
39
+ }
40
+ return (0, exercise_1.shuffleProps)(propositions, n);
41
+ };
42
+ const isAnswerValid = (ans, { answer }) => {
43
+ return ans === answer;
44
+ };
45
+ exports.productCell = {
46
+ id: "productCell",
47
+ connector: "=",
48
+ label: "Calculer un coefficient du produit de deux matrices",
49
+ levels: ["MathExp"],
50
+ isSingleStep: true,
51
+ sections: ["Matrices"],
52
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getProductCellQuestion, nb),
53
+ qcmTimer: 60,
54
+ freeTimer: 60,
55
+ getPropositions,
56
+ isAnswerValid,
57
+ };
@@ -6,4 +6,7 @@ export * from "./probabilityTree";
6
6
  export * from "./stats1var";
7
7
  export * from "./stats2var";
8
8
  export * from "./independancy";
9
+ export * from "./issuesCountingForCards";
10
+ export * from "./probaFromTableNoContext";
11
+ export * from "./probaFromTableWithContext";
9
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/exercises/probaStat/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/exercises/probaStat/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC"}
@@ -22,3 +22,6 @@ __exportStar(require("./probabilityTree"), exports);
22
22
  __exportStar(require("./stats1var"), exports);
23
23
  __exportStar(require("./stats2var"), exports);
24
24
  __exportStar(require("./independancy"), exports);
25
+ __exportStar(require("./issuesCountingForCards"), exports);
26
+ __exportStar(require("./probaFromTableNoContext"), exports);
27
+ __exportStar(require("./probaFromTableWithContext"), exports);
@@ -0,0 +1,7 @@
1
+ import { MathExercise } from "../../exercises/exercise";
2
+ type Identifiers = {
3
+ questionType: string;
4
+ };
5
+ export declare const issuesCountingForCards: MathExercise<Identifiers>;
6
+ export {};
7
+ //# sourceMappingURL=issuesCountingForCards.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"issuesCountingForCards.d.ts","sourceRoot":"","sources":["../../../src/exercises/probaStat/issuesCountingForCards.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EASb,MAAM,0BAA0B,CAAC;AAQlC,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAiEF,eAAO,MAAM,sBAAsB,EAAE,YAAY,CAAC,WAAW,CAa5D,CAAC"}
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.issuesCountingForCards = void 0;
4
+ const exercise_1 = require("../../exercises/exercise");
5
+ const getDistinctQuestions_1 = require("../../exercises/utils/getDistinctQuestions");
6
+ const randint_1 = require("../../math/utils/random/randint");
7
+ const probaLawFlip_1 = require("../../utils/probaLawFlip");
8
+ const random_1 = require("../../utils/random");
9
+ const randomEnumValue_1 = require("../../utils/randomEnumValue");
10
+ const cardsData_1 = require("../utils/cardsData");
11
+ const getIssuesCountingForCardsQuestion = () => {
12
+ const questionType = (0, probaLawFlip_1.probaLawFlip)([
13
+ ["oneCard", 0.25],
14
+ ["valueCard", 0.25],
15
+ ["suitCard", 0.25],
16
+ ["colorCard", 0.25],
17
+ ]);
18
+ let answer = "";
19
+ let target = "";
20
+ let value;
21
+ let color;
22
+ switch (questionType) {
23
+ case "oneCard":
24
+ value = (0, randomEnumValue_1.randomEnumValue)(cardsData_1.CardsValues);
25
+ color = (0, randomEnumValue_1.randomEnumValue)(cardsData_1.CardsColor);
26
+ target = `${value === "dame" ? "une" : "un"} ${value} de ${color}`;
27
+ answer = `1`;
28
+ break;
29
+ case "valueCard":
30
+ value = (0, randomEnumValue_1.randomEnumValue)(cardsData_1.CardsValues);
31
+ target = `${value === "dame" ? "une" : "un"} ${value}`;
32
+ answer = "4";
33
+ break;
34
+ case "colorCard":
35
+ color = (0, random_1.random)(["rouge", "noire"]);
36
+ target = `une carte ${color}`;
37
+ answer = `26`;
38
+ break;
39
+ case "suitCard":
40
+ color = (0, randomEnumValue_1.randomEnumValue)(cardsData_1.CardsColor);
41
+ target = `un ${color}`;
42
+ answer = `13`;
43
+ break;
44
+ }
45
+ const question = {
46
+ answer,
47
+ instruction: `On tire une carte dans un jeu de 52 cartes. Combien l'événement $A = $ "obtenir ${target}" compte-t-il d'issues ?`,
48
+ keys: [],
49
+ answerFormat: "tex",
50
+ identifiers: { questionType },
51
+ };
52
+ return question;
53
+ };
54
+ const getPropositions = (n, { answer }) => {
55
+ const propositions = [];
56
+ (0, exercise_1.addValidProp)(propositions, answer);
57
+ (0, exercise_1.tryToAddWrongProp)(propositions, "1");
58
+ while (propositions.length < n) {
59
+ (0, exercise_1.tryToAddWrongProp)(propositions, (0, randint_1.randint)(0, 52) + "");
60
+ }
61
+ return (0, exercise_1.shuffleProps)(propositions, n);
62
+ };
63
+ const isAnswerValid = (ans, { answer }) => {
64
+ return ans === answer;
65
+ };
66
+ exports.issuesCountingForCards = {
67
+ id: "issuesCountingForCards",
68
+ connector: "=",
69
+ label: "Compter le nombre d'issues d'un événement avec un jeu de cartes",
70
+ levels: ["3ème", "2nde", "2ndPro", "1rePro"],
71
+ isSingleStep: true,
72
+ sections: ["Probabilités"],
73
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getIssuesCountingForCardsQuestion, nb),
74
+ qcmTimer: 60,
75
+ freeTimer: 60,
76
+ getPropositions,
77
+ isAnswerValid,
78
+ };
@@ -0,0 +1,13 @@
1
+ import { MathExercise } from "../../exercises/exercise";
2
+ type Identifiers = {
3
+ aCapB: number;
4
+ aCapBBarre: number;
5
+ aBarreCapB: number;
6
+ aBarreCapBBarre: number;
7
+ event: string;
8
+ type: string;
9
+ probaFrac: number[];
10
+ };
11
+ export declare const probaFromTableNoContext: MathExercise<Identifiers>;
12
+ export {};
13
+ //# sourceMappingURL=probaFromTableNoContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"probaFromTableNoContext.d.ts","sourceRoot":"","sources":["../../../src/exercises/probaStat/probaFromTableNoContext.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EASb,MAAM,0BAA0B,CAAC;AAOlC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAkHF,eAAO,MAAM,uBAAuB,EAAE,YAAY,CAAC,WAAW,CAc7D,CAAC"}
@@ -0,0 +1,115 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.probaFromTableNoContext = void 0;
4
+ const exercise_1 = require("../../exercises/exercise");
5
+ const getDistinctQuestions_1 = require("../../exercises/utils/getDistinctQuestions");
6
+ const rational_1 = require("../../math/numbers/rationals/rational");
7
+ const randint_1 = require("../../math/utils/random/randint");
8
+ const fractionNode_1 = require("../../tree/nodes/operators/fractionNode");
9
+ const random_1 = require("../../utils/random");
10
+ const getProbaFromTableNoContextQuestion = () => {
11
+ const aCapB = (0, randint_1.randint)(1, 20);
12
+ const aCapBBarre = (0, randint_1.randint)(1, 20);
13
+ const aBarreCapB = (0, randint_1.randint)(1, 20);
14
+ const aBarreCapBBarre = (0, randint_1.randint)(1, 20);
15
+ const total = aBarreCapB + aBarreCapBBarre + aCapB + aCapBBarre;
16
+ const aTotal = aCapB + aCapBBarre;
17
+ const bTotal = aCapB + aBarreCapB;
18
+ const aBarreTotal = aBarreCapB + aBarreCapBBarre;
19
+ const bBarreTotal = aBarreCapBBarre + aCapBBarre;
20
+ let event = "";
21
+ let proba = [];
22
+ const type = (0, random_1.random)(["singleEvent", "intersection", "union", "conditionnal"]);
23
+ switch (type) {
24
+ case "singleEvent":
25
+ [event, proba] = (0, random_1.random)([
26
+ ["P(A)", [aTotal, total]],
27
+ ["P(B)", [bTotal, total]],
28
+ ["P(\\overline A)", [aBarreTotal, total]],
29
+ ["P(\\overline B)", [bBarreTotal, total]],
30
+ ]);
31
+ break;
32
+ case "intersection":
33
+ [event, proba] = (0, random_1.random)([
34
+ ["P(A\\cap B)", [aCapB, total]],
35
+ ["P(\\overline A\\cap B)", [aBarreCapB, total]],
36
+ ["P(A\\cap \\overline B)", [aCapBBarre, total]],
37
+ ["P(\\overline A \\cap \\overline B)", [aBarreCapBBarre, total]],
38
+ ]);
39
+ break;
40
+ case "union":
41
+ [event, proba] = (0, random_1.random)([
42
+ ["P(A\\cup B)", [total - aBarreCapBBarre, total]],
43
+ ["P(A\\cup \\overline B)", [total - aBarreCapB, total]],
44
+ ["P(\\overline A \\cup B)", [total - aCapBBarre, total]],
45
+ ["P(\\overline A \\cup \\overline B)", [total - aCapB, total]],
46
+ ]);
47
+ break;
48
+ case "conditionnal":
49
+ [event, proba] = (0, random_1.random)([
50
+ ["P_A(B)", [aCapB, aTotal]],
51
+ ["P_A(\\overline B)", [aCapBBarre, aTotal]],
52
+ ["P_B(A)", [aCapB, bTotal]],
53
+ ["P_B(\\overline{A})", [aBarreCapB, bTotal]],
54
+ ["P_{\\overline A}(B)", [aBarreCapB, aBarreTotal]],
55
+ ["P_{\\overline A}(\\overline B)", [aBarreCapBBarre, aBarreTotal]],
56
+ ["P_{\\overline B}(A)", [aCapBBarre, bBarreTotal]],
57
+ ["P_{\\overline B}(\\overline A)", [aBarreCapBBarre, bBarreTotal]],
58
+ ]);
59
+ }
60
+ const answer = new rational_1.Rational(proba[0], proba[1]).simplify().toTree().toTex();
61
+ const question = {
62
+ answer,
63
+ instruction: `On considère deux événements $A$ et $B$. Le tableau suivant donne le nombre d'issues pour chacun des événements $A\\cap B$, $\\overline A\\cap B$, $A\\cap \\overline B$ et $\\overline A \\cap \\overline B$. Calculer la probabilité $${event}$.
64
+
65
+ | | $B$ | $\\overline{B}$|
66
+ |-|-|-|
67
+ |$A$|${aCapB}|${aCapBBarre}|
68
+ |$\\overline{A}$|${aBarreCapB}|${aBarreCapBBarre}|
69
+
70
+ `,
71
+ keys: [],
72
+ answerFormat: "tex",
73
+ identifiers: {
74
+ aBarreCapB,
75
+ aBarreCapBBarre,
76
+ aCapB,
77
+ aCapBBarre,
78
+ event,
79
+ type,
80
+ probaFrac: proba,
81
+ },
82
+ };
83
+ return question;
84
+ };
85
+ const getPropositions = (n, { answer, aBarreCapB, aBarreCapBBarre, aCapB, aCapBBarre }) => {
86
+ const propositions = [];
87
+ (0, exercise_1.addValidProp)(propositions, answer);
88
+ while (propositions.length < n) {
89
+ (0, exercise_1.tryToAddWrongProp)(propositions, new rational_1.Rational((0, random_1.random)([aBarreCapB, aBarreCapBBarre, aCapB, aCapBBarre]), (0, random_1.random)([aBarreCapB, aBarreCapBBarre, aCapB, aCapBBarre]) +
90
+ (0, random_1.random)([aBarreCapB, aBarreCapBBarre, aCapB, aCapBBarre]))
91
+ .simplify()
92
+ .toTree()
93
+ .toTex());
94
+ }
95
+ return (0, exercise_1.shuffleProps)(propositions, n);
96
+ };
97
+ const isAnswerValid = (ans, { answer, probaFrac }) => {
98
+ const fracTexs = new fractionNode_1.FractionNode(probaFrac[0].toTree(), probaFrac[1].toTree())
99
+ .simplify()
100
+ .toAllValidTexs();
101
+ return fracTexs.includes(ans);
102
+ };
103
+ exports.probaFromTableNoContext = {
104
+ id: "probaFromTableNoContext",
105
+ connector: "=",
106
+ label: "Utiliser un tableau à double entrée pour calculer une probabilité (sans contexte)",
107
+ levels: ["1rePro", "1reSpé", "1reTech", "1reESM", "2ndPro"],
108
+ isSingleStep: true,
109
+ sections: ["Probabilités"],
110
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getProbaFromTableNoContextQuestion, nb),
111
+ qcmTimer: 60,
112
+ freeTimer: 60,
113
+ getPropositions,
114
+ isAnswerValid,
115
+ };
@@ -0,0 +1,13 @@
1
+ import { MathExercise } from "../../exercises/exercise";
2
+ type Identifiers = {
3
+ aCapB: number;
4
+ aCapBBarre: number;
5
+ aBarreCapB: number;
6
+ aBarreCapBBarre: number;
7
+ event: string;
8
+ type: string;
9
+ probaFrac: number[];
10
+ };
11
+ export declare const probaFromTableWithContext: MathExercise<Identifiers>;
12
+ export {};
13
+ //# sourceMappingURL=probaFromTableWithContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"probaFromTableWithContext.d.ts","sourceRoot":"","sources":["../../../src/exercises/probaStat/probaFromTableWithContext.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EASb,MAAM,0BAA0B,CAAC;AAOlC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAsHF,eAAO,MAAM,yBAAyB,EAAE,YAAY,CAAC,WAAW,CAc/D,CAAC"}