math-exercises 2.2.54 → 2.2.56

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 (38) hide show
  1. package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.js +3 -3
  2. package/lib/exercises/math/calcul/proportionality/index.d.ts +1 -0
  3. package/lib/exercises/math/calcul/proportionality/index.d.ts.map +1 -1
  4. package/lib/exercises/math/calcul/proportionality/index.js +1 -0
  5. package/lib/exercises/math/calcul/proportionality/isTableProportional.d.ts +8 -0
  6. package/lib/exercises/math/calcul/proportionality/isTableProportional.d.ts.map +1 -0
  7. package/lib/exercises/math/calcul/proportionality/isTableProportional.js +91 -0
  8. package/lib/exercises/math/calcul/proportionality/isTableProportionalNonInteger.js +3 -3
  9. package/lib/exercises/math/calculLitteral/equation/equationType4Exercise.d.ts.map +1 -1
  10. package/lib/exercises/math/calculLitteral/equation/equationType4Exercise.js +0 -1
  11. package/lib/exercises/math/conversion/aeraConversion.d.ts.map +1 -1
  12. package/lib/exercises/math/conversion/aeraConversion.js +2 -1
  13. package/lib/exercises/math/conversion/capacityConversion.d.ts.map +1 -1
  14. package/lib/exercises/math/conversion/capacityConversion.js +2 -1
  15. package/lib/exercises/math/conversion/lengthConversion.d.ts.map +1 -1
  16. package/lib/exercises/math/conversion/lengthConversion.js +2 -1
  17. package/lib/exercises/math/conversion/massConversion.d.ts.map +1 -1
  18. package/lib/exercises/math/conversion/massConversion.js +2 -1
  19. package/lib/exercises/math/conversion/volumeCapacityConversion.d.ts.map +1 -1
  20. package/lib/exercises/math/conversion/volumeCapacityConversion.js +2 -1
  21. package/lib/exercises/math/conversion/volumeConversion.d.ts.map +1 -1
  22. package/lib/exercises/math/conversion/volumeConversion.js +2 -1
  23. package/lib/exercises/math/geometry/shapes/basicShapesNaming.d.ts.map +1 -1
  24. package/lib/exercises/math/geometry/shapes/basicShapesNaming.js +0 -1
  25. package/lib/exercises/math/percent/index.d.ts +0 -1
  26. package/lib/exercises/math/percent/index.d.ts.map +1 -1
  27. package/lib/exercises/math/percent/index.js +0 -1
  28. package/lib/exercises/math/probaStat/probaFromTableNoContext.d.ts +4 -1
  29. package/lib/exercises/math/probaStat/probaFromTableNoContext.d.ts.map +1 -1
  30. package/lib/exercises/math/probaStat/probaFromTableNoContext.js +17 -5
  31. package/lib/exercises/math/probaStat/stats1var/marginalAndConditionalFrequency.js +0 -1
  32. package/lib/index.d.ts +6 -4
  33. package/lib/index.d.ts.map +1 -1
  34. package/lib/math/numbers/decimals/decimal.d.ts.map +1 -1
  35. package/lib/math/numbers/decimals/decimal.js +0 -2
  36. package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
  37. package/lib/tree/nodes/operators/fractionNode.js +0 -2
  38. package/package.json +1 -1
@@ -67,7 +67,7 @@ const getFindCoeffInProportionalTableNonIntegersQuestion = () => {
67
67
  for (let i = 0; i < 3; i++) {
68
68
  let x = (0, doWhile_1.doWhile)(() => (0, coinFlip_1.coinFlip)()
69
69
  ? (0, randfloat_1.randfloat)(1.1, 10, 1).toTree()
70
- : rational_1.RationalConstructor.randomIrreductible().toTree(), (y) => y.equals(x));
70
+ : rational_1.RationalConstructor.randomIrreductible().toTree(), (y) => xValues.some((x) => x.equals(y)));
71
71
  xValues.push(x);
72
72
  }
73
73
  xValues.sort((a, b) => a.evaluate() - b.evaluate());
@@ -78,7 +78,7 @@ const getFindCoeffInProportionalTableNonIntegersQuestion = () => {
78
78
  for (let i = 0; i < 3; i++) {
79
79
  let x = (0, doWhile_1.doWhile)(() => (0, coinFlip_1.coinFlip)()
80
80
  ? (0, randint_1.randint)(1, 10).toTree()
81
- : (0, randfloat_1.randfloat)(1.1, 10, 1).toTree(), (y) => y.equals(x));
81
+ : (0, randfloat_1.randfloat)(1.1, 10, 1).toTree(), (y) => xValues.some((x) => x.equals(y)));
82
82
  xValues.push(x);
83
83
  }
84
84
  xValues.sort((a, b) => a.evaluate() - b.evaluate());
