math-exercises 2.2.66 → 2.2.68

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 (139) hide show
  1. package/lib/exercises/math/calcul/fractions/fractionAndIntegerSum.d.ts +1 -0
  2. package/lib/exercises/math/calcul/fractions/fractionAndIntegerSum.d.ts.map +1 -1
  3. package/lib/exercises/math/calcul/fractions/fractionAndIntegerSum.js +51 -37
  4. package/lib/exercises/math/calcul/fractions/fractionsOperations.d.ts +8 -0
  5. package/lib/exercises/math/calcul/fractions/fractionsOperations.d.ts.map +1 -0
  6. package/lib/exercises/math/calcul/fractions/fractionsOperations.js +85 -0
  7. package/lib/exercises/math/calcul/fractions/index.d.ts +1 -0
  8. package/lib/exercises/math/calcul/fractions/index.d.ts.map +1 -1
  9. package/lib/exercises/math/calcul/fractions/index.js +1 -0
  10. package/lib/exercises/math/derivation/derivative/rootFunctionDerivative.d.ts.map +1 -1
  11. package/lib/exercises/math/derivation/derivative/rootFunctionDerivative.js +11 -1
  12. package/lib/exercises/math/functions/affines/leadingCoefficient.d.ts.map +1 -1
  13. package/lib/exercises/math/functions/affines/leadingCoefficient.js +9 -16
  14. package/lib/exercises/math/geometry/cartesian/distanceBetweenTwoPoints.d.ts.map +1 -1
  15. package/lib/exercises/math/geometry/cartesian/distanceBetweenTwoPoints.js +3 -1
  16. package/lib/exercises/math/geometry/cartesian/placeAbscissOnLine.js +1 -1
  17. package/lib/exercises/math/percent/applyPercent.d.ts.map +1 -1
  18. package/lib/exercises/math/percent/applyPercent.js +2 -4
  19. package/lib/exercises/math/probaStat/probabilityTree.d.ts +10 -7
  20. package/lib/exercises/math/probaStat/probabilityTree.d.ts.map +1 -1
  21. package/lib/exercises/math/probaStat/probabilityTree.js +194 -90
  22. package/lib/exercises/math/spaceGeometry/vectors/spaceVectorNormCalculation.d.ts.map +1 -1
  23. package/lib/exercises/math/spaceGeometry/vectors/spaceVectorNormCalculation.js +7 -3
  24. package/lib/exercises/vea/rationalVEA.d.ts +7 -1
  25. package/lib/exercises/vea/rationalVEA.d.ts.map +1 -1
  26. package/lib/exercises/vea/rationalVEA.js +28 -3
  27. package/lib/index.d.ts +12 -7
  28. package/lib/index.d.ts.map +1 -1
  29. package/lib/math/complex/complex.d.ts +1 -1
  30. package/lib/math/numbers/rationals/rational.d.ts +1 -1
  31. package/lib/math/numbers/reals/extendedRingElement.d.ts +1 -1
  32. package/lib/math/polynomials/generalAffine.d.ts +1 -1
  33. package/lib/math/polynomials/generalTrinom.d.ts +1 -1
  34. package/lib/math/polynomials/trinom.d.ts +3 -3
  35. package/lib/playground.d.ts.map +1 -1
  36. package/lib/playground.js +1 -5
  37. package/lib/prototypesEnhancement.d.ts +3 -1
  38. package/lib/prototypesEnhancement.d.ts.map +1 -1
  39. package/lib/tree/nodes/algebraicNode.d.ts +1 -0
  40. package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
  41. package/lib/tree/nodes/functions/absNode.d.ts +2 -1
  42. package/lib/tree/nodes/functions/absNode.d.ts.map +1 -1
  43. package/lib/tree/nodes/functions/absNode.js +7 -0
  44. package/lib/tree/nodes/functions/arcSinNode.d.ts +1 -0
  45. package/lib/tree/nodes/functions/arcSinNode.d.ts.map +1 -1
  46. package/lib/tree/nodes/functions/arcSinNode.js +3 -0
  47. package/lib/tree/nodes/functions/arccosNode.d.ts +1 -0
  48. package/lib/tree/nodes/functions/arccosNode.d.ts.map +1 -1
  49. package/lib/tree/nodes/functions/arccosNode.js +3 -0
  50. package/lib/tree/nodes/functions/arctanNode.d.ts +1 -0
  51. package/lib/tree/nodes/functions/arctanNode.d.ts.map +1 -1
  52. package/lib/tree/nodes/functions/arctanNode.js +3 -0
  53. package/lib/tree/nodes/functions/cosNode.d.ts +2 -0
  54. package/lib/tree/nodes/functions/cosNode.d.ts.map +1 -1
  55. package/lib/tree/nodes/functions/cosNode.js +9 -1
  56. package/lib/tree/nodes/functions/expNode.d.ts +2 -0
  57. package/lib/tree/nodes/functions/expNode.d.ts.map +1 -1
  58. package/lib/tree/nodes/functions/expNode.js +10 -1
  59. package/lib/tree/nodes/functions/log10Node.d.ts +1 -0
  60. package/lib/tree/nodes/functions/log10Node.d.ts.map +1 -1
  61. package/lib/tree/nodes/functions/log10Node.js +3 -0
  62. package/lib/tree/nodes/functions/logNode.d.ts +1 -0
  63. package/lib/tree/nodes/functions/logNode.d.ts.map +1 -1
  64. package/lib/tree/nodes/functions/logNode.js +3 -0
  65. package/lib/tree/nodes/functions/oppositeNode.d.ts +1 -0
  66. package/lib/tree/nodes/functions/oppositeNode.d.ts.map +1 -1
  67. package/lib/tree/nodes/functions/oppositeNode.js +3 -0
  68. package/lib/tree/nodes/functions/sinNode.d.ts +2 -0
  69. package/lib/tree/nodes/functions/sinNode.d.ts.map +1 -1
  70. package/lib/tree/nodes/functions/sinNode.js +11 -1
  71. package/lib/tree/nodes/functions/sqrtNode.d.ts +1 -0
  72. package/lib/tree/nodes/functions/sqrtNode.d.ts.map +1 -1
  73. package/lib/tree/nodes/functions/sqrtNode.js +3 -0
  74. package/lib/tree/nodes/functions/tanNode.d.ts +2 -0
  75. package/lib/tree/nodes/functions/tanNode.d.ts.map +1 -1
  76. package/lib/tree/nodes/functions/tanNode.js +9 -1
  77. package/lib/tree/nodes/geometry/degree.d.ts +1 -0
  78. package/lib/tree/nodes/geometry/degree.d.ts.map +1 -1
  79. package/lib/tree/nodes/geometry/degree.js +3 -0
  80. package/lib/tree/nodes/geometry/lengthNode.d.ts +1 -0
  81. package/lib/tree/nodes/geometry/lengthNode.d.ts.map +1 -1
  82. package/lib/tree/nodes/geometry/lengthNode.js +3 -0
  83. package/lib/tree/nodes/node.d.ts +1 -0
  84. package/lib/tree/nodes/node.d.ts.map +1 -1
  85. package/lib/tree/nodes/numbers/constantNode.d.ts +2 -0
  86. package/lib/tree/nodes/numbers/constantNode.d.ts.map +1 -1
  87. package/lib/tree/nodes/numbers/constantNode.js +10 -1
  88. package/lib/tree/nodes/numbers/infiniteNode.d.ts +0 -2
  89. package/lib/tree/nodes/numbers/infiniteNode.d.ts.map +1 -1
  90. package/lib/tree/nodes/numbers/infiniteNode.js +1 -6
  91. package/lib/tree/nodes/numbers/numberNode.d.ts +1 -0
  92. package/lib/tree/nodes/numbers/numberNode.d.ts.map +1 -1
  93. package/lib/tree/nodes/numbers/numberNode.js +3 -0
  94. package/lib/tree/nodes/operators/addNode.d.ts +1 -0
  95. package/lib/tree/nodes/operators/addNode.d.ts.map +1 -1
  96. package/lib/tree/nodes/operators/addNode.js +5 -1
  97. package/lib/tree/nodes/operators/binomialCoefficientNode.d.ts +1 -0
  98. package/lib/tree/nodes/operators/binomialCoefficientNode.d.ts.map +1 -1
  99. package/lib/tree/nodes/operators/binomialCoefficientNode.js +3 -0
  100. package/lib/tree/nodes/operators/divideNode.d.ts +4 -1
  101. package/lib/tree/nodes/operators/divideNode.d.ts.map +1 -1
  102. package/lib/tree/nodes/operators/divideNode.js +17 -2
  103. package/lib/tree/nodes/operators/fractionNode.d.ts +9 -9
  104. package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
  105. package/lib/tree/nodes/operators/fractionNode.js +18 -0
  106. package/lib/tree/nodes/operators/limitNode.d.ts +1 -0
  107. package/lib/tree/nodes/operators/limitNode.d.ts.map +1 -1
  108. package/lib/tree/nodes/operators/limitNode.js +3 -0
  109. package/lib/tree/nodes/operators/multiplyNode.d.ts +1 -0
  110. package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
  111. package/lib/tree/nodes/operators/multiplyNode.js +10 -2
  112. package/lib/tree/nodes/operators/powerNode.d.ts +1 -0
  113. package/lib/tree/nodes/operators/powerNode.d.ts.map +1 -1
  114. package/lib/tree/nodes/operators/powerNode.js +6 -0
  115. package/lib/tree/nodes/operators/substractNode.d.ts +4 -2
  116. package/lib/tree/nodes/operators/substractNode.d.ts.map +1 -1
  117. package/lib/tree/nodes/operators/substractNode.js +9 -2
  118. package/lib/tree/nodes/sets/intervalNode.d.ts.map +1 -1
  119. package/lib/tree/nodes/sets/intervalNode.js +8 -8
  120. package/lib/tree/nodes/variables/variableNode.d.ts +1 -0
  121. package/lib/tree/nodes/variables/variableNode.d.ts.map +1 -1
  122. package/lib/tree/nodes/variables/variableNode.js +7 -0
  123. package/lib/tree/parsers/affineParser.d.ts +1 -2
  124. package/lib/tree/parsers/affineParser.d.ts.map +1 -1
  125. package/lib/tree/parsers/affineParser.js +16 -16
  126. package/lib/tree/parsers/latexParser.d.ts +1 -1
  127. package/lib/tree/parsers/monomParser.d.ts +9 -1
  128. package/lib/tree/parsers/monomParser.d.ts.map +1 -1
  129. package/lib/tree/parsers/monomParser.js +65 -2
  130. package/lib/tree/parsers/powerParser.d.ts +1 -1
  131. package/lib/tree/parsers/purifyLatex.d.ts +9 -0
  132. package/lib/tree/parsers/purifyLatex.d.ts.map +1 -0
  133. package/lib/tree/parsers/purifyLatex.js +17 -0
  134. package/lib/tree/parsers/rationalParser.d.ts +1 -1
  135. package/lib/tree/parsers/rationalParser.d.ts.map +1 -1
  136. package/lib/tree/parsers/trinomParser.d.ts +2 -0
  137. package/lib/tree/parsers/trinomParser.d.ts.map +1 -0
  138. package/lib/tree/parsers/trinomParser.js +31 -0
  139. package/package.json +1 -1
