math-exercises 2.2.60 → 2.2.62

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 (81) hide show
  1. package/lib/exercises/exercise.d.ts +4 -0
  2. package/lib/exercises/exercise.d.ts.map +1 -1
  3. package/lib/exercises/math/calcul/fractions/fractionsSumsSameDenominators.d.ts.map +1 -1
  4. package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.js +1 -1
  5. package/lib/exercises/math/calcul/proportionality/isTableProportionalNonInteger.d.ts.map +1 -1
  6. package/lib/exercises/math/calcul/proportionality/isTableProportionalNonInteger.js +8 -1
  7. package/lib/exercises/math/calculLitteral/systems/basicSystemResolution.d.ts.map +1 -1
  8. package/lib/exercises/math/calculLitteral/systems/basicSystemResolution.js +5 -2
  9. package/lib/exercises/math/functions/basics/graphicInequationAffine.d.ts +12 -0
  10. package/lib/exercises/math/functions/basics/graphicInequationAffine.d.ts.map +1 -0
  11. package/lib/exercises/math/functions/basics/graphicInequationAffine.js +123 -0
  12. package/lib/exercises/math/functions/basics/index.d.ts +1 -0
  13. package/lib/exercises/math/functions/basics/index.d.ts.map +1 -1
  14. package/lib/exercises/math/functions/basics/index.js +1 -0
  15. package/lib/exercises/math/functions/trinoms/findSecondRoot.d.ts +10 -0
  16. package/lib/exercises/math/functions/trinoms/findSecondRoot.d.ts.map +1 -0
  17. package/lib/exercises/math/functions/trinoms/findSecondRoot.js +127 -0
  18. package/lib/exercises/math/functions/trinoms/index.d.ts +3 -0
  19. package/lib/exercises/math/functions/trinoms/index.d.ts.map +1 -1
  20. package/lib/exercises/math/functions/trinoms/index.js +3 -0
  21. package/lib/exercises/math/functions/trinoms/rootsProduct.d.ts +8 -0
  22. package/lib/exercises/math/functions/trinoms/rootsProduct.d.ts.map +1 -0
  23. package/lib/exercises/math/functions/trinoms/rootsProduct.js +112 -0
  24. package/lib/exercises/math/functions/trinoms/rootsSum.d.ts +8 -0
  25. package/lib/exercises/math/functions/trinoms/rootsSum.d.ts.map +1 -0
  26. package/lib/exercises/math/functions/trinoms/rootsSum.js +113 -0
  27. package/lib/exercises/math/geometry/euclidianConstructions/pointImageFromTranslation.d.ts +4 -1
  28. package/lib/exercises/math/geometry/euclidianConstructions/pointImageFromTranslation.d.ts.map +1 -1
  29. package/lib/exercises/math/geometry/euclidianConstructions/pointImageFromTranslation.js +17 -5
  30. package/lib/exercises/math/geometry/thales/thalesCalcul.d.ts.map +1 -1
  31. package/lib/exercises/math/geometry/thales/thalesCalcul.js +6 -0
  32. package/lib/exercises/math/powers/powersDivision.d.ts.map +1 -1
  33. package/lib/exercises/math/powers/powersDivision.js +19 -11
  34. package/lib/exercises/math/powers/powersPower.d.ts.map +1 -1
  35. package/lib/exercises/math/powers/powersPower.js +19 -11
  36. package/lib/exercises/math/powers/powersProduct.d.ts +4 -1
  37. package/lib/exercises/math/powers/powersProduct.d.ts.map +1 -1
  38. package/lib/exercises/math/powers/powersProduct.js +76 -35
  39. package/lib/exercises/math/probaStat/binomial/binomialInequation.d.ts.map +1 -1
  40. package/lib/exercises/math/probaStat/binomial/binomialInequation.js +6 -0
  41. package/lib/exercises/math/probaStat/probaFromTableNoContext.d.ts.map +1 -1
  42. package/lib/exercises/math/probaStat/probaFromTableNoContext.js +5 -1
  43. package/lib/exercises/math/probaStat/probaFromTableWithContext.d.ts.map +1 -1
  44. package/lib/exercises/math/probaStat/probaFromTableWithContext.js +19 -3
  45. package/lib/exercises/vea/rationalVEA.d.ts +2 -0
  46. package/lib/exercises/vea/rationalVEA.d.ts.map +1 -0
  47. package/lib/exercises/vea/rationalVEA.js +14 -0
  48. package/lib/index.d.ts +22 -1
  49. package/lib/index.d.ts.map +1 -1
  50. package/lib/math/geometry/line.d.ts.map +1 -1
  51. package/lib/math/geometry/line.js +3 -1
  52. package/lib/math/geometry/vector.d.ts.map +1 -1
  53. package/lib/math/geometry/vector.js +1 -7
  54. package/lib/math/inequations/inequation.d.ts +1 -0
  55. package/lib/math/inequations/inequation.d.ts.map +1 -1
  56. package/lib/math/inequations/inequation.js +3 -0
  57. package/lib/math/numbers/rationals/rational.d.ts +1 -1
  58. package/lib/math/numbers/rationals/rational.d.ts.map +1 -1
  59. package/lib/math/numbers/rationals/rational.js +18 -6
  60. package/lib/math/polynomials/affine.d.ts +1 -0
  61. package/lib/math/polynomials/affine.d.ts.map +1 -1
  62. package/lib/math/polynomials/affine.js +4 -0
  63. package/lib/math/polynomials/generalTrinom.d.ts +10 -2
  64. package/lib/math/polynomials/generalTrinom.d.ts.map +1 -1
  65. package/lib/math/polynomials/generalTrinom.js +29 -1
  66. package/lib/playground.d.ts.map +1 -1
  67. package/lib/playground.js +4 -6
  68. package/lib/tree/nodes/operators/fractionNode.d.ts +1 -0
  69. package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
  70. package/lib/tree/nodes/operators/fractionNode.js +10 -0
  71. package/lib/tree/nodes/operators/powerNode.d.ts +1 -0
  72. package/lib/tree/nodes/operators/powerNode.d.ts.map +1 -1
  73. package/lib/tree/nodes/operators/powerNode.js +10 -1
  74. package/lib/tree/parsers/powerParser.d.ts +2 -0
  75. package/lib/tree/parsers/powerParser.d.ts.map +1 -0
  76. package/lib/tree/parsers/powerParser.js +26 -0
  77. package/lib/tree/parsers/rationalParser.d.ts.map +1 -1
  78. package/lib/tree/parsers/rationalParser.js +1 -4
  79. package/lib/tree/parsers/spacePointParser.d.ts.map +1 -1
  80. package/lib/tree/parsers/spaceVectorParser.d.ts.map +1 -1
  81. package/package.json +1 -1
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.rootsSum = void 0;
4
+ const exercise_1 = require("../../../../exercises/exercise");
5
+ const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
6
+ const rationalVEA_1 = require("../../../../exercises/vea/rationalVEA");
7
+ const generalTrinom_1 = require("../../../../math/polynomials/generalTrinom");
8
+ const randint_1 = require("../../../../math/utils/random/randint");
9
+ const oppositeNode_1 = require("../../../../tree/nodes/functions/oppositeNode");
10
+ const fractionNode_1 = require("../../../../tree/nodes/operators/fractionNode");
11
+ const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
12
+ const getPropositions = (n, { answer, trinomIdentifiers }) => {
13
+ const propositions = [];
14
+ (0, exercise_1.addValidProp)(propositions, answer);
15
+ const trinom = generalTrinom_1.GeneralTrinomConstructor.fromIdentifiers(trinomIdentifiers);
16
+ (0, exercise_1.tryToAddWrongProp)(propositions, (0, fractionNode_1.frac)(trinom.b, trinom.a).simplify().toTex());
17
+ (0, exercise_1.tryToAddWrongProp)(propositions, (0, fractionNode_1.frac)(trinom.c, trinom.a).simplify().toTex());
18
+ (0, exercise_1.tryToAddWrongProp)(propositions, (0, fractionNode_1.frac)((0, oppositeNode_1.opposite)(trinom.b), (0, multiplyNode_1.multiply)(2, trinom.a)).simplify().toTex());
19
+ while (propositions.length < n) {
20
+ (0, exercise_1.tryToAddWrongProp)(propositions, (0, randint_1.randint)(-10, 10).frenchify());
21
+ }
22
+ return (0, exercise_1.shuffleProps)(propositions, n);
23
+ };
24
+ const getAnswer = (identifiers) => {
25
+ const { trinomIdentifiers } = identifiers;
26
+ const trinom = generalTrinom_1.GeneralTrinomConstructor.fromIdentifiers(trinomIdentifiers);
27
+ const ans = (0, fractionNode_1.frac)((0, oppositeNode_1.opposite)(trinom.b), trinom.a).simplify().toTex();
28
+ return ans;
29
+ };
30
+ const getInstruction = (identifiers) => {
31
+ const { trinomIdentifiers } = identifiers;
32
+ const trinom = generalTrinom_1.GeneralTrinomConstructor.fromIdentifiers(trinomIdentifiers);
33
+ return `Soit $f$ la fonction définie sur $\\mathbb{R}$ par :
34
+
35
+ $$
36
+ f(x) = ${trinom.toTree().toTex()}
37
+ $$
38
+
39
+ On admet que $f$ possède deux racines.
40
+
41
+ Que vaut la somme des racines de $f$ ?`;
42
+ };
43
+ const getHint = (identifiers) => {
44
+ return `Si $f(x) = ax^2 + bx + c$ admet deux racines, alors leur produit vaut :
45
+
46
+ $$
47
+ S = -\\frac{b}{a}
48
+ $$`;
49
+ };
50
+ const getCorrection = (identifiers) => {
51
+ const { trinomIdentifiers } = identifiers;
52
+ const trinom = generalTrinom_1.GeneralTrinomConstructor.fromIdentifiers(trinomIdentifiers);
53
+ const aTex = trinom.a.toTex();
54
+ const bTex = trinom.b.toTex();
55
+ const ans = (0, fractionNode_1.frac)((0, oppositeNode_1.opposite)(trinom.b), trinom.a);
56
+ return `Si $f(x) = ax^2 + bx + c$ admet deux racines, alors leur smomme $S$ vaut :
57
+
58
+ $$
59
+ S = \\frac{c}{a}
60
+ $$
61
+
62
+ Ici, on a $a = ${aTex}$ et $b = ${bTex}$, donc :
63
+
64
+ $$
65
+ S = ${ans.toSimplificationString()}
66
+ $$
67
+ `;
68
+ };
69
+ const getKeys = (identifiers) => {
70
+ return [];
71
+ };
72
+ const isAnswerValid = (ans, { answer }) => {
73
+ return (0, rationalVEA_1.rationalVEA)(ans, answer);
74
+ };
75
+ const getRootsSumQuestion = (ops) => {
76
+ //(b,c) != 0
77
+ //ac <= 0
78
+ const a = (0, randint_1.randint)(-10, 10, [0]);
79
+ const b = (0, randint_1.randint)(-10, 10);
80
+ const c = (a / Math.abs(a)) * (0, randint_1.randint)(-10, 10, !b ? [0] : []);
81
+ // const trinom = GeneralTrinomConstructor.randomNiceRoots(2);
82
+ const trinom = new generalTrinom_1.GeneralTrinom(a, b, c);
83
+ const identifiers = {
84
+ trinomIdentifiers: trinom.toIdentifiers(),
85
+ };
86
+ const question = {
87
+ answer: getAnswer(identifiers),
88
+ instruction: getInstruction(identifiers),
89
+ keys: getKeys(identifiers),
90
+ answerFormat: "tex",
91
+ identifiers,
92
+ hint: getHint(identifiers),
93
+ correction: getCorrection(identifiers),
94
+ };
95
+ return question;
96
+ };
97
+ exports.rootsSum = {
98
+ id: "rootsSum",
99
+ connector: "=",
100
+ label: "Somme des racines d'un trinôme",
101
+ isSingleStep: true,
102
+ generator: (nb, opts) => (0, getDistinctQuestions_1.getDistinctQuestions)(() => getRootsSumQuestion(opts), nb),
103
+ qcmTimer: 60,
104
+ freeTimer: 60,
105
+ getPropositions,
106
+ isAnswerValid,
107
+ subject: "Mathématiques",
108
+ getInstruction,
109
+ getHint,
110
+ getCorrection,
111
+ getAnswer,
112
+ hasHintAndCorrection: true,
113
+ };
@@ -5,6 +5,9 @@ type Identifiers = {
5
5
  startPoint: string;
6
6
  translationPoints: string[];
7
7
  };
