math-exercises 2.0.6 → 2.0.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.
Files changed (156) hide show
  1. package/lib/exercises/calculLitteral/equation/index.d.ts +0 -2
  2. package/lib/exercises/calculLitteral/equation/index.d.ts.map +1 -1
  3. package/lib/exercises/calculLitteral/equation/index.js +0 -2
  4. package/lib/exercises/calculLitteral/simplifying/index.d.ts +0 -2
  5. package/lib/exercises/calculLitteral/simplifying/index.d.ts.map +1 -1
  6. package/lib/exercises/calculLitteral/simplifying/index.js +0 -2
  7. package/lib/exercises/complex/argumentFromAlgebraicComplex.d.ts +6 -0
  8. package/lib/exercises/complex/argumentFromAlgebraicComplex.d.ts.map +1 -1
  9. package/lib/exercises/complex/argumentFromAlgebraicComplex.js +62 -51
  10. package/lib/exercises/complex/index.d.ts +1 -0
  11. package/lib/exercises/complex/index.d.ts.map +1 -1
  12. package/lib/exercises/complex/index.js +1 -0
  13. package/lib/exercises/exercise.d.ts +1 -1
  14. package/lib/exercises/exercise.d.ts.map +1 -1
  15. package/lib/exercises/functions/basics/graphicEquation.d.ts +8 -0
  16. package/lib/exercises/functions/basics/graphicEquation.d.ts.map +1 -0
  17. package/lib/exercises/functions/basics/graphicEquation.js +109 -0
  18. package/lib/exercises/functions/basics/graphicInequation.d.ts +16 -0
  19. package/lib/exercises/functions/basics/graphicInequation.d.ts.map +1 -0
  20. package/lib/exercises/functions/basics/graphicInequation.js +147 -0
  21. package/lib/exercises/functions/basics/index.d.ts +2 -0
  22. package/lib/exercises/functions/basics/index.d.ts.map +1 -1
  23. package/lib/exercises/functions/basics/index.js +2 -0
  24. package/lib/exercises/functions/exponential/expEquation.d.ts +9 -0
  25. package/lib/exercises/functions/exponential/expEquation.d.ts.map +1 -0
  26. package/lib/exercises/functions/exponential/expEquation.js +75 -0
  27. package/lib/exercises/functions/exponential/expSimplifiying.d.ts +10 -0
  28. package/lib/exercises/functions/exponential/expSimplifiying.d.ts.map +1 -0
  29. package/lib/exercises/functions/exponential/expSimplifiying.js +116 -0
  30. package/lib/exercises/functions/exponential/index.d.ts +3 -0
  31. package/lib/exercises/functions/exponential/index.d.ts.map +1 -0
  32. package/lib/exercises/functions/exponential/index.js +18 -0
  33. package/lib/exercises/functions/index.d.ts +2 -0
  34. package/lib/exercises/functions/index.d.ts.map +1 -1
  35. package/lib/exercises/functions/index.js +2 -0
  36. package/lib/exercises/functions/logarithm/index.d.ts +5 -0
  37. package/lib/exercises/functions/logarithm/index.d.ts.map +1 -0
  38. package/lib/exercises/functions/logarithm/index.js +20 -0
  39. package/lib/exercises/functions/logarithm/log10PowerSimplifying.d.ts +7 -0
  40. package/lib/exercises/functions/logarithm/log10PowerSimplifying.d.ts.map +1 -0
  41. package/lib/exercises/functions/logarithm/log10PowerSimplifying.js +54 -0
  42. package/lib/exercises/functions/logarithm/logEquation.d.ts +9 -0
  43. package/lib/exercises/functions/logarithm/logEquation.d.ts.map +1 -0
  44. package/lib/exercises/functions/logarithm/logEquation.js +74 -0
  45. package/lib/exercises/functions/logarithm/logPowerEquation.d.ts +12 -0
  46. package/lib/exercises/functions/logarithm/logPowerEquation.d.ts.map +1 -0
  47. package/lib/exercises/functions/logarithm/logPowerEquation.js +103 -0
  48. package/lib/exercises/functions/logarithm/logSimplifiying.d.ts +9 -0
  49. package/lib/exercises/functions/logarithm/logSimplifiying.d.ts.map +1 -0
  50. package/lib/exercises/functions/logarithm/logSimplifiying.js +77 -0
  51. package/lib/exercises/sets/intervals/inequalityToInterval.d.ts.map +1 -1
  52. package/lib/exercises/trigonometry/associatePoint.d.ts +7 -0
  53. package/lib/exercises/trigonometry/associatePoint.d.ts.map +1 -0
  54. package/lib/exercises/trigonometry/associatePoint.js +64 -0
  55. package/lib/exercises/trigonometry/index.d.ts +1 -0
  56. package/lib/exercises/trigonometry/index.d.ts.map +1 -1
  57. package/lib/exercises/trigonometry/index.js +1 -0
  58. package/lib/exercises/trigonometry/remarkableValues.d.ts +1 -1
  59. package/lib/exercises/trigonometry/remarkableValues.d.ts.map +1 -1
  60. package/lib/exercises/trigonometry/remarkableValues.js +9 -7
  61. package/lib/index.d.ts +43 -18
  62. package/lib/index.d.ts.map +1 -1
  63. package/lib/math/complex/complex.d.ts +1 -1
  64. package/lib/math/numbers/logarithms/ln.d.ts +12 -0
  65. package/lib/math/numbers/logarithms/ln.d.ts.map +1 -0
  66. package/lib/math/numbers/logarithms/ln.js +18 -0
  67. package/lib/math/numbers/nombre.js +1 -1
  68. package/lib/math/numbers/reals/extendedRingElement.d.ts +2 -1
  69. package/lib/math/numbers/reals/extendedRingElement.d.ts.map +1 -1
  70. package/lib/math/polynomials/trinom.d.ts +2 -2
  71. package/lib/math/trigonometry/remarkableValue.d.ts +3 -10
  72. package/lib/math/trigonometry/remarkableValue.d.ts.map +1 -1
  73. package/lib/math/trigonometry/remarkableValue.js +5 -15
  74. package/lib/math/trigonometry/remarkableValues.d.ts +7 -1
  75. package/lib/math/trigonometry/remarkableValues.d.ts.map +1 -1
  76. package/lib/math/trigonometry/remarkableValues.js +63 -13
  77. package/lib/math/utils/arithmetic/gcd.js +1 -1
  78. package/lib/server.js +1 -7
  79. package/lib/tree/nodes/algebraicNode.d.ts +3 -0
  80. package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
  81. package/lib/tree/nodes/functions/absNode.d.ts +3 -1
  82. package/lib/tree/nodes/functions/absNode.d.ts.map +1 -1
  83. package/lib/tree/nodes/functions/absNode.js +5 -1
  84. package/lib/tree/nodes/functions/cosNode.d.ts +3 -1
  85. package/lib/tree/nodes/functions/cosNode.d.ts.map +1 -1
  86. package/lib/tree/nodes/functions/cosNode.js +21 -0
  87. package/lib/tree/nodes/functions/expNode.d.ts +3 -1
  88. package/lib/tree/nodes/functions/expNode.d.ts.map +1 -1
  89. package/lib/tree/nodes/functions/expNode.js +4 -0
  90. package/lib/tree/nodes/functions/functionNode.d.ts +3 -2
  91. package/lib/tree/nodes/functions/functionNode.d.ts.map +1 -1
  92. package/lib/tree/nodes/functions/functionNode.js +3 -2
  93. package/lib/tree/nodes/functions/log10Node.d.ts +20 -0
  94. package/lib/tree/nodes/functions/log10Node.d.ts.map +1 -0
  95. package/lib/tree/nodes/functions/log10Node.js +82 -0
  96. package/lib/tree/nodes/functions/logNode.d.ts +3 -1
  97. package/lib/tree/nodes/functions/logNode.d.ts.map +1 -1
  98. package/lib/tree/nodes/functions/logNode.js +33 -1
  99. package/lib/tree/nodes/functions/oppositeNode.d.ts +3 -0
  100. package/lib/tree/nodes/functions/oppositeNode.d.ts.map +1 -1
  101. package/lib/tree/nodes/functions/oppositeNode.js +7 -0
  102. package/lib/tree/nodes/functions/sinNode.d.ts +3 -1
  103. package/lib/tree/nodes/functions/sinNode.d.ts.map +1 -1
  104. package/lib/tree/nodes/functions/sinNode.js +21 -0
  105. package/lib/tree/nodes/functions/sqrtNode.d.ts +3 -0
  106. package/lib/tree/nodes/functions/sqrtNode.d.ts.map +1 -1
  107. package/lib/tree/nodes/functions/sqrtNode.js +41 -0
  108. package/lib/tree/nodes/geometry/lengthNode.d.ts +5 -1
  109. package/lib/tree/nodes/geometry/lengthNode.d.ts.map +1 -1
  110. package/lib/tree/nodes/geometry/lengthNode.js +12 -1
  111. package/lib/tree/nodes/inequations/inequationSolutionNode.d.ts +3 -2
  112. package/lib/tree/nodes/inequations/inequationSolutionNode.d.ts.map +1 -1
  113. package/lib/tree/nodes/inequations/inequationSolutionNode.js +15 -6
  114. package/lib/tree/nodes/node.d.ts +1 -0
  115. package/lib/tree/nodes/node.d.ts.map +1 -1
  116. package/lib/tree/nodes/node.js +14 -1
  117. package/lib/tree/nodes/numbers/constantNode.d.ts +3 -0
  118. package/lib/tree/nodes/numbers/constantNode.d.ts.map +1 -1
  119. package/lib/tree/nodes/numbers/constantNode.js +7 -0
  120. package/lib/tree/nodes/numbers/numberNode.d.ts +3 -0
  121. package/lib/tree/nodes/numbers/numberNode.d.ts.map +1 -1
  122. package/lib/tree/nodes/numbers/numberNode.js +7 -0
  123. package/lib/tree/nodes/operators/addNode.d.ts +3 -0
  124. package/lib/tree/nodes/operators/addNode.d.ts.map +1 -1
  125. package/lib/tree/nodes/operators/addNode.js +175 -0
  126. package/lib/tree/nodes/operators/divideNode.d.ts +3 -0
  127. package/lib/tree/nodes/operators/divideNode.d.ts.map +1 -1
  128. package/lib/tree/nodes/operators/divideNode.js +12 -0
  129. package/lib/tree/nodes/operators/fractionNode.d.ts +3 -0
  130. package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
  131. package/lib/tree/nodes/operators/fractionNode.js +86 -0
  132. package/lib/tree/nodes/operators/multiplyNode.d.ts +5 -0
  133. package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
  134. package/lib/tree/nodes/operators/multiplyNode.js +127 -10
  135. package/lib/tree/nodes/operators/powerNode.d.ts +3 -0
  136. package/lib/tree/nodes/operators/powerNode.d.ts.map +1 -1
  137. package/lib/tree/nodes/operators/powerNode.js +46 -0
  138. package/lib/tree/nodes/operators/substractNode.d.ts +3 -0
  139. package/lib/tree/nodes/operators/substractNode.d.ts.map +1 -1
  140. package/lib/tree/nodes/operators/substractNode.js +12 -0
  141. package/lib/tree/nodes/sets/discreteSetNode.d.ts +3 -1
  142. package/lib/tree/nodes/sets/discreteSetNode.d.ts.map +1 -1
  143. package/lib/tree/nodes/sets/discreteSetNode.js +7 -1
  144. package/lib/tree/nodes/sets/intervalNode.d.ts +3 -1
  145. package/lib/tree/nodes/sets/intervalNode.d.ts.map +1 -1
  146. package/lib/tree/nodes/sets/intervalNode.js +7 -1
  147. package/lib/tree/nodes/sets/setNode.d.ts +9 -1
  148. package/lib/tree/nodes/sets/setNode.d.ts.map +1 -1
  149. package/lib/tree/nodes/sets/setNode.js +12 -0
  150. package/lib/tree/nodes/sets/unionIntervalNode.d.ts +3 -1
  151. package/lib/tree/nodes/sets/unionIntervalNode.d.ts.map +1 -1
  152. package/lib/tree/nodes/sets/unionIntervalNode.js +7 -1
  153. package/lib/tree/nodes/variables/variableNode.d.ts +3 -0
  154. package/lib/tree/nodes/variables/variableNode.d.ts.map +1 -1
  155. package/lib/tree/nodes/variables/variableNode.js +10 -0
  156. package/package.json +1 -1