@@ -1,5 +1,6 @@
1
1
  import { Exercise } from "../../../../exercises/exercise";
2
2
  type Identifiers = {
3
+ isIntegerFirst: boolean;
3
4
  integer: number;
4
5
  rational: [number, number];
5
6
  };
@@ -1 +1 @@
1
- {"version":3,"file":"fractionAndIntegerSum.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionAndIntegerSum.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AA4ClC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC5B,CAAC;AAgCF,KAAK,OAAO,GAAG;IACb,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AAwBF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAehE,CAAC"}
1
+ {"version":3,"file":"fractionAndIntegerSum.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionAndIntegerSum.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,0BAA0B,CAAC;AAgBlC,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,OAAO,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC5B,CAAC;AA+FF,KAAK,OAAO,GAAG;IACb,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AAcF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAgBhE,CAAC"}
@@ -4,35 +4,60 @@ exports.fractionAndIntegerSum = void 0;
4
4
  const exercise_1 = require("../../../../exercises/exercise");
5
5
  const allowNonIrreductibleFractions_1 = require("../../../../exercises/options/allowNonIrreductibleFractions");
6
6
  const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
7
+ const rationalVEA_1 = require("../../../../exercises/vea/rationalVEA");
7
8
  const integer_1 = require("../../../../math/numbers/integer/integer");
