math-exercises 3.0.175 → 3.0.176

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 (61) hide show
  1. package/lib/exercises/exercise.d.ts +9 -0
  2. package/lib/exercises/exercise.d.ts.map +1 -1
  3. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductOrthoInSquare.d.ts.map +1 -1
  4. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductOrthoInSquare.js +33 -1
  5. package/lib/exercises/math/probaStat/index.d.ts +1 -1
  6. package/lib/exercises/math/probaStat/index.d.ts.map +1 -1
  7. package/lib/exercises/math/probaStat/index.js +1 -2
  8. package/lib/exercises/math/probaStat/randomVariable/decideWhichGameIsLessRisky.d.ts.map +1 -1
  9. package/lib/exercises/math/probaStat/randomVariable/decideWhichGameIsLessRisky.js +0 -1
  10. package/lib/exercises/math/probaStat/randomVariable/findValueForFairRandomVariable.d.ts +0 -7
  11. package/lib/exercises/math/probaStat/randomVariable/findValueForFairRandomVariable.d.ts.map +1 -1
  12. package/lib/exercises/math/probaStat/randomVariable/findValueForFairRandomVariable.js +154 -125
  13. package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationAverage.d.ts +2 -2
  14. package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationAverage.d.ts.map +1 -1
  15. package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationComputeProbability.d.ts +2 -2
  16. package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationComputeProbability.d.ts.map +1 -1
  17. package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationIsGameFavorable.d.ts +2 -2
  18. package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationIsGameFavorable.d.ts.map +1 -1
  19. package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationProbabilityLaw.d.ts +2 -2
  20. package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationProbabilityLaw.d.ts.map +1 -1
  21. package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationProbabilityLaw.js +1 -1
  22. package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationStandardDeviation.d.ts +2 -2
  23. package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationStandardDeviation.d.ts.map +1 -1
  24. package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationValues.d.ts +2 -2
  25. package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationValues.d.ts.map +1 -1
  26. package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationVariance.d.ts +2 -2
  27. package/lib/exercises/math/probaStat/randomVariable/randomVariableSituationVariance.d.ts.map +1 -1
  28. package/lib/exercises/math/probaStat/randomVariable/utils/randomVariableSituations.d.ts +3 -3
  29. package/lib/exercises/math/probaStat/randomVariable/utils/randomVariableSituations.d.ts.map +1 -1
  30. package/lib/exercises/math/probaStat/randomVariable/utils/randomVariableSituations.js +1 -1
  31. package/lib/exercises/math/probaStat/trees/buildTreeFromSituation.d.ts +6 -0
  32. package/lib/exercises/math/probaStat/trees/buildTreeFromSituation.d.ts.map +1 -1
  33. package/lib/exercises/math/probaStat/trees/buildTreeFromSituation.js +199 -68
  34. package/lib/exercises/math/probaStat/trees/fillProbaTreeWithComplementaryProbabilities.js +12 -12
  35. package/lib/exercises/math/probaStat/trees/index.d.ts +3 -1
  36. package/lib/exercises/math/probaStat/trees/index.d.ts.map +1 -1
  37. package/lib/exercises/math/probaStat/trees/index.js +5 -1
  38. package/lib/exercises/math/probaStat/trees/probaTreeSituationTotalProbaFormula.d.ts +2 -0
  39. package/lib/exercises/math/probaStat/trees/probaTreeSituationTotalProbaFormula.d.ts.map +1 -0
  40. package/lib/exercises/math/probaStat/trees/probaTreeSituationTotalProbaFormula.js +80 -0
  41. package/lib/exercises/math/probaStat/trees/probaTreeSituations.d.ts +60 -0
  42. package/lib/exercises/math/probaStat/trees/probaTreeSituations.d.ts.map +1 -1
  43. package/lib/exercises/math/probaStat/trees/probaTreeSituations.js +344 -108
  44. package/lib/exercises/math/probaStat/trees/treeInInstruction.js +10 -10
  45. package/lib/exercises/math/sequences/limits/index.d.ts +1 -1
  46. package/lib/exercises/math/sequences/limits/index.d.ts.map +1 -1
  47. package/lib/exercises/math/sequences/limits/index.js +2 -1
  48. package/lib/exercises/math/trigonometry/functions/cosInequationMainInterval.js +2 -2
  49. package/lib/exercises/vea/percentVEA.d.ts +2 -0
  50. package/lib/exercises/vea/percentVEA.d.ts.map +1 -0
  51. package/lib/exercises/vea/percentVEA.js +1 -0
  52. package/lib/index.d.ts +31 -19
  53. package/lib/index.d.ts.map +1 -1
  54. package/lib/server.js +22 -0
  55. package/lib/tests/exoTest.d.ts.map +1 -1
  56. package/lib/tests/exoTest.js +2 -0
  57. package/lib/tests/questionTest.d.ts.map +1 -1
  58. package/lib/tests/questionTest.js +14 -2
  59. package/lib/types/keyIds.d.ts +1 -1
  60. package/lib/types/keyIds.d.ts.map +1 -1
  61. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  import { Exercise } from "../../../../exercises/exercise.js";