@@ -3,9 +3,7 @@ export * from "./equationType1Exercise";
3
3
  export * from "./equationType2Exercise";
4
4
  export * from "./equationType3Exercise";
5
5
  export * from "./equationType4Exercise";
6
- export * from "./expEquation";
7
6
  export * from "./firstDegreeEquation";
8
7
  export * from "./fractionEquation";
9
- export * from "./logEquation";
10
8
  export * from "./multiplicationEquation";
11
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/equation/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/equation/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC"}
@@ -19,8 +19,6 @@ __exportStar(require("./equationType1Exercise"), exports);
19
19
  __exportStar(require("./equationType2Exercise"), exports);
20
20
  __exportStar(require("./equationType3Exercise"), exports);
21
21
  __exportStar(require("./equationType4Exercise"), exports);
22
- __exportStar(require("./expEquation"), exports);
23
22
  __exportStar(require("./firstDegreeEquation"), exports);
24
23
  __exportStar(require("./fractionEquation"), exports);
25
- __exportStar(require("./logEquation"), exports);
26
24
  __exportStar(require("./multiplicationEquation"), exports);
@@ -1,5 +1,3 @@
1
1
  export * from "./evaluateExpression";
2
- export * from "./expSimplifiying";
3
- export * from "./logSimplifiying";
4
2
  export * from "./reduceExpression";