8
9
  const rational_1 = require("../../../../math/numbers/rationals/rational");
9
10
  const randint_1 = require("../../../../math/utils/random/randint");
10
11
  const addNode_1 = require("../../../../tree/nodes/operators/addNode");
11
- const rationalParser_1 = require("../../../../tree/parsers/rationalParser");
12
+ const fractionNode_1 = require("../../../../tree/nodes/operators/fractionNode");
13
+ const coinFlip_1 = require("../../../../utils/alea/coinFlip");
12
14
  const shuffle_1 = require("../../../../utils/alea/shuffle");
15
+ const rebuildIdentifiers = (oldIdentifiers) => {
16
+ if (oldIdentifiers.isIntegerFirst !== undefined)
17
+ return oldIdentifiers;
18
+ return {
19
+ integer: oldIdentifiers.integer,
20
+ isIntegerFirst: (0, coinFlip_1.coinFlip)(),
21
+ rational: oldIdentifiers.rational,
22
+ };
23
+ };
24
+ const getStatementNode = (identifiers) => {
25
+ const ratio = (0, fractionNode_1.frac)(identifiers.rational[0], identifiers.rational[1]);
26
+ const statement = identifiers.isIntegerFirst
27
+ ? (0, addNode_1.add)(identifiers.integer, ratio)
28
+ : (0, addNode_1.add)(ratio, identifiers.integer);
29
+ return statement;
30
+ };
31
+ const getInstruction = (identifiers, opts) => {
32
+ const statement = getStatementNode(identifiers);
33
+ return `Calculer ${opts?.allowNonIrreductible
34
+ ? ""
35
+ : "et donner le résultat sous la forme la plus simplifiée possible"} :
36
+
37
+ $$
38
+ ${statement.toTex()}
39
+ $$`;
40
+ };
41
+ const getAnswer = (identifiers, opts) => {
42
+ const answerTree = getStatementNode(identifiers);
43
+ return answerTree.simplify().toTex();
44
+ };
13
45
  const getFractionAndIntegerSum = (opts) => {
14
46
  const rational = rational_1.RationalConstructor.randomIrreductible();
15
- const integer = new integer_1.Integer((0, randint_1.randint)(-10, 11, [0]));
16
- const statementTree = new addNode_1.AddNode(rational.toTree(), integer.toTree());
17
- statementTree.shuffle();
18
- const answerTree = rational.add(integer).toTree();
19
- const answer = answerTree.toTex();
47
+ const integer = (0, randint_1.randint)(-10, 11, [0]);
48
+ const isIntegerFirst = (0, coinFlip_1.coinFlip)();
49
+ const identifiers = {
50
+ integer: integer,
51
+ rational: [rational.num, rational.denum],
52
+ isIntegerFirst,
53
+ };
20
54
  const question = {
21
- instruction: `Calculer ${opts?.allowNonIrreductible
22
- ? ""
23
- : "et donner le résultat sous la forme la plus simplifiée possible"} :
24
-
25
- $$
26
- ${statementTree.toTex()}
27
- $`,
28
- startStatement: statementTree.toTex(),
29
- answer,
55
+ instruction: getInstruction(identifiers, opts),
56
+ startStatement: getStatementNode(identifiers).toTex(),
57
+ answer: getAnswer(identifiers, opts),
30
58
  keys: [],
31
59
  answerFormat: "tex",
32
- identifiers: {
33
- integer: integer.value,
34
- rational: [rational.num, rational.denum],
35
- },
60
+ identifiers,
36
61
  };
37
62
  return question;
38
63
  };
