math-exercises 2.2.67 → 2.2.69

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 (123) hide show
  1. package/lib/exercises/math/calcul/fractions/fractionsOperations.d.ts +8 -0
  2. package/lib/exercises/math/calcul/fractions/fractionsOperations.d.ts.map +1 -0
  3. package/lib/exercises/math/calcul/fractions/fractionsOperations.js +85 -0
  4. package/lib/exercises/math/calcul/fractions/index.d.ts +1 -0
  5. package/lib/exercises/math/calcul/fractions/index.d.ts.map +1 -1
  6. package/lib/exercises/math/calcul/fractions/index.js +1 -0
  7. package/lib/exercises/math/derivation/derivative/rootFunctionDerivative.d.ts.map +1 -1
  8. package/lib/exercises/math/derivation/derivative/rootFunctionDerivative.js +11 -1
  9. package/lib/exercises/math/functions/absolute/absolueValueAffineEquation.d.ts +9 -0
  10. package/lib/exercises/math/functions/absolute/absolueValueAffineEquation.d.ts.map +1 -0
  11. package/lib/exercises/math/functions/absolute/absolueValueAffineEquation.js +178 -0
  12. package/lib/exercises/math/functions/absolute/index.d.ts +1 -0
  13. package/lib/exercises/math/functions/absolute/index.d.ts.map +1 -1
  14. package/lib/exercises/math/functions/absolute/index.js +1 -0
  15. package/lib/exercises/math/functions/affines/leadingCoefficient.d.ts.map +1 -1
  16. package/lib/exercises/math/functions/affines/leadingCoefficient.js +9 -16
  17. package/lib/exercises/math/functions/trinoms/rootsProduct.js +1 -1
  18. package/lib/exercises/math/functions/trinoms/rootsSum.d.ts.map +1 -1
  19. package/lib/exercises/math/functions/trinoms/rootsSum.js +2 -3
  20. package/lib/exercises/math/geometry/cartesian/placeAbscissOnLine.js +1 -1
  21. package/lib/exercises/math/geometry/euclidianConstructions/pointImageFromTranslation.d.ts.map +1 -1
  22. package/lib/exercises/math/geometry/euclidianConstructions/pointImageFromTranslation.js +4 -1
  23. package/lib/index.d.ts +5 -0
  24. package/lib/index.d.ts.map +1 -1
  25. package/lib/math/numbers/nombre.d.ts +5 -0
  26. package/lib/math/numbers/nombre.d.ts.map +1 -1
  27. package/lib/math/numbers/nombre.js +12 -0
  28. package/lib/math/polynomials/generalAffine.d.ts +13 -0
  29. package/lib/math/polynomials/generalAffine.d.ts.map +1 -1
  30. package/lib/math/polynomials/generalAffine.js +25 -1
  31. package/lib/playground.d.ts.map +1 -1
  32. package/lib/playground.js +6 -2
  33. package/lib/tree/nodes/algebraicNode.d.ts +1 -0
  34. package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
  35. package/lib/tree/nodes/functions/absNode.d.ts +2 -0
  36. package/lib/tree/nodes/functions/absNode.d.ts.map +1 -1
  37. package/lib/tree/nodes/functions/absNode.js +13 -1
  38. package/lib/tree/nodes/functions/arcSinNode.d.ts +1 -0
  39. package/lib/tree/nodes/functions/arcSinNode.d.ts.map +1 -1
  40. package/lib/tree/nodes/functions/arcSinNode.js +3 -0
  41. package/lib/tree/nodes/functions/arccosNode.d.ts +1 -0
  42. package/lib/tree/nodes/functions/arccosNode.d.ts.map +1 -1
  43. package/lib/tree/nodes/functions/arccosNode.js +3 -0
  44. package/lib/tree/nodes/functions/arctanNode.d.ts +1 -0
  45. package/lib/tree/nodes/functions/arctanNode.d.ts.map +1 -1
  46. package/lib/tree/nodes/functions/arctanNode.js +3 -0
  47. package/lib/tree/nodes/functions/cosNode.d.ts +2 -0
  48. package/lib/tree/nodes/functions/cosNode.d.ts.map +1 -1
  49. package/lib/tree/nodes/functions/cosNode.js +9 -1
  50. package/lib/tree/nodes/functions/expNode.d.ts +2 -0
  51. package/lib/tree/nodes/functions/expNode.d.ts.map +1 -1
  52. package/lib/tree/nodes/functions/expNode.js +10 -1
  53. package/lib/tree/nodes/functions/log10Node.d.ts +1 -0
  54. package/lib/tree/nodes/functions/log10Node.d.ts.map +1 -1
  55. package/lib/tree/nodes/functions/log10Node.js +3 -0
  56. package/lib/tree/nodes/functions/logNode.d.ts +1 -0
  57. package/lib/tree/nodes/functions/logNode.d.ts.map +1 -1
  58. package/lib/tree/nodes/functions/logNode.js +3 -0
  59. package/lib/tree/nodes/functions/oppositeNode.d.ts +1 -0
  60. package/lib/tree/nodes/functions/oppositeNode.d.ts.map +1 -1
  61. package/lib/tree/nodes/functions/oppositeNode.js +3 -0
  62. package/lib/tree/nodes/functions/sinNode.d.ts +2 -0
  63. package/lib/tree/nodes/functions/sinNode.d.ts.map +1 -1
  64. package/lib/tree/nodes/functions/sinNode.js +11 -1
  65. package/lib/tree/nodes/functions/sqrtNode.d.ts +1 -0
  66. package/lib/tree/nodes/functions/sqrtNode.d.ts.map +1 -1
  67. package/lib/tree/nodes/functions/sqrtNode.js +3 -0
  68. package/lib/tree/nodes/functions/tanNode.d.ts +2 -0
  69. package/lib/tree/nodes/functions/tanNode.d.ts.map +1 -1
  70. package/lib/tree/nodes/functions/tanNode.js +9 -1
  71. package/lib/tree/nodes/geometry/degree.d.ts +1 -0
  72. package/lib/tree/nodes/geometry/degree.d.ts.map +1 -1
  73. package/lib/tree/nodes/geometry/degree.js +3 -0
  74. package/lib/tree/nodes/geometry/lengthNode.d.ts +1 -0
  75. package/lib/tree/nodes/geometry/lengthNode.d.ts.map +1 -1
  76. package/lib/tree/nodes/geometry/lengthNode.js +3 -0
  77. package/lib/tree/nodes/node.d.ts +1 -0
  78. package/lib/tree/nodes/node.d.ts.map +1 -1
  79. package/lib/tree/nodes/nodeConstructor.d.ts +3 -0
  80. package/lib/tree/nodes/nodeConstructor.d.ts.map +1 -1
  81. package/lib/tree/nodes/nodeConstructor.js +5 -1
  82. package/lib/tree/nodes/numbers/constantNode.d.ts +2 -0
  83. package/lib/tree/nodes/numbers/constantNode.d.ts.map +1 -1
  84. package/lib/tree/nodes/numbers/constantNode.js +10 -1
  85. package/lib/tree/nodes/numbers/infiniteNode.d.ts +0 -2
  86. package/lib/tree/nodes/numbers/infiniteNode.d.ts.map +1 -1
  87. package/lib/tree/nodes/numbers/infiniteNode.js +1 -6
  88. package/lib/tree/nodes/numbers/numberNode.d.ts +1 -0
  89. package/lib/tree/nodes/numbers/numberNode.d.ts.map +1 -1
  90. package/lib/tree/nodes/numbers/numberNode.js +3 -0
  91. package/lib/tree/nodes/operators/addNode.d.ts +1 -0
  92. package/lib/tree/nodes/operators/addNode.d.ts.map +1 -1
  93. package/lib/tree/nodes/operators/addNode.js +3 -0
  94. package/lib/tree/nodes/operators/binomialCoefficientNode.d.ts +1 -0
  95. package/lib/tree/nodes/operators/binomialCoefficientNode.d.ts.map +1 -1
  96. package/lib/tree/nodes/operators/binomialCoefficientNode.js +3 -0
  97. package/lib/tree/nodes/operators/divideNode.d.ts +4 -1
  98. package/lib/tree/nodes/operators/divideNode.d.ts.map +1 -1
  99. package/lib/tree/nodes/operators/divideNode.js +17 -2
  100. package/lib/tree/nodes/operators/fractionNode.d.ts +1 -0
  101. package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
  102. package/lib/tree/nodes/operators/fractionNode.js +9 -1
  103. package/lib/tree/nodes/operators/limitNode.d.ts +1 -0
  104. package/lib/tree/nodes/operators/limitNode.d.ts.map +1 -1
  105. package/lib/tree/nodes/operators/limitNode.js +3 -0
  106. package/lib/tree/nodes/operators/multiplyNode.d.ts +1 -0
  107. package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
  108. package/lib/tree/nodes/operators/multiplyNode.js +10 -2
  109. package/lib/tree/nodes/operators/powerNode.d.ts +1 -0
  110. package/lib/tree/nodes/operators/powerNode.d.ts.map +1 -1
  111. package/lib/tree/nodes/operators/powerNode.js +6 -0
  112. package/lib/tree/nodes/operators/substractNode.d.ts +4 -2
  113. package/lib/tree/nodes/operators/substractNode.d.ts.map +1 -1
  114. package/lib/tree/nodes/operators/substractNode.js +9 -2
  115. package/lib/tree/nodes/sets/intervalNode.d.ts.map +1 -1
  116. package/lib/tree/nodes/sets/intervalNode.js +8 -8
  117. package/lib/tree/nodes/variables/variableNode.d.ts +1 -0
  118. package/lib/tree/nodes/variables/variableNode.d.ts.map +1 -1
  119. package/lib/tree/nodes/variables/variableNode.js +7 -0
  120. package/lib/tree/parsers/rationalParser.d.ts +1 -1
  121. package/lib/tree/parsers/rationalParser.d.ts.map +1 -1
  122. package/lib/tree/parsers/rationalParser.js +1 -0
  123. package/package.json +1 -1