5
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/simplifying/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/calculLitteral/simplifying/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC"}
@@ -15,6 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./evaluateExpression"), exports);
18
- __exportStar(require("./expSimplifiying"), exports);
19
- __exportStar(require("./logSimplifiying"), exports);
20
18
  __exportStar(require("./reduceExpression"), exports);
@@ -1 +1,7 @@
1
+ import { MathExercise } from "../../exercises/exercise";
2
+ type Identifiers = {
3
+ arg: number;
4
+ };
5
+ export declare const argumentFromAlgebraicComplex: MathExercise<Identifiers>;
6
+ export {};
1
7
  //# sourceMappingURL=argumentFromAlgebraicComplex.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"argumentFromAlgebraicComplex.d.ts","sourceRoot":"","sources":["../../../src/exercises/complex/argumentFromAlgebraicComplex.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"argumentFromAlgebraicComplex.d.ts","sourceRoot":"","sources":["../../../src/exercises/complex/argumentFromAlgebraicComplex.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EASb,MAAM,0BAA0B,CAAC;AAgBlC,KAAK,WAAW,GAAG;IACjB,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AA4CF,eAAO,MAAM,4BAA4B,EAAE,YAAY,CAAC,WAAW,CAalE,CAAC"}
@@ -1,52 +1,63 @@
1
1
  "use strict";
2
- // import {
3
- // MathExercise,
4
- // Proposition,
5
- // QCMGenerator,
6
- // Question,
7
- // QuestionGenerator,
8
- // VEA,
9
- // addValidProp,
10
- // shuffleProps,
11
- // tryToAddWrongProp,
12
- // } from "../../exercises/exercise";
13
- // import { getDistinctQuestions } from "../../exercises/utils/getDistinctQuestions";
14
- // import { ComplexConstructor } from "../../math/complex/complex";
15
- // type Identifiers = {
16
- // re: number;
17
- // im: number;
18
- // };
19
- // const getArgumentFromAlgebraicComplexQuestion: QuestionGenerator<
20
- // Identifiers
21
- // > = () => {
22
- // const z = ComplexConstructor.random();
23
- // const zTex = z.toTree().toTex();
24
- // const answer = z.toModuleTree().toTex();
25
- // const question: Question<Identifiers> = {
26
- // answer: answer,
27
- // instruction: `Soit $z=${zTex}$. Déterminer le module $|z|$ de $z$.`,
28
- // keys: [],
29
- // answerFormat: "tex",
30
- // identifiers: { re: z.re, im: z.im },
31
- // };
32
- // return question;
33
- // };
34
- // const getPropositions: QCMGenerator<Identifiers> = (n, { answer }) => {
35
- // const propositions: Proposition[] = [];
36
- // addValidProp(propositions, answer);
37
- // while (propositions.length < n) {}
38
- // return shuffleProps(propositions, n);
39
- // };
40
- // export const argumentFromAlgebraicComplex: MathExercise<Identifiers> = {
41
- // id: "argumentFromAlgebraicComplex",
42
- // connector: "=",
43
- // label: "Déterminer l'argument d'un nombre complexe via sa forme algébrique",
44
- // levels: ["MathExp"],
45
- // isSingleStep: true,
46
- // sections: ["Nombres complexes"],
47
- // generator: (nb: number) =>
48
- // getDistinctQuestions(getArgumentFromAlgebraicComplexQuestion, nb),
49
- // qcmTimer: 60,
50
- // freeTimer: 60,
51
- // getPropositions,
52
- // };
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.argumentFromAlgebraicComplex = void 0;
4
+ const exercise_1 = require("../../exercises/exercise");
5
+ const getDistinctQuestions_1 = require("../../exercises/utils/getDistinctQuestions");
6
+ const integer_1 = require("../../math/numbers/integer/integer");
7
+ const rational_1 = require("../../math/numbers/rationals/rational");
8
+ const remarkableValue_1 = require("../../math/trigonometry/remarkableValue");
9
+ const remarkableValues_1 = require("../../math/trigonometry/remarkableValues");
10
+ const randint_1 = require("../../math/utils/random/randint");
11
+ const complexNode_1 = require("../../tree/nodes/complex/complexNode");
12
+ const sqrtNode_1 = require("../../tree/nodes/functions/sqrtNode");
13
+ const numberNode_1 = require("../../tree/nodes/numbers/numberNode");
14
+ const multiplyNode_1 = require("../../tree/nodes/operators/multiplyNode");
15
+ const random_1 = require("../../utils/random");
16
+ const getArgumentFromAlgebraicComplexQuestion = () => {
17
+ const arg = remarkableValue_1.RemarkableValueConstructor.mainInterval();
18
+ const factor = (0, random_1.random)([
19
+ new integer_1.Integer((0, randint_1.randint)(-5, 6, [0, 1])).toTree(),
20
+ rational_1.RationalConstructor.randomIrreductible().toTree(),
21
+ (0, random_1.random)([new sqrtNode_1.SqrtNode(new numberNode_1.NumberNode(2)), new sqrtNode_1.SqrtNode(new numberNode_1.NumberNode(3))]),
22
+ ]);
23
+ const re = new multiplyNode_1.MultiplyNode(factor, arg.cos).simplify();
24
+ const im = new multiplyNode_1.MultiplyNode(factor, arg.sin).simplify();
25
+ const z = new complexNode_1.ComplexNode(re, im);
26
+ const zTex = z.toTex();
27
+ const answer = arg.angle.toTex();
28
+ const question = {
29
+ answer: answer,
30
+ instruction: `Soit $z=${zTex}$. Déterminer l'argument principal de $z$.`,
31
+ keys: ["pi"],
32
+ answerFormat: "tex",
33
+ identifiers: { arg: arg.angle.evaluate({}) },
34
+ };
35
+ return question;
36
+ };
37
+ const getPropositions = (n, { answer }) => {
38
+ const propositions = [];
39
+ (0, exercise_1.addValidProp)(propositions, answer);
40
+ while (propositions.length < n) {
41
+ const randomPoint = remarkableValue_1.RemarkableValueConstructor.mainInterval();
42
+ (0, exercise_1.tryToAddWrongProp)(propositions, randomPoint.angle.toTex());
43
+ }
44
+ return (0, exercise_1.shuffleProps)(propositions, n);
45
+ };
46
+ const isAnswerValid = (ans, { arg }) => {
47
+ const point = remarkableValues_1.remarkableTrigoValues.find((point) => point.angle.evaluate({}) === arg);
48
+ const texs = point.angle.toAllValidTexs();
49
+ return texs.includes(ans);
50
+ };
51
+ exports.argumentFromAlgebraicComplex = {
52
+ id: "argumentFromAlgebraicComplex",
53
+ connector: "=",
54
+ label: "Déterminer l'argument d'un nombre complexe via sa forme algébrique",
55
+ levels: ["MathExp"],
56
+ isSingleStep: true,
57
+ sections: ["Nombres complexes"],
58
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getArgumentFromAlgebraicComplexQuestion, nb),
59
+ qcmTimer: 60,
60
+ freeTimer: 60,
61
+ getPropositions,
62
+ isAnswerValid,
63
+ };
@@ -8,4 +8,5 @@ export * from "./linearCombinaisonComplex";
8
8
  export * from "./moduloFromAlgebraicComplex";