@@ -90,7 +90,7 @@ const getFindCoeffInProportionalTableNonIntegersQuestion = () => {
90
90
  for (let i = 0; i < 3; i++) {
91
91
  let x = (0, doWhile_1.doWhile)(() => (0, coinFlip_1.coinFlip)()
92
92
  ? (0, randint_1.randint)(1, 10).toTree()
93
- : rational_1.RationalConstructor.randomIrreductible().toTree(), (y) => y.equals(x));
93
+ : rational_1.RationalConstructor.randomIrreductible().toTree(), (y) => xValues.some((x) => x.equals(y)));
94
94
  xValues.push(x);
95
95
  }
96
96
  xValues.sort((a, b) => a.evaluate() - b.evaluate());
@@ -4,4 +4,5 @@ export * from "./scaleCalculation";
4
4
  export * from "./scaleUsage";
5
5
  export * from "./isTableProportionalNonInteger";
6
6
  export * from "./findCoeffInProportionalTableNonIntegers";
7
+ export * from "./isTableProportional";
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/proportionality/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,mCAAmC,CAAC;AAClD,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,iCAAiC,CAAC;AAChD,cAAc,2CAA2C,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/proportionality/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,mCAAmC,CAAC;AAClD,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,iCAAiC,CAAC;AAChD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,uBAAuB,CAAC"}
@@ -20,3 +20,4 @@ __exportStar(require("./scaleCalculation"), exports);
20
20
  __exportStar(require("./scaleUsage"), exports);
21
21
  __exportStar(require("./isTableProportionalNonInteger"), exports);
22
22
  __exportStar(require("./findCoeffInProportionalTableNonIntegers"), exports);
23
+ __exportStar(require("./isTableProportional"), exports);
@@ -0,0 +1,8 @@
1
+ import { Exercise } from "../../../../exercises/exercise";
2
+ type Identifiers = {
3
+ xValues: number[];
4
+ yValues: number[];
5
+ };
6
+ export declare const isTableProportional: Exercise<Identifiers>;
7
+ export {};
8
+ //# sourceMappingURL=isTableProportional.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isTableProportional.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/proportionality/isTableProportional.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,0BAA0B,CAAC;AASlC,KAAK,WAAW,GAAG;IAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AA6E5D,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAgBrD,CAAC"}
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isTableProportional = void 0;
4
+ const exercise_1 = require("../../../../exercises/exercise");
5
+ const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
6
+ const randTupleInt_1 = require("../../../../math/utils/random/randTupleInt");
7
+ const randint_1 = require("../../../../math/utils/random/randint");
8
+ const coinFlip_1 = require("../../../../utils/alea/coinFlip");
9
+ const doWhile_1 = require("../../../../utils/doWhile");
10
+ const dollarize_1 = require("../../../../utils/latex/dollarize");
11
+ const mdTable_1 = require("../../../../utils/markdown/mdTable");
12
+ const getInstruction = ({ xValues, yValues }) => {
13
+ return `Le tableau ci-dessous est-il un tableau de proportionnalité ?
14
+
15
+ ${(0, mdTable_1.mdTable)([xValues.map((v) => (0, dollarize_1.dollarize)(v)), yValues.map((v) => (0, dollarize_1.dollarize)(v))])}
16
+
17
+ `;
18
+ };
19
+ const getIsTableProportionalQuestion = () => {
20
+ const xValues = (0, randTupleInt_1.randTupleInt)(3, {
21
+ from: 1,
22
+ to: 15,
23
+ allDifferent: true,
24
+ }).sort((a, b) => a - b);
25
+ const isProportionnal = (0, coinFlip_1.coinFlip)();
26
+ const coeff = (0, randint_1.randint)(2, 6);
27
+ const fakeCoeffs = [];
28
+ let yValues = [];
29
+ if (isProportionnal) {
30
+ yValues = xValues.map((value) => value * coeff);
31
+ }
32
+ else {
33
+ xValues.forEach((x) => {
34
+ const newCoeff = (0, doWhile_1.doWhile)(() => (0, randint_1.randint)(2, 6), (newX) => fakeCoeffs.length === 2 &&
35
+ fakeCoeffs[0] === newX &&
36
+ fakeCoeffs[1] === newX);
37
+ fakeCoeffs.push(newCoeff);
38
+ yValues.push(x * newCoeff);
39
+ });
40
+ }
41
+ const identifiers = { xValues, yValues };
42
+ const question = {
43
+ answer: isProportionnal ? "Oui" : "Non",
44
+ instruction: getInstruction(identifiers),
45
+ keys: [],
46
+ answerFormat: "raw",
47
+ style: { tableHasNoHeader: true },
48
+ identifiers,
49
+ hint: "Pour passer de la ligne du haut à la ligne du bas, multiplie-t-on toujours par le même nombre ? Si oui, alors c'est un tableau de proportionnalité.",
50
+ correction: `On divise les nombres de la deuxième ligne par les nombres de la première ligne. Si on obtient toujours le même résultat, alors c'est un tableau de proportionnalité.
51
+
52
+ - $${yValues[0]}\\div ${xValues[0]} = ${yValues[0] / xValues[0]}$
53
+
54
+ - $${yValues[1]}\\div ${xValues[1]} = ${yValues[1] / xValues[1]}$
55
+
56
+ - $${yValues[2]}\\div ${xValues[2]} = ${yValues[2] / xValues[2]}$
57
+
58
+ ${isProportionnal
59
+ ? "Puisque tous les résultats sont égaux, c'est bien un tableau de proportionnalité."
60
+ : "Puisque les résultats ne sont pas tous égaux, ce n'est pas un tableau de proportionnalité."}
61
+ `,
62
+ };
63
+ return question;
64
+ };
65
+ const getPropositions = (n, { answer }) => {
66
+ const propositions = [];
67
+ (0, exercise_1.addValidProp)(propositions, answer, "raw");
68
+ (0, exercise_1.tryToAddWrongProp)(propositions, "Oui", "raw");
69
+ (0, exercise_1.tryToAddWrongProp)(propositions, "Non", "raw");
70
+ (0, exercise_1.tryToAddWrongProp)(propositions, "On ne peut pas savoir", "raw");
71
+ return (0, exercise_1.shuffleProps)(propositions, n);
72
+ };
73
+ const isAnswerValid = (ans, { answer }) => {
74
+ return ans === answer;
75
+ };
76
+ exports.isTableProportional = {
77
+ id: "isVTableProportional",
78
+ label: "Reconnaître un tableau de proportionnalité",
79
+ levels: ["5ème"],
80
+ isSingleStep: true,
81
+ sections: ["Proportionnalité"],
82
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getIsTableProportionalQuestion, nb),
83
+ qcmTimer: 60,
84
+ freeTimer: 60,
85
+ getPropositions,
86
+ isAnswerValid,
87
+ answerType: "QCU",
88
+ subject: "Mathématiques",
89
+ hasHintAndCorrection: true,
90
+ getInstruction,
91
+ };
@@ -55,7 +55,7 @@ const getIsTableProportionalNonIntegerQuestion = () => {
55
55
  for (let i = 0; i < 3; i++) {
56
56
  let x = (0, doWhile_1.doWhile)(() => (0, coinFlip_1.coinFlip)()
57
57
  ? (0, randfloat_1.randfloat)(1.1, 10, 1).toTree()
58
- : rational_1.RationalConstructor.randomIrreductible().toTree(), (y) => y.equals(x));
58
+ : rational_1.RationalConstructor.randomIrreductible().toTree(), (y) => xValues.some((x) => x.equals(y)));
59
59
  xValues.push(x);
60
60
  }
