math-exercises 2.2.59 → 2.2.60

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 (64) hide show
  1. package/lib/exercises/exercise.d.ts +2 -0
  2. package/lib/exercises/exercise.d.ts.map +1 -1
  3. package/lib/exercises/math/calcul/fractions/fractionAndIntegerDivision.d.ts +1 -1
  4. package/lib/exercises/math/calcul/fractions/fractionAndIntegerDivision.d.ts.map +1 -1
  5. package/lib/exercises/math/calcul/fractions/fractionAndIntegerDivision.js +75 -37
  6. package/lib/exercises/math/calcul/fractions/fractionAndIntegerProduct.d.ts +6 -2
  7. package/lib/exercises/math/calcul/fractions/fractionAndIntegerProduct.d.ts.map +1 -1
  8. package/lib/exercises/math/calcul/fractions/fractionAndIntegerProduct.js +88 -40
  9. package/lib/exercises/math/calcul/fractions/fractionAndIntegerSum.d.ts +4 -1
  10. package/lib/exercises/math/calcul/fractions/fractionAndIntegerSum.d.ts.map +1 -1
  11. package/lib/exercises/math/calcul/fractions/fractionAndIntegerSum.js +23 -5
  12. package/lib/exercises/math/calcul/fractions/fractionsDivision.d.ts.map +1 -1
  13. package/lib/exercises/math/calcul/fractions/fractionsDivision.js +24 -6
  14. package/lib/exercises/math/calcul/fractions/fractionsProduct.d.ts +4 -1
  15. package/lib/exercises/math/calcul/fractions/fractionsProduct.d.ts.map +1 -1
  16. package/lib/exercises/math/calcul/fractions/fractionsProduct.js +24 -6
  17. package/lib/exercises/math/calcul/fractions/fractionsSum.d.ts +2 -2
  18. package/lib/exercises/math/calcul/fractions/fractionsSum.d.ts.map +1 -1
  19. package/lib/exercises/math/calcul/fractions/fractionsSum.js +20 -11
  20. package/lib/exercises/math/calcul/fractions/fractionsSumsMultiplesDenominators.js +1 -1
  21. package/lib/exercises/math/calcul/fractions/fractionsSumsPrimeDenominators.js +1 -1
  22. package/lib/exercises/math/calcul/fractions/fractionsSumsSameDenominators.js +2 -2
  23. package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.d.ts +7 -2
  24. package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.d.ts.map +1 -1
  25. package/lib/exercises/math/calcul/proportionality/findCoeffInProportionalTableNonIntegers.js +52 -44
  26. package/lib/exercises/math/calcul/proportionality/isTableProportionalNonInteger.d.ts +7 -2
  27. package/lib/exercises/math/calcul/proportionality/isTableProportionalNonInteger.d.ts.map +1 -1
  28. package/lib/exercises/math/calcul/proportionality/isTableProportionalNonInteger.js +48 -40
  29. package/lib/exercises/math/functions/affines/signFunction.js +1 -1
  30. package/lib/exercises/math/functions/trinoms/factorizedFormFromRoots.d.ts.map +1 -1
  31. package/lib/exercises/math/functions/trinoms/factorizedFormFromRoots.js +1 -0
  32. package/lib/exercises/math/spaceGeometry/lineAndPlaneRelativePosition.d.ts +1 -0
  33. package/lib/exercises/math/spaceGeometry/lineAndPlaneRelativePosition.d.ts.map +1 -0
  34. package/lib/exercises/math/spaceGeometry/lineAndPlaneRelativePosition.js +84 -0
  35. package/lib/exercises/math/squareRoots/index.d.ts +2 -0
  36. package/lib/exercises/math/squareRoots/index.d.ts.map +1 -1
  37. package/lib/exercises/math/squareRoots/index.js +2 -0
  38. package/lib/exercises/math/squareRoots/squareRootsFractions.d.ts +10 -0
  39. package/lib/exercises/math/squareRoots/squareRootsFractions.d.ts.map +1 -0
  40. package/lib/exercises/math/squareRoots/squareRootsFractions.js +93 -0
  41. package/lib/exercises/math/squareRoots/squareRootsToSquare.d.ts +10 -0
  42. package/lib/exercises/math/squareRoots/squareRootsToSquare.d.ts.map +1 -0
  43. package/lib/exercises/math/squareRoots/squareRootsToSquare.js +116 -0
  44. package/lib/exercises/math/trigonometry/mainAngleMeasure.js +13 -13
  45. package/lib/index.d.ts +35 -11
  46. package/lib/index.d.ts.map +1 -1
  47. package/lib/math/numbers/reals/extendedRingElement.d.ts +1 -1
  48. package/lib/playground.d.ts.map +1 -1
  49. package/lib/playground.js +8 -1
  50. package/lib/tree/nodes/functions/absNode.d.ts +1 -1
  51. package/lib/tree/nodes/functions/absNode.d.ts.map +1 -1
  52. package/lib/tree/nodes/functions/absNode.js +9 -1
  53. package/lib/tree/nodes/functions/sqrtNode.d.ts.map +1 -1
  54. package/lib/tree/nodes/functions/sqrtNode.js +9 -0
  55. package/lib/tree/nodes/operators/operatorNode.d.ts +2 -1
  56. package/lib/tree/nodes/operators/operatorNode.d.ts.map +1 -1
  57. package/lib/tree/nodes/operators/operatorNode.js +1 -0
  58. package/lib/tree/nodes/operators/powerNode.d.ts +1 -0
  59. package/lib/tree/nodes/operators/powerNode.d.ts.map +1 -1
  60. package/lib/tree/nodes/operators/powerNode.js +12 -83
  61. package/lib/tree/parsers/rationalParser.d.ts +1 -1
  62. package/lib/tree/parsers/rationalParser.d.ts.map +1 -1
  63. package/lib/tree/parsers/rationalParser.js +13 -8
  64. package/package.json +1 -1