9
9
  export * from "./mutiplyComplex";
10
10
  export * from "./reAndIm";
11
+ export * from "./argumentFromAlgebraicComplex";
11
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/exercises/complex/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAE7B,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/exercises/complex/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAE7B,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,gCAAgC,CAAC"}
@@ -25,3 +25,4 @@ __exportStar(require("./linearCombinaisonComplex"), exports);
25
25
  __exportStar(require("./moduloFromAlgebraicComplex"), exports);
26
26
  __exportStar(require("./mutiplyComplex"), exports);
27
27
  __exportStar(require("./reAndIm"), exports);
28
+ __exportStar(require("./argumentFromAlgebraicComplex"), exports);
@@ -47,5 +47,5 @@ export interface MathExercise<TIdentifiers = {}> {
47
47
  isAnswerValid?: VEA<TIdentifiers>;
48
48
  }
49
49
  export type MathLevel = "6ème" | "5ème" | "4ème" | "3ème" | "2nde" | "1reTech" | "1reESM" | "1reSpé" | "TermSpé" | "TermTech" | "MathExp" | "MathComp" | "CAP" | "2ndPro" | "1rePro" | "TermPro";
50
- export type MathSection = "Aires" | "Arithmétique" | "Calcul littéral" | "Calculs" | "Combinatoire et dénombrement" | "Conversions" | "Dérivation" | "Droites" | "Ensembles et intervalles" | "Équations" | "Équations différentielles" | "Exponentielle" | "Fonction cube" | "Fonction inverse" | "Fonctions" | "Fonctions affines" | "Fonctions de référence" | "Fractions" | "Géométrie cartésienne" | "Géométrie euclidienne" | "Inéquations" | "Intégration" | "Limites" | "Logarithme népérien" | "Nombres complexes" | "Périmètres" | "Pourcentages" | "Primitives" | "Probabilités" | "Proportionnalité" | "Puissances" | "Racines carrées" | "Second degré" | "Statistiques" | "Suites" | "Théorème de Pythagore" | "Théorème de Thalès" | "Trigonométrie" | "Valeur absolue" | "Vecteurs";
50
+ export type MathSection = "Aires" | "Arithmétique" | "Calcul littéral" | "Calculs" | "Combinatoire et dénombrement" | "Conversions" | "Dérivation" | "Droites" | "Ensembles et intervalles" | "Équations" | "Équations différentielles" | "Exponentielle" | "Fonction cube" | "Fonction inverse" | "Fonctions" | "Fonctions affines" | "Fonctions de référence" | "Fractions" | "Géométrie cartésienne" | "Géométrie euclidienne" | "Inéquations" | "Intégration" | "Limites" | "Logarithme népérien" | "Logarithme décimal" | "Nombres complexes" | "Périmètres" | "Pourcentages" | "Primitives" | "Probabilités" | "Proportionnalité" | "Puissances" | "Racines carrées" | "Second degré" | "Statistiques" | "Suites" | "Théorème de Pythagore" | "Théorème de Thalès" | "Trigonométrie" | "Valeur absolue" | "Vecteurs";
51
51
  //# sourceMappingURL=exercise.d.ts.map