@@ -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,
@@ -0,0 +1,9 @@
1
+ import { Exercise } from "../../../../exercises/exercise";
2
+ import { GeneralAffineIdentifiers } from "../../../../math/polynomials/generalAffine";
3
+ type Identifiers = {
4
+ firstAffine: GeneralAffineIdentifiers;
5
+ secondAffine: GeneralAffineIdentifiers;
6
+ };
7
+ export declare const absolueValueAffineEquation: Exercise<Identifiers>;
8
+ export {};
9
+ //# sourceMappingURL=absolueValueAffineEquation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"absolueValueAffineEquation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/absolute/absolueValueAffineEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAKlC,OAAO,EAGL,wBAAwB,EACzB,MAAM,sCAAsC,CAAC;AAM9C,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,wBAAwB,CAAC;IACtC,YAAY,EAAE,wBAAwB,CAAC;CACxC,CAAC;AA4KF,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,WAAW,CAiB5D,CAAC"}
@@ -0,0 +1,178 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.absolueValueAffineEquation = 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 nombre_1 = require("../../../../math/numbers/nombre");
8
+ const rational_1 = require("../../../../math/numbers/rationals/rational");
9
+ const generalAffine_1 = require("../../../../math/polynomials/generalAffine");
10
+ const equalNode_1 = require("../../../../tree/nodes/equations/equalNode");
11
+ const absNode_1 = require("../../../../tree/nodes/functions/absNode");
12
+ const rationalParser_1 = require("../../../../tree/parsers/rationalParser");
13
+ const getPropositions = (n, { answer }) => {
14
+ const propositions = [];
15
+ (0, exercise_1.addValidProp)(propositions, answer);
16
+ while (propositions.length < n) {
17
+ const fracs = [
18
+ rational_1.RationalConstructor.randomIrreductibleWithSign().toTree(),
19
+ rational_1.RationalConstructor.randomIrreductibleWithSign().toTree(),
20
+ ].sort((a, b) => a.evaluate() - b.evaluate());
21
+ (0, exercise_1.tryToAddWrongProp)(propositions, `x=${fracs[0].toTex()}\\text{ ou }${fracs[1].toTex()}`);
22
+ }
23
+ return (0, exercise_1.shuffleProps)(propositions, n);
24
+ };
25
+ const getAnswerNode = (identifiers) => {
26
+ const affines = [
27
+ generalAffine_1.GeneralAffineConstructor.fromIdentifiers(identifiers.firstAffine),
28
+ generalAffine_1.GeneralAffineConstructor.fromIdentifiers(identifiers.secondAffine),
29
+ ];
30
+ const firstIntersec = affines[0].xIntersect(affines[1]);
31
+ const oppositeAffine = affines[1].opposite();
32
+ const secondIntersec = oppositeAffine.xIntersect(affines[0]);
33
+ const res = [firstIntersec, secondIntersec]
34
+ .filter(Boolean)
35
+ .sort((a, b) => a.evaluate() - b.evaluate());
36
+ return res;
37
+ };
38
+ const getAnswer = (identifiers) => {
39
+ const nodes = getAnswerNode(identifiers);
40
+ if (nodes.length > 1)
41
+ return `x=${nodes[0].toTex()}\\text{ ou }x=${nodes[1].toTex()}`;
42
+ return `x=${nodes[0]?.toTex() || nodes[1]?.toTex()}`;
43
+ };
44
+ const getInstruction = (identifiers) => {
45
+ const affines = [
46
+ generalAffine_1.GeneralAffineConstructor.fromIdentifiers(identifiers.firstAffine),
47
+ generalAffine_1.GeneralAffineConstructor.fromIdentifiers(identifiers.secondAffine),
48
+ ];
49
+ const node = (0, equalNode_1.equal)((0, absNode_1.abs)(affines[0].toTree()), (0, absNode_1.abs)(affines[1].toTree()));
50
+ return `Résoudre :
51
+
52
+ $$
53
+ ${node.toTex()}
54
+ $$`;
55
+ };
56
+ const getHint = (identifiers) => {
57
+ return `L'égalité $|a|=|b|$ est vraie si et seulement si $a = b$ ou $a = -b$.`;
58
+ };
59
+ const getCorrection = (identifiers) => {
60
+ const affines = [
61
+ generalAffine_1.GeneralAffineConstructor.fromIdentifiers(identifiers.firstAffine),
62
+ generalAffine_1.GeneralAffineConstructor.fromIdentifiers(identifiers.secondAffine),
63
+ ];
64
+ const firstIntersec = affines[0].xIntersect(affines[1]);
65
+ const oppositeAffine = affines[1].opposite();
66
+ const secondIntersec = oppositeAffine.xIntersect(affines[0]);
67
+ const res = [firstIntersec, secondIntersec]
68
+ .filter(Boolean)
69
+ .sort((a, b) => a.evaluate() - b.evaluate());
70
+ return `L'égalité $|a|=|b|$ est vraie si et seulement si $a = b$ ou $a=-b$.
71
+
72
+ On doit donc résoudre deux équations: d'une part,
73
+
74
+ $$
75
+ ${affines[0].toTree().toTex()} = ${affines[1].toTree().toTex()}
76
+ $$
77
+
78
+ ${firstIntersec
79
+ ? `ce qui donne :
80
+
81
+ $$
82
+ x=${firstIntersec?.toTex()}
83
+ $$`
84
+ : "qui n'a pas de solution, "}
85
+
86
+ et d'autre part :
87
+
88
+ $$
89
+ ${affines[0].toTree().toTex()} = ${oppositeAffine.toTree().toTex()}
90
+ $$
91
+
92
+ ${secondIntersec
93
+ ? `ce qui donne :
94
+
95
+ $$
96
+ x=${secondIntersec?.toTex()}
97
+ $$`
98
+ : "qui n'a pas de solution."}
99
+
100
+
101
+ Ainsi, la solution de cette équation est :
102
+
103
+ $$
104
+ ${res.length > 1
105
+ ? `x=${res[0].toTex()} \\text{ ou } x=${res[1].toTex()}`
106
+ : `x=${res[0]?.toTex() || res[1]?.toTex()}`}
107
+ `;
108
+ };
109
+ const getKeys = (identifiers) => {
110
+ return ["x", "equal", "ou"];
111
+ };
112
+ const isAnswerValid = (ans, { answer, ...identifiers }) => {
113
+ const parsedOu = ans.split("\\text{ ou }");
114
+ console.log(parsedOu);
115
+ try {
116
+ const nodes = [];
117
+ parsedOu.forEach((item) => {
118
+ let formated = item
119
+ .replaceAll("\\text{", "")
120
+ .replaceAll("}", "")
121
+ .replaceAll(" ", "");
122
+ const equalForm = formated.split("=");
123
+ if (equalForm.length > 1 && equalForm[0] !== "x")
124
+ throw Error("wrong answer");
125
+ const nbStr = equalForm.length > 1 ? equalForm[1] : formated;
126
+ const node = (0, rationalParser_1.rationalParser)(nbStr);
127
+ if (!node)
128
+ throw Error("wrong answer");
129
+ nodes.push(node);
130
+ });
131
+ const answerNodes = getAnswerNode(identifiers);
132
+ return answerNodes.every((e) => nodes.some((n) => n.evaluate() === e.evaluate()));
133
+ }
134
+ catch (err) {
135
+ return false;
136
+ }
137
+ };
138
+ const getAbsolueValueAffineEquationQuestion = (ops) => {
139
+ const types = [nombre_1.NumberType.Integer];
140
+ const [a, c] = nombre_1.NombreConstructor.manyRandom(4, {
141
+ types,
142
+ excludes: [new integer_1.Integer(0)],
143
+ }).map((e) => e.toTree());
144
+ const [b, d] = nombre_1.NombreConstructor.manyRandom(4, {
145
+ types,
146
+ }).map((e) => e.toTree());
147
+ const identifiers = {
148
+ firstAffine: new generalAffine_1.GeneralAffine(a, b).toIdentifiers(),
149
+ secondAffine: new generalAffine_1.GeneralAffine(c, d).toIdentifiers(),
150
+ };
151
+ const question = {
152
+ answer: getAnswer(identifiers),
153
+ instruction: getInstruction(identifiers),
154
+ keys: getKeys(identifiers),
155
+ answerFormat: "tex",
156
+ identifiers,
157
+ hint: getHint(identifiers),
158
+ correction: getCorrection(identifiers),
159
+ };
160
+ return question;
161
+ };
162
+ exports.absolueValueAffineEquation = {
163
+ id: "absolueValueAffineEquation",
164
+ connector: "\\iff",
165
+ label: "Résoudre une équation avec valeur absolue du type $|ax+b|=|cx+d|$",
166
+ isSingleStep: false,
167
+ generator: (nb, opts) => (0, getDistinctQuestions_1.getDistinctQuestions)(() => getAbsolueValueAffineEquationQuestion(opts), nb),
168
+ qcmTimer: 60,
169
+ freeTimer: 60,
170
+ getPropositions,
171
+ isAnswerValid,
172
+ subject: "Mathématiques",
173
+ getInstruction,
174
+ getHint,
175
+ getCorrection,
176
+ getAnswer,
177
+ hasHintAndCorrection: true,
178
+ };
@@ -1,3 +1,4 @@
1
1
  export * from "./absoluteValueEquations";