@@ -94,6 +94,7 @@ export type QuestionGenerator<TIdentifiers = {}, TOptions = any> = (opts?: TOpti
94
94
  export type GetHint<TIdentifiers, TOptions = {}> = (args: TIdentifiers, options?: TOptions) => string;
95
95
  export type GetCorrection<TIdentifiers, TOptions = {}> = (args: TIdentifiers, options?: TOptions) => string;
96
96
  export type GetInstruction<TIdentifiers, TOptions = {}> = (args: TIdentifiers, options?: TOptions) => string;
97
+ export type GetStartStatement<TIdentifiers, TOptions = {}> = (args: TIdentifiers, options?: TOptions) => string;
97
98
  export type GetAnswer<TIdentifiers, TOptions = {}> = (args: TIdentifiers, options?: TOptions) => string;
98
99
  export type GetKeys<TIdentifiers, TOptions = {}> = (args: TIdentifiers, options?: TOptions) => (KeyId | KeyProps)[];
99
100
  export type GetGGBAnswer<TIdentifiers, TOptions = {}> = (args: TIdentifiers, options?: TOptions) => string[];
@@ -130,6 +131,7 @@ export interface Exercise<TIdentifiers = {}, TOptions = {}> {
130
131
  subject: "Mathématiques" | "Chimie" | "Physique";
131
132
  hasHintAndCorrection?: boolean;
132
133
  getInstruction?: GetInstruction<TIdentifiers, TOptions>;
134
+ getStartStatement?: GetStartStatement<TIdentifiers, TOptions>;
133
135
  getHint?: GetHint<TIdentifiers, TOptions>;
134
136
  getCorrection?: GetCorrection<TIdentifiers, TOptions>;
135
137
  getKeys?: GetKeys<TIdentifiers, TOptions>;
@@ -1 +1 @@
1
- {"version":3,"file":"exercise.d.ts","sourceRoot":"","sources":["../../src/exercises/exercise.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAIhD,eAAO,MAAM,YAAY,UAChB,WAAW,EAAE,aACT,MAAM,WACT,KAAK,GAAG,KAAK,SAQtB,CAAC;AACF,eAAO,MAAM,YAAY,UAChB,WAAW,EAAE,aACT,MAAM,WACT,KAAK,GAAG,KAAK,SAQtB,CAAC;AACF,eAAO,MAAM,iBAAiB,UACrB,WAAW,EAAE,aACT,MAAM,WACT,KAAK,GAAG,KAAK,SAUtB,CAAC;AAEF,eAAO,MAAM,YAAY,UAAW,WAAW,EAAE,KAAK,MAAM,kBAE3D,CAAC;AAEF,oBAAY,qBAAqB;IAC/B,UAAU,eAAe;IACzB,GAAG,QAAQ;IACX,GAAG,QAAQ;IACX,WAAW,gBAAgB;IAC3B,IAAI,SAAS;IACb,UAAU,eAAe;IACzB,MAAM,WAAW;IACjB,GAAG,QAAQ;IACX,IAAI,SAAS;CACd;AACD,oBAAY,mBAAmB;IAC7B,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,WAAW,gBAAgB;CAC5B;AACD,MAAM,MAAM,eAAe,CAAC,MAAM,GAAG,GAAG,IAAI;IAC1C,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,mBAAmB,CAAC;IAC1B,MAAM,EAAE,qBAAqB,CAAC;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;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QAAQ,GACR,iBAAiB,GACjB,cAAc,GACd,cAAc,GACd,QAAQ,GACR,UAAU,GACV,uBAAuB,GACvB,oBAAoB,GACpB,eAAe,GACf,gBAAgB,GAChB,UAAU,CAAC;AAEf,MAAM,MAAM,SAAS,GACjB,mBAAmB,GACnB,sBAAsB,GACtB,QAAQ,GACR,kBAAkB,GAClB,WAAW,GACX,SAAS,GACT,cAAc,GACd,+CAA+C,GAC/C,OAAO,GACP,KAAK,GACL,wBAAwB,GACxB,SAAS,GACT,KAAK,GACL,aAAa,GACb,4BAA4B,GAC5B,oBAAoB,GACpB,WAAW,GACX,iBAAiB,GACjB,SAAS,CAAC"}
@@ -2,7 +2,7 @@ import { Exercise } from "../../../../exercises/exercise";
2
2
  type Identifiers = {
3
3
  integerFirst: boolean;
4
4
  integer: number;
5
- rational: [number, number];
5
+ rational: number[];
6
6
  };
7
7
  export declare const fractionAndIntegerDivision: Exercise<Identifiers>;
8
8
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"fractionAndIntegerDivision.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionAndIntegerDivision.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAgGlC,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,OAAO,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC5B,CAAC;AAwCF,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,WAAW,CAe5D,CAAC"}
1
+ {"version":3,"file":"fractionAndIntegerDivision.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionAndIntegerDivision.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,0BAA0B,CAAC;AAYlC,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,OAAO,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AAiKF,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,WAAW,CAmB5D,CAAC"}
@@ -9,66 +9,100 @@ const randint_1 = require("../../../../math/utils/random/randint");
9
9
  const divideNode_1 = require("../../../../tree/nodes/operators/divideNode");
10
10
  const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
11
11
  const coinFlip_1 = require("../../../../utils/alea/coinFlip");
12
- const getFractionAndIntegerDivision = () => {
13
- const rational = rational_1.RationalConstructor.randomIrreductible();
14
- const integerFirst = (0, coinFlip_1.coinFlip)();
15
- const integer = integerFirst
16
- ? new integer_1.Integer((0, randint_1.randint)(-10, 11, [0]))
17
- : new integer_1.Integer((0, randint_1.randint)(-10, 11, [0, 1]));
18
- const statementTree = integerFirst
19
- ? new divideNode_1.DivideNode(integer.toTree(), rational.toTree())
20
- : new divideNode_1.DivideNode(rational.toTree(), integer.toTree());
12
+ const getAnswer = (identifiers) => {
13
+ const { integerFirst, integer, rational } = identifiers;
14
+ const rationalObj = new rational_1.Rational(rational[0], rational[1]);
15
+ const integerObj = new integer_1.Integer(integer);
21
16
  const answerTree = integerFirst
22
- ? integer.divide(rational).toTree()
23
- : rational.divide(integer).toTree();
17
+ ? integerObj.divide(rationalObj).toTree()
18
+ : rationalObj.divide(integerObj).toTree();
24
19
  const answerTex = answerTree.toTex();
20
+ return answerTex;
21
+ };
22
+ const getInstruction = (identifiers) => {
23
+ const { integerFirst, integer, rational } = identifiers;
24
+ const rationalObj = new rational_1.Rational(rational[0], rational[1]);
25
+ const statementTree = integerFirst
26
+ ? new divideNode_1.DivideNode(integer.toTree(), rationalObj.toTree())
27
+ : new divideNode_1.DivideNode(rationalObj.toTree(), integer.toTree());
28
+ return `Calculer et simplifier au maximum :
29
+
30
+ $$
31
+ ${statementTree.toTex()}
32
+ $$`;
33
+ };
34
+ const getHint = (identifiers) => {
35
+ return "Pour diviser une fraction par un nombre entier, on peut écrire le nombre entier sous forme de fraction. Puis, on multiplie la première fraction par l'inverse de la seconde. Enfin, on simplife la fraction obtenue si possible.";
36
+ };
37
+ const getCorrection = (identifiers) => {
38
+ const { integerFirst, integer, rational } = identifiers;
39
+ const rationalObj = new rational_1.Rational(rational[0], rational[1]);
25
40
  const beforeSimplification = integerFirst
26
- ? new rational_1.Rational(integer.value * rational.denum, rational.num)
27
- : new rational_1.Rational(rational.num, rational.denum * integer.value);
28
- const question = {
29
- instruction: `Calculer et donner le résultat sous la forme d'une fraction irréductible : $${statementTree.toTex()}$`,
30
- startStatement: statementTree.toTex(),
31
- answer: answerTex,
32
- keys: [],
33
- hint: "Pour diviser une fraction par un nombre entier, on peut écrire le nombre entier sous forme de fraction. Puis, on multiplie la première fraction par l'inverse de la seconde. Enfin, on simplife la fraction obtenue si possible.",
34
- correction: `
35
- On écrit $${integer.value}$ sous forme de fraction :
41
+ ? new rational_1.Rational(integer * rationalObj.denum, rationalObj.num)
42
+ : new rational_1.Rational(rationalObj.num, rationalObj.denum * integer);
43
+ const answerTex = getAnswer(identifiers);
44
+ return `
45
+ On écrit $${integer}$ sous forme de fraction :
36
46
 
37
47
  $$
38
- ${integer.value} = \\frac{${integer.value}}{1}
48
+ ${integer} = \\frac{${integer}}{1}
39
49
  $$
40
50
 
41
51
  On multiplie la première fraction par l'inverse de la seconde :
42
52
 
43
53
  $$
44
54
  ${integerFirst
45
- ? `\\frac{${integer.value}}{1}\\div ${rational.toTree().toTex()} = \\frac{${integer.value}}{1} \\times ${rational
46
- .reverse(false)
47
- .toTree()
48
- .toTex()} = \\frac{${new multiplyNode_1.MultiplyNode(integer.toTree(), rational.denum.toTree()).toTex({ forceNoSimplification: true })}}{${new multiplyNode_1.MultiplyNode((1).toTree(), rational.num.toTree()).toTex({ forceNoSimplification: true })}}
55
+ ? `\\frac{${integer}}{1}\\div ${rationalObj
56
+ .toTree()
57
+ .toTex()} = \\frac{${integer}}{1} \\times ${rationalObj
58
+ .reverse(false)
59
+ .toTree()
60
+ .toTex()} = \\frac{${new multiplyNode_1.MultiplyNode(integer.toTree(), rationalObj.denum.toTree()).toTex({ forceNoSimplification: true })}}{${new multiplyNode_1.MultiplyNode((1).toTree(), rationalObj.num.toTree()).toTex({ forceNoSimplification: true })}}
49
61
  = ${beforeSimplification.toTree().toTex()}`
50
- : `${rational.toTree().toTex()}\\div \\frac{${integer.value}}{1} = ${rational.toTree().toTex()}\\times \\frac{1}{${integer.value}} = \\frac{${rational.num}\\times 1}{${new multiplyNode_1.MultiplyNode(rational.denum.toTree(), integer.toTree()).toTex({ forceNoSimplification: true })}} = ${beforeSimplification
51
- .toTree()
52
- .toTex()}`}
62
+ : `${rationalObj
63
+ .toTree()
64
+ .toTex()}\\div \\frac{${integer}}{1} = ${rationalObj
65
+ .toTree()
66
+ .toTex()}\\times \\frac{1}{${integer}} = \\frac{${rationalObj.num}\\times 1}{${new multiplyNode_1.MultiplyNode(rationalObj.denum.toTree(), integer.toTree()).toTex({ forceNoSimplification: true })}} = ${beforeSimplification
67
+ .toTree()
68
+ .toTex()}`}
53
69
  $$
54
70
 
55
71
  ${!beforeSimplification.isIrreductible()
56
- ? `On peut alors simplifier cette fraction :
72
+ ? `On peut alors simplifier cette fraction :
57
73
 
58
74
  $$
59
75
  ${beforeSimplification.toTree().toTex()} = ${answerTex}
60
76
  $$
61
77
  `
62
- : "Cette fraction est déjà irréductible."}
78
+ : "Cette fraction est déjà simplifiée."}
63
79
 
64
80
  Ainsi, le résultat attendu est $${answerTex}$.
65
- `,
81
+ `;
82
+ };
83
+ const getFractionAndIntegerDivision = () => {
84
+ const rational = rational_1.RationalConstructor.randomIrreductible();
85
+ const integerFirst = (0, coinFlip_1.coinFlip)();
86
+ const integer = integerFirst
87
+ ? new integer_1.Integer((0, randint_1.randint)(-10, 11, [0]))
88
+ : new integer_1.Integer((0, randint_1.randint)(-10, 11, [0, 1]));
89
+ const statementTree = integerFirst
90
+ ? new divideNode_1.DivideNode(integer.toTree(), rational.toTree())
91
+ : new divideNode_1.DivideNode(rational.toTree(), integer.toTree());
92
+ const identifiers = {
93
+ integerFirst,
94
+ integer: integer.value,
95
+ rational: [rational.num, rational.denum],
96
+ };
97
+ const question = {
98
+ instruction: getInstruction(identifiers),
99
+ startStatement: statementTree.toTex(),
100
+ answer: getAnswer(identifiers),
101
+ keys: [],
102
+ hint: getHint(identifiers),
103
+ correction: getCorrection(identifiers),
66
104
  answerFormat: "tex",
67
- identifiers: {
68
- integerFirst,
69
- integer: integer.value,
70
- rational: [rational.num, rational.denum],
71
- },
105
+ identifiers,
72
106
  };
73
107
  return question;
74
108
  };
@@ -112,4 +146,8 @@ exports.fractionAndIntegerDivision = {
112
146
  isAnswerValid,
113
147
  subject: "Mathématiques",
114
148
  hasHintAndCorrection: true,
149
+ getAnswer,
150
+ getInstruction,
151
+ getHint,
152
+ getCorrection,
115
153
  };
@@ -1,8 +1,12 @@
1
1
  import { Exercise } from "../../../../exercises/exercise";
2
2
  type Identifiers = {
3
3
  integer: number;
4
- rational: [number, number];
4
+ rational: number[];
5
+ integerFirst: boolean;
5
6
  };
6
- export declare const fractionAndIntegerProduct: Exercise<Identifiers>;
7
+ type Options = {
8
+ allowNonIrreductible?: boolean;
9
+ };
10
+ export declare const fractionAndIntegerProduct: Exercise<Identifiers, Options>;
7
11
  export {};
8
12
  //# sourceMappingURL=fractionAndIntegerProduct.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fractionAndIntegerProduct.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionAndIntegerProduct.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AA+DlC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC5B,CAAC;AAqCF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAe3D,CAAC"}
1
+ {"version":3,"file":"fractionAndIntegerProduct.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionAndIntegerProduct.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,0BAA0B,CAAC;AAkBlC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AA2IF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAqBpE,CAAC"}
@@ -2,75 +2,117 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.fractionAndIntegerProduct = 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
- const integer_1 = require("../../../../math/numbers/integer/integer");
7
7
  const rational_1 = require("../../../../math/numbers/rationals/rational");
8
8
  const randint_1 = require("../../../../math/utils/random/randint");
9
+ const fractionNode_1 = require("../../../../tree/nodes/operators/fractionNode");
9
10
  const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
11
+ const rationalParser_1 = require("../../../../tree/parsers/rationalParser");
12
+ const coinFlip_1 = require("../../../../utils/alea/coinFlip");
10
13
  const shuffle_1 = require("../../../../utils/alea/shuffle");
11
- const getFractionAndIntegerProduct = () => {
12
- const rational = rational_1.RationalConstructor.randomIrreductible();
13
- const integer = new integer_1.Integer((0, randint_1.randint)(-10, 11, [0, 1]));
14
- const statementTree = new multiplyNode_1.MultiplyNode(rational.toTree(), integer.toTree());
15
- statementTree.shuffle();
16
- const answerTree = rational.multiply(integer).toTree();
17
- const answer = answerTree.toTex();
18
- const beforeSimplification = new rational_1.Rational(rational.num * integer.value, rational.denum);
19
- const question = {
20
- instruction: `Calculer et donner le résultat sous la forme d'une fraction irréductible : $${statementTree.toTex()}$`,
21
- startStatement: statementTree.toTex(),
22
- answer,
23
- keys: [],
24
- answerFormat: "tex",
25
- hint: "Pour multiplier une fraction par un nombre entier, on multiplie le numérateur de la fraction par le nombre entier, sans toucher au dénominateur. On simplifie ensuite la fraction obtenue si possible.",
26
- correction: `
14
+ const options = [allowNonIrreductibleFractions_1.allowNonIrreductibleOption];
15
+ const getStatement = (identifiers) => {
16
+ const { integer, rational, integerFirst } = identifiers;
17
+ const fraction = (0, fractionNode_1.frac)(rational[0], rational[1]);
18
+ const statementTree = integerFirst
19
+ ? (0, multiplyNode_1.multiply)(integer, fraction)
20
+ : (0, multiplyNode_1.multiply)(fraction, integer);
21
+ return statementTree;
22
+ };
23
+ const getInstruction = (identifiers, opts) => {
24
+ const statementTree = getStatement(identifiers);
25
+ return `Calculer ${opts?.allowNonIrreductible
26
+ ? ""
27
+ : "et donner le résultat sous la forme la plus simplifiée possible"} :
28
+
29
+ $$
30
+ ${statementTree.toTex()}
31
+ $$`;
32
+ };
33
+ const getStartStatement = (identifiers) => {
34
+ const statementTree = getStatement(identifiers);
35
+ return statementTree.toTex();
36
+ };
37
+ const getAnswer = (identifiers) => {
38
+ const statementTree = getStatement(identifiers);
39
+ return statementTree.simplify().toTex();
40
+ };
41
+ const getHint = (identifiers) => {
42
+ return "Pour multiplier une fraction par un nombre entier, on multiplie le numérateur de la fraction par le nombre entier, sans toucher au dénominateur. On simplifie ensuite la fraction obtenue si possible.";
43
+ };
44
+ const getCorrection = (identifiers) => {
45
+ const { integer, rational } = identifiers;
46
+ const answer = getAnswer(identifiers);
47
+ const statementTree = getStatement(identifiers);
48
+ const beforeSimplification = new rational_1.Rational(rational[0] * integer, rational[1]);
49
+ return `
27
50
  On multiplie le numérateur de la fraction par le nombre entier :
28
51
 
29
52
  $$
30
- ${statementTree.toTex()} = \\frac{${new multiplyNode_1.MultiplyNode(rational.num.toTree(), integer.toTree()).toTex({ forceNoSimplification: true })}}{${rational.denum}} = ${beforeSimplification.toTree().toTex()}
53
+ ${statementTree.toTex()} = \\frac{${new multiplyNode_1.MultiplyNode(rational[0].toTree(), integer.toTree()).toTex({ forceNoSimplification: true })}}{${rational[1]}} = ${beforeSimplification.toTree().toTex()}
31
54
  $$
32
55
 
33
56
  ${!beforeSimplification.isIrreductible()
34
- ? `On peut alors simplifier cette fraction :
57
+ ? `On peut alors simplifier cette fraction :
35
58
 
36
59
  $$
37
60
  ${beforeSimplification.toTree().toTex()} = ${answer}
38
61
  $$
39
62
  `
40
- : "Cette fraction est déjà irréductible."}
63
+ : "Cette fraction est déjà simplifiée."}
41
64
 
42
65
  Ainsi, le résultat attendu est $${answer}$.
43
- `,
44
- identifiers: {
45
- integer: integer.value,
46
- rational: [rational.num, rational.denum],
47
- },
66
+ `;
67
+ };
68
+ const getFractionAndIntegerProduct = (opts) => {
69
+ const rational = rational_1.RationalConstructor.randomIrreductible();
70
+ const integer = (0, randint_1.randint)(-10, 11, [-1, 0, 1]);
71
+ const integerFirst = (0, coinFlip_1.coinFlip)();
72
+ const identifiers = {
73
+ integer,
74
+ rational: [rational.num, rational.denum],
75
+ integerFirst,
76
+ };
77
+ const question = {
78
+ instruction: getInstruction(identifiers, opts),
79
+ startStatement: getStartStatement(identifiers),
80
+ answer: getAnswer(identifiers),
81
+ keys: [],
82
+ answerFormat: "tex",
83
+ hint: getHint(identifiers),
84
+ correction: getCorrection(identifiers),
85
+ identifiers,
48
86
  };
49
87
  return question;
50
88
  };
51
89
  const getPropositions = (n, { answer, integer, rational }) => {
52
90
  const propositions = [];
53
- const integerObj = new integer_1.Integer(integer);
54
- const rationalObj = new rational_1.Rational(rational[0], rational[1]);
55
91
  (0, exercise_1.addValidProp)(propositions, answer);
56
- (0, exercise_1.tryToAddWrongProp)(propositions, new rational_1.Rational(integerObj.value * rationalObj.num, integerObj.value * rationalObj.denum).toTex());
92
+ (0, exercise_1.tryToAddWrongProp)(propositions, (0, fractionNode_1.frac)(integer * rational[0], integer * rational[1]).toTex());
57
93
  while (propositions.length < n) {
58
94
  const randomMultiplier = (0, randint_1.randint)(-10, 10);
59
- const wrongAnswerTree = rationalObj
60
- .multiply(new integer_1.Integer(randomMultiplier))
61
- .toTree();
95
+ const wrongAnswerTree = (0, multiplyNode_1.multiply)((0, fractionNode_1.frac)(rational[0], rational[1]), randomMultiplier).simplify();
62
96
  (0, exercise_1.tryToAddWrongProp)(propositions, wrongAnswerTree.toTex());
63
97
  }
64
98
  return (0, shuffle_1.shuffle)(propositions);
65
99
  };
66
- const isAnswerValid = (ans, { integer, rational }) => {
67
- const integerObj = new integer_1.Integer(integer);
68
- const rationalObj = new rational_1.Rational(rational[0], rational[1]);
69
- const answerTree = rationalObj
70
- .multiply(integerObj)
71
- .toTree({ allowFractionToDecimal: true });
72
- const texs = answerTree.toAllValidTexs();
73
- return texs.includes(ans);
100
+ const isAnswerValid = (ans, { integer, rational, integerFirst, answer }, opts) => {
101
+ const answerTree = getStatement({
102
+ integer,
103
+ rational,
104
+ integerFirst,
105
+ }).simplify();
106
+ const texs = answerTree.toAllValidTexs({ allowFractionToDecimal: true });
107
+ if (opts?.allowNonIrreductible) {
108
+ const parsed = (0, rationalParser_1.rationalParser)(ans);
109
+ if (!parsed)
110
+ return false;
111
+ return texs.includes(parsed.simplify().toTex());
112
+ }
113
+ else {
114
+ return texs.includes(ans);
115
+ }
74
116
  };
75
117
  exports.fractionAndIntegerProduct = {
76
118
  id: "fractionAndIntegerProduct",
@@ -79,11 +121,17 @@ exports.fractionAndIntegerProduct = {
79
121
  levels: ["4ème", "3ème", "2nde", "CAP", "2ndPro", "1rePro"],
80
122
  isSingleStep: false,
81
123
  sections: ["Fractions"],
82
- generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getFractionAndIntegerProduct, nb),
124
+ generator: (nb, opts) => (0, getDistinctQuestions_1.getDistinctQuestions)(() => getFractionAndIntegerProduct(opts), nb),
83
125
  qcmTimer: 60,
84
126
  freeTimer: 60,
85
127
  getPropositions,
86
128
  isAnswerValid,
87
129
  hasHintAndCorrection: true,
88
130
  subject: "Mathématiques",
131
+ getHint,
132
+ getCorrection,
133
+ getInstruction,
134
+ getAnswer,
135
+ getStartStatement,
136
+ options,
89
137
  };
@@ -3,6 +3,9 @@ type Identifiers = {
3
3
  integer: number;
4
4
  rational: [number, number];
5
5
  };
6
- export declare const fractionAndIntegerSum: Exercise<Identifiers>;
6
+ type Options = {
7
+ allowNonIrreductible?: boolean;
8
+ };
9
+ export declare const fractionAndIntegerSum: Exercise<Identifiers, Options>;
7
10
  export {};
8
11
  //# sourceMappingURL=fractionAndIntegerSum.d.ts.map
@@ -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;AAgClC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC5B,CAAC;AA0CF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,CAavD,CAAC"}
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"}
@@ -2,13 +2,15 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.fractionAndIntegerSum = 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 integer_1 = require("../../../../math/numbers/integer/integer");
7
8
  const rational_1 = require("../../../../math/numbers/rationals/rational");
8
9
  const randint_1 = require("../../../../math/utils/random/randint");
9
10
  const addNode_1 = require("../../../../tree/nodes/operators/addNode");
11
+ const rationalParser_1 = require("../../../../tree/parsers/rationalParser");
10
12
  const shuffle_1 = require("../../../../utils/alea/shuffle");
11
- const getFractionAndIntegerSum = () => {
13
+ const getFractionAndIntegerSum = (opts) => {
12
14
  const rational = rational_1.RationalConstructor.randomIrreductible();
13
15
  const integer = new integer_1.Integer((0, randint_1.randint)(-10, 11, [0]));
14
16
  const statementTree = new addNode_1.AddNode(rational.toTree(), integer.toTree());
@@ -16,7 +18,13 @@ const getFractionAndIntegerSum = () => {
16
18
  const answerTree = rational.add(integer).toTree();
17
19
  const answer = answerTree.toTex();
18
20
  const question = {
19
- instruction: `Calculer et donner le résultat sous la forme d'une fraction irréductible : $${statementTree.toTex()}$`,
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
+ $`,
20
28
  startStatement: statementTree.toTex(),
21
29
  answer,
22
30
  keys: [],
@@ -43,14 +51,23 @@ const getPropositions = (n, { answer, integer, rational }) => {
43
51
  }
44
52
  return (0, shuffle_1.shuffle)(propositions);
45
53
  };
46
- const isAnswerValid = (ans, { integer, rational }) => {
54
+ const options = [allowNonIrreductibleFractions_1.allowNonIrreductibleOption];
55
+ const isAnswerValid = (ans, { integer, rational }, opts) => {
47
56
  const integerObj = new integer_1.Integer(integer);
48
57
  const rationalObj = new rational_1.Rational(rational[0], rational[1]);
49
58
  const answerTree = rationalObj
50
59
  .add(integerObj)
51
60
  .toTree({ allowFractionToDecimal: true });
52
61
  const texs = answerTree.toAllValidTexs();
53
- return texs.includes(ans);
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
+ }
54
71
  };
55
72
  exports.fractionAndIntegerSum = {
56
73
  id: "fractionAndIntegerSum",
@@ -59,10 +76,11 @@ exports.fractionAndIntegerSum = {
59
76
  levels: ["4ème", "3ème", "2nde", "CAP", "2ndPro", "1rePro"],
60
77
  isSingleStep: false,
61
78
  sections: ["Fractions"],
62
- generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getFractionAndIntegerSum, nb),
79
+ generator: (nb, opts) => (0, getDistinctQuestions_1.getDistinctQuestions)(() => getFractionAndIntegerSum(opts), nb),
63
80
  qcmTimer: 60,
64
81
  freeTimer: 60,
65
82
  getPropositions,
66
83
  isAnswerValid,
67
84
  subject: "Mathématiques",
85
+ options,
68
86
  };
@@ -1 +1 @@
1
- {"version":3,"file":"fractionsDivision.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionsDivision.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AAgElC,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,aAAa,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC,CAAC;AAwCF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAcnD,CAAC"}
1
+ {"version":3,"file":"fractionsDivision.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionsDivision.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AAkFlC,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,aAAa,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC,CAAC;AAgDF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAgBnD,CAAC"}
@@ -2,11 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.fractionsDivision = 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 divideNode_1 = require("../../../../tree/nodes/operators/divideNode");
9
+ const rationalParser_1 = require("../../../../tree/parsers/rationalParser");
8
10
  const shuffle_1 = require("../../../../utils/alea/shuffle");
9
- const getFractionsDivision = () => {
11
+ const options = [allowNonIrreductibleFractions_1.allowNonIrreductibleOption];
12
+ const getFractionsDivision = (opts) => {
10
13
  const rational = rational_1.RationalConstructor.randomIrreductible();
11
14
  const rational2 = rational_1.RationalConstructor.randomIrreductible();
12
15
  const statementTree = new divideNode_1.DivideNode(rational.toTree(), rational2.toTree());
@@ -15,7 +18,13 @@ const getFractionsDivision = () => {
15
18
  const beforeSimplification = new rational_1.Rational(rational.num * rational2.denum, rational.denum * rational2.num);
16
19
  const isSimplifiable = !beforeSimplification.isIrreductible();
17
20
  const question = {
18
- instruction: `Calculer et donner le résultat sous la forme d'une fraction irréductible : $${statementTree.toTex()}$`,
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
+ $$`,
19
28
  startStatement: statementTree.toTex(),
20
29
  answer,
21
30
  keys: [],
@@ -42,7 +51,7 @@ ${isSimplifiable
42
51
  $$
43
52
  ${beforeSimplification.toTree().toTex()} = ${answer}
44
53
  $$`
45
- : "Cette fraction est déjà sous forme irréductible."}
54
+ : "Cette fraction est déjà simplifiée."}
46
55
 
47
56
  Ainsi, le résultat attendu est $${answer}$.
48
57
  `,
@@ -66,14 +75,22 @@ const getPropositions = (n, { answer, rationalNum, rationalDenum }) => {
66
75
  }
67
76
  return (0, shuffle_1.shuffle)(propositions);
68
77
  };
69
- const isAnswerValid = (ans, { rationalDenum, rationalNum }) => {
78
+ const isAnswerValid = (ans, { rationalDenum, rationalNum }, opts) => {
70
79
  const rational = new rational_1.Rational(rationalNum[0], rationalNum[1]);
71
80
  const rational2 = new rational_1.Rational(rationalDenum[0], rationalDenum[1]);
72
81
  const answerTree = rational
73
82
  .divide(rational2)
74
83
  .toTree({ allowFractionToDecimal: true });
75
84
  const texs = answerTree.toAllValidTexs();
76
- return texs.includes(ans);
85
+ if (opts?.allowNonIrreductible) {
86
+ const parsed = (0, rationalParser_1.rationalParser)(ans);
87
+ if (!parsed)
88
+ return false;
89
+ return texs.includes(parsed.simplify().toTex());
90
+ }
91
+ else {
92
+ return texs.includes(ans);
93
+ }
77
94
  };
78
95
  exports.fractionsDivision = {
79
96
  id: "fractionsDivision",
@@ -82,11 +99,12 @@ exports.fractionsDivision = {
82
99
  levels: ["4ème", "3ème", "2nde", "CAP", "2ndPro", "1rePro"],
83
100
  sections: ["Fractions"],
84
101
  isSingleStep: false,
85
- generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getFractionsDivision, nb),
102
+ generator: (nb, opts) => (0, getDistinctQuestions_1.getDistinctQuestions)(() => getFractionsDivision(opts), nb),
86
103
  qcmTimer: 60,
87
104
  freeTimer: 60,
88
105
  getPropositions,
89
106
  isAnswerValid,
90
107
  subject: "Mathématiques",
91
108
  hasHintAndCorrection: true,
109
+ options,
92
110
  };
@@ -3,6 +3,9 @@ type Identifiers = {
3
3
  rationalNum: [number, number];
4
4
  rationalDenum: [number, number];
5
5
  };
6
- export declare const fractionsProduct: Exercise<Identifiers>;
6
+ type Options = {
7
+ allowNonIrreductible?: boolean;
8
+ };
9
+ export declare const fractionsProduct: Exercise<Identifiers, Options>;
7
10
  export {};
8
11
  //# sourceMappingURL=fractionsProduct.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fractionsProduct.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionsProduct.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AAUlC,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,aAAa,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC,CAAC;AA8EF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAclD,CAAC"}
1
+ {"version":3,"file":"fractionsProduct.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionsProduct.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AAYlC,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,aAAa,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AAgGF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAgB3D,CAAC"}