@@ -52,30 +77,16 @@ const getPropositions = (n, { answer, integer, rational }) => {
52
77
  return (0, shuffle_1.shuffle)(propositions);
53
78
  };
54
79
  const options = [allowNonIrreductibleFractions_1.allowNonIrreductibleOption];
55
- const isAnswerValid = (ans, { integer, rational }, opts) => {
56
- const integerObj = new integer_1.Integer(integer);
57
- const rationalObj = new rational_1.Rational(rational[0], rational[1]);
58
- const answerTree = rationalObj
59
- .add(integerObj)
60
- .toTree({ allowFractionToDecimal: true });
61
- const texs = answerTree.toAllValidTexs();
62
- if (opts?.allowNonIrreductible) {
63
- const parsed = (0, rationalParser_1.rationalParser)(ans);
64
- if (!parsed)
65
- return false;
66
- return texs.includes(parsed.simplify().toTex());
67
- }
68
- else {
69
- return texs.includes(ans);
70
- }
80
+ const isAnswerValid = (ans, { answer, integer, rational }, opts) => {
81
+ return (0, rationalVEA_1.rationalVEA)(ans, answer, {
82
+ allowNonIrreductible: !!opts?.allowNonIrreductible,
83
+ });
71
84
  };
72
85
  exports.fractionAndIntegerSum = {
73
86
  id: "fractionAndIntegerSum",
74
87
  connector: "=",
75
88
  label: "Somme d'un entier et d'une fraction",
76
- levels: ["4ème", "3ème", "2nde", "CAP", "2ndPro", "1rePro"],
77
89
  isSingleStep: false,
78
- sections: ["Fractions"],
79
90
  generator: (nb, opts) => (0, getDistinctQuestions_1.getDistinctQuestions)(() => getFractionAndIntegerSum(opts), nb),
80
91
  qcmTimer: 60,
81
92
  freeTimer: 60,
@@ -83,4 +94,7 @@ exports.fractionAndIntegerSum = {
83
94
  isAnswerValid,
84
95
  subject: "Mathématiques",
85
96
  options,
97
+ getAnswer,
98
+ getInstruction,
99
+ rebuildIdentifiers,
86
100
  };
@@ -0,0 +1,8 @@
1
+ import { Exercise } from "../../../../exercises/exercise";
2
+ import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor";
3
+ type Identifiers = {
4
+ statementIdentifiers: NodeIdentifiers;
5
+ };
6
+ export declare const fractionsOperations: Exercise<Identifiers>;
7
+ export {};
8
+ //# sourceMappingURL=fractionsOperations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fractionsOperations.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionsOperations.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAKlC,OAAO,EAEL,eAAe,EAChB,MAAM,kCAAkC,CAAC;AAS1C,KAAK,WAAW,GAAG;IACjB,oBAAoB,EAAE,eAAe,CAAC;CACvC,CAAC;AA6EF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAgBrD,CAAC"}
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fractionsOperations = 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 rational_1 = require("../../../../math/numbers/rationals/rational");
8
+ const randint_1 = require("../../../../math/utils/random/randint");
9
+ const nodeConstructor_1 = require("../../../../tree/nodes/nodeConstructor");
10
+ const addNode_1 = require("../../../../tree/nodes/operators/addNode");
11
+ const divideNode_1 = require("../../../../tree/nodes/operators/divideNode");
12
+ const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
13
+ const substractNode_1 = require("../../../../tree/nodes/operators/substractNode");
14
+ const getPropositions = (n, { answer }) => {
15
+ const propositions = [];
16
+ (0, exercise_1.addValidProp)(propositions, answer);
17
+ while (propositions.length < n) {
18
+ (0, exercise_1.tryToAddWrongProp)(propositions, rational_1.RationalConstructor.randomIrreductible(100).toTree().toTex());
19
+ }
20
+ return (0, exercise_1.shuffleProps)(propositions, n);
21
+ };
22
+ const getAnswer = (identifiers) => {
23
+ const statement = nodeConstructor_1.NodeConstructor.fromIdentifiers(identifiers.statementIdentifiers);
24
+ return statement.simplify().toTex();
25
+ };
26
+ const getInstruction = (identifiers) => {
27
+ const statement = nodeConstructor_1.NodeConstructor.fromIdentifiers(identifiers.statementIdentifiers);
28
+ return `Calculer :
29
+
30
+ $$
31
+ ${statement.toTex({ forceTimesSign: true })}
32
+ $$`;
33
+ };
34
+ // const getHint: GetHint<Identifiers> = (identifiers) => {};
35
+ // const getCorrection: GetCorrection<Identifiers> = (identifiers) => {};
36
+ const getKeys = (identifiers) => {
37
+ return [];
38
+ };
39
+ const isAnswerValid = (ans, { answer }) => {
40
+ return (0, rationalVEA_1.rationalVEA)(ans, answer);
41
+ };
42
+ const getFractionsOperationsQuestion = (ops) => {
43
+ const operations = [addNode_1.add, substractNode_1.substract, multiplyNode_1.multiply, divideNode_1.divide];
44
+ const firstOpIndex = (0, randint_1.randint)(0, operations.length);
45
+ const secondOpIndex = (0, randint_1.randint)(0, operations.length, [firstOpIndex]);
46
+ const firstOp = operations[firstOpIndex];
47
+ const secondOp = operations[secondOpIndex];
48
+ const rationals = [
49
+ rational_1.RationalConstructor.randomIrreductible().toTree(),
50
+ rational_1.RationalConstructor.randomIrreductible().toTree(),
51
+ rational_1.RationalConstructor.randomIrreductible().toTree(),
52
+ ];
53
+ const statement = firstOp(secondOp(rationals[0], rationals[1]), rationals[2]);
54
+ statement.shuffle();
55
+ const ids = statement.toIdentifiers();
56
+ const identifiers = {
57
+ statementIdentifiers: ids,
58
+ };
59
+ const question = {
60
+ answer: getAnswer(identifiers),
61
+ instruction: getInstruction(identifiers),
62
+ keys: getKeys(identifiers),
63
+ answerFormat: "tex",
64
+ identifiers,
65
+ // hint: getHint(identifiers),
66
+ // correction: getCorrection(identifiers),
67
+ };
68
+ return question;
69
+ };
70
+ exports.fractionsOperations = {
71
+ id: "fractionsOperations",
72
+ connector: "=",
73
+ label: "Calculs avec des fractions : mélange d'opérations",
74
+ isSingleStep: true,
75
+ generator: (nb, opts) => (0, getDistinctQuestions_1.getDistinctQuestions)(() => getFractionsOperationsQuestion(opts), nb),
76
+ qcmTimer: 60,
77
+ freeTimer: 60,
78
+ getPropositions,
79
+ isAnswerValid,
80
+ subject: "Mathématiques",
81
+ getInstruction,
82
+ // getHint,
83
+ // getCorrection,
84
+ getAnswer,
85
+ };
@@ -10,4 +10,5 @@ export * from "./periodicWritingToFraction";
10
10
  export * from "./fractionsSumsSameDenominators";
11
11
  export * from "./fractionsSumsMultiplesDenominators";
12
12
  export * from "./fractionsSumsPrimeDenominators";
13
+ export * from "./fractionsOperations";
13
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC;AAChD,cAAc,sCAAsC,CAAC;AACrD,cAAc,kCAAkC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC;AAChD,cAAc,sCAAsC,CAAC;AACrD,cAAc,kCAAkC,CAAC;AACjD,cAAc,uBAAuB,CAAC"}
@@ -26,3 +26,4 @@ __exportStar(require("./periodicWritingToFraction"), exports);
26
26
  __exportStar(require("./fractionsSumsSameDenominators"), exports);
27
27
  __exportStar(require("./fractionsSumsMultiplesDenominators"), exports);
28
28
  __exportStar(require("./fractionsSumsPrimeDenominators"), exports);
29
+ __exportStar(require("./fractionsOperations"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"rootFunctionDerivative.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/rootFunctionDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AAclC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAgEF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAcxD,CAAC"}
1
+ {"version":3,"file":"rootFunctionDerivative.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/rootFunctionDerivative.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAiBlC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA2EF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAcxD,CAAC"}
@@ -11,6 +11,16 @@ const fractionNode_1 = require("../../../../tree/nodes/operators/fractionNode");
11
11
  const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
12
12
  const variableNode_1 = require("../../../../tree/nodes/variables/variableNode");
13
13
  const shuffle_1 = require("../../../../utils/alea/shuffle");
14
+ const getStatementNode = (identifiers) => {
15
+ return (0, multiplyNode_1.multiply)(identifiers.a, (0, sqrtNode_1.sqrt)("x"));
16
+ };
17
+ const getInstruction = (identifiers) => {
18
+ return `Déterminer la fonction dérivée $f'$ de la fonction $f$ définie par :
19
+
20
+ $$
21
+ f(x) = ${getStatementNode(identifiers).toTex()}
22
+ $$ `;
23
+ };
14
24
  const getRootFunctionDerivative = () => {
15
25
  const a = (0, randint_1.randint)(-19, 20, [0]);
16
26
  let instruction = `Déterminer la fonction dérivée $f'$ de la fonction $f$ définie par $f(x) =$ `;
@@ -65,7 +75,7 @@ const isAnswerValid = (ans, { a }) => {
65
75
  exports.rootFunctionDerivative = {
66
76
  id: "rootFunctionDerivative",
67
77
  connector: "=",
68
- label: "Dérivée d'une fonction racine",
78
+ label: "Dérivée d'une fonction racine carrée",
69
79
  levels: ["1reESM", "1reSpé", "1reTech", "MathComp"],
70
80
  sections: ["Dérivation", "Racines carrées"],
71
81
  isSingleStep: false,
@@ -1 +1 @@
1
- {"version":3,"file":"leadingCoefficient.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/leadingCoefficient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AAUlC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAuEF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAepD,CAAC"}
1
+ {"version":3,"file":"leadingCoefficient.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/leadingCoefficient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AAYlC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAgEF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAepD,CAAC"}
@@ -3,36 +3,33 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.leadingCoefficient = void 0;
4
4
  const exercise_1 = require("../../../../exercises/exercise");
5
5
  const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
6
+ const rationalVEA_1 = require("../../../../exercises/vea/rationalVEA");
6
7
  const colors_1 = require("../../../../geogebra/colors");
7
8
  const geogebraConstructor_1 = require("../../../../geogebra/geogebraConstructor");
8
- const integer_1 = require("../../../../math/numbers/integer/integer");
9
9
  const rational_1 = require("../../../../math/numbers/rationals/rational");
10
10
  const randint_1 = require("../../../../math/utils/random/randint");
11
11
  const numberNode_1 = require("../../../../tree/nodes/numbers/numberNode");
12
+ const fractionNode_1 = require("../../../../tree/nodes/operators/fractionNode");
12
13
  const shuffle_1 = require("../../../../utils/alea/shuffle");
13
14
  const getLeadingCoefficientQuestion = () => {
14
15
  let xA, yA, xB, yB;
15
16
  [xA, yA] = [1, 2].map((el) => (0, randint_1.randint)(-5, 6));
16
17
  xB = xA > 0 ? (0, randint_1.randint)(xA - 4, 6, [xA]) : (0, randint_1.randint)(-4, xA + 5, [xA]); // l'écart entre les deux points ne soit pas grand
17
18
  yB = yA > 0 ? (0, randint_1.randint)(yA - 4, 6) : (0, randint_1.randint)(-4, yA + 5);
18
- const a = new rational_1.Rational(yB - yA, xB - xA).simplify();
19
- const b = a.opposite().multiply(new integer_1.Integer(xA)).add(new integer_1.Integer(yA));
20
- const aTree = a.toTree();
21
- const bTree = b.toTree();
22
- const aString = aTree.toMathString();
23
- const bString = bTree.toMathString();
19
+ const a = (0, fractionNode_1.frac)(yB - yA, xB - xA).simplify();
20
+ const answer = a.toTex();
24
21
  const xMin = Math.min(xA, xB);
25
22
  const xMax = Math.max(xA, xB);
26
23
  const yMin = Math.min(yA, yB);
27
24
  const yMax = Math.max(yA, yB);
28
25
  const commands = [
29
- `f(x) = (${aString}) * x + (${bString})`,
30
- `SetColor(f, "${(0, colors_1.randomColor)()}")`,
26
+ `L = Line((${xA}, ${yA}), (${xB}, ${yB}))`,
27
+ "SetFixed(L, true)",
28
+ `SetColor(L, "${(0, colors_1.randomColor)()}")`,
31
29
  ];
32
30
  const ggb = new geogebraConstructor_1.GeogebraConstructor({
33
31
  commands,
34
32
  });
35
- const answer = aTree.toTex();
36
33
  const question = {
37
34
  instruction: "Déterminer le coefficient directeur de la droite représentée ci-dessous : ",
38
35
  answer,
@@ -56,12 +53,8 @@ const getPropositions = (n, { answer, xA, xB, yA, yB }) => {
56
53
  }
57
54
  return (0, shuffle_1.shuffle)(propositions);
58
55
  };
59
- const isAnswerValid = (ans, { xA, xB, yA, yB }) => {
60
- const leadingCoeff = new rational_1.Rational(yB - yA, xB - xA)
61
- .simplify()
62
- .toTree({ allowFractionToDecimal: true });
63
- const texs = leadingCoeff.toAllValidTexs();
64
- return texs.includes(ans);
56
+ const isAnswerValid = (ans, { answer, xA, xB, yA, yB }) => {
57
+ return (0, rationalVEA_1.rationalVEA)(ans, answer);
65
58
  };
66
59
  exports.leadingCoefficient = {
67
60
  id: "leadingCoefficient",
@@ -1 +1 @@
1
- {"version":3,"file":"distanceBetweenTwoPoints.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/cartesian/distanceBetweenTwoPoints.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAYlC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAgHF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,CAc1D,CAAC"}
1
+ {"version":3,"file":"distanceBetweenTwoPoints.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/cartesian/distanceBetweenTwoPoints.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAYlC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAkHF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,CAc1D,CAAC"}
@@ -18,7 +18,9 @@ const getDistanceBetweenTwoPoints = () => {
18
18
  .toTree()
19
19
  .toTex();
20
20
  const question = {
21
- instruction: `Soit $${A.toTexWithCoords()}$ et $${B.toTexWithCoords()}$. Calculer la distance $AB$.`,
21
+ instruction: `Dans un repère orthonormé, soit deux points $${A.toTexWithCoords()}$ et $${B.toTexWithCoords()}$.
22
+
23
+ Calculer la distance $AB$.`,
22
24
  startStatement: "AB",
23
25
  answer,
24
26
  keys: [],
@@ -55,7 +55,7 @@ const isGGBAnswerValid = (ans, { ggbAnswer, absciss, abscissTex, abscissType, ax
55
55
  const points = (0, parseGGBPoints_1.parseGGBPoints)(ans).map((p) => (0, ggbPointToCoords_1.ggbPointToCoords)(p));
56
56
  return (points.length === 1 &&
57
57
  points[0].y === 0 &&
58
- Math.abs(points[0].x - coeff) < 0.1);
58
+ Math.abs(points[0].x - coeff) < 0.2);
59
59
  };
60
60
  const getPlaceAbscissOnLineQuestion = () => {
61
61
  const abscissType = (0, random_1.random)([
@@ -1 +1 @@
1
- {"version":3,"file":"applyPercent.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/percent/applyPercent.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,QAAQ,EAQT,MAAM,gBAAgB,CAAC;AAGxB,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;AAqFF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,CAwB9C,CAAC"}
1
+ {"version":3,"file":"applyPercent.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/percent/applyPercent.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,QAAQ,EAQT,MAAM,gBAAgB,CAAC;AAGxB,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;AAmFF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,CAwB9C,CAAC"}
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.applyPercent = void 0;
4
+ const numberVEA_1 = require("../../../exercises/vea/numberVEA");
4
5
  const randint_1 = require("../../../math/utils/random/randint");
5
6
  const round_1 = require("../../../math/utils/round");
6
- const numberNode_1 = require("../../../tree/nodes/numbers/numberNode");
7
7
  const coinFlip_1 = require("../../../utils/alea/coinFlip");
8
8
  const shuffle_1 = require("../../../utils/alea/shuffle");
9
9
  const exercise_1 = require("../../exercise");
@@ -74,9 +74,7 @@ const getPropositions = (n, { answer }) => {
74
74
  return (0, shuffle_1.shuffle)(propositions);
75
75
  };
76
76
  const isAnswerValid = (ans, { answer }) => {
77
- const answerTree = new numberNode_1.NumberNode(Number(answer.replace(",", ".")));
78
- const texs = answerTree.toAllValidTexs();
79
- return texs.includes(ans);
77
+ return (0, numberVEA_1.numberVEA)(ans, answer);
80
78
  };
81
79
  exports.applyPercent = {
82
80
  id: "applyPercent",
@@ -1,15 +1,18 @@
1
+ import { NodeIdentifiers } from "../../../tree/nodes/nodeConstructor";
1
2
  import { Exercise } from "../../exercise";
2
3
  type Identifiers = {
3
- type: number;
4
- A: number;
5
- B: number;
6
- AC: number;
7
- AD: number;
8
- BC: number;
9
- BD: number;
4
+ A: NodeIdentifiers;
5
+ B: NodeIdentifiers;
6
+ AC: NodeIdentifiers;
7
+ AD: NodeIdentifiers;
8
+ BC: NodeIdentifiers;
9
+ BD: NodeIdentifiers;
10
+ probaName: string;
10
11
  };
11
12
  type Options = {
12
13
  allowApproximate: string;
14
+ eventTypes: string[];
15
+ probaType: string;
13
16
  };
14
17
  export declare const probabilityTree: Exercise<Identifiers, Options>;
15
18
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"probabilityTree.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/probabilityTree.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,QAAQ,EAWT,MAAM,gBAAgB,CAAC;AAGxB,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAwIF,KAAK,OAAO,GAAG;IACb,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAAC;AA0CF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAwB1D,CAAC"}
1
+ {"version":3,"file":"probabilityTree.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/probabilityTree.ts"],"names":[],"mappings":"AAYA,OAAO,EAEL,eAAe,EAChB,MAAM,kCAAkC,CAAC;AAY1C,OAAO,EACL,QAAQ,EAeT,MAAM,gBAAgB,CAAC;AAmCxB,KAAK,WAAW,GAAG;IAIjB,CAAC,EAAE,eAAe,CAAC;IACnB,CAAC,EAAE,eAAe,CAAC;IACnB,EAAE,EAAE,eAAe,CAAC;IACpB,EAAE,EAAE,eAAe,CAAC;IACpB,EAAE,EAAE,eAAe,CAAC;IACpB,EAAE,EAAE,eAAe,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AA4MF,KAAK,OAAO,GAAG;IACb,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AA+CF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAiB1D,CAAC"}