2
- import { SituationParams } from "./utils/randomVariableSituations.js";
2
+ import { RandomVariableSituationParams } from "./utils/randomVariableSituations.js";
3
3
  type Identifiers = {
4
- params: SituationParams;
4
+ params: RandomVariableSituationParams;
5
5
  };
6
6
  export declare const randomVariableSituationValues: Exercise<Identifiers>;
7
7
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"randomVariableSituationValues.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/randomVariable/randomVariableSituationValues.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AASrC,OAAO,EAGL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAE7C,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,eAAe,CAAC;CACzB,CAAC;AAuPF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,CAqB/D,CAAC"}
1
+ {"version":3,"file":"randomVariableSituationValues.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/randomVariable/randomVariableSituationValues.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AASrC,OAAO,EAGL,6BAA6B,EAC9B,MAAM,qCAAqC,CAAC;AAE7C,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,6BAA6B,CAAC;CACvC,CAAC;AAuPF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,CAqB/D,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { Exercise } from "../../../../exercises/exercise.js";
2
- import { SituationParams } from "./utils/randomVariableSituations.js";
2
+ import { RandomVariableSituationParams } from "./utils/randomVariableSituations.js";
3
3
  type Identifiers = {
4
- params: SituationParams;
4
+ params: RandomVariableSituationParams;
5
5
  };
6
6
  export declare const randomVariableSituationVariance: Exercise<Identifiers>;
7
7
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"randomVariableSituationVariance.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/randomVariable/randomVariableSituationVariance.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EAGL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAE7C,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,eAAe,CAAC;CACzB,CAAC;AA4GF,eAAO,MAAM,+BAA+B,EAAE,QAAQ,CAAC,WAAW,CAqBjE,CAAC"}
1
+ {"version":3,"file":"randomVariableSituationVariance.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/randomVariable/randomVariableSituationVariance.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EAGL,6BAA6B,EAC9B,MAAM,qCAAqC,CAAC;AAE7C,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,6BAA6B,CAAC;CACvC,CAAC;AA4GF,eAAO,MAAM,+BAA+B,EAAE,QAAQ,CAAC,WAAW,CAqBjE,CAAC"}
@@ -23,7 +23,7 @@ type CardsParams = {
23
23
  gFigure: number;
24
24
  gOther: number;
25
25
  };
