math-exercises 3.0.176 → 3.0.177

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 (44) hide show
  1. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductOrthoInSquare.d.ts.map +1 -1
  2. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductOrthoInSquare.js +31 -6
  3. package/lib/exercises/math/probaStat/trees/index.d.ts +1 -3
  4. package/lib/exercises/math/probaStat/trees/index.d.ts.map +1 -1
  5. package/lib/exercises/math/probaStat/trees/index.js +8 -3
  6. package/lib/exercises/math/probaStat/trees/probabilityTree.d.ts +3 -9
  7. package/lib/exercises/math/probaStat/trees/probabilityTree.d.ts.map +1 -1
  8. package/lib/exercises/math/probaStat/trees/probabilityTree.js +45 -419
  9. package/lib/exercises/math/probaStat/trees/probabilityTreeV2.d.ts +25 -0
  10. package/lib/exercises/math/probaStat/trees/probabilityTreeV2.d.ts.map +1 -0
  11. package/lib/exercises/math/probaStat/trees/probabilityTreeV2.js +625 -0
  12. package/lib/exercises/math/trigonometry/circle/findAngleFromCosAndSin.d.ts.map +1 -1
  13. package/lib/exercises/math/trigonometry/circle/findAngleFromCosAndSin.js +17 -8
  14. package/lib/exercises/math/trigonometry/circle/index.d.ts +2 -0
  15. package/lib/exercises/math/trigonometry/circle/index.d.ts.map +1 -1
  16. package/lib/exercises/math/trigonometry/circle/index.js +2 -1
  17. package/lib/exercises/math/trigonometry/circle/mainRemarkableValues.d.ts.map +1 -1
  18. package/lib/exercises/math/trigonometry/circle/mainRemarkableValues.js +57 -0
  19. package/lib/exercises/math/trigonometry/circle/remarkableValues.d.ts.map +1 -1
  20. package/lib/exercises/math/trigonometry/circle/remarkableValues.js +88 -0
  21. package/lib/exercises/math/trigonometry/circle/selectQuadrantOnTrigoCircle.d.ts +5 -0
  22. package/lib/exercises/math/trigonometry/circle/selectQuadrantOnTrigoCircle.d.ts.map +1 -1
  23. package/lib/exercises/math/trigonometry/circle/selectQuadrantOnTrigoCircle.js +92 -94
  24. package/lib/exercises/math/trigonometry/functions/associateAngleSimplification.d.ts +11 -0
  25. package/lib/exercises/math/trigonometry/functions/associateAngleSimplification.d.ts.map +1 -0
  26. package/lib/exercises/math/trigonometry/functions/associateAngleSimplification.js +166 -0
  27. package/lib/exercises/math/trigonometry/functions/basicEquationCos.d.ts.map +1 -1
  28. package/lib/exercises/math/trigonometry/functions/basicEquationCos.js +54 -9
  29. package/lib/exercises/math/trigonometry/functions/basicEquationSin.d.ts.map +1 -1
  30. package/lib/exercises/math/trigonometry/functions/basicEquationSin.js +54 -8
  31. package/lib/exercises/math/trigonometry/functions/equationSinOnRandomInterval.js +1 -2
  32. package/lib/exercises/math/trigonometry/functions/index.d.ts +1 -0
  33. package/lib/exercises/math/trigonometry/functions/index.d.ts.map +1 -1
  34. package/lib/exercises/math/trigonometry/functions/index.js +1 -0
  35. package/lib/index.d.ts +13 -15
  36. package/lib/index.d.ts.map +1 -1
  37. package/lib/math/utils/random/randTupleInt.d.ts +1 -0
  38. package/lib/math/utils/random/randTupleInt.d.ts.map +1 -1
  39. package/lib/math/utils/random/randTupleInt.js +1 -1
  40. package/lib/tree/nodes/algebraicNode.d.ts +1 -0
  41. package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
  42. package/lib/tree/nodes/operators/addNode.d.ts.map +1 -1
  43. package/lib/tree/nodes/operators/addNode.js +4 -2
  44. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"scalarProductOrthoInSquare.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/geometry/vectors/scalarProduct/scalarProductOrthoInSquare.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAgBrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAwMF,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,WAAW,CAmB5D,CAAC"}
1
+ {"version":3,"file":"scalarProductOrthoInSquare.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/geometry/vectors/scalarProduct/scalarProductOrthoInSquare.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAmBT,MAAM,6BAA6B,CAAC;AAiBrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAkOF,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,WAAW,CAmB5D,CAAC"}
@@ -1,5 +1,7 @@
1
1
  import { addValidProp, shuffleProps, tryToAddWrongProp, propWhile,
2
2
  // GetHint,
3
+ // GetCorrection,
4
+ // GetHint,
3
5
  // GetCorrection,
4
6
  } from "../../../../../exercises/exercise.js";