2
2
  export * from "./absoluteValueInequations";
3
+ export * from "./absolueValueAffineEquation";
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/absolute/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/absolute/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC"}
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./absoluteValueEquations"), exports);
18
18
  __exportStar(require("./absoluteValueInequations"), exports);
19
+ __exportStar(require("./absolueValueAffineEquation"), exports);
@@ -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",
@@ -77,7 +77,7 @@ const getRootsProductQuestion = (ops) => {
77
77
  //ac <= 0
78
78
  const a = (0, randint_1.randint)(-10, 10, [0]);
79
79
  const b = (0, randint_1.randint)(-10, 10);
80
- const c = (a / Math.abs(a)) * (0, randint_1.randint)(-10, 10, !b ? [0] : []);
80
+ const c = (a / Math.abs(a)) * (0, randint_1.randint)(-10, 0, !b ? [0] : []);
81
81
  const trinom = new generalTrinom_1.GeneralTrinom(a, b, c);
82
82
  const identifiers = {
83
83
  trinomIdentifiers: trinom.toIdentifiers(),
@@ -1 +1 @@
1
- {"version":3,"file":"rootsSum.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/trinoms/rootsSum.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAGL,wBAAwB,EACzB,MAAM,sCAAsC,CAAC;AAO9C,KAAK,WAAW,GAAG;IACjB,iBAAiB,EAAE,wBAAwB,CAAC;CAC7C,CAAC;AAqGF,eAAO,MAAM,QAAQ,EAAE,QAAQ,CAAC,WAAW,CAiB1C,CAAC"}
1
+ {"version":3,"file":"rootsSum.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/trinoms/rootsSum.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAGL,wBAAwB,EACzB,MAAM,sCAAsC,CAAC;AAO9C,KAAK,WAAW,GAAG;IACjB,iBAAiB,EAAE,wBAAwB,CAAC;CAC7C,CAAC;AAoGF,eAAO,MAAM,QAAQ,EAAE,QAAQ,CAAC,WAAW,CAiB1C,CAAC"}
@@ -56,7 +56,7 @@ const getCorrection = (identifiers) => {
56
56
  return `Si $f(x) = ax^2 + bx + c$ admet deux racines, alors leur somme $S$ vaut :
57
57
 
58
58
  $$
59
- S = \\frac{c}{a}
59
+ S = \\frac{-b}{a}
60
60
  $$
61
61
 
62
62
  Ici, on a $a = ${aTex}$ et $b = ${bTex}$, donc :
@@ -73,11 +73,10 @@ const isAnswerValid = (ans, { answer }) => {
73
73
  return (0, rationalVEA_1.rationalVEA)(ans, answer);
74
74
  };
75
75
  const getRootsSumQuestion = (ops) => {
76
- //(b,c) != 0
77
76
  //ac <= 0
78
77
  const a = (0, randint_1.randint)(-10, 10, [0]);
79
78
  const b = (0, randint_1.randint)(-10, 10);
80
- const c = (a / Math.abs(a)) * (0, randint_1.randint)(-10, 10, !b ? [0] : []);
79
+ const c = (a / Math.abs(a)) * (0, randint_1.randint)(-10, 0, !b ? [0] : []);
81
80
  // const trinom = GeneralTrinomConstructor.randomNiceRoots(2);
82
81
  const trinom = new generalTrinom_1.GeneralTrinom(a, b, c);
83
82
  const identifiers = {
@@ -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":"pointImageFromTranslation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/euclidianConstructions/pointImageFromTranslation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,0BAA0B,CAAC;AAOlC,OAAO,EAGL,gBAAgB,EACjB,MAAM,2BAA2B,CAAC;AAMnC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,EAAE,CAAC;CAC7B,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAiIF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAepE,CAAC"}
1
+ {"version":3,"file":"pointImageFromTranslation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/euclidianConstructions/pointImageFromTranslation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,0BAA0B,CAAC;AAOlC,OAAO,EAGL,gBAAgB,EACjB,MAAM,2BAA2B,CAAC;AAMnC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,EAAE,CAAC;CAC7B,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAmIF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAepE,CAAC"}
@@ -57,7 +57,10 @@ const isGGBAnswerValid = (ans, { ggbAnswer }) => {
57
57
  const studentAns = ans.filter((c) => !["A", "B", "C", "D"].includes(c[0]));
58
58
  if (studentAns.length !== 1)
59
59
  return false;
60
- const coords = (0, ggbPointToCoords_1.ggbPointToCoords)(studentAns[0].split("=")[1]);
60
+ const studentPoint = studentAns[0].split("=")[1];
61
+ if (studentPoint === undefined)
62
+ return false;
63
+ const coords = (0, ggbPointToCoords_1.ggbPointToCoords)(studentPoint);
61
64
  const coordsAns = (0, ggbPointToCoords_1.ggbPointToCoords)(ggbAnswer[0].split("=")[1]);
62
65
  return ((0, approxEqual_1.approxEqual)(coords.x, coordsAns.x, 0.2) &&
63
66
  (0, approxEqual_1.approxEqual)(coords.y, coordsAns.y, 0.2));
package/lib/index.d.ts CHANGED
@@ -78,6 +78,8 @@ declare const mathExercises: (Exercise<{
78
78
  num2: number;
79
79
  denom1: number;
80
80
  denom2: number;
81
+ }, {}> | Exercise<{
82
+ statementIdentifiers: import("./tree/nodes/nodeConstructor").NodeIdentifiers;
81
83
  }, {}> | Exercise<{
82
84
  numbers: number[];
83
85
  }, {}> | Exercise<{
@@ -576,6 +578,9 @@ declare const mathExercises: (Exercise<{
576
578
  a: number;
577
579
  b: number;
578
580
  isStrict: boolean;
581
+ }, {}> | Exercise<{
582
+ firstAffine: import("./math/polynomials/generalAffine").GeneralAffineIdentifiers;
583
+ secondAffine: import("./math/polynomials/generalAffine").GeneralAffineIdentifiers;
579
584
  }, {}> | Exercise<{
580
585
  xA: number;
581
586
  yA: number;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAG1D,OAAO,yBAAyB,CAAC;AAEjC,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAA6B,CAAC;AAE/C,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC"}
@@ -18,5 +18,10 @@ export declare abstract class NombreConstructor {
18
18
  types?: NumberType[];
19
19
  excludes?: Nombre[];
20
20
  }): Nombre;
21
+ static manyRandom(n: number, { types, excludes, allDifferent, }?: {
22
+ types?: NumberType[];
23
+ excludes?: Nombre[];
24
+ allDifferent?: boolean;
25
+ }): Nombre[];
21
26
  }
22
27
  //# sourceMappingURL=nombre.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"nombre.d.ts","sourceRoot":"","sources":["../../../src/math/numbers/nombre.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAQ,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAQ1D,oBAAY,UAAU;IACpB,OAAO,IAAA;IACP,OAAO,IAAA;IACP,QAAQ,IAAA;IACR,IAAI,IAAA;CACL;AAED,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,UAAU,CAAC;IACjB,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,WAAW,KAAK,aAAa,CAAC;IAC9C,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC;CAChC;AAED,8BAAsB,iBAAiB;IACrC,MAAM,CAAC,MAAM,CAAC,EACZ,KAAK,EACL,QAAQ,GACT,GAAE;QACD,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;QACrB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;KAChB;CAiCP"}
1
+ {"version":3,"file":"nombre.d.ts","sourceRoot":"","sources":["../../../src/math/numbers/nombre.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAQ,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAQ1D,oBAAY,UAAU;IACpB,OAAO,IAAA;IACP,OAAO,IAAA;IACP,QAAQ,IAAA;IACR,IAAI,IAAA;CACL;AAED,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,UAAU,CAAC;IACjB,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,WAAW,KAAK,aAAa,CAAC;IAC9C,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC;CAChC;AAED,8BAAsB,iBAAiB;IACrC,MAAM,CAAC,MAAM,CAAC,EACZ,KAAK,EACL,QAAQ,GACT,GAAE;QACD,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;QACrB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;KAChB;IAiCN,MAAM,CAAC,UAAU,CACf,CAAC,EAAE,MAAM,EACT,EACE,KAAK,EACL,QAAQ,EACR,YAAoB,GACrB,GAAE;QACD,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;QACrB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;QACpB,YAAY,CAAC,EAAE,OAAO,CAAC;KACnB;CAaT"}
@@ -48,5 +48,17 @@ class NombreConstructor {
48
48
  }
49
49
  return res;
50
50
  }
51
+ static manyRandom(n, { types, excludes, allDifferent = false, } = {}) {
52
+ const res = [];
53
+ res.push(NombreConstructor.random({ types, excludes }));
54
+ for (let i = 0; i < n - 1; i++) {
55
+ let b;
56
+ do {
57
+ b = NombreConstructor.random({ types, excludes });
58
+ } while (allDifferent && res.some((el) => el.equals(b)));
59
+ res.push(b);
60
+ }
61
+ return res;
62
+ }
51
63
  }
52
64
  exports.NombreConstructor = NombreConstructor;
@@ -1,10 +1,23 @@
1
1
  import { AlgebraicNode } from "../../tree/nodes/algebraicNode";
2
+ import { NodeIdentifiers } from "../../tree/nodes/nodeConstructor";
3
+ export declare abstract class GeneralAffineConstructor {
4
+ static fromIdentifiers(identifiers: GeneralAffineIdentifiers): GeneralAffine;
5
+ }
6
+ export type GeneralAffineIdentifiers = {
7
+ id: "affine";
8
+ a: NodeIdentifiers;
9
+ b: NodeIdentifiers;
10
+ variable?: string;
11
+ };
2
12
  export declare class GeneralAffine {
3
13
  a: AlgebraicNode;
4
14
  b: AlgebraicNode;
5
15
  variable: string;
6
16
  constructor(a: number | AlgebraicNode, b: number | AlgebraicNode, variable?: string);
17
+ toIdentifiers(): GeneralAffineIdentifiers;
7
18
  getRoot(): AlgebraicNode;
8
19
  toTree(): import("../../tree/nodes/operators/addNode").AddNode | import("../../tree/nodes/operators/multiplyNode").MultiplyNode;
20
+ xIntersect(aff: GeneralAffine): AlgebraicNode | undefined;
21
+ opposite(): GeneralAffine;
9
22
  }
10
23
  //# sourceMappingURL=generalAffine.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"generalAffine.d.ts","sourceRoot":"","sources":["../../../src/math/polynomials/generalAffine.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAO/D,qBAAa,aAAa;IACxB,CAAC,EAAE,aAAa,CAAC;IACjB,CAAC,EAAE,aAAa,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;gBAGf,CAAC,EAAE,MAAM,GAAG,aAAa,EACzB,CAAC,EAAE,MAAM,GAAG,aAAa,EACzB,QAAQ,GAAE,MAAY;IAWxB,OAAO,IAAI,aAAa;IAIxB,MAAM;CAKP"}
1
+ {"version":3,"file":"generalAffine.d.ts","sourceRoot":"","sources":["../../../src/math/polynomials/generalAffine.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAG/D,OAAO,EAEL,eAAe,EAEhB,MAAM,kCAAkC,CAAC;AAQ1C,8BAAsB,wBAAwB;IAC5C,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,wBAAwB;CAM7D;AACD,MAAM,MAAM,wBAAwB,GAAG;IACrC,EAAE,EAAE,QAAQ,CAAC;IACb,CAAC,EAAE,eAAe,CAAC;IACnB,CAAC,EAAE,eAAe,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AACF,qBAAa,aAAa;IACxB,CAAC,EAAE,aAAa,CAAC;IACjB,CAAC,EAAE,aAAa,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;gBAGf,CAAC,EAAE,MAAM,GAAG,aAAa,EACzB,CAAC,EAAE,MAAM,GAAG,aAAa,EACzB,QAAQ,GAAE,MAAY;IAUxB,aAAa,IAAI,wBAAwB;IAQzC,OAAO,IAAI,aAAa;IAIxB,MAAM;IAMN,UAAU,CAAC,GAAG,EAAE,aAAa;IAI7B,QAAQ;CAGT"}