math-exercises 2.2.57 → 2.2.59

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.
@@ -1 +1 @@
1
- {"version":3,"file":"factorizedFormFromRoots.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/trinoms/factorizedFormFromRoots.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAUlC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA8EF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAczD,CAAC"}
1
+ {"version":3,"file":"factorizedFormFromRoots.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/trinoms/factorizedFormFromRoots.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,0BAA0B,CAAC;AAgBlC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA+EF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAczD,CAAC"}
@@ -7,13 +7,20 @@ const randint_1 = require("../../../../math/utils/random/randint");
7
7
  const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
8
8
  const powerNode_1 = require("../../../../tree/nodes/operators/powerNode");
9
9
  const substractNode_1 = require("../../../../tree/nodes/operators/substractNode");
10
- const variableNode_1 = require("../../../../tree/nodes/variables/variableNode");
11
10
  const probaFlip_1 = require("../../../../utils/alea/probaFlip");
12
- const getAnswer = (roots, a) => {
11
+ const getAnswerNode = (roots, a) => {
13
12
  const isSingleRoot = roots.length === 1;
14
13
  return isSingleRoot
15
- ? new multiplyNode_1.MultiplyNode(a.toTree(), new powerNode_1.SquareNode(new substractNode_1.SubstractNode(new variableNode_1.VariableNode("x"), roots[0].toTree()))).simplify({ keepPowers: true })
16
- : new multiplyNode_1.MultiplyNode(new multiplyNode_1.MultiplyNode(a.toTree(), new substractNode_1.SubstractNode(new variableNode_1.VariableNode("x"), roots[0].toTree())), new substractNode_1.SubstractNode(new variableNode_1.VariableNode("x"), roots[1].toTree())).simplify();
14
+ ? (0, multiplyNode_1.multiply)(a, (0, powerNode_1.square)((0, substractNode_1.substract)("x", roots[0]))).simplify({
15
+ keepPowers: true,
16
+ })
17
+ : (0, multiplyNode_1.multiply)((0, multiplyNode_1.multiply)(a, (0, substractNode_1.substract)("x", roots[0])), (0, substractNode_1.substract)("x", roots[1])).simplify();
18
+ };
19
+ const getInstruction = (identifiers) => {
20
+ const { a, roots } = identifiers;
21
+ return `Soit $f(x) = ax^2 + bx + c$ un polynôme du second degré avec $a = ${a}$ et qui a ${roots.length === 1
22
+ ? `pour seule racine : $${roots[0]}$`
23
+ : `deux racines : $${roots[0]}$ et $${roots[1]}$`}. Déterminer la forme factorisée de $f$.`;
17
24
  };
18
25
  const getFactorizedFormFromRootsQuestion = () => {
19
26
  const a = (0, randint_1.randint)(-10, 10, [0]);
@@ -23,32 +30,31 @@ const getFactorizedFormFromRootsQuestion = () => {
23
30
  const roots = isSingleRoot
24
31
  ? [firstRoot]
25
32
  : [firstRoot, secondRoot].sort((a, b) => a - b);
26
- const answer = getAnswer(roots, a);
33
+ const answer = getAnswerNode(roots, a);
27
34
  const answerTex = answer.toTex();
35
+ const identifiers = { a, roots };
28
36
  const question = {
29
37
  answer: answerTex,
30
- instruction: `Soit $f(x) = ax^2 + bx + c$ un polynôme du second degré avec $a = ${a}$ et qui a ${roots.length === 1
31
- ? `une racine : $${roots[0]}$`
32
- : `deux racines : $${roots[0]}$ et $${roots[1]}$`}. Déterminer la forme factorisée de $f$.`,
38
+ instruction: getInstruction(identifiers),
33
39
  keys: ["x"],
34
40
  answerFormat: "tex",
35
- identifiers: { a, roots },
41
+ identifiers,
36
42
  };
37
43
  return question;
38
44
  };
39
45
  const getPropositions = (n, { answer, a, roots }) => {
40
46
  const propositions = [];
41
47
  (0, exercise_1.addValidProp)(propositions, answer);
42
- (0, exercise_1.tryToAddWrongProp)(propositions, getAnswer(roots.map((r) => -r), a).toTex());
48
+ (0, exercise_1.tryToAddWrongProp)(propositions, getAnswerNode(roots.map((r) => -r), a).toTex());
43
49
  while (propositions.length < n) {
44
50
  const x1 = (0, randint_1.randint)(-10, 10);
45
51
  const x2 = (0, randint_1.randint)(-10, 10, [x1]);
46
- (0, exercise_1.tryToAddWrongProp)(propositions, getAnswer([x1, x2].sort((a, b) => a - b), (0, randint_1.randint)(-10, 10, [0])).toTex());
52
+ (0, exercise_1.tryToAddWrongProp)(propositions, getAnswerNode([x1, x2].sort((a, b) => a - b), (0, randint_1.randint)(-10, 10, [0])).toTex());
47
53
  }
48
54
  return (0, exercise_1.shuffleProps)(propositions, n);
49
55
  };
50
56
  const isAnswerValid = (ans, { answer, a, roots }) => {
51
- const answerNode = getAnswer(roots, a);
57
+ const answerNode = getAnswerNode(roots, a);
52
58
  const texs = answerNode.toAllValidTexs();
53
59
  return texs.includes(ans);
54
60
  };
@@ -88,7 +88,7 @@ const getPointImageFromTranslationQuestion = () => {
88
88
  };
89
89
  exports.pointImageFromTranslation = {
90
90
  id: "pointImageFromTranslation",
91
- label: "undefined",
91
+ label: "Placer l'image d'un point par une translation",
92
92
  isSingleStep: true,
93
93
  generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getPointImageFromTranslationQuestion, nb),
94
94
  ggbTimer: 60,
@@ -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;AAeF,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,CAiB7D,CAAC"}
@@ -66,7 +66,7 @@ ${identifiers.isSentence
66
66
  : `Calculer en donnant la réponse à $10^{-2}$ près :
67
67
 
68
68
  $$
69
- ${interval.toInequality("P(X)".toTree()).toTex()}
69
+ P\\left(${interval.toInequality("X".toTree()).toTex()}\\right)
70
70
  $$`}`;
71
71
  };
72
72
  // const getHint: GetHint<Identifiers> = (identifiers) => {};
@@ -132,19 +132,20 @@ const options = [
132
132
  {
133
133
  id: "instructionType",
134
134
  label: "Types de consignes",
135
- target: exercise_1.GeneratorOptionTarget.instruction,
135
+ target: exercise_1.GeneratorOptionTarget.generation,
136
136
  type: exercise_1.GeneratorOptionType.select,
137
137
  values: [
138
138
  "Toutes",
139
139
  "Uniquement sous forme de phrase",
140
140
  "Uniquement sous forme mathématique",
141
141
  ],
142
+ defaultValue: "Toutes",
142
143
  },
143
144
  ];
144
145
  exports.binomialInequation = {
145
146
  id: "binomialInequation",
146
147
  connector: "\\iff",
147
- label: "Calculer une probabilité binomiale du type $P(x) \\leq a$, $P(X)\\geq a$ ou $a\\leq P(X)\\leq b$",
148
+ label: "Calculer une probabilité binomiale du type $P(X \\leq a)$, $P(X \\geq a)$ ou $P(a\\leq X\\leq b)$",
148
149
  isSingleStep: true,
149
150
  generator: (nb, opts) => (0, getDistinctQuestions_1.getDistinctQuestions)(() => getBinomialInequationQuestion(opts), nb),
150
151
  qcmTimer: 60,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "math-exercises",
3
- "version": "2.2.57",
3
+ "version": "2.2.59",
4
4
  "description": "Math exercises generator for middle school and high school",
5
5
  "main": "lib/index.js",
6
6
  "files": [