5
7
  import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
@@ -155,14 +157,37 @@ const getScalarProductOrthoInSquareQuestion = () => {
155
157
  // `;
156
158
  // };
157
159
  // const getCorrection: GetCorrection<Identifiers> = (identifiers) => {
158
- // const {areSameDirection,vec1Name,vec2Name} = identifiers
159
- // if(areSameDirection){
160
- // const vec1 =
160
+ // const { areSameDirection, vec1Name, vec2Name, c } = identifiers;
161
+ // const vecs = [
162
+ // ["AB", "DC"],
163
+ // ["AC"],
164
+ // ["AD", "IK", "BC"],
165
+ // ["AJ", "LC"],
166
+ // ["AO", "LK", "OC", "IJ"],
167
+ // ["AK", "IC"],
168
+ // ["AI", "IB", "LO", "OJ", "DK", "KC"],
169
+ // ["AL", "LD", "IO", "OK", "BJ", "JC"],
170
+ // ];
171
+ // const index1 = vecs.findIndex(
172
+ // (e) =>
173
+ // e.includes(vec1Name) || e.includes(vec1Name.split("").reverse().join("")),
174
+ // );
175
+ // const firstIsReversed = !vecs[index1].includes(vec1Name);
176
+ // const index2 = vecs.findIndex(
177
+ // (e) =>
178
+ // e.includes(vec2Name) || e.includes(vec2Name.split("").reverse().join("")),
179
+ // );
180
+ // const secondIsReversed = !vecs[index2].includes(vec2Name);
181
+ // if (vec1Name[0] === vec2Name[0]) return `immédiat`;
182
+ // for (let i = 0; i < vecs[index1].length; i++) {
183
+ // const rep = vecs[index1][i];
184
+ // const origin1 = rep[0];
185
+ // const sameOrigin = vecs[index2].find((e) => e[0] === origin1);
186
+ // if (sameOrigin)
187
+ // return `on prend $${rep}$ et $${sameOrigin}$. ${sameOrigin[1]} à projeter sur ${rep}`;
161
188
  // }
162
189
  // return `On a :
163
- // ${alignTex([
164
- // []
165
- // ])}
190
+ // ${alignTex([[]])}
166
191
  // `;
167
192
  // };
168
193
  const getQuestionFromIdentifiers = (identifiers) => {
@@ -1,4 +1,2 @@
1
- export { probabilityTree, probabilityTreeIntersection, probabilityTreeTotalProbability, probabilityTreeReadProbability, probabilityTreeInversionProbability, } from "./probabilityTree.js";
2
- export * from "./fillProbaTreeWithComplementaryProbabilities.js";
3
- export * from "./buildTreeFromSituation.js";
1
+ export { probabilityTree, } from "./probabilityTree.js";
4
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/trees/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,eAAe,EACf,2BAA2B,EAC3B,+BAA+B,EAC/B,8BAA8B,EAC9B,mCAAmC,GACpC,MAAM,sBAAsB,CAAC;AAC9B,cAAc,kDAAkD,CAAC;AACjE,cAAc,6BAA6B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/trees/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,eAAe,GAKhB,MAAM,sBAAsB,CAAC"}
@@ -1,5 +1,10 @@
1
1
  // export * from "./treeInInstruction.js";
2
2
  // export * from "./treeInAnswer.js";
3
- export { probabilityTree, probabilityTreeIntersection, probabilityTreeTotalProbability, probabilityTreeReadProbability, probabilityTreeInversionProbability, } from "./probabilityTree.js";
4
- export * from "./fillProbaTreeWithComplementaryProbabilities.js";
5
- export * from "./buildTreeFromSituation.js";
3
+ export { probabilityTree,
4
+ // probabilityTreeIntersection,
5
+ // probabilityTreeTotalProbability,
6
+ // probabilityTreeReadProbability,
7
+ // probabilityTreeInversionProbability,
8
+ } from "./probabilityTree.js";
9
+ // export * from "./fillProbaTreeWithComplementaryProbabilities.js";
10
+ // export * from "./buildTreeFromSituation.js";
@@ -8,18 +8,12 @@ type Identifiers = {
8
8
  BC: NodeIdentifiers;
9
9
  BD: NodeIdentifiers;
10
10
  probaName: string;
11
- useContraryNames?: boolean;
12
11
  };
13
12
  type Options = {
14
- allowApproximate?: string;
15
- eventTypes?: string[];
16
- probaType?: string;
17
- eventsNames?: string;
13
+ allowApproximate: string;
14
+ eventTypes: string[];
15
+ probaType: string;
18
16
  };
19
17
  export declare const probabilityTree: Exercise<Identifiers, Options>;
20
- export declare const probabilityTreeIntersection: Exercise<Identifiers, Options>;
21
- export declare const probabilityTreeTotalProbability: Exercise<Identifiers, Options>;
22
- export declare const probabilityTreeReadProbability: Exercise<Identifiers, Options>;
23
- export declare const probabilityTreeInversionProbability: Exercise<Identifiers, Options>;
24
18
  export {};
25
19
  //# sourceMappingURL=probabilityTree.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"probabilityTree.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/trees/probabilityTree.ts"],"names":[],"mappings":"AAMA,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAQ7C,OAAO,EACL,QAAQ,EAkBT,MAAM,sBAAsB,CAAC;AAG9B,KAAK,WAAW,GAAG;IAIjB,CAAC,EAAE,eAAe,CAAC;IACnB,CAAC,EAAE,eAAe,CAAC;IACnB,EAAE,EAAE,eAAe,CAAC;IACpB,EAAE,EAAE,eAAe,CAAC;IACpB,EAAE,EAAE,eAAe,CAAC;IACpB,EAAE,EAAE,eAAe,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAuhBF,KAAK,OAAO,GAAG;IACb,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAwDF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAe1D,CAAC;AAEF,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAwBtE,CAAC;AAEF,eAAO,MAAM,+BAA+B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAwB1E,CAAC;AAEF,eAAO,MAAM,8BAA8B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CA2BzE,CAAC;AAEF,eAAO,MAAM,mCAAmC,EAAE,QAAQ,CACxD,WAAW,EACX,OAAO,CA0BR,CAAC"}
1
+ {"version":3,"file":"probabilityTree.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/trees/probabilityTree.ts"],"names":[],"mappings":"AAOA,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAQ7C,OAAO,EACL,QAAQ,EAiBT,MAAM,sBAAsB,CAAC;AAG9B,KAAK,WAAW,GAAG;IAIjB,CAAC,EAAE,eAAe,CAAC;IACnB,CAAC,EAAE,eAAe,CAAC;IACnB,EAAE,EAAE,eAAe,CAAC;IACpB,EAAE,EAAE,eAAe,CAAC;IACpB,EAAE,EAAE,eAAe,CAAC;IACpB,EAAE,EAAE,eAAe,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAkNF,KAAK,OAAO,GAAG;IACb,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AA2CF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAe1D,CAAC"}
@@ -1,11 +1,11 @@
1
1
  import { rationalVEA } from "../../../../exercises/vea/rationalVEA.js";
2
+ import { GeogebraConstructor } from "../../../../geogebra/geogebraConstructor.js";
2
3
  import { RationalConstructor } from "../../../../math/numbers/rationals/rational.js";
3
4
  import { randfloat } from "../../../../math/utils/random/randfloat.js";
4
5
  import { randint } from "../../../../math/utils/random/randint.js";
5
6
  import { round } from "../../../../math/utils/round.js";
6
7
  import { NodeConstructor, } from "../../../../tree/nodes/nodeConstructor.js";
7
8
  import { add } from "../../../../tree/nodes/operators/addNode.js";
8
- import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
9
9
  import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
10
10
  import { substract } from "../../../../tree/nodes/operators/substractNode.js";
11
11
  import { random } from "../../../../utils/alea/random.js";
@@ -18,26 +18,12 @@ const optionValues = [
18
18
  "Probabilité totale $P(C)$",
19
19
  "Probabilité conditionnelle $P_B(A)$",
20
20
  "Probabilité 'simple' $P(A)$",
21
- "Probabilité d'inversion de causalité $P_B(A)$",
22
21
  ];
23
22
  const defaultOptionValues = [
24
23
  "Probabilité d'intersection $P(A\\cap C)$",
25
24
  "Probabilité totale $P(C)$",
26
25
  "Probabilité conditionnelle $P_B(A)$",
27
- "Probabilité 'simple' $P(A)$",
28
26
  ];
29
- const getProbaType = (identifiers) => {
30
- const { probaName } = identifiers;
31
- return probaName.includes("\\cap")
32
- ? "inter"
33
- : ["P(C)", "P(D)"].includes(probaName)
34
- ? "totale"
35
- : ["P(A)", "P(B)"].includes(probaName)
36
- ? "simple"
37
- : ["P_A(C)", "P_A(D)", "P_B(C)", "P_B(D)"].includes(probaName)
38
- ? "conditionnelle"
39
- : "inversion";
40
- };
41
27
  const buildAll = (identifiers) => {
42
28
  return {
43
29
  pA: NodeConstructor.fromIdentifiers(identifiers.A),
@@ -76,82 +62,16 @@ const getAnswerNode = (identifiers) => {
76
62
  case "P(D)":
77
63
  default:
78
64
  return add(multiply(probas.pA, probas.pAD), multiply(probas.pB, probas.pBD)).simplify();
79
- case "P_C(A)": {
80
- //anc / c
81
- const pc = add(multiply(probas.pA, probas.pAC), multiply(probas.pB, probas.pBC)).simplify();
82
- return frac(multiply(probas.pA, probas.pAC), pc).simplify();
83
- }
84
- case "P_C(B)": {
85
- //cnb / c
86
- const pc = add(multiply(probas.pA, probas.pAC), multiply(probas.pB, probas.pBC)).simplify();
87
- return frac(multiply(probas.pB, probas.pBC), pc).simplify();
88
- }
89
- case "P_D(A)": {
90
- //and / d
91
- const pd = add(multiply(probas.pA, probas.pAD), multiply(probas.pB, probas.pBD)).simplify();
92
- return frac(multiply(probas.pA, probas.pAD), pd).simplify();
93
- }
94
- case "P_D(B)": {
95
- //cnb / c
96
- const pd = add(multiply(probas.pA, probas.pAD), multiply(probas.pB, probas.pBD)).simplify();
97
- return frac(multiply(probas.pB, probas.pBD), pd).simplify();
98
- }
99
65
  }
100
66
  };
101
67
  const getAnswer = (identifiers) => {
102
68
  return getAnswerNode(identifiers).toTex();
103
69
  };
104
- const getTrueProbaName = (identifiers) => {
105
- const { probaName, useContraryNames } = identifiers;
106
- if (!useContraryNames)
107
- return probaName;
108
- return probaName
109
- .replaceAll("_B", "_{\\overline{A}}")
110
- .replaceAll("B", "\\overline{A}")
111
- .replaceAll("_D", "_{\\overline{B}}")
112
- .replaceAll("C", "B")
113
- .replaceAll("D", "\\overline{B}");
114
- };
115
70
  const getInstruction = (identifiers, options) => {
116
- const probas = buildAll(identifiers);
117
- const type = getProbaType(identifiers);
118
- const { useContraryNames } = identifiers;
119
- const trueProbaName = getTrueProbaName(identifiers);
120
- const tree = [
121
- [
122
- [
123
- [`£${probas.pA.toTex()}£`, "£A£"],
124
- [
125
- `£${probas.pB.toTex()}£`,
126
- useContraryNames ? "£\\overline{A}£" : "£B£",
127
- ],
128
- ],
129
- ],
130
- [
131
- [
132
- [`£${probas.pAC.toTex()}£`, useContraryNames ? "£B£" : "£C£"],
133
- [
134
- `£${probas.pAD.toTex()}£`,
135
- useContraryNames ? "£\\overline{B}£" : "£D£",
136
- ],
137
- ],
138
- [
139
- [`£${probas.pBC.toTex()}£`, useContraryNames ? "£B£" : "£C£"],
140
- [
141
- `£${probas.pBD.toTex()}£`,
142
- useContraryNames ? "£\\overline{B}£" : "£D£",
143
- ],
144
- ],
145
- ],
146
- ];
147
- let instr = `On considère l'arbre de probabilités ci-dessous :
148
-
149
- <svg id="treeDiagram">${JSON.stringify(tree)}</svg>
150
-
151
- ${type === "conditionnelle" || type === "simple" ? "Déterminer :" : "Calculer :"}
71
+ let instr = `On considère l'arbre de probabilités ci-dessous. Calculer :
152
72
 
153
73
  $$
154
- ${trueProbaName}
74
+ ${identifiers.probaName}
155
75
  $$`;
156
76
  if (options?.allowApproximate) {
157
77
  instr += `
@@ -171,7 +91,7 @@ const getProbaAndOpposite = (decimal = false) => {
171
91
  }
172
92
  };
173
93
  const getStartStatement = (identifiers) => {
174
- return getTrueProbaName(identifiers);
94
+ return identifiers.probaName;
175
95
  };
176
96
  const getProbabilityTree = (opts) => {
177
97
  const isDecimal = opts?.probaType === "Décimales";
@@ -202,9 +122,6 @@ const getProbabilityTree = (opts) => {
202
122
  case 3: //simple
203
123
  probaName = random(["P(A)", "P(B)"]);
204
124
  break;
205
- case 4: //inversion
206
- probaName = random(["P_C(A)", "P_D(A)", "P_C(B)", "P_D(B)"]);
207
- break;
208
125
  }
209
126
  const identifiers = {
210
127
  A: pA.toIdentifiers(),
@@ -214,254 +131,58 @@ const getProbabilityTree = (opts) => {
214
131
  BC: pCSachantB.toIdentifiers(),
215
132
  BD: pDSachantB.toIdentifiers(),
216
133
  probaName,
217
- useContraryNames: opts?.eventsNames === "Événements et leur contraire",
218
134
  };
219
135
  return getQuestionFromIdentifiers(identifiers, opts);
220
136
  };
221
- const getHint = (identifiers) => {
222
- const { probaName, useContraryNames } = identifiers;
223
- const type = getProbaType(identifiers);
224
- const trueProbaName = getTrueProbaName(identifiers);
225
- switch (type) {
226
- case "conditionnelle": {
227
- const splitted = probaName
228
- .replaceAll("(", "")
229
- .replaceAll(")", "")
230
- .split("_")[1];
231
- const under = splitted[0];
232
- const trueUnder = useContraryNames && under === "B" ? "\\overline{A}" : under;
233
- const over = splitted[1];
234
- const trueOver = useContraryNames
235
- ? over === "C"
236
- ? "B"
237
- : "\\overline{B}"
238
- : over;
239
- return `La probabilité $${trueProbaName}$ est la probabilité de $${trueOver}$ sachant $${trueUnder}$.
240
-
241
- Dans l'arbre, elle se lit sur la branche partant de $${trueUnder}$ et allant jusqu'à $${trueOver}$.`;
242
- }
243
- case "inter": {
244
- const [first, second] = probaName
245
- .replaceAll("P(", "")
246
- .replaceAll(")", "")
247
- .split("\\cap ");
248
- const trueFirst = useContraryNames && first === "B" ? "\\overline{A}" : first;
249
- const trueSecond = useContraryNames
250
- ? second === "C"
251
- ? "B"
252
- : "\\overline{B}"
253
- : second;
254
- return `La probabilité $${trueProbaName}$ est la probabilité d'une intersection.
255
-
256
- Pour la calculer, il faut multiplier les probabilités présentes sur les branches suivant le chemin $${trueFirst}$ puis $${trueSecond}$.
257
- `;
258
- }
259
- case "totale": {
260
- const evenement = probaName[2];
261
- const trueEvenement = useContraryNames
262
- ? evenement === "C"
263
- ? "B"
264
- : "\\overline{B}"
265
- : evenement;
266
- return `Il y a plusieurs chemins qui mènent à l'événement $${trueEvenement}$. Sa probabilité est la somme des probabilités de chacun de ces chemins. Pour obtenir la probabilité d'un chemin, il faut multiplier les probabilités présentes sur les branches de ce chemin.`;
267
- }
268
- case "simple": {
269
- const trueEvent = useContraryNames && probaName[2] === "B"
270
- ? "\\overline{A}"
271
- : probaName[2];
272
- return `La probabilité $${trueProbaName}$ se lit sur la branche menant à l'événement $${trueEvent}$.`;
273
- }
274
- case "inversion": {
275
- const splitted = probaName
276
- .replaceAll("(", "")
277
- .replaceAll(")", "")
278
- .split("_")[1];
279
- const under = splitted[0];
280
- const trueUnder = useContraryNames
281
- ? under === "C"
282
- ? "B"
283
- : "\\overline{B}"
284
- : under;
285
- const over = splitted[1];
286
- const trueOver = useContraryNames && over === "B" ? "\\overline{A}" : over;
287
- return `La probabilité $${trueProbaName}$ est la probabilité de $${trueOver}$ sachant $${trueUnder}$.
288
-
289
- Pour la déterminer, tu peux revenir à la définition d'une probabilité conditionnelle : pour deux évenements $M$ et $N$, on a :
290
-
291
- $$
292
- P_M(N) = \\frac{P(M \\cap N)}{P(M)}
293
- $$
294
- `;
295
- }
296
- }
297
- };
298
- const getCorrection = (identifiers) => {
299
- const { probaName } = identifiers;
300
- const probas = buildAll(identifiers);
301
- const type = getProbaType(identifiers);
302
- const trueProbaName = getTrueProbaName(identifiers);
303
- const { useContraryNames } = identifiers;
304
- switch (type) {
305
- case "conditionnelle": {
306
- const splitted = probaName
307
- .replaceAll("(", "")
308
- .replaceAll(")", "")
309
- .split("_")[1];
310
- const under = splitted[0];
311
- const trueUnder = useContraryNames && under === "B" ? "\\overline{A}" : under;
312
- const over = splitted[1];
313
- const trueOver = useContraryNames
314
- ? over === "C"
315
- ? "B"
316
- : "\\overline{B}"
317
- : over;
318
- return `La probabilité $${trueProbaName}$ est la probabilité de $${trueOver}$ sachant $${trueUnder}$.
319
-
320
- Dans l'arbre, elle se lit sur la branche partant de $${trueUnder}$ et allant jusqu'à $${trueOver}$.
321
-
322
- On a donc :
323
-
324
- $$
325
- ${trueProbaName} = ${getAnswer(identifiers)}
326
- $$`;
327
- }
328
- case "inter": {
329
- const [first, second] = probaName
330
- .replaceAll("P(", "")
331
- .replaceAll(")", "")
332
- .split("\\cap ");
333
- const firstProba = first === "A" ? probas.pA : probas.pB;
334
- const secondProba = second === "C"
335
- ? first === "A"
336
- ? probas.pAC
337
- : probas.pBC
338
- : first === "A"
339
- ? probas.pAD
340
- : probas.pBD;
341
- const trueFirst = useContraryNames && first === "B" ? "\\overline{A}" : first;
342
- const secondFirst = useContraryNames
343
- ? second === "C"
344
- ? "B"
345
- : "\\overline{B}"
346
- : second;
347
- return `La probabilité $${trueProbaName}$ est la probabilité d'une intersection.
348
-
349
- Pour la calculer, il faut multiplier les probabilités présentes sur les branches suivant le chemin $${trueFirst}$ puis $${secondFirst}$.
350
-
351
- On a donc :
352
-
353
- $$
354
- ${trueProbaName} = ${multiply(firstProba, secondProba).toSimplificationTex()}
355
- $$
356
- `;
357
- }
358
- case "totale": {
359
- const evenement = probaName[2];
360
- const trueEvenement = useContraryNames
361
- ? evenement === "C"
362
- ? "B"
363
- : "\\overline{B}"
364
- : evenement;
365
- const first = evenement === "C" ? probas.pAC : probas.pAD;
366
- const second = evenement === "C" ? probas.pBC : probas.pBD;
367
- const firstWay = multiply(probas.pA, first);
368
- const secondWay = multiply(probas.pB, second);
369
- return `Il y a plusieurs chemins qui mènent à l'événement $${trueEvenement}$ : le chemin de l'intersection $A\\cap ${trueEvenement}$ et celui de l'intersection $${useContraryNames ? "\\overline{A}" : "B"}\\cap ${trueEvenement}$. La probabilité $${trueProbaName}$ est la somme des probabilités de ces chemins.
370
-
371
- On a :
372
-
373
- $$
374
- P(A\\cap ${trueEvenement}) = ${firstWay.toSimplificationTex()}
375
- $$
376
-
377
- et
378
-
379
- $$
380
- P(${useContraryNames ? "\\overline{A}" : "B"}\\cap ${trueEvenement}) = ${secondWay.toSimplificationTex()}
381
- $$
382
-
383
- Donc :
384
-
385
- $$
386
- ${trueProbaName} = ${add(firstWay.simplify(), secondWay.simplify()).toSimplificationTex()}
387
- $$
388
- `;
389
- }
390
- case "simple": {
391
- const trueEvent = useContraryNames && probaName[2] === "B"
392
- ? "\\overline{A}"
393
- : probaName[2];
394
- return `La probabilité $${trueProbaName}$ se lit sur la branche menant à l'événement $${trueEvent}$.
395
-
396
- On a donc :
397
-
398
- $$
399
- ${trueProbaName} = ${getAnswer(identifiers)}
400
- $$`;
401
- }
402
- case "inversion": {
403
- const splitted = probaName
404
- .replaceAll("(", "")
405
- .replaceAll(")", "")
406
- .split("_")[1];
407
- const under = splitted[0];
408
- const trueUnder = useContraryNames
409
- ? under === "C"
410
- ? "B"
411
- : "\\overline{B}"
412
- : under;
413
- const over = splitted[1];
414
- const trueOver = useContraryNames && over === "B" ? "\\overline{A}" : over;
415
- const total = add(multiply(probas.pA, under === "C" ? probas.pAC : probas.pAD), multiply(probas.pB, under === "C" ? probas.pBC : probas.pBD));
416
- const inter = multiply(over === "A" ? probas.pA : probas.pB, under === "C"
417
- ? over === "A"
418
- ? probas.pAC
419
- : probas.pBC
420
- : over === "A"
421
- ? probas.pAD
422
- : probas.pBD);
423
- return `La probabilité $${trueProbaName}$ est la probabilité de $${trueOver}$ sachant $${trueUnder}$.
424
-
425
- Pour la déterminer, on revient à la définition d'une probabilité conditionnelle :
426
-
427
- $$
428
- ${trueProbaName} = \\frac{P(${trueOver} \\cap ${trueUnder})}{P(${trueUnder})}
429
- $$
430
-
431
- On calcule donc d'abord $P(${trueOver} \\cap ${trueUnder})$ :
432
-
433
- $$
434
- P(${trueOver} \\cap ${trueUnder}) = ${inter.toSimplificationTex()}
435
- $$
436
-
437
- Puis on calcule la probabilité totale $P(${trueUnder})$ :
438
-
439
- $$
440
- P(${trueUnder})=${total.toSimplificationTex()}
441
- $$
442
-
443
- On a donc :
444
-
445
- $$
446
- ${trueProbaName} = ${frac(inter.simplify(), total.simplify()).toSimplificationTex()}
447
- $$
448
- `;
449
- }
450
- }
451
- };
452
137
  const getQuestionFromIdentifiers = (identifiers, opts) => {
453
138
  const question = {
454
139
  instruction: getInstruction(identifiers, opts),
455
140
  startStatement: getStartStatement(identifiers, opts),
456
- answer: getAnswer(identifiers, opts),
141
+ answer: getAnswer(identifiers),
457
142
  keys: [],
143
+ ggbOptions: getGGBOptions(identifiers, opts),
458
144
  answerFormat: "tex",
459
145
  identifiers,
460
- hint: getHint(identifiers, opts),
461
- correction: getCorrection(identifiers, opts),
462
146
  };
463
147
  return question;
464
148
  };
149
+ const getGGBOptions = (identifiers) => {
150
+ const probas = buildAll(identifiers);
151
+ const commands = [
152
+ "A = Point({2,2})",
153
+ "B = Point({2,-2})",
154
+ "AC = Point({5,3})",
155
+ "AD = Point({5,1})",
156
+ "BC = Point({5,-1})",
157
+ "BD = Point({5,-3})",
158
+ "Segment(Point({0,0}),A)",
159
+ "Segment(A,AC)",
160
+ "Segment(A,AD)",
161
+ "Segment(Point({0,0}),B)",
162
+ "Segment(B,BC)",
163
+ "Segment(B,BD)",
164
+ `Text("\\scriptsize ${probas.pA.toTex()}", (0.1, 2.2), true, true)`,
165
+ `Text("\\scriptsize ${probas.pAC.toTex()}", (2.8, 4), true, true)`,
166
+ `Text("\\scriptsize ${probas.pAD.toTex()}", (2.8, 1.6), true, true)`,
167
+ `Text("\\scriptsize ${probas.pB.toTex()}", (0.1, -0.8), true, true)`,
168
+ `Text("\\scriptsize ${probas.pBC.toTex()}", (2.8, -0.6), true, true)`,
169
+ `Text("\\scriptsize ${probas.pBD.toTex()}", (2.8, -2.5), true, true)`,
170
+ 'Text("A", (1.85 , 2.5))',
171
+ 'Text("B", (1.85 , -2.8))',
172
+ 'Text("C", (5.5 , 2.85))',
173
+ 'Text("D", (5.5 , 0.85))',
174
+ 'Text("C", (5.5 , -1.1))',
175
+ 'Text("D", (5.5 , -3.1))',
176
+ ];
177
+ const ggb = new GeogebraConstructor({
178
+ commands,
179
+ hideAxes: true,
180
+ hideGrid: true,
181
+ });
182
+ return ggb.getOptions({
183
+ coords: [-2, 8, -5, 5],
184
+ });
185
+ };
465
186
  const getPropositions = (n, { answer, ...identifiers }) => {
466
187
  const propositions = [];
467
188
  addValidProp(propositions, answer);
@@ -512,114 +233,19 @@ const options = [
512
233
  defaultValue: "Fractions",
513
234
  values: ["Fractions", "Décimales"],
514
235
  },
515
- {
516
- id: "eventsNames",
517
- label: "Noms des événements",
518
- target: GeneratorOptionTarget.generation,
519
- type: GeneratorOptionType.select,
520
- defaultValue: "Événements et leur contraire",
521
- values: [
522
- "Événements et leur contraire",
523
- "Noms d'événements tous différents",
524
- ],
525
- },
526
236
  ];
527
- const partialOptions = options.filter((p) => p.id !== "eventTypes");
528
237
  export const probabilityTree = {
529
238
  id: "probabilityTree",
530
239
  connector: "=",
531
- label: "Calculer une probabilité dans un arbre pondéré (tous calculs)",
240
+ label: "Calculs de probabilités à l'aide d'un arbre pondéré",
532
241
  isSingleStep: false,
533
242
  generator: (nb, opts) => getDistinctQuestions(() => getProbabilityTree(opts), nb),
534
243
  qcmTimer: 60,
535
244
  freeTimer: 60,
536
245
  getPropositions,
537
246
  isAnswerValid,
247
+ hasGeogebra: true,
538
248
  subject: "Mathématiques",
539
249
  options,
540
250
  getQuestionFromIdentifiers,
541
- hasHintAndCorrection: true,
542
- };
543
- export const probabilityTreeIntersection = {
544
- id: "probabilityTreeIntersection",
545
- connector: "=",
546
- label: "Calculer une intersection dans un arbre pondéré",
547
- isSingleStep: false,
548
- generator: (nb, opts) => getDistinctQuestions(() => getProbabilityTree({
549
- eventTypes: ["Probabilité d'intersection $P(A\\cap C)$"],
550
- allowApproximate: opts?.allowApproximate,
551
- probaType: opts?.probaType,
552
- eventsNames: opts?.eventsNames,
553
- }), nb),
554
- qcmTimer: 60,
555
- freeTimer: 60,
556
- getPropositions,
557
- isAnswerValid,
558
- subject: "Mathématiques",
559
- options: partialOptions,
560
- getQuestionFromIdentifiers,
561
- hasHintAndCorrection: true,
562
- };
563
- export const probabilityTreeTotalProbability = {
564
- id: "probabilityTreeTotalProbability",
565
- connector: "=",
566
- label: "Calculer une probabilité totale dans un arbre pondéré",
567
- isSingleStep: false,
568
- generator: (nb, opts) => getDistinctQuestions(() => getProbabilityTree({
569
- eventTypes: ["Probabilité totale $P(C)$"],
570
- allowApproximate: opts?.allowApproximate,
571
- probaType: opts?.probaType,
572
- eventsNames: opts?.eventsNames,
573
- }), nb),
574
- qcmTimer: 60,
575
- freeTimer: 60,
576
- getPropositions,
577
- isAnswerValid,
578
- subject: "Mathématiques",
579
- options: partialOptions,
580
- getQuestionFromIdentifiers,
581
- hasHintAndCorrection: true,
582
- };
583
- export const probabilityTreeReadProbability = {
584
- id: "probabilityTreeReadProbability",
585
- connector: "=",
586
- label: "Lire une probabilité dans un arbre pondéré",
587
- isSingleStep: false,
588
- generator: (nb, opts) => getDistinctQuestions(() => getProbabilityTree({
589
- eventTypes: [
590
- "Probabilité conditionnelle $P_B(A)$",
591
- "Probabilité 'simple' $P(A)$",
592
- ],
593
- allowApproximate: opts?.allowApproximate,
594
- probaType: opts?.probaType,
595
- eventsNames: opts?.eventsNames,
596
- }), nb),
597
- qcmTimer: 60,
598
- freeTimer: 60,
599
- getPropositions,
600
- isAnswerValid,
601
- subject: "Mathématiques",
602
- options: partialOptions,
603
- getQuestionFromIdentifiers,
604
- hasHintAndCorrection: true,
605
- };
606
- export const probabilityTreeInversionProbability = {
607
- id: "probabilityTreeInversionProbability",
608
- connector: "=",
609
- label: "Calculer une probabilité d'inversion de causalité du type $P_B(A)$ dans un arbre pondéré",
610
- isSingleStep: false,
611
- generator: (nb, opts) => getDistinctQuestions(() => getProbabilityTree({
612
- eventTypes: ["Probabilité d'inversion de causalité $P_B(A)$"],
613
- allowApproximate: opts?.allowApproximate,
614
- probaType: opts?.probaType,
615
- eventsNames: opts?.eventsNames,
616
- }), nb),
617
- qcmTimer: 60,
618
- freeTimer: 60,
619
- getPropositions,
620
- isAnswerValid,
621
- subject: "Mathématiques",
622
- options: partialOptions,
623
- getQuestionFromIdentifiers,
624
- hasHintAndCorrection: true,
625
251
  };