8
- export declare const pointImageFromTranslation: Exercise<Identifiers>;
8
+ type Options = {
9
+ useVector: boolean;
10
+ };
11
+ export declare const pointImageFromTranslation: Exercise<Identifiers, Options>;
9
12
  export {};
10
13
  //# sourceMappingURL=pointImageFromTranslation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pointImageFromTranslation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/euclidianConstructions/pointImageFromTranslation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAOlC,OAAO,EAGL,gBAAgB,EACjB,MAAM,2BAA2B,CAAC;AAMnC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,EAAE,CAAC;CAC7B,CAAC;AAgHF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAc3D,CAAC"}
1
+ {"version":3,"file":"pointImageFromTranslation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/euclidianConstructions/pointImageFromTranslation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,0BAA0B,CAAC;AAOlC,OAAO,EAGL,gBAAgB,EACjB,MAAM,2BAA2B,CAAC;AAMnC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,EAAE,CAAC;CAC7B,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAiIF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAepE,CAAC"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.pointImageFromTranslation = void 0;
4
+ const exercise_1 = require("../../../../exercises/exercise");
4
5
  const toolBarConstructor_1 = require("../../../../exercises/utils/geogebra/toolBarConstructor");
5
6
  const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
6
7
  const geogebraConstructor_1 = require("../../../../geogebra/geogebraConstructor");
@@ -10,8 +11,10 @@ const point_1 = require("../../../../math/geometry/point");
10
11
  const vector_1 = require("../../../../math/geometry/vector");
11
12
  const random_1 = require("../../../../utils/alea/random");
12
13
  const doWhile_1 = require("../../../../utils/doWhile");
13
- const getInstruction = (identifiers) => {
14
- return `Placer l'image du point $${identifiers.startPoint}$ par la translation qui transforme $${identifiers.translationPoints[0]}$ en $${identifiers.translationPoints[1]}$.`;
14
+ const getInstruction = (identifiers, opts) => {
15
+ return `Placer l'image du point $${identifiers.startPoint}$ par la translation ${opts?.useVector
16
+ ? `de vecteur $\\overrightarrow{${identifiers.translationPoints[0]}${identifiers.translationPoints[1]}}$.`
17
+ : `qui transforme $${identifiers.translationPoints[0]}$ en $${identifiers.translationPoints[1]}$.`}`;
15
18
  };
16
19
  const getEndPoint = (identifiers) => {
17
20
  const translationPoints = [
@@ -59,7 +62,7 @@ const isGGBAnswerValid = (ans, { ggbAnswer }) => {
59
62
  return ((0, approxEqual_1.approxEqual)(coords.x, coordsAns.x, 0.2) &&
60
63
  (0, approxEqual_1.approxEqual)(coords.y, coordsAns.y, 0.2));
61
64
  };
62
- const getPointImageFromTranslationQuestion = () => {
65
+ const getPointImageFromTranslationQuestion = (opts) => {
63
66
  const points = [];
64
67
  for (let i = 0; i < 4; i++) {
65
68
  const name = String.fromCharCode(65 + i);
@@ -78,7 +81,7 @@ const getPointImageFromTranslationQuestion = () => {
78
81
  };
79
82
  const question = {
80
83
  ggbAnswer: getGGBAnswer(identifiers),
81
- instruction: getInstruction(identifiers),
84
+ instruction: getInstruction(identifiers, opts),
82
85
  studentGgbOptions: getStudentGGBOptions(identifiers),
83
86
  identifiers,
84
87
  // hint: getHint(identifiers),
@@ -86,11 +89,19 @@ const getPointImageFromTranslationQuestion = () => {
86
89
  };
87
90
  return question;
88
91
  };
92
+ const options = [
93
+ {
94
+ id: "useVector",
95
+ label: 'Utiliser le terme "translation de vecteur"',
96
+ type: exercise_1.GeneratorOptionType.checkbox,
97
+ target: exercise_1.GeneratorOptionTarget.instruction,
98
+ },
99
+ ];
89
100
  exports.pointImageFromTranslation = {
90
101
  id: "pointImageFromTranslation",
91
102
  label: "Placer l'image d'un point par une translation",
92
103
  isSingleStep: true,
93
- generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getPointImageFromTranslationQuestion, nb),
104
+ generator: (nb, opts) => (0, getDistinctQuestions_1.getDistinctQuestions)(() => getPointImageFromTranslationQuestion(opts), nb),
94
105
  ggbTimer: 60,
95
106
  isGGBAnswerValid,
96
107
  subject: "Mathématiques",
@@ -99,4 +110,5 @@ exports.pointImageFromTranslation = {
99
110
  getGGBAnswer,
100
111
  getStudentGGBOptions,
101
112
  answerType: "GGB",
113
+ options,
102
114
  };
@@ -1 +1 @@
1
- {"version":3,"file":"thalesCalcul.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/thales/thalesCalcul.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAqBT,MAAM,0BAA0B,CAAC;AASlC,OAAO,EAAoB,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,EAGL,kBAAkB,EACnB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAGL,mBAAmB,EACpB,MAAM,8BAA8B,CAAC;AAUtC,KAAK,WAAW,GAAG;IACjB,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,uBAAuB,EAAE,gBAAgB,EAAE,CAAC;IAC5C,YAAY,EAAE,kBAAkB,CAAC;IACjC,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AAsKF,KAAK,OAAO,GAAG;IACb,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC;AAiEF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAkBvD,CAAC"}
1
+ {"version":3,"file":"thalesCalcul.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/thales/thalesCalcul.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAqBT,MAAM,0BAA0B,CAAC;AASlC,OAAO,EAAoB,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,EAGL,kBAAkB,EACnB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAGL,mBAAmB,EACpB,MAAM,8BAA8B,CAAC;AAUtC,KAAK,WAAW,GAAG;IACjB,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,uBAAuB,EAAE,gBAAgB,EAAE,CAAC;IAC5C,YAAY,EAAE,kBAAkB,CAAC;IACjC,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AAsKF,KAAK,OAAO,GAAG;IACb,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC;AAiEF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAwBvD,CAAC"}
@@ -196,4 +196,10 @@ exports.thalesCalcul = {
196
196
  getGGBOptions,
197
197
  options,
198
198
  hasGeogebra: true,
199
+ validateOptions: (opts) => {
200
+ return {
201
+ valid: !!opts?.configurationType,
202
+ message: "Veuillez choisir un type de figure.",
203
+ };
204
+ },
199
205
  };
@@ -1 +1 @@
1
- {"version":3,"file":"powersDivision.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/powers/powersDivision.ts"],"names":[],"mappings":"AAAA;;GAEG;AAUH,OAAO,EACL,QAAQ,EAQT,MAAM,gBAAgB,CAAC;AAGxB,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAyFF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CA6BhD,CAAC;AACF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAkBrD,CAAC"}
1
+ {"version":3,"file":"powersDivision.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/powers/powersDivision.ts"],"names":[],"mappings":"AAAA;;GAEG;AAUH,OAAO,EACL,QAAQ,EAQT,MAAM,gBAAgB,CAAC;AAKxB,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA8FF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CA6BhD,CAAC;AACF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAkBrD,CAAC"}
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.powersOfTenDivision = exports.powersDivision = void 0;
7
7
  const power_1 = require("../../../math/numbers/integer/power");
8
8
  const randint_1 = require("../../../math/utils/random/randint");
9
- const numberNode_1 = require("../../../tree/nodes/numbers/numberNode");
10
9
  const fractionNode_1 = require("../../../tree/nodes/operators/fractionNode");
11
10
  const powerNode_1 = require("../../../tree/nodes/operators/powerNode");
12
11
  const substractNode_1 = require("../../../tree/nodes/operators/substractNode");
@@ -14,15 +13,21 @@ const alignTex_1 = require("../../../utils/latex/alignTex");
14
13
  const shuffle_1 = require("../../../utils/alea/shuffle");
15
14
  const exercise_1 = require("../../exercise");
16
15
  const getDistinctQuestions_1 = require("../../utils/getDistinctQuestions");
16
+ const rationalParser_1 = require("../../../tree/parsers/rationalParser");
17
+ const powerParser_1 = require("../../../tree/parsers/powerParser");
17
18
  const getPowersDivisionQuestion = (opts) => {
18
19
  let a = opts.useOnlyPowersOfTen ? 10 : (0, randint_1.randint)(-11, 11, [0]);
19
20
  const [b, c] = [1, 2].map((el) => (0, randint_1.randint)(-11, 11));
20
- const statement = new fractionNode_1.FractionNode(new powerNode_1.PowerNode(new numberNode_1.NumberNode(a), new numberNode_1.NumberNode(b)), new powerNode_1.PowerNode(new numberNode_1.NumberNode(a), new numberNode_1.NumberNode(c)));
21
- const answerTree = new power_1.Power(a, b - c).simplify();
21
+ const statement = (0, fractionNode_1.frac)((0, powerNode_1.power)(a, b), (0, powerNode_1.power)(a, c));
22
+ const answerTree = (0, powerNode_1.power)(a, b - c).simplify();
22
23
  const answer = answerTree.toTex();
23
24
  const statementTex = statement.toTex();
24
25
  const question = {
25
- instruction: `Simplifier : $${statementTex}$`,
26
+ instruction: `Simplifier :
27
+
28
+ $$
29
+ ${statementTex}
30
+ $$`,
26
31
  startStatement: statementTex,
27
32
  answer,
28
33
  keys: [],
@@ -71,13 +76,16 @@ const getPropositions = (n, { answer, a, b, c }) => {
71
76
  return (0, shuffle_1.shuffle)(propositions);
72
77
  };
73
78
  const isAnswerValid = (ans, { a, b, c }) => {
74
- const power = new power_1.Power(a, b - c);
75
- const answerTree = power.simplify();
76
- const texs = answerTree.toAllValidTexs();
77
- const rawTex = power.toTree().toTex();
78
- if (!texs.includes(rawTex))
79
- texs.push(rawTex);
80
- return texs.includes(ans);
79
+ const powerNode = (0, powerNode_1.power)(a, b - c);
80
+ const answerTree = powerNode.simplify();
81
+ const ev = answerTree.evaluate();
82
+ const parsed = (0, rationalParser_1.rationalParser)(ans);
83
+ if (parsed && Math.abs(parsed.evaluate() - ev) < 0.000001)
84
+ return true;
85
+ const powerParsed = (0, powerParser_1.powerParser)(ans);
86
+ if (powerParsed && Math.abs(powerParsed.evaluate() - ev) < 0.000001)
87
+ return true;
88
+ return false;
81
89
  };
82
90
  exports.powersDivision = {
83
91
  id: "powersDivision",
@@ -1 +1 @@
1
- {"version":3,"file":"powersPower.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/powers/powersPower.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,OAAO,EACL,QAAQ,EAST,MAAM,gBAAgB,CAAC;AAExB,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAyDF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CA6BlD,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,WAAW,CAiB7C,CAAC"}
1
+ {"version":3,"file":"powersPower.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/powers/powersPower.ts"],"names":[],"mappings":"AAAA;;GAEG;AASH,OAAO,EACL,QAAQ,EAST,MAAM,gBAAgB,CAAC;AAExB,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA8DF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CA6BlD,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,QAAQ,CAAC,WAAW,CAiB7C,CAAC"}
@@ -6,19 +6,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.powersPower = exports.powersOfTenPower = void 0;
7
7
  const power_1 = require("../../../math/numbers/integer/power");
8
8
  const randint_1 = require("../../../math/utils/random/randint");
9
- const numberNode_1 = require("../../../tree/nodes/numbers/numberNode");
10
9
  const powerNode_1 = require("../../../tree/nodes/operators/powerNode");
10
+ const powerParser_1 = require("../../../tree/parsers/powerParser");
11
+ const rationalParser_1 = require("../../../tree/parsers/rationalParser");
11
12
  const exercise_1 = require("../../exercise");
12
13
  const getDistinctQuestions_1 = require("../../utils/getDistinctQuestions");
13
14
  const getPowersPowerQuestion = (opts) => {
14
15
  const a = opts?.useOnlyPowersOfTen ? 10 : (0, randint_1.randint)(-11, 11, [0, 1]);
15
16
  const [b, c] = [1, 2].map((el) => (0, randint_1.randint)(-11, 11));
16
- const statement = new powerNode_1.PowerNode(new powerNode_1.PowerNode(new numberNode_1.NumberNode(a), new numberNode_1.NumberNode(b)), new numberNode_1.NumberNode(c));
17
- let answerTree = new power_1.Power(a, b * c).simplify();
17
+ const statement = (0, powerNode_1.power)((0, powerNode_1.power)(a, b), c);
18
+ let answerTree = (0, powerNode_1.power)(a, b * c).simplify();
18
19
  const answer = answerTree.toTex();
19
20
  const statementTex = statement.toTex();
20
21
  const question = {
21
- instruction: `Simplifier : $${statementTex}$`,
22
+ instruction: `Simplifier :
23
+
24
+ $$
25
+ ${statementTex}
26
+ $$`,
22
27
  startStatement: statementTex,
23
28
  answer,
24
29
  keys: [],
@@ -45,13 +50,16 @@ const getPropositions = (n, { answer, a, b, c }) => {
45
50
  return (0, exercise_1.shuffleProps)(propositions, n);
46
51
  };
47
52
  const isAnswerValid = (ans, { a, b, c }) => {
48
- const power = new power_1.Power(a, b * c);
49
- const answerTree = power.simplify();
50
- const texs = answerTree.toAllValidTexs();
51
- const rawTex = power.toTree().toTex();
52
- if (!texs.includes(rawTex))
53
- texs.push(rawTex);
54
- return texs.includes(ans);
53
+ const powerNode = (0, powerNode_1.power)(a, b * c);
54
+ const answerTree = powerNode.simplify();
55
+ const ev = answerTree.evaluate();
56
+ const parsed = (0, rationalParser_1.rationalParser)(ans);
57
+ if (parsed && Math.abs(parsed.evaluate() - ev) < 0.000001)
58
+ return true;
59
+ const powerParsed = (0, powerParser_1.powerParser)(ans);
60
+ if (powerParsed && Math.abs(powerParsed.evaluate() - ev) < 0.000001)
61
+ return true;
62
+ return false;
55
63
  };
56
64
  exports.powersOfTenPower = {
57
65
  id: "powersOfTenPower",
@@ -7,7 +7,10 @@ type Identifiers = {
7
7
  b: number;
8
8
  c: number;
9
9
  };
10
+ type Options = {
11
+ useOnlyPowersOfTen: boolean;
12
+ };
10
13
  export declare const powersOfTenProduct: Exercise<Identifiers>;
11
- export declare const powersProduct: Exercise<Identifiers>;
14
+ export declare const powersProduct: Exercise<Identifiers, Options>;
12
15
  export {};
13
16
  //# sourceMappingURL=powersProduct.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"powersProduct.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/powers/powersProduct.ts"],"names":[],"mappings":"AAAA;;GAEG;AAUH,OAAO,EACL,QAAQ,EAQT,MAAM,gBAAgB,CAAC;AAIxB,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA+EF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CA8BpD,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,WAAW,CAkB/C,CAAC"}
1
+ {"version":3,"file":"powersProduct.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/powers/powersProduct.ts"],"names":[],"mappings":"AAAA;;GAEG;AAaH,OAAO,EACL,QAAQ,EAaT,MAAM,gBAAgB,CAAC;AAMxB,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,kBAAkB,EAAE,OAAO,CAAC;CAC7B,CAAC;AA2HF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CA8BpD,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAuBxD,CAAC"}
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.powersProduct = exports.powersOfTenProduct = void 0;
7
7
  const power_1 = require("../../../math/numbers/integer/power");
8
8
  const randint_1 = require("../../../math/utils/random/randint");
9
- const numberNode_1 = require("../../../tree/nodes/numbers/numberNode");
10
9
  const addNode_1 = require("../../../tree/nodes/operators/addNode");
11
10
  const multiplyNode_1 = require("../../../tree/nodes/operators/multiplyNode");
12
11
  const powerNode_1 = require("../../../tree/nodes/operators/powerNode");
@@ -14,38 +13,72 @@ const alignTex_1 = require("../../../utils/latex/alignTex");
14
13
  const shuffle_1 = require("../../../utils/alea/shuffle");
15
14
  const exercise_1 = require("../../exercise");
16
15
  const getDistinctQuestions_1 = require("../../utils/getDistinctQuestions");
16
+ const rationalParser_1 = require("../../../tree/parsers/rationalParser");
17
+ const powerParser_1 = require("../../../tree/parsers/powerParser");
18
+ const getInstruction = (identifiers, opts) => {
19
+ const { a, b, c } = identifiers;
20
+ const statement = (0, multiplyNode_1.multiply)((0, powerNode_1.power)(a, b), (0, powerNode_1.power)(a, c));
21
+ const statmentTex = statement.toTex();
22
+ return `Simplifier :
23
+
24
+ $$
25
+ ${statmentTex}
26
+ $$`;
27
+ };
28
+ const getStartStatement = (identifiers, opts) => {
29
+ const { a, b, c } = identifiers;
30
+ const statement = (0, multiplyNode_1.multiply)((0, powerNode_1.power)(a, b), (0, powerNode_1.power)(a, c));
31
+ const statmentTex = statement.toTex();
32
+ return statmentTex;
33
+ };
34
+ const getHint = (identifiers, opts) => {
35
+ return `Utilise la propriété :
36
+
37
+ $$
38
+ ${opts?.useOnlyPowersOfTen
39
+ ? `10^n \\times 10^m = 10^{n+m}`
40
+ : `a^n \\times a^m = a^{n+m}`}
41
+ $$
42
+ `;
43
+ };
44
+ const getCorrection = (identifiers, opts) => {
45
+ const { a, b, c } = identifiers;
46
+ const addPower = (0, powerNode_1.power)(a, (0, addNode_1.add)(b, c));
47
+ return `On sait que :
48
+
49
+ $$
50
+ ${opts?.useOnlyPowersOfTen
51
+ ? `10^n \\times 10^m = 10^{n+m}`
52
+ : `a^n \\times a^m = a^{n+m}`}
53
+ $$
54
+
55
+ On a donc :
56
+
57
+ ${(0, alignTex_1.alignTex)([
58
+ [(0, multiplyNode_1.multiply)((0, powerNode_1.power)(a, b), (0, powerNode_1.power)(a, c)).toTex(), "=", addPower.toTex()],
59
+ ["", "=", addPower.simplify().toTex()],
60
+ ])}
61
+ `;
62
+ };
63
+ const getAnswer = (identifiers) => {
64
+ const { a, b, c } = identifiers;
65
+ const answerTree = (0, powerNode_1.power)(a, b + c, { allowPowerOne: false }).simplify();
66
+ const answer = answerTree.toTex();
67
+ return answer;
68
+ };
17
69
  const getPowersProductQuestion = (opts) => {
18
70
  const a = opts?.useOnlyPowersOfTen ? 10 : (0, randint_1.randint)(-11, 11, [0]);
19
71
  const [b, c] = [1, 2].map((el) => (0, randint_1.randint)(-11, 11));
20
- const statement = new multiplyNode_1.MultiplyNode(new powerNode_1.PowerNode(new numberNode_1.NumberNode(a), new numberNode_1.NumberNode(b)), new powerNode_1.PowerNode(new numberNode_1.NumberNode(a), new numberNode_1.NumberNode(c)));
21
- const answerTree = new power_1.Power(a, b + c).simplify();
22
- const answer = answerTree.toTex();
23
- const statmentTex = statement.toTex();
72
+ const identifiers = { a, b, c };
24
73
  const question = {
25
- instruction: `Calculer : $${statmentTex}$`,
26
- startStatement: statmentTex,
27
- answer,
74
+ instruction: getInstruction(identifiers, opts),
75
+ startStatement: getStartStatement(identifiers, opts),
76
+ answer: getAnswer(identifiers),
28
77
  keys: [],
29
78
  answerFormat: "tex",
30
- identifiers: { a, b, c },
31
- hint: `Utilise la propriété : ${opts?.useOnlyPowersOfTen
32
- ? `$10^n \\times 10^m = 10^{n+m}$`
33
- : `$a^n \\times a^m = a^{n+m}$`}`,
34
- correction: `On sait que ${opts?.useOnlyPowersOfTen
35
- ? `$10^n \\times 10^m = 10^{n+m}$`
36
- : `$a^n \\times a^m = a^{n+m}$`}.
37
-
38
- On a donc :
39
-
40
- ${(0, alignTex_1.alignTex)([
41
- [
42
- statmentTex,
43
- "=",
44
- new powerNode_1.PowerNode(a.toTree(), new addNode_1.AddNode(b.toTree(), c.toTree())).toTex(),
45
- ],
46
- ["", "=", answer],
47
- ])}
48
- `,
79
+ identifiers,
80
+ hint: getHint(identifiers, opts),
81
+ correction: getCorrection(identifiers, opts),
49
82
  };
50
83
  return question;
51
84
  };
@@ -61,13 +94,16 @@ const getPropositions = (n, { answer, a, b, c }) => {
61
94
  return (0, shuffle_1.shuffle)(propositions);
62
95
  };
63
96
  const isAnswerValid = (ans, { a, b, c }) => {
64
- const power = new power_1.Power(a, b + c);
65
- const answerTree = power.simplify();
66
- const texs = answerTree.toAllValidTexs();
67
- const rawTex = power.toTree().toTex();
68
- if (!texs.includes(rawTex))
69
- texs.push(rawTex);
70
- return texs.includes(ans);
97
+ const powerNode = (0, powerNode_1.power)(a, b + c);
98
+ const answerTree = powerNode.simplify();
99
+ const ev = answerTree.evaluate();
100
+ const parsed = (0, rationalParser_1.rationalParser)(ans);
101
+ if (parsed && Math.abs(parsed.evaluate() - ev) < 0.000001)
102
+ return true;
103
+ const powerParsed = (0, powerParser_1.powerParser)(ans);
104
+ if (powerParsed && Math.abs(powerParsed.evaluate() - ev) < 0.000001)
105
+ return true;
106
+ return false;
71
107
  };
72
108
  exports.powersOfTenProduct = {
73
109
  id: "powersOfTenProduct",
@@ -103,11 +139,16 @@ exports.powersProduct = {
103
139
  levels: ["4ème", "3ème", "2nde"],
104
140
  sections: ["Puissances"],
105
141
  isSingleStep: true,
106
- generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(() => getPowersProductQuestion({ useOnlyPowersOfTen: false }), nb),
142
+ generator: (nb, opts) => (0, getDistinctQuestions_1.getDistinctQuestions)(() => getPowersProductQuestion({ useOnlyPowersOfTen: false }), nb),
107
143
  qcmTimer: 60,
108
144
  freeTimer: 60,
109
145
  getPropositions,
110
146
  isAnswerValid,
111
147
  subject: "Mathématiques",
112
148
  hasHintAndCorrection: true,
149
+ getAnswer,
150
+ getCorrection,
151
+ getHint,
152
+ getInstruction,
153
+ getStartStatement,
113
154
  };
@@ -1 +1 @@
1
- {"version":3,"file":"binomialInequation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/binomial/binomialInequation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,0BAA0B,CAAC;AAUlC,OAAO,EAEL,eAAe,EAChB,MAAM,kCAAkC,CAAC;AAM1C,OAAO,EAEL,uBAAuB,EACxB,MAAM,oCAAoC,CAAC;AAK5C,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,eAAe,CAAC;IACnB,QAAQ,EAAE,uBAAuB,CAAC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AAgKF,KAAK,OAAO,GAAG;IACb,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAgBF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAiB7D,CAAC"}
1
+ {"version":3,"file":"binomialInequation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/binomial/binomialInequation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,0BAA0B,CAAC;AAUlC,OAAO,EAEL,eAAe,EAChB,MAAM,kCAAkC,CAAC;AAM1C,OAAO,EAEL,uBAAuB,EACxB,MAAM,oCAAoC,CAAC;AAK5C,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,eAAe,CAAC;IACnB,QAAQ,EAAE,uBAAuB,CAAC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AAgKF,KAAK,OAAO,GAAG;IACb,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAgBF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAuB7D,CAAC"}
@@ -157,4 +157,10 @@ exports.binomialInequation = {
157
157
  // getCorrection,
158
158
  getAnswer,
159
159
  options,
160
+ validateOptions: (opts) => {
161
+ return {
162
+ valid: !!opts?.instructionType,
163
+ message: "Veuillez choisir un type de consigne.",
164
+ };
165
+ },
160
166
  };
@@ -1 +1 @@
1
- {"version":3,"file":"probaFromTableNoContext.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/probaFromTableNoContext.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,0BAA0B,CAAC;AAWlC,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;AAgIF,KAAK,OAAO,GAAG;IACb,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AAsBF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAiBlE,CAAC"}
1
+ {"version":3,"file":"probaFromTableNoContext.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/probaFromTableNoContext.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,0BAA0B,CAAC;AAWlC,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;AAoIF,KAAK,OAAO,GAAG;IACb,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AAsBF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAiBlE,CAAC"}
@@ -17,7 +17,9 @@ const getInstruction = ({ aBarreCapB, aBarreCapBBarre, aCapB, aCapBBarre, event,
17
17
  const bTotal = aCapB + aBarreCapB;
18
18
  const aBarreTotal = aBarreCapB + aBarreCapBBarre;
19
19
  const bBarreTotal = aBarreCapBBarre + aCapBBarre;
20
- return `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}$.
20
+ return `On considère deux événements $A$ et $B$.
21
+
22
+ 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$.
21
23
 
22
24
  ${(0, mdTable_1.mdTable)([
23
25
  [" ", "$B$", "$\\overline{B}$", "Total"],
@@ -30,6 +32,8 @@ ${(0, mdTable_1.mdTable)([
30
32
  ],
31
33
  ["Total", (0, dollarize_1.dollarize)(bTotal), (0, dollarize_1.dollarize)(bBarreTotal), (0, dollarize_1.dollarize)(total)],
32
34
  ])}
35
+
36
+ Calculer la probabilité $${event}$.
33
37
  `;
34
38
  };
35
39
  const getProbaFromTableNoContextQuestion = () => {
@@ -1 +1 @@
1
- {"version":3,"file":"probaFromTableWithContext.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/probaFromTableWithContext.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,0BAA0B,CAAC;AAWlC,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;AA2HF,KAAK,OAAO,GAAG;IACb,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AAsBF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAoBpE,CAAC"}
1
+ {"version":3,"file":"probaFromTableWithContext.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/probaFromTableWithContext.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,0BAA0B,CAAC;AAWlC,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;AA2IF,KAAK,OAAO,GAAG;IACb,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AAsBF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAoBpE,CAAC"}
@@ -15,9 +15,25 @@ const getInstruction = ({ aBarreCapB, aBarreCapBBarre, aCapB, aCapBBarre, event,
15
15
  return `Le tableau suivant donne le nombre de filles et de garçons portant des lunettes dans un lycée :
16
16
 
17
17
  ${(0, mdTable_1.mdTable)([
18
- [" ", "Porte des lunettes", "Ne porte pas de lunettes"],
19
- ["Filles", (0, dollarize_1.dollarize)(aCapB), (0, dollarize_1.dollarize)(aCapBBarre)],
20
- ["Garçons", (0, dollarize_1.dollarize)(aBarreCapB), (0, dollarize_1.dollarize)(aBarreCapBBarre)],
18
+ [" ", "Porte des lunettes", "Ne porte pas de lunettes", "Total"],
19
+ [
20
+ "Filles",
21
+ (0, dollarize_1.dollarize)(aCapB),
22
+ (0, dollarize_1.dollarize)(aCapBBarre),
23
+ (0, dollarize_1.dollarize)(aCapB + aCapBBarre),
24
+ ],
25
+ [
26
+ "Garçons",
27
+ (0, dollarize_1.dollarize)(aBarreCapB),
28
+ (0, dollarize_1.dollarize)(aBarreCapBBarre),
29
+ (0, dollarize_1.dollarize)(aBarreCapB + aBarreCapBBarre),
30
+ ],
31
+ [
32
+ "Total",
33
+ (0, dollarize_1.dollarize)(aCapB + aBarreCapB),
34
+ (0, dollarize_1.dollarize)(aCapBBarre + aBarreCapBBarre),
35
+ (0, dollarize_1.dollarize)(aCapB + aCapBBarre + aBarreCapB + aBarreCapBBarre),
36
+ ],
21
37
  ])}
22
38
 
23
39
  On choisit un élève au hasard. Quelle est la probabilité de tomber sur ${event} ?
@@ -0,0 +1,2 @@
1
+ export declare const rationalVEA: (studentAns: string, answer: string) => boolean;
2
+ //# sourceMappingURL=rationalVEA.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rationalVEA.d.ts","sourceRoot":"","sources":["../../../src/exercises/vea/rationalVEA.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW,eAAgB,MAAM,UAAU,MAAM,YAK7D,CAAC"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.rationalVEA = void 0;
4
+ const latexParser_1 = require("../../tree/parsers/latexParser");
5
+ const rationalParser_1 = require("../../tree/parsers/rationalParser");
6
+ //return true if studentAns is a number or rational, and if it evaluates to answer
7
+ const rationalVEA = (studentAns, answer) => {
8
+ const parsed = (0, rationalParser_1.rationalParser)(studentAns);
9
+ if (!parsed)
10
+ return false;
11
+ const parsedAnswer = (0, latexParser_1.parseAlgebraic)(answer);
12
+ return Math.abs(parsed.evaluate() - parsedAnswer.evaluate()) < 0.0000001;
13
+ };
14
+ exports.rationalVEA = rationalVEA;