61
61
  xValues.sort((a, b) => a.evaluate() - b.evaluate());
@@ -66,7 +66,7 @@ const getIsTableProportionalNonIntegerQuestion = () => {
66
66
  for (let i = 0; i < 3; i++) {
67
67
  let x = (0, doWhile_1.doWhile)(() => (0, coinFlip_1.coinFlip)()
68
68
  ? (0, randint_1.randint)(1, 10).toTree()
69
- : (0, randfloat_1.randfloat)(1.1, 10, 1).toTree(), (y) => y.equals(x));
69
+ : (0, randfloat_1.randfloat)(1.1, 10, 1).toTree(), (y) => xValues.some((x) => x.equals(y)));
70
70
  xValues.push(x);
71
71
  }
72
72
  xValues.sort((a, b) => a.evaluate() - b.evaluate());
@@ -78,7 +78,7 @@ const getIsTableProportionalNonIntegerQuestion = () => {
78
78
  for (let i = 0; i < 3; i++) {
79
79
  let x = (0, doWhile_1.doWhile)(() => (0, coinFlip_1.coinFlip)()
80
80
  ? (0, randint_1.randint)(1, 10).toTree()
81
- : rational_1.RationalConstructor.randomIrreductible().toTree(), (y) => y.equals(x));
81
+ : rational_1.RationalConstructor.randomIrreductible().toTree(), (y) => xValues.some((x) => x.equals(y)));
82
82
  xValues.push(x);
83
83
  }
84
84
  xValues.sort((a, b) => a.evaluate() - b.evaluate());