@@ -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;AAI3C,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,MAAM,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAElC,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,OAAO,CAAC;IACvB,MAAM,EAAE,KAAK,GAAG,KAAK,CAAC;CACvB,CAAC;AACF,MAAM,WAAW,QAAQ,CAAC,YAAY,GAAG,EAAE;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,cA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AG,MAAM,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,YAAY,CAAC;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,YAAY,CAAC,CAAC;IAClE,aAAa,CAAC,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC;CACnC;AAED,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,SAAS,GACT,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,UAAU,GACV,SAAS,GACT,UAAU,GACV,KAAK,GACL,QAAQ,GACR,QAAQ,GACR,SAAS,CAAC;AAEd,MAAM,MAAM,WAAW,GACnB,OAAO,GACP,cAAc,GACd,iBAAiB,GACjB,SAAS,GACT,8BAA8B,GAC9B,aAAa,GACb,YAAY,GACZ,SAAS,GACT,0BAA0B,GAC1B,WAAW,GACX,2BAA2B,GAC3B,eAAe,GACf,eAAe,GACf,kBAAkB,GAClB,WAAW,GACX,mBAAmB,GACnB,wBAAwB,GACxB,WAAW,GACX,uBAAuB,GACvB,uBAAuB,GACvB,aAAa,GACb,aAAa,GACb,SAAS,GACT,qBAAqB,GACrB,mBAAmB,GACnB,YAAY,GACZ,cAAc,GACd,YAAY,GACZ,cAAc,GACd,kBAAkB,GAClB,YAAY,GACZ,iBAAiB,GACjB,cAAc,GACd,cAAc,GACd,QAAQ,GACR,uBAAuB,GACvB,oBAAoB,GACpB,eAAe,GACf,gBAAgB,GAChB,UAAU,CAAC"}
1
+ {"version":3,"file":"exercise.d.ts","sourceRoot":"","sources":["../../src/exercises/exercise.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAI3C,eAAO,MAAM,YAAY,UAChB,WAAW,EAAE,aACT,MAAM,WACT,KAAK,GAAG,KAAK,SAQtB,CAAC;AACF,eAAO,MAAM,YAAY,UAChB,WAAW,EAA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,GACvB,aAAa,GACb,aAAa,GACb,SAAS,GACT,qBAAqB,GACrB,oBAAoB,GACpB,mBAAmB,GACnB,YAAY,GACZ,cAAc,GACd,YAAY,GACZ,cAAc,GACd,kBAAkB,GAClB,YAAY,GACZ,iBAAiB,GACjB,cAAc,GACd,cAAc,GACd,QAAQ,GACR,uBAAuB,GACvB,oBAAoB,GACpB,eAAe,GACf,gBAAgB,GAChB,UAAU,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { MathExercise } from "../../../exercises/exercise";
2
+ type Identifiers = {
3
+ yValue: number;
4
+ splinePoints: [number, number][];
5
+ };
6
+ export declare const graphicEquation: MathExercise<Identifiers>;
7
+ export {};
8
+ //# sourceMappingURL=graphicEquation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphicEquation.d.ts","sourceRoot":"","sources":["../../../../src/exercises/functions/basics/graphicEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EASb,MAAM,0BAA0B,CAAC;AAYlC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;CAClC,CAAC;AAiGF,eAAO,MAAM,eAAe,EAAE,YAAY,CAAC,WAAW,CAarD,CAAC"}
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.graphicEquation = void 0;
4
+ const exercise_1 = require("../../../exercises/exercise");
5
+ const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
6
+ const equationKeys_1 = require("../../../exercises/utils/keys/equationKeys");
7
+ const randint_1 = require("../../../math/utils/random/randint");
8
+ const equationSolutionNode_1 = require("../../../tree/nodes/equations/equationSolutionNode");
9
+ const numberNode_1 = require("../../../tree/nodes/numbers/numberNode");
10
+ const discreteSetNode_1 = require("../../../tree/nodes/sets/discreteSetNode");
11
+ const coinFlip_1 = require("../../../utils/coinFlip");
12
+ const getGraphicEquationQuestion = () => {
13
+ let xSolutions = [];
14
+ const nb = (0, randint_1.randint)(2, 4);
15
+ // const nb = 2;
16
+ for (let i = 0; i < nb; i++) {
17
+ xSolutions.push((0, randint_1.randint)(-9, 10, xSolutions));
18
+ }
19
+ xSolutions.sort((a, b) => a - b);
20
+ const answer = new equationSolutionNode_1.EquationSolutionNode(new discreteSetNode_1.DiscreteSetNode(xSolutions.map((sol) => new numberNode_1.NumberNode(sol)))).toTex();
21
+ const yValue = (0, randint_1.randint)(-5, 6);
22
+ const splinePoints = [];
23
+ let prevYWasAbove = (0, coinFlip_1.coinFlip)();
24
+ if ((0, coinFlip_1.coinFlip)()) {
25
+ const y = prevYWasAbove ? (0, randint_1.randint)(-2, 0) : (0, randint_1.randint)(1, 3);
26
+ prevYWasAbove = y > 0;
27
+ splinePoints.push([xSolutions[0] - (1 + Math.random() * 3), yValue + y]);
28
+ }
29
+ for (let i = 0; i < xSolutions.length; i++) {
30
+ splinePoints.push([xSolutions[i], yValue]);
31
+ if (i < xSolutions.length - 1) {
32
+ const mid = (xSolutions[i] + xSolutions[i + 1]) / 2;
33
+ const distance = xSolutions[i + 1] - xSolutions[i];
34
+ const x = mid + ((Math.random() * 2) / 5) * (distance / 2);
35
+ const y = prevYWasAbove ? (0, randint_1.randint)(-2, 0) : (0, randint_1.randint)(1, 3);
36
+ prevYWasAbove = y > 0;
37
+ splinePoints.push([x, yValue + y]);
38
+ }
39
+ }
40
+ if ((0, coinFlip_1.coinFlip)() || splinePoints.length < 4) {
41
+ const y = prevYWasAbove ? (0, randint_1.randint)(-2, 0) : (0, randint_1.randint)(1, 3);
42
+ prevYWasAbove = y > 0;
43
+ splinePoints.push([
44
+ xSolutions[xSolutions.length - 1] + (1 + Math.random() * 3),
45
+ yValue + y,
46
+ ]);
47
+ }
48
+ const xMin = Math.min(...splinePoints.map((point) => point[0]));
49
+ const yMin = Math.min(...splinePoints.map((point) => point[1]));
50
+ const xMax = Math.max(...splinePoints.map((point) => point[0]));
51
+ const yMax = Math.max(...splinePoints.map((point) => point[1]));
52
+ const question = {
53
+ answer,
54
+ instruction: `Déterminer graphiquement les solutions de l'équation $f(x) = ${yValue}$ où $f$ est la fonction représentée ci-dessous.`,
55
+ keys: equationKeys_1.equationKeys,
56
+ answerFormat: "tex",
57
+ commands: [
58
+ `Spline(${splinePoints
59
+ .map((point) => `(${point[0]},${point[1]})`)
60
+ .join(",")})`,
61
+ ...splinePoints.map((point) => `(${point[0]},${point[1]})`),
62
+ ],
63
+ coords: [
64
+ Math.min(xMin - 1, -1),
65
+ Math.max(xMax + 1, 1),
66
+ Math.min(yMin - 1, -1),
67
+ Math.max(yMax + 1, 1),
68
+ ],
69
+ identifiers: { yValue, splinePoints },
70
+ };
71
+ return question;
72
+ };
73
+ const getPropositions = (n, { answer }) => {
74
+ const propositions = [];
75
+ (0, exercise_1.addValidProp)(propositions, answer);
76
+ (0, exercise_1.tryToAddWrongProp)(propositions, `S=\\emptyset`);
77
+ while (propositions.length < n) {
78
+ const nbs = [];
79
+ const nbSol = (0, randint_1.randint)(2, 4);
80
+ for (let i = 0; i < nbSol; i++) {
81
+ nbs.push((0, randint_1.randint)(-9, 10, nbs));
82
+ }
83
+ nbs.sort((a, b) => a - b);
84
+ const sol = new equationSolutionNode_1.EquationSolutionNode(new discreteSetNode_1.DiscreteSetNode(nbs.map((nb) => new numberNode_1.NumberNode(nb))));
85
+ (0, exercise_1.tryToAddWrongProp)(propositions, sol.toTex());
86
+ }
87
+ return (0, exercise_1.shuffleProps)(propositions, n);
88
+ };
89
+ const isAnswerValid = (ans, { yValue, splinePoints }) => {
90
+ const xSolutions = splinePoints
91
+ .filter((p) => p[1] === yValue)
92
+ .map((p) => p[0]);
93
+ const answerTree = new equationSolutionNode_1.EquationSolutionNode(new discreteSetNode_1.DiscreteSetNode(xSolutions.map((sol) => new numberNode_1.NumberNode(sol))));
94
+ const texs = answerTree.toAllValidTexs();
95
+ return texs.includes(ans);
96
+ };
97
+ exports.graphicEquation = {
98
+ id: "graphicEquation",
99
+ connector: "\\iff",
100
+ label: "Résoudre graphiquement une équation",
101
+ levels: ["2ndPro", "2nde", "1rePro", "1reESM", "1reTech"],
102
+ isSingleStep: true,
103
+ sections: ["Équations", "Fonctions"],
104
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getGraphicEquationQuestion, nb),
105
+ qcmTimer: 60,
106
+ freeTimer: 60,
107
+ getPropositions,
108
+ isAnswerValid,
109
+ };
@@ -0,0 +1,16 @@
1
+ import { MathExercise } from "../../../exercises/exercise";
2
+ import { ClosureType } from "../../../tree/nodes/sets/intervalNode";
3
+ type Identifiers = {
4
+ yValue: number;
5
+ splinePoints: [number, number][];
6
+ isStrict: boolean;
7
+ isAskingSup: boolean;
8
+ intervals: {
9
+ a: number;
10
+ b: number;
11
+ closure: ClosureType;
12
+ }[];
13
+ };
14
+ export declare const graphicInequation: MathExercise<Identifiers>;
15
+ export {};
16
+ //# sourceMappingURL=graphicInequation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphicInequation.d.ts","sourceRoot":"","sources":["../../../../src/exercises/functions/basics/graphicInequation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EASb,MAAM,0BAA0B,CAAC;AAOlC,OAAO,EAAE,WAAW,EAAgB,MAAM,oCAAoC,CAAC;AAI/E,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;IACjC,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,WAAW,CAAA;KAAE,EAAE,CAAC;CAC7D,CAAC;AA6JF,eAAO,MAAM,iBAAiB,EAAE,YAAY,CAAC,WAAW,CAavD,CAAC"}
@@ -0,0 +1,147 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.graphicInequation = void 0;
4
+ const exercise_1 = require("../../../exercises/exercise");
5
+ const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
6
+ const randint_1 = require("../../../math/utils/random/randint");
7
+ const inequationSolutionNode_1 = require("../../../tree/nodes/inequations/inequationSolutionNode");
8
+ const numberNode_1 = require("../../../tree/nodes/numbers/numberNode");
9
+ const intervalNode_1 = require("../../../tree/nodes/sets/intervalNode");
10
+ const unionIntervalNode_1 = require("../../../tree/nodes/sets/unionIntervalNode");
11
+ const coinFlip_1 = require("../../../utils/coinFlip");
12
+ const getGraphicInequationQuestion = () => {
13
+ let xSolutions = [];
14
+ const nb = (0, randint_1.randint)(2, 4);
15
+ for (let i = 0; i < nb; i++) {
16
+ xSolutions.push((0, randint_1.randint)(-9, 10, xSolutions));
17
+ }
18
+ xSolutions.sort((a, b) => a - b);
19
+ const isAskingSup = (0, coinFlip_1.coinFlip)();
20
+ const isStrict = (0, coinFlip_1.coinFlip)();
21
+ const intervals = [];
22
+ const yValue = (0, randint_1.randint)(-5, 6);
23
+ const splinePoints = [];
24
+ let prevYWasAbove = (0, coinFlip_1.coinFlip)();
25
+ if (!isStrict || (0, coinFlip_1.coinFlip)()) {
26
+ //le !isStrict sert à empcher les points uniques solution
27
+ const x = xSolutions[0] - (0, randint_1.randint)(1, 3);
28
+ const y = prevYWasAbove ? (0, randint_1.randint)(-2, 0) : (0, randint_1.randint)(1, 3);
29
+ if ((y > 0 && isAskingSup) || (y < 0 && !isAskingSup)) {
30
+ intervals.push({
31
+ a: x,
32
+ b: xSolutions[0],
33
+ closure: isStrict ? intervalNode_1.ClosureType.FO : intervalNode_1.ClosureType.FF,
34
+ });
35
+ }
36
+ prevYWasAbove = y > 0;
37
+ splinePoints.push([x, yValue + y]);
38
+ }
39
+ for (let i = 0; i < xSolutions.length; i++) {
40
+ splinePoints.push([xSolutions[i], yValue]);
41
+ if (i < xSolutions.length - 1) {
42
+ const mid = (xSolutions[i] + xSolutions[i + 1]) / 2;
43
+ const distance = xSolutions[i + 1] - xSolutions[i];
44
+ const x = mid + ((Math.random() * 2) / 5) * (distance / 2);
45
+ const y = prevYWasAbove ? (0, randint_1.randint)(-2, 0) : (0, randint_1.randint)(1, 3);
46
+ if ((y > 0 && isAskingSup) || (y < 0 && !isAskingSup)) {
47
+ intervals.push({
48
+ a: xSolutions[i],
49
+ b: xSolutions[i + 1],
50
+ closure: isStrict ? intervalNode_1.ClosureType.OO : intervalNode_1.ClosureType.FF,
51
+ });
52
+ }
53
+ prevYWasAbove = y > 0;
54
+ splinePoints.push([x, yValue + y]);
55
+ }
56
+ }
57
+ if (!isStrict || (0, coinFlip_1.coinFlip)() || splinePoints.length < 4) {
58
+ const x = xSolutions[xSolutions.length - 1] + (0, randint_1.randint)(1, 3);
59
+ const y = prevYWasAbove ? (0, randint_1.randint)(-2, 0) : (0, randint_1.randint)(1, 3);
60
+ if ((y > 0 && isAskingSup) || (y < 0 && !isAskingSup)) {
61
+ intervals.push({
62
+ a: xSolutions[xSolutions.length - 1],
63
+ b: x,
64
+ closure: isStrict ? intervalNode_1.ClosureType.OF : intervalNode_1.ClosureType.FF,
65
+ });
66
+ }
67
+ prevYWasAbove = y > 0;
68
+ splinePoints.push([x, yValue + y]);
69
+ }
70
+ const xMin = Math.min(...splinePoints.map((point) => point[0]));
71
+ const yMin = Math.min(...splinePoints.map((point) => point[1]));
72
+ const xMax = Math.max(...splinePoints.map((point) => point[0]));
73
+ const yMax = Math.max(...splinePoints.map((point) => point[1]));
74
+ const intervalsNodes = intervals.map((i) => new intervalNode_1.IntervalNode(new numberNode_1.NumberNode(i.a), new numberNode_1.NumberNode(i.b), i.closure));
75
+ const answer = intervalsNodes.length === 1
76
+ ? `S=${intervalsNodes[0].toTex()}`
77
+ : `S=${new unionIntervalNode_1.UnionIntervalNode(intervalsNodes).toTex()}`;
78
+ const question = {
79
+ answer,
80
+ instruction: `Déterminer graphiquement les solutions de l'inéquation $f(x)${isAskingSup ? (isStrict ? ">" : "\\geq") : isStrict ? "<" : "\\leq"}${yValue}$ où $f$ est la fonction représentée ci-dessous.`,
81
+ keys: [
82
+ "S",
83
+ "equal",
84
+ "lbracket",
85
+ "semicolon",
86
+ "rbracket",
87
+ "cup",
88
+ "lbrace",
89
+ "rbrace",
90
+ ],
91
+ answerFormat: "tex",
92
+ commands: [
93
+ `Spline(${splinePoints
94
+ .map((point) => `(${point[0]},${point[1]})`)
95
+ .join(",")})`,
96
+ ...splinePoints.map((point) => `(${point[0]},${point[1]})`),
97
+ ],
98
+ coords: [
99
+ Math.min(xMin - 1, -1),
100
+ Math.max(xMax + 1, 1),
101
+ Math.min(yMin - 1, -1),
102
+ Math.max(yMax + 1, 1),
103
+ ],
104
+ identifiers: {
105
+ yValue,
106
+ splinePoints,
107
+ isAskingSup,
108
+ isStrict,
109
+ intervals,
110
+ },
111
+ };
112
+ return question;
113
+ };
114
+ const getPropositions = (n, { answer, intervals, splinePoints, yValue }) => {
115
+ const propositions = [];
116
+ (0, exercise_1.addValidProp)(propositions, answer);
117
+ (0, exercise_1.tryToAddWrongProp)(propositions, `S=\\emptyset`);
118
+ (0, exercise_1.tryToAddWrongProp)(propositions, `S=${new intervalNode_1.IntervalNode(new numberNode_1.NumberNode(splinePoints[0][0]), new numberNode_1.NumberNode(yValue), intervalNode_1.ClosureType.FF).toTex()}`);
119
+ while (propositions.length < n) {
120
+ const a = (0, randint_1.randint)(-9, 3);
121
+ const b = (0, randint_1.randint)(3, 10, [a]);
122
+ (0, exercise_1.tryToAddWrongProp)(propositions, `S=${new intervalNode_1.IntervalNode(new numberNode_1.NumberNode(a), new numberNode_1.NumberNode(b), intervalNode_1.ClosureType.FF).toTex()}`);
123
+ }
124
+ return (0, exercise_1.shuffleProps)(propositions, n);
125
+ };
126
+ const isAnswerValid = (ans, { intervals }) => {
127
+ const intervalsNodes = intervals.map((n) => new intervalNode_1.IntervalNode(new numberNode_1.NumberNode(n.a), new numberNode_1.NumberNode(n.b), n.closure));
128
+ const intervalsTree = intervalsNodes.length === 1
129
+ ? intervalsNodes[0]
130
+ : new unionIntervalNode_1.UnionIntervalNode(intervalsNodes);
131
+ const answerTree = new inequationSolutionNode_1.InequationSolutionNode(intervalsTree);
132
+ const texs = answerTree.toAllValidTexs();
133
+ return texs.includes(ans);
134
+ };
135
+ exports.graphicInequation = {
136
+ id: "graphicInequation",
137
+ connector: "\\iff",
138
+ label: "Résoudre graphiquement une inéquation",
139
+ levels: ["2ndPro", "2nde", "1rePro", "1reESM", "1reTech"],
140
+ isSingleStep: true,
141
+ sections: ["Inéquations", "Fonctions"],
142
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getGraphicInequationQuestion, nb),
143
+ qcmTimer: 60,
144
+ freeTimer: 60,
145
+ getPropositions,
146
+ isAnswerValid,
147
+ };
@@ -2,4 +2,6 @@ export * from "./imageFunction";
2
2
  export * from "./imageFunctionGeogebra";