26
- export type SituationParams = (UrneParams & {
26
+ export type RandomVariableSituationParams = (UrneParams & {
27
27
  id: "urne";
28
28
  }) | (CoinParams & {
29
29
  id: "coin";
@@ -32,10 +32,10 @@ export type SituationParams = (UrneParams & {
32
32
  }) | (CardsParams & {
33
33
  id: "cards";
34
34
  });
35
- export declare const getRandomVariableSituation: (params: SituationParams) => {
35
+ export declare const getRandomVariableSituation: (params: RandomVariableSituationParams) => {
36
36
  getContext: () => string;
37
37
  getVA: () => RandomVariable;
38
38
  };
39
- export declare const buildRandomVariableSituation: () => SituationParams;
39
+ export declare const buildRandomVariableSituation: () => RandomVariableSituationParams;
40
40
  export {};
41
41
  //# sourceMappingURL=randomVariableSituations.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"randomVariableSituations.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/probaStat/randomVariable/utils/randomVariableSituations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAU1E,KAAK,UAAU,GAAG;IAChB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAqDF,KAAK,UAAU,GAAG;IAChB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAmEF,KAAK,kBAAkB,GAAG;IACxB,CAAC,EAAE,MAAM,CAAC;IACV,eAAe,EAAE,MAAM,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAkCF,KAAK,WAAW,GAAG;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AA4BF,MAAM,MAAM,eAAe,GACvB,CAAC,UAAU,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,GAC7B,CAAC,UAAU,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,GAC7B,CAAC,kBAAkB,GAAG;IAAE,EAAE,EAAE,cAAc,CAAA;CAAE,CAAC,GAC7C,CAAC,WAAW,GAAG;IAAE,EAAE,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC;AAIpC,eAAO,MAAM,0BAA0B,GAAI,QAAQ,eAAe;;;CAajE,CAAC;AAEF,eAAO,MAAM,4BAA4B,QAAO,eAkB/C,CAAC"}
1
+ {"version":3,"file":"randomVariableSituations.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/probaStat/randomVariable/utils/randomVariableSituations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAU1E,KAAK,UAAU,GAAG;IAChB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAqDF,KAAK,UAAU,GAAG;IAChB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAmEF,KAAK,kBAAkB,GAAG;IACxB,CAAC,EAAE,MAAM,CAAC;IACV,eAAe,EAAE,MAAM,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAkCF,KAAK,WAAW,GAAG;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AA4BF,MAAM,MAAM,6BAA6B,GACrC,CAAC,UAAU,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,GAC7B,CAAC,UAAU,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,GAC7B,CAAC,kBAAkB,GAAG;IAAE,EAAE,EAAE,cAAc,CAAA;CAAE,CAAC,GAC7C,CAAC,WAAW,GAAG;IAAE,EAAE,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC;AAIpC,eAAO,MAAM,0BAA0B,GACrC,QAAQ,6BAA6B;;;CActC,CAAC;AAEF,eAAO,MAAM,4BAA4B,QACnC,6BAkBH,CAAC"}
@@ -85,7 +85,7 @@ const getDiceMultipleSituation = (params) => {
85
85
  getVA: () => {
86
86
  const values = [-loss, gain];
87
87
  let multiples = 0;
88
- for (let i = 2; i < n; i++) {
88
+ for (let i = 2; i <= n; i++) {
89
89
  if (i % winningMultiple === 0) {
90
90
  multiples++;
91
91
  }
@@ -1,2 +1,8 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ import { ProbaTreeSituationParams } from "./probaTreeSituations.js";
3
+ type Identifiers = {
4
+ params: ProbaTreeSituationParams;
5
+ };
6
+ export declare const buildTreeFromSituation: Exercise<Identifiers>;
1
7
  export {};
2
8
  //# sourceMappingURL=buildTreeFromSituation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"buildTreeFromSituation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/trees/buildTreeFromSituation.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"buildTreeFromSituation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/trees/buildTreeFromSituation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EAGL,wBAAwB,EACzB,MAAM,0BAA0B,CAAC;AAElC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,wBAAwB,CAAC;CAClC,CAAC;AAoMF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAiBxD,CAAC"}
@@ -1,68 +1,199 @@
1
- // import {
2
- // Exercise,
3
- // QuestionGenerator,
4
- // GetHint,
5
- // GetCorrection,
6
- // GetInstruction,
7
- // GetKeys,
8
- // GetQuestionFromIdentifiers,
9
- // GetAnswerTreeTable,
10
- // TreeDiagramVEA,
11
- // } from '../../../../exercises/exercise.js';
12
- // import { getDistinctQuestions } from '../../../../exercises/utils/getDistinctQuestions.js';
13
- // import { treeTableVEA } from '../../../../exercises/vea/treeTableVEA.js';
14
- // import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
15
- export {};
16
- // type Identifiers = {
17
- // situationId: string
18
- // };
19
- // const getAnswerTreeTable : GetAnswerTreeTable<Identifiers> = (identifiers)=>{
20
- // }
21
- // const getInstruction : GetInstruction<Identifiers> = (identifiers)=>{
22
- // const {} = identifiers
23
- // }
24
- // const getHint : GetHint<Identifiers> = (identifiers)=>{
25
- // }
26
- // const getCorrection : GetCorrection<Identifiers> = (identifiers)=>{
27
- // }
28
- // const getKeys : GetKeys<Identifiers> = (identifiers)=>{
29
- // return []
30
- // }
31
- // const isAnswerTreeTableValid: TreeDiagramVEA<Identifiers> = (ans, {answerTreeTable})=>{
32
- // try {
33
- // return treeTableVEA(ans, answerTreeTable)
34
- // } catch(err){
35
- // return handleVEAError(err)
36
- // }
37
- // }
38
- // const getBuildTreeFromSituationQuestion: QuestionGenerator<Identifiers> = (ops)=>{
39
- // const identifiers: Identifiers = {}
40
- // return getQuestionFromIdentifiers(identifiers);
41
- // }
42
- // const getQuestionFromIdentifiers: GetQuestionFromIdentifiers<Identifiers> = (identifiers)=>{
43
- // return {
44
- // answerTreeTable: getAnswerTreeTable(identifiers),
45
- // instruction: getInstruction(identifiers),
46
- // keys: getKeys(identifiers),
47
- // answerFormat: 'tex',
48
- // identifiers,
49
- // hint: getHint(identifiers),
50
- // correction: getCorrection(identifiers)
51
- // }
52
- // }
53
- // export const buildTreeFromSituation: Exercise<Identifiers> = {
54
- // id: 'buildTreeFromSituation',
55
- // label: "undefined",
56
- // isSingleStep: true,
57
- // generator: (nb, opts) => getDistinctQuestions(()=>getBuildTreeFromSituationQuestion(opts), nb),
58
- // qcmTimer: 60,
59
- // freeTimer: 60,
60
- // isAnswerTreeTableValid,
61
- // subject: "Mathématiques",
62
- // getInstruction,
63
- // getHint,
64
- // getCorrection,
65
- // getAnswerTreeTable,
66
- // getQuestionFromIdentifiers,
67
- // hasHintAndCorrection: true
68
- // };
1
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
2
+ import { treeTableVEA } from "../../../../exercises/vea/treeTableVEA.js";
3
+ import { reifyAlgebraic } from "../../../../tree/nodes/nodeConstructor.js";
4
+ import { substract } from "../../../../tree/nodes/operators/substractNode.js";
5
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
6
+ import { buildProbaTreeSituation, getProbaTreeSituation, } from "./probaTreeSituations.js";
7
+ const getAnswerTreeTable = (identifiers) => {
8
+ const { params } = identifiers;
9
+ const situation = getProbaTreeSituation(params);
10
+ return situation.tree;
11
+ };
12
+ const getInstruction = (identifiers) => {
13
+ const { params } = identifiers;
14
+ const situation = getProbaTreeSituation(params);
15
+ return (situation.context +
16
+ `
17
+
18
+ Modéliser cette situation par un arbre pondéré.`);
19
+ };
20
+ const getHint = () => {
21
+ return `Utilise les données de l'énoncé, ainsi que le fait que la somme des probabilités des branches issues d'un même noeud est égale à $1$.`;
22
+ };
23
+ const getCorrection = (identifiers) => {
24
+ const { params } = identifiers;
25
+ const situation = getProbaTreeSituation(params);
26
+ let mainEventProba;
27
+ let firstCondProba;
28
+ let secondCondProba;
29
+ const mainEvent = situation.mainEvent;
30
+ const secondEvent = situation.secondEvent;
31
+ switch (params.id) {
32
+ case "virus":
33
+ {
34
+ const { pContamineIds, pNegSainIds, pPosContamineIds } = params;
35
+ const pContamine = reifyAlgebraic(pContamineIds);
36
+ const pPosContamine = reifyAlgebraic(pPosContamineIds);
37
+ const pNegSain = reifyAlgebraic(pNegSainIds);
38
+ return `D'après l'énoncé, on a :
39
+
40
+ $$
41
+ P(C) = ${pContamine.toTex()}\\%
42
+ $$
43
+
44
+ $$
45
+ P_C(T) = ${pPosContamine.toTex()}\\%
46
+ $$
47
+
48
+ $$
49
+ P_{\\overline{C}}\\left(\\overline{T}\\right) = ${pNegSain.toTex()}\\%
50
+ $$
51
+
52
+ On en déduit les probabilités manquantes :
53
+
54
+ $$
55
+ P\\left(\\overline{C}\\right) = ${substract(100, pContamine)
56
+ .simplify()
57
+ .toTex()}\\%
58
+ $$
59
+
60
+ $$
61
+ P_{C}(\\overline{T}) = ${substract(100, pPosContamine).simplify().toTex()}\\%
62
+ $$
63
+
64
+ $$
65
+ P_{\\overline{C}}(T) = ${substract(100, pNegSain).simplify().toTex()}\\%
66
+ $$
67
+ `;
68
+ }
69
+ break;
70
+ case "car":
71
+ {
72
+ const { pAutreSinistreIds, pJeuneIds, pJeuneSinistreIds } = params;
73
+ secondCondProba = reifyAlgebraic(pAutreSinistreIds);
74
+ mainEventProba = reifyAlgebraic(pJeuneIds);
75
+ firstCondProba = reifyAlgebraic(pJeuneSinistreIds);
76
+ }
77
+ break;
78
+ case "dragee":
79
+ mainEventProba = reifyAlgebraic(params.pAmandeIds);
80
+ firstCondProba = reifyAlgebraic(params.pBlancheAmandeIds);
81
+ secondCondProba = reifyAlgebraic(params.pBlancheChocolatIds);
82
+ break;
83
+ case "lycee":
84
+ mainEventProba = reifyAlgebraic(params.pFIds);
85
+ firstCondProba = reifyAlgebraic(params.pFMathsIds);
86
+ secondCondProba = reifyAlgebraic(params.pGMathsIds);
87
+ break;
88
+ case "match":
89
+ mainEventProba = reifyAlgebraic(params.pDomicileIds);
90
+ firstCondProba = reifyAlgebraic(params.pVDomicileIds);
91
+ secondCondProba = reifyAlgebraic(params.pVExterieurIds);
92
+ break;
93
+ case "usine":
94
+ mainEventProba = reifyAlgebraic(params.pAIds);
95
+ firstCondProba = reifyAlgebraic(params.pDefAIds);
96
+ secondCondProba = reifyAlgebraic(params.pDefBIds);
97
+ break;
98
+ }
99
+ return `D'après l'énoncé, on a :
100
+
101
+ $$
102
+ P(${situation.mainEvent}) = ${mainEventProba.toTex()}\\%
103
+ $$
104
+
105
+ $$
106
+ P_{${mainEvent}}(${secondEvent}) = ${firstCondProba.toTex()}\\%
107
+ $$
108
+
109
+ $$
110
+ P_{\\overline{${mainEvent}}}(${secondEvent}) = ${secondCondProba.toTex()}\\%
111
+ $$
112
+
113
+ On en déduit les probabilités manquantes :
114
+
115
+ $$
116
+ P\\left(\\overline{${mainEvent}}\\right) = ${substract(100, mainEventProba)
117
+ .simplify()
118
+ .toTex()}\\%
119
+ $$
120
+
121
+ $$
122
+ P_{${mainEvent}}(\\overline{${secondEvent}}) = ${substract(100, firstCondProba)
123
+ .simplify()
124
+ .toTex()}\\%
125
+ $$
126
+
127
+ $$
128
+ P_{\\overline{${mainEvent}}}(\\overline{${secondEvent}}) = ${substract(100, secondCondProba)
129
+ .simplify()
130
+ .toTex()}\\%
131
+ $$
132
+ `;
133
+ };
134
+ const getKeys = (identifiers) => {
135
+ const { params } = identifiers;
136
+ const situation = getProbaTreeSituation(params);
137
+ return situation.keys;
138
+ };
139
+ const isAnswerTreeTableValid = (ans, { answerTreeTable }) => {
140
+ try {
141
+ return treeTableVEA(ans, answerTreeTable);
142
+ }
143
+ catch (err) {
144
+ return handleVEAError(err);
145
+ }
146
+ };
147
+ const getBuildTreeFromSituationQuestion = () => {
148
+ const params = buildProbaTreeSituation();
149
+ const identifiers = {
150
+ params,
151
+ };
152
+ return getQuestionFromIdentifiers(identifiers);
153
+ };
154
+ const getQuestionFromIdentifiers = (identifiers) => {
155
+ return {
156
+ answerTreeTable: getAnswerTreeTable(identifiers),
157
+ instruction: getInstruction(identifiers),
158
+ keys: getKeys(identifiers),
159
+ answerFormat: "tex",
160
+ identifiers,
161
+ hint: getHint(identifiers),
162
+ correction: getCorrection(identifiers),
163
+ initTreeTable: [
164
+ [
165
+ [
166
+ ["", ""],
167
+ ["", ""],
168
+ ],
169
+ ],
170
+ [
171
+ [
172
+ ["", ""],
173
+ ["", ""],
174
+ ],
175
+ [
176
+ ["", ""],
177
+ ["", ""],
178
+ ],
179
+ ],
180
+ ],
181
+ };
182
+ };
183
+ export const buildTreeFromSituation = {
184
+ id: "buildTreeFromSituation",
185
+ label: "Modéliser une situation par un arbre pondéré",
186
+ isSingleStep: true,
187
+ generator: (nb, opts) => getDistinctQuestions(() => getBuildTreeFromSituationQuestion(opts), nb),
188
+ qcmTimer: 60,
189
+ freeTimer: 60,
190
+ isAnswerTreeTableValid,
191
+ subject: "Mathématiques",
192
+ getInstruction,
193
+ getHint,
194
+ getCorrection,
195
+ getAnswerTreeTable,
196
+ getQuestionFromIdentifiers,
197
+ answerType: "treeDiagram",
198
+ hasHintAndCorrection: true,
199
+ };
@@ -29,18 +29,18 @@ const getAnswerTreeTable = (identifiers) => {
29
29
  return [
30
30
  [
31
31
  [
32
- [`$${datas[0][0]}$`, "$A$"],
33
- [`$${datas[0][1]}$`, "$\\overline{A}$"],
32
+ [`${datas[0][0]}`, "A"],
33
+ [`${datas[0][1]}`, "\\overline{A}"],
34
34
  ],
35
35
  ],
36
36
  [
37
37
  [
38
- [`$${datas[1][0]}$`, "$B$"],
39
- [`$${datas[1][1]}$`, "$\\overline{B}$"],
38
+ [`${datas[1][0]}`, "B"],
39
+ [`${datas[1][1]}`, "\\overline{B}"],
40
40
  ],
41
41
  [
42
- [`$${datas[2][0]}$`, "$B$"],
43
- [`$${datas[2][1]}$`, "$\\overline{B}$"],
42
+ [`${datas[2][0]}`, "B"],
43
+ [`${datas[2][1]}`, "\\overline{B}"],
44
44
  ],
45
45
  ],
46
46
  ];
@@ -129,26 +129,26 @@ const getFillProbaTreeWithComplementaryProbabilitiesQuestion = (ops) => {
129
129
  const initTree = [
130
130
  [
131
131
  [
132
- [!valueDatas[0].isComp ? valueDatas[0].value.toTex() : "", "$A$"],
132
+ [!valueDatas[0].isComp ? valueDatas[0].value.toTex() : "", "A"],
133
133
  [
134
134
  valueDatas[0].isComp ? valueDatas[0].value.toTex() : "",
135
- "$\\overline{A}$",
135
+ "\\overline{A}",
136
136
  ],
137
137
  ],
138
138
  ],
139
139
  [
140
140
  [
141
- [!valueDatas[1].isComp ? valueDatas[1].value.toTex() : "", "$B$"],
141
+ [!valueDatas[1].isComp ? valueDatas[1].value.toTex() : "", "B"],
142
142
  [
143
143
  valueDatas[1].isComp ? valueDatas[1].value.toTex() : "",
144
- "$\\overline{B}$",
144
+ "\\overline{B}",
145
145
  ],
146
146
  ],
147
147
  [
148
- [!valueDatas[2].isComp ? valueDatas[2].value.toTex() : "", "$B$"],
148
+ [!valueDatas[2].isComp ? valueDatas[2].value.toTex() : "", "B"],
149
149
  [
150
150
  valueDatas[2].isComp ? valueDatas[2].value.toTex() : "",
151
- "$\\overline{B}$",
151
+ "\\overline{B}",
152
152
  ],
153
153
  ],
154
154
  ],
@@ -1,2 +1,4 @@
1
- export * from "./treeInInstruction.js";
1
+ export { probabilityTree, probabilityTreeIntersection, probabilityTreeTotalProbability, probabilityTreeReadProbability, probabilityTreeInversionProbability, } from "./probabilityTree.js";
2
+ export * from "./fillProbaTreeWithComplementaryProbabilities.js";
3
+ export * from "./buildTreeFromSituation.js";
2
4
  //# 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":"AAAA,cAAc,wBAAwB,CAAC"}
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 +1,5 @@
1
- export * from "./treeInInstruction.js";
1
+ // export * from "./treeInInstruction.js";
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";
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=probaTreeSituationTotalProbaFormula.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"probaTreeSituationTotalProbaFormula.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/trees/probaTreeSituationTotalProbaFormula.ts"],"names":[],"mappings":""}
@@ -0,0 +1,80 @@
1
+ // import {
2
+ // Exercise,
3
+ // Proposition,
4
+ // QCMGenerator,
5
+ // Question,
6
+ // QuestionGenerator,
7
+ // VEA,
8
+ // addValidProp,
9
+ // shuffleProps,
10
+ // GetAnswer,
11
+ // GetHint,
12
+ // GetCorrection,
13
+ // GetInstruction,
14
+ // GetKeys,
15
+ // GetQuestionFromIdentifiers,
16
+ // } from '../../../../exercises/exercise.js';
17
+ // import { getDistinctQuestions } from '../../../../exercises/utils/getDistinctQuestions.js';
18
+ // import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
19
+ export {};
20
+ // type Identifiers = {
21
+ // };
22
+ // const getPropositions: QCMGenerator<Identifiers> = (n, { answer }) => {
23
+ // const propositions: Proposition[] = [];
24
+ // addValidProp(propositions, answer);
25
+ // propWhile(propositions, n, () => {
26
+ // throw Error("QCM not implemented")
27
+ // })
28
+ // return shuffleProps(propositions, n);
29
+ // };
30
+ // const getAnswer : GetAnswer<Identifiers> = (identifiers)=>{
31
+ // }
32
+ // const getInstruction : GetInstruction<Identifiers> = (identifiers)=>{
33
+ // }
34
+ // const getHint : GetHint<Identifiers> = (identifiers)=>{
35
+ // }
36
+ // const getCorrection : GetCorrection<Identifiers> = (identifiers)=>{
37
+ // }
38
+ // const getKeys : GetKeys<Identifiers> = (identifiers)=>{
39
+ // return []
40
+ // }
41
+ // const isAnswerValid: VEA<Identifiers> = (ans, {answer})=>{
42
+ // try {
43
+ // throw Error("VEA not implemented")
44
+ // } catch(err){
45
+ // return handleVEAError(err)
46
+ // }
47
+ // }
48
+ // const getProbaTreeSituationTotalProbaFormulaQuestion: QuestionGenerator<Identifiers> = (ops)=>{
49
+ // const identifiers: Identifiers = {}
50
+ // return getQuestionFromIdentifiers(identifiers);
51
+ // }
52
+ // const getQuestionFromIdentifiers: GetQuestionFromIdentifiers<Identifiers> = (identifiers)=>{
53
+ // return {
54
+ // answer: getAnswer(identifiers),
55
+ // instruction: getInstruction(identifiers),
56
+ // keys: getKeys(identifiers),
57
+ // answerFormat: 'tex',
58
+ // identifiers,
59
+ // hint: getHint(identifiers),
60
+ // correction: getCorrection(identifiers)
61
+ // }
62
+ // }
63
+ // export const probaTreeSituationTotalProbaFormula: Exercise<Identifiers> = {
64
+ // id: 'probaTreeSituationTotalProbaFormula',
65
+ // connector: "",
66
+ // label: undefined,
67
+ // isSingleStep: true,
68
+ // generator: (nb, opts) => getDistinctQuestions(()=>getProbaTreeSituationTotalProbaFormulaQuestion(opts), nb),
69
+ // qcmTimer: 60,
70
+ // freeTimer: 60,
71
+ // getPropositions,
72
+ // isAnswerValid,
73
+ // subject: "Mathématiques",
74
+ // getInstruction,
75
+ // getHint,
76
+ // getCorrection,
77
+ // getAnswer,
78
+ // getQuestionFromIdentifiers,
79
+ // hasHintAndCorrection: true
80
+ // };
@@ -1,2 +1,62 @@
1
+ import { AlgebraicNode } from "../../../../tree/nodes/algebraicNode.js";
2
+ import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
3
+ import { KeyId } from "../../../../types/keyIds.js";
4
+ import { KeyProps } from "../../../../types/keyProps.js";
5
+ type ProbaTreeSituation = {
6
+ id: string;
7
+ context: string;
8
+ keys: (KeyId | KeyProps)[];
9
+ tree: string[][][][];
10
+ mainEvent: string;
11
+ secondEvent: string;
12
+ mainEventProba: AlgebraicNode;
13
+ firstCondProba: AlgebraicNode;
14
+ secondCondProba: AlgebraicNode;
15
+ };
16
+ type VirusParams = {
17
+ pContamineIds: NodeIdentifiers;
18
+ pPosContamineIds: NodeIdentifiers;
19
+ pNegSainIds: NodeIdentifiers;
20
+ };
21
+ type DrageeParams = {
22
+ pAmandeIds: NodeIdentifiers;
23
+ pBlancheAmandeIds: NodeIdentifiers;
24
+ pBlancheChocolatIds: NodeIdentifiers;
25
+ };
26
+ type UsineParams = {
27
+ pAIds: NodeIdentifiers;
28
+ pDefAIds: NodeIdentifiers;
29
+ pDefBIds: NodeIdentifiers;
30
+ };
31
+ type MatchParams = {
32
+ pDomicileIds: NodeIdentifiers;
33
+ pVDomicileIds: NodeIdentifiers;
34
+ pVExterieurIds: NodeIdentifiers;
35
+ };
36
+ type CarParams = {
37
+ pJeuneIds: NodeIdentifiers;
38
+ pJeuneSinistreIds: NodeIdentifiers;
39
+ pAutreSinistreIds: NodeIdentifiers;
40
+ };
41
+ type LyceeParams = {
42
+ pFIds: NodeIdentifiers;
43
+ pFMathsIds: NodeIdentifiers;
44
+ pGMathsIds: NodeIdentifiers;
45
+ };
46
+ export type ProbaTreeSituationParams = (VirusParams & {
47
+ id: "virus";
48
+ }) | (DrageeParams & {
49
+ id: "dragee";
50
+ }) | (UsineParams & {
51
+ id: "usine";
52
+ }) | (MatchParams & {
53
+ id: "match";
54
+ }) | (LyceeParams & {
55
+ id: "lycee";
56
+ }) | (CarParams & {
57
+ id: "car";
58
+ });
59
+ export declare const getProbaTreeSituation: (params: ProbaTreeSituationParams) => ProbaTreeSituation;
60
+ export declare const buildProbaTreeSituation: () => ProbaTreeSituationParams;
1
61
  export {};
2
62
  //# sourceMappingURL=probaTreeSituations.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"probaTreeSituations.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/trees/probaTreeSituations.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"probaTreeSituations.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/trees/probaTreeSituations.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAG7C,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAGnD,KAAK,kBAAkB,GAAG;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,CAAC,KAAK,GAAG,QAAQ,CAAC,EAAE,CAAC;IAC3B,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,aAAa,CAAC;IAC9B,cAAc,EAAE,aAAa,CAAC;IAC9B,eAAe,EAAE,aAAa,CAAC;CAChC,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,aAAa,EAAE,eAAe,CAAC;IAC/B,gBAAgB,EAAE,eAAe,CAAC;IAClC,WAAW,EAAE,eAAe,CAAC;CAC9B,CAAC;AAsDF,KAAK,YAAY,GAAG;IAClB,UAAU,EAAE,eAAe,CAAC;IAC5B,iBAAiB,EAAE,eAAe,CAAC;IACnC,mBAAmB,EAAE,eAAe,CAAC;CACtC,CAAC;AAsDF,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,eAAe,CAAC;IACvB,QAAQ,EAAE,eAAe,CAAC;IAC1B,QAAQ,EAAE,eAAe,CAAC;CAC3B,CAAC;AAkDF,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,eAAe,CAAC;IAC9B,aAAa,EAAE,eAAe,CAAC;IAC/B,cAAc,EAAE,eAAe,CAAC;CACjC,CAAC;AA0DF,KAAK,SAAS,GAAG;IACf,SAAS,EAAE,eAAe,CAAC;IAC3B,iBAAiB,EAAE,eAAe,CAAC;IACnC,iBAAiB,EAAE,eAAe,CAAC;CACpC,CAAC;AAuDF,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,eAAe,CAAC;IACvB,UAAU,EAAE,eAAe,CAAC;IAC5B,UAAU,EAAE,eAAe,CAAC;CAC7B,CAAC;AAkDF,MAAM,MAAM,wBAAwB,GAChC,CAAC,WAAW,GAAG;IAAE,EAAE,EAAE,OAAO,CAAA;CAAE,CAAC,GAC/B,CAAC,YAAY,GAAG;IAAE,EAAE,EAAE,QAAQ,CAAA;CAAE,CAAC,GACjC,CAAC,WAAW,GAAG;IAAE,EAAE,EAAE,OAAO,CAAA;CAAE,CAAC,GAC/B,CAAC,WAAW,GAAG;IAAE,EAAE,EAAE,OAAO,CAAA;CAAE,CAAC,GAC/B,CAAC,WAAW,GAAG;IAAE,EAAE,EAAE,OAAO,CAAA;CAAE,CAAC,GAC/B,CAAC,SAAS,GAAG;IAAE,EAAE,EAAE,KAAK,CAAA;CAAE,CAAC,CAAC;AAEhC,eAAO,MAAM,qBAAqB,GAAI,QAAQ,wBAAwB,uBAerE,CAAC;AAEF,eAAO,MAAM,uBAAuB,QAAO,wBAsB1C,CAAC"}