@@ -1 +1 @@
1
- {"version":3,"file":"equationType4Exercise.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/equationType4Exercise.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AAgBlC;;GAEG;AAEH,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAyFF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,CAcvD,CAAC"}
1
+ {"version":3,"file":"equationType4Exercise.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/equation/equationType4Exercise.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AAgBlC;;GAEG;AAEH,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAwFF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,CAcvD,CAAC"}
@@ -65,7 +65,6 @@ const isAnswerValid = (ans, { a, b, c, d }) => {
65
65
  // try {
66
66
  // const parsed = equationSolutionParser(ans);
67
67
  // if (!parsed) return false;
68
- // console.log("parsed", parsed.toTex());
69
68
  // const solution = new Rational(d - b, a - c).simplify().toTree();
70
69
  // const solutionTex = solution.toTex();
71
70
  // const decimal = round(solution.evaluate({}), 12).frenchify();
@@ -1 +1 @@
1
- {"version":3,"file":"aeraConversion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/aeraConversion.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,QAAQ,EAQT,MAAM,gBAAgB,CAAC;AAExB,KAAK,WAAW,GAAG;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,0BAA0B,EAAE,MAAM,CAAC;IACnC,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AA2DF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAahD,CAAC"}
1
+ {"version":3,"file":"aeraConversion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/aeraConversion.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,QAAQ,EAQT,MAAM,gBAAgB,CAAC;AAExB,KAAK,WAAW,GAAG;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,0BAA0B,EAAE,MAAM,CAAC;IACnC,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AA+DF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAahD,CAAC"}
@@ -4,6 +4,7 @@ exports.aeraConversion = void 0;
4
4
  const decimal_1 = require("../../../math/numbers/decimals/decimal");
5
5
  const randint_1 = require("../../../math/utils/random/randint");
6
6
  const shuffle_1 = require("../../../utils/alea/shuffle");
7
+ const doWhile_1 = require("../../../utils/doWhile");
7
8
  const exercise_1 = require("../../exercise");
8
9
  const getDistinctQuestions_1 = require("../../utils/getDistinctQuestions");
9
10
  const units = ["mm", "cm", "dm", "m", "dam", "hm", "km"];
@@ -12,7 +13,7 @@ const getAeraConversion = () => {
12
13
  const randomUnitInstructionIndex = (0, randint_1.randint)(
13
14
  // cette manip a pour but d'éviter des conversion de type km² --> cm² ou le contraire (chiffre trop grand/petit)
14
15
  randomUnitIndex - 2 < 0 ? 0 : randomUnitIndex - 2, randomUnitIndex + 2 > 7 ? 7 : randomUnitIndex + 3, [randomUnitIndex]);
15
- const randomAera = decimal_1.DecimalConstructor.random(0, 1000, (0, randint_1.randint)(0, 4));
16
+ const randomAera = (0, doWhile_1.doWhile)(() => decimal_1.DecimalConstructor.random(0, 1000, (0, randint_1.randint)(0, 4)), (x) => x.value === 0);
16
17
  const answer = (randomAera.multiplyByPowerOfTen(2 * (randomUnitIndex - randomUnitInstructionIndex)).value + "").replace(".", ",");
17
18
  const question = {
18
19
  instruction: `Compléter : $${randomAera.value
@@ -1 +1 @@
1
- {"version":3,"file":"capacityConversion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/capacityConversion.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,QAAQ,EAQT,MAAM,gBAAgB,CAAC;AAGxB,KAAK,WAAW,GAAG;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,0BAA0B,EAAE,MAAM,CAAC;IACnC,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAuDF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAcpD,CAAC"}
1
+ {"version":3,"file":"capacityConversion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/capacityConversion.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,QAAQ,EAQT,MAAM,gBAAgB,CAAC;AAGxB,KAAK,WAAW,GAAG;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,0BAA0B,EAAE,MAAM,CAAC;IACnC,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AA0DF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAcpD,CAAC"}
@@ -4,13 +4,14 @@ exports.capacityConversion = void 0;
4
4
  const decimal_1 = require("../../../math/numbers/decimals/decimal");
5
5
  const randint_1 = require("../../../math/utils/random/randint");
6
6
  const shuffle_1 = require("../../../utils/alea/shuffle");
7
+ const doWhile_1 = require("../../../utils/doWhile");
7
8
  const exercise_1 = require("../../exercise");
8
9
  const getDistinctQuestions_1 = require("../../utils/getDistinctQuestions");
9
10
  const units = ["mL", "cL", "dL", "L", "daL", "hL", "kL"];
10
11
  const getCapacityConversion = () => {
11
12
  const randomUnitIndex = (0, randint_1.randint)(0, 7);
12
13
  const randomUnitInstructionIndex = (0, randint_1.randint)(0, 7, [randomUnitIndex]);
13
- const randomCapacity = decimal_1.DecimalConstructor.random(0, 1000, (0, randint_1.randint)(0, 4));
14
+ const randomCapacity = (0, doWhile_1.doWhile)(() => decimal_1.DecimalConstructor.random(0, 1000, (0, randint_1.randint)(0, 4)), (x) => x.value === 0);
14
15
  const answer = (randomCapacity.multiplyByPowerOfTen(randomUnitIndex - randomUnitInstructionIndex).value + "").replace(".", ",");
15
16
  const question = {
16
17
  instruction: `Compléter : $${randomCapacity.value
@@ -1 +1 @@
1
- {"version":3,"file":"lengthConversion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/lengthConversion.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,QAAQ,EAaT,MAAM,gBAAgB,CAAC;AAIxB,KAAK,WAAW,GAAG;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,0BAA0B,EAAE,MAAM,CAAC;IACnC,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AACF,KAAK,OAAO,GAAG;IACb,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AAqHF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAkB3D,CAAC"}
1
+ {"version":3,"file":"lengthConversion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/lengthConversion.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,QAAQ,EAaT,MAAM,gBAAgB,CAAC;AAIxB,KAAK,WAAW,GAAG;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,0BAA0B,EAAE,MAAM,CAAC;IACnC,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AACF,KAAK,OAAO,GAAG;IACb,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AAwHF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAkB3D,CAAC"}
@@ -8,6 +8,7 @@ const measure_1 = require("../../../pc/measure/measure");
8
8
  const distanceUnits_1 = require("../../../pc/units/distanceUnits");
9
9
  const random_1 = require("../../../utils/alea/random");
10
10
  const shuffle_1 = require("../../../utils/alea/shuffle");
11
+ const doWhile_1 = require("../../../utils/doWhile");
11
12
  const exercise_1 = require("../../exercise");
12
13
  const getDistinctQuestions_1 = require("../../utils/getDistinctQuestions");
13
14
  const units = ["mm", "cm", "dm", "m", "dam", "hm", "km"];
@@ -43,7 +44,7 @@ const getLengthConversion = (options) => {
43
44
  const randomUnitInstructionIndex = (0, random_1.random)(availableUnitsIndexes, [
44
45
  randomUnitIndex,
45
46
  ]);
46
- const randomLength = decimal_1.DecimalConstructor.random(0, 1000, (0, randint_1.randint)(0, 4));
47
+ const randomLength = (0, doWhile_1.doWhile)(() => decimal_1.DecimalConstructor.random(0, 1000, (0, randint_1.randint)(0, 4)), (x) => x.value === 0);
47
48
  const identifiers = {
48
49
  randomLength: randomLength.value,
49
50
  randomUnitIndex,
@@ -1 +1 @@
1
- {"version":3,"file":"massConversion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/massConversion.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,QAAQ,EAQT,MAAM,gBAAgB,CAAC;AAGxB,KAAK,WAAW,GAAG;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,0BAA0B,EAAE,MAAM,CAAC;IACnC,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAyDF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAahD,CAAC"}
1
+ {"version":3,"file":"massConversion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/massConversion.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,QAAQ,EAQT,MAAM,gBAAgB,CAAC;AAGxB,KAAK,WAAW,GAAG;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,0BAA0B,EAAE,MAAM,CAAC;IACnC,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AA8DF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAahD,CAAC"}
@@ -5,13 +5,14 @@ const decimal_1 = require("../../../math/numbers/decimals/decimal");
5
5
  const randint_1 = require("../../../math/utils/random/randint");
6
6
  const numberParser_1 = require("../../../tree/parsers/numberParser");
7
7
  const shuffle_1 = require("../../../utils/alea/shuffle");
8
+ const doWhile_1 = require("../../../utils/doWhile");
8
9
  const exercise_1 = require("../../exercise");
9
10
  const getDistinctQuestions_1 = require("../../utils/getDistinctQuestions");
10
11
  const units = ["mg", "cg", "dg", "g", "dag", "hg", "kg"];
11
12
  const getMassConversion = () => {
12
13
  const randomUnitIndex = (0, randint_1.randint)(0, 7);
13
14
  const randomUnitInstructionIndex = (0, randint_1.randint)(0, 7, [randomUnitIndex]);
14
- const randomMass = decimal_1.DecimalConstructor.random(0, 1000, (0, randint_1.randint)(0, 4));
15
+ const randomMass = (0, doWhile_1.doWhile)(() => decimal_1.DecimalConstructor.random(0, 1000, (0, randint_1.randint)(0, 4)), (x) => x.value === 0);
15
16
  const answer = (randomMass.multiplyByPowerOfTen(randomUnitIndex - randomUnitInstructionIndex).value + "").replace(".", ",");
16
17
  const question = {
17
18
  instruction: `Compléter : $${randomMass.value
@@ -1 +1 @@
1
- {"version":3,"file":"volumeCapacityConversion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/volumeCapacityConversion.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,QAAQ,EAQT,MAAM,gBAAgB,CAAC;AAGxB,KAAK,WAAW,GAAG;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,0BAA0B,EAAE,MAAM,CAAC;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,OAAO,CAAC;CAC7B,CAAC;AAkEF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,CAe1D,CAAC"}
1
+ {"version":3,"file":"volumeCapacityConversion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/volumeCapacityConversion.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,QAAQ,EAQT,MAAM,gBAAgB,CAAC;AAGxB,KAAK,WAAW,GAAG;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,0BAA0B,EAAE,MAAM,CAAC;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,OAAO,CAAC;CAC7B,CAAC;AAoEF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,CAe1D,CAAC"}
@@ -5,6 +5,7 @@ const decimal_1 = require("../../../math/numbers/decimals/decimal");
5
5
  const randint_1 = require("../../../math/utils/random/randint");
6
6
  const coinFlip_1 = require("../../../utils/alea/coinFlip");
7
7
  const shuffle_1 = require("../../../utils/alea/shuffle");
8
+ const doWhile_1 = require("../../../utils/doWhile");
8
9
  const exercise_1 = require("../../exercise");
9
10
  const getDistinctQuestions_1 = require("../../utils/getDistinctQuestions");
10
11
  const volumeUnits = ["mm", "cm", "dm", "m", "dam", "hm", "km"];
@@ -14,7 +15,7 @@ const getVolumeCapacityConversion = () => {
14
15
  const randomUnitIndex = (0, randint_1.randint)(
15
16
  // cette manip a pour but d'éviter des conversion avec des nombres trop grand/petit
16
17
  randomUnitInstructionIndex - 1 < 0 ? 0 : randomUnitInstructionIndex - 1, randomUnitInstructionIndex + 2 > 7 ? 7 : randomUnitInstructionIndex + 2);
17
- const random = decimal_1.DecimalConstructor.random(0, 1000, (0, randint_1.randint)(0, 4));
18
+ const random = (0, doWhile_1.doWhile)(() => decimal_1.DecimalConstructor.random(0, 1000, (0, randint_1.randint)(0, 4)), (x) => x.value === 0);
18
19
  let instructionUnit;
19
20
  let answerUnit;
20
21
  let answer;
@@ -1 +1 @@
1
- {"version":3,"file":"volumeConversion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/volumeConversion.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,QAAQ,EAQT,MAAM,gBAAgB,CAAC;AAExB,KAAK,WAAW,GAAG;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,0BAA0B,EAAE,MAAM,CAAC;IACnC,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AA4DF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAclD,CAAC"}
1
+ {"version":3,"file":"volumeConversion.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/volumeConversion.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,QAAQ,EAQT,MAAM,gBAAgB,CAAC;AAExB,KAAK,WAAW,GAAG;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,0BAA0B,EAAE,MAAM,CAAC;IACnC,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAiEF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAclD,CAAC"}
@@ -4,6 +4,7 @@ exports.volumeConversion = void 0;
4
4
  const decimal_1 = require("../../../math/numbers/decimals/decimal");
5
5
  const randint_1 = require("../../../math/utils/random/randint");
6
6
  const shuffle_1 = require("../../../utils/alea/shuffle");
7
+ const doWhile_1 = require("../../../utils/doWhile");
7
8
  const exercise_1 = require("../../exercise");
8
9
  const getDistinctQuestions_1 = require("../../utils/getDistinctQuestions");
9
10
  const units = ["mm", "cm", "dm", "m", "dam", "hm", "km"];
@@ -12,7 +13,7 @@ const getVolumeConversion = () => {
12
13
  const randomUnitInstructionIndex = (0, randint_1.randint)(
13
14
  // cette manip a pour but d'éviter des conversion de type km³ --> cm³ ou le contraire (chiffre trop grand/petit)
14
15
  randomUnitIndex - 2 < 0 ? 0 : randomUnitIndex - 2, randomUnitIndex + 2 > 6 ? 6 : randomUnitIndex + 2, [randomUnitIndex]);
15
- const randomVolume = decimal_1.DecimalConstructor.random(0, 1000, (0, randint_1.randint)(0, 4));
16
+ const randomVolume = (0, doWhile_1.doWhile)(() => decimal_1.DecimalConstructor.random(0, 1000, (0, randint_1.randint)(0, 4)), (x) => x.value === 0);
16
17
  const answer = (randomVolume.multiplyByPowerOfTen(3 * (randomUnitIndex - randomUnitInstructionIndex)).value + "").replace(".", ",");
17
18
  const question = {
18
19
  instruction: `Compléter : $${randomVolume.value
@@ -1 +1 @@
1
- {"version":3,"file":"basicShapesNaming.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/shapes/basicShapesNaming.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,0BAA0B,CAAC;AAWlC,KAAK,WAAW,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AA+FxD,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAgBnD,CAAC"}
1
+ {"version":3,"file":"basicShapesNaming.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/shapes/basicShapesNaming.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,0BAA0B,CAAC;AAWlC,KAAK,WAAW,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AA8FxD,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAgBnD,CAAC"}
@@ -42,7 +42,6 @@ const getBasicShapesNamingQuestion = () => {
42
42
  hideGrid: true,
43
43
  });
44
44
  const letters = answer.substring(1, answer.length - 1).split("");
45
- // console.log(letters);
46
45
  const question = {
47
46
  answer,
48
47
  instruction: `Comment se nomme la figure suivante ?`,
@@ -6,7 +6,6 @@ export * from "./reciprocalPercentage";
6
6
  export * from "./percentToDecimal";
7
7
  export * from "./valuePercent";
8
8
  export * from "./findProportion";
9
- export * from "./isTableProportional";
10
9
  export * from "./cmToEvolution";
11
10
  export * from "./htToTTC";
12
11
  export * from "./ttcToHT";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/percent/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,uCAAuC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/percent/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,uCAAuC,CAAC"}
@@ -22,7 +22,6 @@ __exportStar(require("./reciprocalPercentage"), exports);
22
22
  __exportStar(require("./percentToDecimal"), exports);
23
23
  __exportStar(require("./valuePercent"), exports);
24
24
  __exportStar(require("./findProportion"), exports);
25
- __exportStar(require("./isTableProportional"), exports);
26
25
  __exportStar(require("./cmToEvolution"), exports);
27
26
  __exportStar(require("./htToTTC"), exports);
28
27
  __exportStar(require("./ttcToHT"), exports);
@@ -8,6 +8,9 @@ type Identifiers = {
8
8
  type: string;
9
9
  probaFrac: number[];
10
10
  };
11
- export declare const probaFromTableNoContext: Exercise<Identifiers>;
11
+ type Options = {
12
+ allowNonIrreductible?: boolean;
13
+ };
14
+ export declare const probaFromTableNoContext: Exercise<Identifiers, Options>;
12
15
  export {};
13
16
  //# sourceMappingURL=probaFromTableNoContext.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"probaFromTableNoContext.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/probaFromTableNoContext.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,0BAA0B,CAAC;AASlC,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;AAyIF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAgBzD,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;AAgIF,KAAK,OAAO,GAAG;IACb,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AAsBF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAiBlE,CAAC"}
@@ -2,10 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.probaFromTableNoContext = void 0;
4
4
  const exercise_1 = require("../../../exercises/exercise");
5
+ const allowNonIrreductibleFractions_1 = require("../../../exercises/options/allowNonIrreductibleFractions");
5
6
  const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
6
7
  const rational_1 = require("../../../math/numbers/rationals/rational");
7
8
  const randint_1 = require("../../../math/utils/random/randint");
8
9
  const fractionNode_1 = require("../../../tree/nodes/operators/fractionNode");
10
+ const rationalParser_1 = require("../../../tree/parsers/rationalParser");
9
11
  const random_1 = require("../../../utils/alea/random");
10
12
  const dollarize_1 = require("../../../utils/latex/dollarize");
11
13
  const mdTable_1 = require("../../../utils/markdown/mdTable");
@@ -111,11 +113,20 @@ const getPropositions = (n, { answer, aBarreCapB, aBarreCapBBarre, aCapB, aCapBB
111
113
  }
112
114
  return (0, exercise_1.shuffleProps)(propositions, n);
113
115
  };
114
- const isAnswerValid = (ans, { answer, probaFrac }) => {
115
- const fracTexs = new fractionNode_1.FractionNode(probaFrac[0].toTree(), probaFrac[1].toTree())
116
- .simplify()
117
- .toAllValidTexs();
118
- return fracTexs.includes(ans);
116
+ const options = [allowNonIrreductibleFractions_1.allowNonIrreductibleOption];
117
+ const isAnswerValid = (ans, { answer, probaFrac }, options) => {
118
+ if (options?.allowNonIrreductible) {
119
+ const parsed = (0, rationalParser_1.rationalParser)(ans);
120
+ if (!parsed)
121
+ return false;
122
+ return parsed.simplify().toTex() === answer;
123
+ }
124
+ else {
125
+ const fracTexs = new fractionNode_1.FractionNode(probaFrac[0].toTree(), probaFrac[1].toTree())
126
+ .simplify()
127
+ .toAllValidTexs();
128
+ return fracTexs.includes(ans);
129
+ }
119
130
  };
120
131
  exports.probaFromTableNoContext = {
121
132
  id: "probaFromTableNoContext",
@@ -131,4 +142,5 @@ exports.probaFromTableNoContext = {
131
142
  isAnswerValid,
132
143
  subject: "Mathématiques",
133
144
  getInstruction,
145
+ options,
134
146
  };
@@ -146,7 +146,6 @@ const getPropositions = (n, { answer, rand, x1, x2, x3, x4 }) => {
146
146
  (0, exercise_1.addValidProp)(propositions, answer);
147
147
  while (propositions.length < n) {
148
148
  const fakeRand = (0, randint_1.randint)(0, 12);
149
- // console.log("marg and cond freq", answer, rand, x1, x2, x3, x4);
150
149
  const answerTree = getAnswerNode(fakeRand, x1, x2, x3, x4);
151
150
  (0, exercise_1.tryToAddWrongProp)(propositions, answerTree.toTex());
152
151
  }
package/lib/index.d.ts CHANGED
@@ -137,6 +137,9 @@ declare const mathExercises: (import("./exercises/exercise").Exercise<{
137
137
  xValues: any[];
138
138
  yValues: any[];
139
139
  type: number;
140
+ }, {}> | import("./exercises/exercise").Exercise<{
141
+ xValues: number[];
142
+ yValues: number[];
140
143
  }, {}> | import("./exercises/exercise").Exercise<{
141
144
  precisionAsked: number;
142
145
  decimal: number;
@@ -1165,9 +1168,6 @@ declare const mathExercises: (import("./exercises/exercise").Exercise<{
1165
1168
  }, {}> | import("./exercises/exercise").Exercise<{
1166
1169
  total: number;
1167
1170
  lefties: number;
1168
- }, {}> | import("./exercises/exercise").Exercise<{
1169
- xValues: number[];
1170
- yValues: number[];
1171
1171
  }, {}> | import("./exercises/exercise").Exercise<{
1172
1172
  evolution: number;
1173
1173
  }, {}> | import("./exercises/exercise").Exercise<{
@@ -1314,7 +1314,9 @@ declare const mathExercises: (import("./exercises/exercise").Exercise<{
1314
1314
  event: string;
1315
1315
  type: string;
1316
1316
  probaFrac: number[];
1317
- }, {}> | import("./exercises/exercise").Exercise<{
1317
+ }, {
1318
+ allowNonIrreductible?: boolean | undefined;
1319
+ }> | import("./exercises/exercise").Exercise<{
1318
1320
  aCapB: number;
1319
1321
  aCapBBarre: number;
1320
1322
  aBarreCapB: number;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,yBAAyB,CAAC;AAEjC,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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IAY1E,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO;IAMpE,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO;IAK/D,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO;CAMrD;AAED,qBAAa,OAAQ,YAAW,MAAM;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,aAAsB;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;gBACR,KAAK,EAAE,MAAM,GAAG,MAAM;IAQlC,KAAK,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IASxB,MAAM,CAAC,CAAC,EAAE,MAAM;IAIhB;;;;OAIG;IACH,KAAK,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAIhC,oBAAoB,CAAC,KAAK,EAAE,MAAM;IAiClC,gBAAgB;IA6BhB,oBAAoB,CAAC,QAAQ,CAAC,EAAE,MAAM;IAuCtC,cAAc,CAAC,IAAI,EAAE,MAAM;IAS3B,UAAU;IAMV,MAAM;IAIN,aAAa;IAIb,YAAY,CAAC,UAAU,EAAE,MAAM;IAS/B,YAAY,CAAC,UAAU,EAAE,MAAM;CAShC"}
@@ -101,7 +101,6 @@ class Decimal {
101
101
  (isNegative ? "-" : "") +
102
102
  intPartString.slice(0, power + intPartString.length);
103
103
  }
104
- // console.log("in", newIntPart, newFracPart);
105
104
  return DecimalConstructor.fromParts(newIntPart, newFracPart);
106
105
  }
107
106
  toScientificPart() {
@@ -142,7 +141,6 @@ class Decimal {
142
141
  let value = decimals === undefined
143
142
  ? this.toScientificPart()
144
143
  : (0, round_1.round)(this.toScientificPart(), decimals);
145
- // console.log(value);
146
144
  let power = 0;
147
145
  if (value >= 10) {
148
146
  value = 1;
@@ -1 +1 @@
1
- {"version":3,"file":"fractionNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/fractionNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,YAAY,EAAkB,MAAM,gBAAgB,CAAC;AAK3E,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAKlE,wBAAgB,cAAc,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,YAAY,CAEzD;AAED,eAAO,MAAM,IAAI,MACZ,aAAa,GAAG,MAAM,GAAG,MAAM,KAC/B,aAAa,GAAG,MAAM,GAAG,MAAM,iBAOnC,CAAC;AAEF,qBAAa,YAAa,YAAW,YAAY;IAC/C,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB;;;OAGG;IACH,EAAE,EAAE,WAAW,CAAC;IAChB,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,aAAa,CAAC;IAC1B,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;gBAEjB,SAAS,EAAE,aAAa,EACxB,UAAU,EAAE,aAAa,EACzB,IAAI,CAAC,EAAE,WAAW;IAUpB,YAAY,IAAI,MAAM;IAItB,aAAa;;;;;;;;;IAQb,UAAU;IAGV,iBAAiB,CAAC,IAAI,CAAC,EAAE,WAAW;IA+BpC,cAAc,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,MAAM,EAAE;IAI5C,KAAK,IAAI,MAAM;IAsBf,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAMtC,QAAQ,CAAC,IAAI,CAAC,EAAE,eAAe,GAAG,aAAa;IA2J/C,MAAM,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO;I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,EAAE,aAAa,GAAG,OAAO;IAOpC,oBAAoB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC;CAMzD"}
@@ -153,7 +153,6 @@ class FractionNode {
153
153
  // }
154
154
  const simplifyExternalNodes = (num, denum) => {
155
155
  if ((0, numberNode_1.isNumberNode)(num) && (0, numberNode_1.isNumberNode)(denum)) {
156
- // console.log("num nb, denum nb", num.toTex(), denum.toTex());
157
156
  if (denum.value < 0) {
158
157
  if (num.value < 0) {
159
158
  return new FractionNode(new numberNode_1.NumberNode(-num.value), new numberNode_1.NumberNode(-denum.value)).simplify();
@@ -176,7 +175,6 @@ class FractionNode {
176
175
  if ((0, numberNode_1.isNumberNode)(denum) &&
177
176
  (isFractionNode(num) ||
178
177
  ((0, oppositeNode_1.isOppositeNode)(num) && isFractionNode(num.child)))) {
179
- // console.log("num frac, denum nb, ", num.toTex(), denum.toTex());
180
178
  const trueNum = isFractionNode(num) ? num : num.child;
181
179
  return new FractionNode(trueNum.leftChild, new multiplyNode_1.MultiplyNode(trueNum.rightChild, denum)).simplify();
182
180
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "math-exercises",
3
- "version": "2.2.54",
3
+ "version": "2.2.56",
4
4
  "description": "Math exercises generator for middle school and high school",
5
5
  "main": "lib/index.js",
6
6
  "files": [