math-exercises 1.4.11 → 1.4.13

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":"diceBasicProbas.d.ts","sourceRoot":"","sources":["../../../src/exercises/probaStat/diceBasicProbas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,YAAY,EAAe,QAAQ,EAAqB,MAAM,0BAA0B,CAAC;AAQhH,eAAO,MAAM,eAAe,EAAE,YAW7B,CAAC;AAEF,wBAAgB,0BAA0B,IAAI,QAAQ,CA6DrD"}
1
+ {"version":3,"file":"diceBasicProbas.d.ts","sourceRoot":"","sources":["../../../src/exercises/probaStat/diceBasicProbas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,YAAY,EAAe,QAAQ,EAAqB,MAAM,0BAA0B,CAAC;AAQhH,eAAO,MAAM,eAAe,EAAE,YAW7B,CAAC;AAEF,wBAAgB,0BAA0B,IAAI,QAAQ,CA8DrD"}
@@ -28,8 +28,8 @@ function getDiceBasicProbasQuestion() {
28
28
  const target = isParityQuestion ? `un nombre ${isEvenQuestion ? 'pair' : 'impair'}` : `la face ${faceAsked}`;
29
29
  const answer = isParityQuestion
30
30
  ? isEvenQuestion
31
- ? new rational_1.Rational((nbFaces - 1) / 2, nbFaces).simplify().tex
32
- : new rational_1.Rational((nbFaces + 1) / 2, nbFaces).simplify().tex
31
+ ? new rational_1.Rational(Math.floor(nbFaces / 2), nbFaces).simplify().tex
32
+ : new rational_1.Rational(Math.ceil(nbFaces / 2), nbFaces).simplify().tex
33
33
  : `\\frac{1}{${nbFaces}}`;
34
34
  const getPropositions = (n) => {
35
35
  const res = [];
@@ -41,7 +41,10 @@ function getDiceBasicProbasQuestion() {
41
41
  });
42
42
  if (isParityQuestion) {
43
43
  (0, exercise_1.tryToAddWrongProp)(res, '\\frac{1}{2}');
44
- (0, exercise_1.tryToAddWrongProp)(res, Math.ceil(nbFaces / 2) + '');
44
+ if (isEvenQuestion)
45
+ (0, exercise_1.tryToAddWrongProp)(res, new rational_1.Rational(Math.ceil(nbFaces / 2), nbFaces).simplify().tex);
46
+ else
47
+ (0, exercise_1.tryToAddWrongProp)(res, new rational_1.Rational(Math.floor(nbFaces / 2), nbFaces).simplify().tex);
45
48
  }
46
49
  else {
47
50
  (0, exercise_1.tryToAddWrongProp)(res, '1');
@@ -20,7 +20,7 @@ class DivideNode extends operatorNode_1.OperatorNode {
20
20
  let leftTex = this.leftChild.toTex();
21
21
  if (this.leftChild.type === node_1.NodeType.operator) {
22
22
  if ([operatorNode_1.OperatorIds.add, operatorNode_1.OperatorIds.substract, operatorNode_1.OperatorIds.multiply].includes(this.leftChild.id))
23
- leftTex = `(${leftTex})`;
23
+ leftTex = `\\left(${leftTex}\\right)`;
24
24
  }
25
25
  let needBrackets = rightTex[0] === '-';
26
26
  if (this.rightChild.type === node_1.NodeType.operator) {
@@ -28,7 +28,7 @@ class DivideNode extends operatorNode_1.OperatorNode {
28
28
  needBrackets ||= [operatorNode_1.OperatorIds.add, operatorNode_1.OperatorIds.substract, operatorNode_1.OperatorIds.divide].includes(operatorRightChild.id);
29
29
  }
30
30
  if (needBrackets)
31
- rightTex = `(${rightTex})`;
31
+ rightTex = `\\left(${rightTex}\\right)`;
32
32
  const nextIsLetter = rightTex[0].toLowerCase() !== rightTex[0].toUpperCase();
33
33
  return `${leftTex}\\div${nextIsLetter ? ' ' : ''}${rightTex}`;
34
34
  }
@@ -29,7 +29,7 @@ class MultiplyNode extends operatorNode_1.OperatorNode {
29
29
  }
30
30
  if (this.leftChild.type === node_1.NodeType.operator) {
31
31
  if ([operatorNode_1.OperatorIds.add, operatorNode_1.OperatorIds.substract, operatorNode_1.OperatorIds.divide].includes(this.leftChild.id))
32
- leftTex = `(${leftTex})`;
32
+ leftTex = `\\left(${leftTex}\\right)`;
33
33
  }
34
34
  let needBrackets = rightTex[0] === '-';
35
35
  if (this.rightChild.type === node_1.NodeType.operator) {
@@ -37,7 +37,7 @@ class MultiplyNode extends operatorNode_1.OperatorNode {
37
37
  needBrackets ||= [operatorNode_1.OperatorIds.add, operatorNode_1.OperatorIds.substract].includes(operatorRightChild.id);
38
38
  }
39
39
  if (needBrackets)
40
- rightTex = `(${rightTex})`;
40
+ rightTex = `\\left(${rightTex}\\right)`;
41
41
  // permet de gérer le cas 3*2^x par ex
42
42
  let showTimesSign = this.forceTimesSign || !isNaN(+rightTex[0]) || this.rightChild.type === node_1.NodeType.number;
43
43
  if (this.rightChild.type === node_1.NodeType.operator) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "math-exercises",
3
- "version": "1.4.11",
3
+ "version": "1.4.13",
4
4
  "description": "Math exercises generator for middle school and high school",
5
5
  "main": "lib/index.js",
6
6
  "files": [