math-exercises 2.1.7 → 2.1.9

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.
@@ -20,7 +20,7 @@ const getCommonDivisorsListQuestion = () => {
20
20
  const answer = res.join(",");
21
21
  const question = {
22
22
  answer,
23
- instruction: `Donner la liste des diviseurs communs à ${a} et ${b} (séparer les valeurs par des virgules).`,
23
+ instruction: `Donner la liste des diviseurs communs à $${a}$ et $${b}$ (séparer les valeurs par des virgules).`,
24
24
  keys: [],
25
25
  answerFormat: "tex",
26
26
  identifiers: { a, b },
@@ -13,7 +13,7 @@ const getDivisorsListQuestion = () => {
13
13
  const answer = divisors.join(",");
14
14
  const question = {
15
15
  answer,
16
- instruction: `Donner la liste des diviseurs de ${a} (séparer les valeurs par des virgules).`,
16
+ instruction: `Donner la liste des diviseurs de $${a}$ (séparer les valeurs par des virgules).`,
17
17
  keys: [],
18
18
  answerFormat: "tex",
19
19
  identifiers: { a },
@@ -20,7 +20,7 @@ const getEuclideanDivisionQuestions = () => {
20
20
  const answer = new equalNode_1.EqualNode(new numberNode_1.NumberNode(dividend), new addNode_1.AddNode(new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode(divisor), new numberNode_1.NumberNode(quotient)), new numberNode_1.NumberNode(remainder)));
21
21
  const answerTex = answer.toTex();
22
22
  const question = {
23
- instruction: `Ecrire la division euclidienne de ${dividend} par ${divisor}.`,
23
+ instruction: `Ecrire la division euclidienne de $${dividend}$ par $${divisor}$.`,
24
24
  answer: answerTex,
25
25
  keys: ["equal"],
26
26
  answerFormat: "tex",
@@ -13,7 +13,7 @@ const getPgcdCalculQuestion = () => {
13
13
  const pgcd = (0, gcd_1.gcd)(a, b);
14
14
  const question = {
15
15
  answer: pgcd + "",
16
- instruction: `Donner le PGCD de ${a} et ${b}`,
16
+ instruction: `Donner le PGCD de $${a}$ et $${b}$`,
17
17
  keys: [],
18
18
  answerFormat: "tex",
19
19
  identifiers: { a, b },
@@ -23,7 +23,7 @@ const getRoundQuestions = (opts) => {
23
23
  const decTex = dec.toTree().toTex();
24
24
  const answer = dec.round(precisionAsked).toTree().toTex();
25
25
  const question = {
26
- instruction: `${instructions[precisionAsked]} ${decTex}`,
26
+ instruction: `${instructions[precisionAsked]} $${decTex}$`,
27
27
  startStatement: decTex,
28
28
  answer,
29
29
  keys: [],
@@ -12,7 +12,7 @@ const getFindProportionQuestion = () => {
12
12
  const answer = (0, round_1.round)((lefties / total) * 100, 2).frenchify() + "\\%";
13
13
  const question = {
14
14
  answer,
15
- instruction: `Dans un lycée de ${total} élèves, ${lefties} sont gauchers. Quel est le pourcentage de gauchers dans ce lycée ? (arrondir au centième de pourcentage)`,
15
+ instruction: `Dans un lycée de $${total}$ élèves, $${lefties}$ sont gauchers. Quel est le pourcentage de gauchers dans ce lycée ? (arrondir au centième de pourcentage)`,
16
16
  keys: ["percent"],
17
17
  answerFormat: "tex",
18
18
  identifiers: { total, lefties },
@@ -1 +1 @@
1
- {"version":3,"file":"calculateCombustionEnergy.d.ts","sourceRoot":"","sources":["../../../../src/exercises/pc/chemicalReactions/calculateCombustionEnergy.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAgBlC,KAAK,WAAW,GAAG;IAAE,eAAe,EAAE,MAAM,CAAC;IAAC,mBAAmB,EAAE,MAAM,CAAA;CAAE,CAAC;AAmE5E,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAa3D,CAAC"}
1
+ {"version":3,"file":"calculateCombustionEnergy.d.ts","sourceRoot":"","sources":["../../../../src/exercises/pc/chemicalReactions/calculateCombustionEnergy.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAgBlC,KAAK,WAAW,GAAG;IAAE,eAAe,EAAE,MAAM,CAAC;IAAC,mBAAmB,EAAE,MAAM,CAAA;CAAE,CAAC;AAkE5E,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAa3D,CAAC"}
@@ -18,10 +18,9 @@ const combustibles = [
18
18
  const getCalculateCombustionEnergyQuestion = () => {
19
19
  const combustibleQuantity = (0, randint_1.randint)(100, 301);
20
20
  const combustible = (0, random_1.random)(combustibles);
21
- const instruction = `Calculer l'énergie libérée lors de la combustion de $${combustibleQuantity}\\ \\text{g}$ ${(0, requiresApostropheBefore_1.requiresApostropheBefore)(combustible.name) ? "d'" : "de"}
22
- ${combustible.name} (en $\\text{MJ}$).
23
-
24
- Données : $\\text{PC(${combustible.name})} = ${combustible.value}\\ \\text{MJ}\\cdot\\text{kg}^{-1}$`;
21
+ const instruction = `Calculer l'énergie libérée lors de la combustion de $${combustibleQuantity}\\ \\text{g}$ ${(0, requiresApostropheBefore_1.requiresApostropheBefore)(combustible.name) ? "d'" : "de"} ${combustible.name} (en $\\text{MJ}$).
22
+ $\\newline$
23
+ Données : $\\text{PC(${combustible.name})} = ${combustible.value.frenchify()}\\ \\text{MJ}\\cdot\\text{kg}^{-1}$`;
25
24
  const energy = (0, round_1.roundSignificant)(-combustibleQuantity * 0.001 * combustible.value, 1);
26
25
  const question = {
27
26
  answer: energy,
@@ -1 +1 @@
1
- {"version":3,"file":"electricEnergyFromPower.d.ts","sourceRoot":"","sources":["../../../../src/exercises/pc/electricity/electricEnergyFromPower.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AA8BlC,KAAK,WAAW,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAwCtD,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAazD,CAAC"}
1
+ {"version":3,"file":"electricEnergyFromPower.d.ts","sourceRoot":"","sources":["../../../../src/exercises/pc/electricity/electricEnergyFromPower.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AA8BlC,KAAK,WAAW,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAiDtD,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAazD,CAAC"}
@@ -4,7 +4,6 @@ exports.electricEnergyFromPower = void 0;
4
4
  const exercise_1 = require("../../../exercises/exercise");
5
5
  const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
6
6
  const randint_1 = require("../../../math/utils/random/randint");
7
- const round_1 = require("../../../math/utils/round");
8
7
  const random_1 = require("../../../utils/random");
9
8
  // const homeObjects = [
10
9
  // { id: "lampLed", label: "ampoule LED", gender: "feminine", power: 7 },
@@ -47,9 +46,9 @@ const getPropositions = (n, { answer, power, seconds }) => {
47
46
  const energy = power * seconds;
48
47
  const firstDivision = power / seconds;
49
48
  const secondDivision = seconds / power;
50
- (0, exercise_1.tryToAddWrongProp)(propositions, `${(0, round_1.roundSignificant)(firstDivision, 1)}`);
51
- (0, exercise_1.tryToAddWrongProp)(propositions, `${(0, round_1.roundSignificant)(secondDivision, 1)}`);
52
- (0, exercise_1.tryToAddWrongProp)(propositions, `${(0, round_1.roundSignificant)(energy * 0.1, 0)}`);
49
+ (0, exercise_1.tryToAddWrongProp)(propositions, firstDivision.toScientific(0).toTex({ scientific: 0 }));
50
+ (0, exercise_1.tryToAddWrongProp)(propositions, secondDivision.toScientific(0).toTex({ scientific: 0 }));
51
+ (0, exercise_1.tryToAddWrongProp)(propositions, (energy * 0.1).toScientific(0).toTex({ scientific: 0 }));
53
52
  return (0, exercise_1.shuffleProps)(propositions, n);
54
53
  };
55
54
  const isAnswerValid = (ans, { answer }) => {
@@ -11,7 +11,7 @@ const getMolFromMassQuestion = () => {
11
11
  const answer = (0, round_1.roundSignificant)(mass / molarMass, 1);
12
12
  const question = {
13
13
  answer,
14
- instruction: `On prélève $${(0, round_1.roundSignificant)(mass, 1)}\\ \\text{g}$ d'une espèce chimique de masse molaire $${(0, round_1.roundSignificant)(molarMass, 1)}\\ \\text{g}\\cdot \\text{mol}^{-1}$. Quelle est la quantité de matière prélevée ?`,
14
+ instruction: `On prélève $${(0, round_1.roundSignificant)(mass, 1)}\\ \\text{g}$ d'une espèce chimique de masse molaire $${(0, round_1.roundSignificant)(molarMass, 1)}\\ \\text{g}\\cdot \\text{mol}^{-1}$. Quelle est la quantité de matière prélevée, en $\\text{mol}$ ?`,
15
15
  keys: [],
16
16
  answerFormat: "tex",
17
17
  identifiers: { mass, molarMass },
@@ -41,5 +41,5 @@ exports.molFromMass = {
41
41
  freeTimer: 60,
42
42
  getPropositions,
43
43
  isAnswerValid,
44
- subject: "Mathématiques",
44
+ subject: "Chimie",
45
45
  };
@@ -41,5 +41,5 @@ exports.molFromMolarMass = {
41
41
  freeTimer: 60,
42
42
  getPropositions,
43
43
  isAnswerValid,
44
- subject: "Mathématiques",
44
+ subject: "Chimie",
45
45
  };
@@ -1 +1 @@
1
- {"version":3,"file":"potentialEnergy.d.ts","sourceRoot":"","sources":["../../../src/exercises/pc/potentialEnergy.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,QAAQ,EACT,MAAM,0BAA0B,CAAC;AAMlC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AA+CF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAajD,CAAC"}
1
+ {"version":3,"file":"potentialEnergy.d.ts","sourceRoot":"","sources":["../../../src/exercises/pc/potentialEnergy.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,QAAQ,EACT,MAAM,0BAA0B,CAAC;AAMlC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AA8CF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAajD,CAAC"}
@@ -11,9 +11,9 @@ const getPotentialEnergy = () => {
11
11
  const height = Math.floor(Math.random() * 50 + 1); // Hauteur par rapport à la référence entre 1 et 51 m
12
12
  const gravitationalAcceleration = 9.81; // Accélération due à la gravité en m/s²
13
13
  const potentialEnergy = mass * 9.81 * height;
14
- const instruction = `Un objet de masse ${mass} kg est suspendu à une hauteur de ${height} mètres. Il est ensuite relâché et tombe librement.
15
- $\\\\$ Calculer l'énergie potentielle de l'objet. (Supposons que l'accélération due à la gravité est de 9,81 m/s²)`;
16
- const answer = `${(0, frenchify_1.frenchify)((0, round_1.round)(potentialEnergy, 2))} \\ J`;
14
+ const instruction = `Un objet de masse $${mass} \\ \\text{kg}$ est suspendu à une hauteur de $${height}\\ \\text{m}$. Il est ensuite relâché et tombe librement.
15
+ $\\\\$ Calculer l'énergie potentielle de l'objet. (Supposons que l'accélération due à la gravité est de $9,81 \\ \\text{m}\\cdot \\text{s}^{-2}$)`;
16
+ const answer = `${(0, frenchify_1.frenchify)((0, round_1.round)(potentialEnergy, 2))}J`;
17
17
  const question = {
18
18
  instruction,
19
19
  startStatement: "Ep",
@@ -29,8 +29,7 @@ const getPropositions = (n, { answer, height, mass }) => {
29
29
  (0, exercise_1.addValidProp)(propositions, answer);
30
30
  const potentialEnergy = mass * 9.81 * height;
31
31
  while (propositions.length < n) {
32
- (0, exercise_1.tryToAddWrongProp)(propositions, (0, frenchify_1.frenchify)((0, round_1.round)(potentialEnergy * (0.3 + Math.random() * 1.5), 2)) +
33
- " \\ J");
32
+ (0, exercise_1.tryToAddWrongProp)(propositions, (0, frenchify_1.frenchify)((0, round_1.round)(potentialEnergy * (0.3 + Math.random() * 1.5), 2)) + "J");
34
33
  }
35
34
  return (0, shuffle_1.shuffle)(propositions);
36
35
  };
@@ -70,5 +70,5 @@ exports.periodicWaveCelerity = {
70
70
  freeTimer: 60,
71
71
  getPropositions,
72
72
  isAnswerValid,
73
- subject: "Mathématiques",
73
+ subject: "Physique",
74
74
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "math-exercises",
3
- "version": "2.1.7",
3
+ "version": "2.1.9",
4
4
  "description": "Math exercises generator for middle school and high school",
5
5
  "main": "lib/index.js",
6
6
  "files": [