3
3
  export * from "./inverseImageFunction";
4
4
  export * from "./inverseImageFunctionGeogebra";
5
+ export * from "./graphicEquation";
6
+ export * from "./graphicInequation";
5
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/functions/basics/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gCAAgC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/functions/basics/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC"}
@@ -18,3 +18,5 @@ __exportStar(require("./imageFunction"), exports);
18
18
  __exportStar(require("./imageFunctionGeogebra"), exports);
19
19
  __exportStar(require("./inverseImageFunction"), exports);
20
20
  __exportStar(require("./inverseImageFunctionGeogebra"), exports);
21
+ __exportStar(require("./graphicEquation"), exports);
22
+ __exportStar(require("./graphicInequation"), exports);
@@ -0,0 +1,9 @@
1
+ import { MathExercise } from "../../../exercises/exercise";
2
+ /**ae^x = k */
3
+ type Identifiers = {
4
+ a: number;
5
+ k: number;
6
+ };
7
+ export declare const expEquation: MathExercise<Identifiers>;
8
+ export {};
9
+ //# sourceMappingURL=expEquation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expEquation.d.ts","sourceRoot":"","sources":["../../../../src/exercises/functions/exponential/expEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAQb,MAAM,0BAA0B,CAAC;AAelC,cAAc;AACd,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAwEF,eAAO,MAAM,WAAW,EAAE,YAAY,CAAC,WAAW,CAYjD,CAAC"}
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.expEquation = void 0;
4
+ const exercise_1 = require("../../../exercises/exercise");
5
+ const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
6
+ const rational_1 = require("../../../math/numbers/rationals/rational");
7
+ const randint_1 = require("../../../math/utils/random/randint");
8
+ const equationSolutionNode_1 = require("../../../tree/nodes/equations/equationSolutionNode");
9
+ const expNode_1 = require("../../../tree/nodes/functions/expNode");
10
+ const logNode_1 = require("../../../tree/nodes/functions/logNode");
11
+ const numberNode_1 = require("../../../tree/nodes/numbers/numberNode");
12
+ const equalNode_1 = require("../../../tree/nodes/equations/equalNode");
13
+ const multiplyNode_1 = require("../../../tree/nodes/operators/multiplyNode");
14
+ const discreteSetNode_1 = require("../../../tree/nodes/sets/discreteSetNode");
15
+ const variableNode_1 = require("../../../tree/nodes/variables/variableNode");
16
+ const shuffle_1 = require("../../../utils/shuffle");
17
+ const getExpEquation = () => {
18
+ const a = (0, randint_1.randint)(-9, 20, [0]);
19
+ const k = a > 0 ? (0, randint_1.randint)(1, 20) : (0, randint_1.randint)(-20, 0);
20
+ const equation = new equalNode_1.EqualNode(new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode(a), new expNode_1.ExpNode(new variableNode_1.VariableNode("x"))), new numberNode_1.NumberNode(k));
21
+ const answer = new equationSolutionNode_1.EquationSolutionNode(new discreteSetNode_1.DiscreteSetNode([new logNode_1.LogNode(new rational_1.Rational(k, a).simplify().toTree())])).toTex();
22
+ const question = {
23
+ instruction: `Résoudre l'équation $${equation.toTex()}$.`,
24
+ answer: answer,
25
+ keys: [
26
+ "x",
27
+ "equal",
28
+ "epower",
29
+ "exp",
30
+ "ln",
31
+ "S",
32
+ "lbrace",
33
+ "semicolon",
34
+ "rbrace",
35
+ ],
36
+ answerFormat: "tex",
37
+ identifiers: { a, k },
38
+ };
39
+ return question;
40
+ };
41
+ const getPropositions = (n, { answer }) => {
42
+ const propositions = [];
43
+ (0, exercise_1.addValidProp)(propositions, answer);
44
+ while (propositions.length < n) {
45
+ const randomA = (0, randint_1.randint)(1, 10);
46
+ const randomK = (0, randint_1.randint)(1, 20);
47
+ (0, exercise_1.tryToAddWrongProp)(propositions, new equationSolutionNode_1.EquationSolutionNode(new discreteSetNode_1.DiscreteSetNode([
48
+ new logNode_1.LogNode(new rational_1.Rational(randomK, randomA).simplify().toTree()),
49
+ ])).toTex());
50
+ }
51
+ return (0, shuffle_1.shuffle)(propositions);
52
+ };
53
+ const isAnswerValid = (ans, { a, k }) => {
54
+ const answer = new equationSolutionNode_1.EquationSolutionNode(new discreteSetNode_1.DiscreteSetNode([
55
+ new logNode_1.LogNode(new rational_1.Rational(k, a)
56
+ .simplify()
57
+ .toTree({ allowFractionToDecimal: true })),
58
+ ], { allowRawRightChildAsSolution: true }));
59
+ const texs = answer.toAllValidTexs();
60
+ console.log(texs);
61
+ return texs.includes(ans);
62
+ };
63
+ exports.expEquation = {
64
+ id: "expEquation",
65
+ connector: "=",
66
+ label: "Résoudre des équations de type $a \\times \\exp(x) = k$",
67
+ levels: ["1reSpé", "TermSpé", "MathComp"],
68
+ sections: ["Exponentielle"],
69
+ isSingleStep: false,
70
+ generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getExpEquation, nb),
71
+ qcmTimer: 60,
72
+ freeTimer: 60,
73
+ getPropositions,
74
+ isAnswerValid,
75
+ };