math-exercises 2.2.70 → 2.2.72

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 (106) hide show
  1. package/lib/exercises/math/calcul/fractions/fractionsOperations.d.ts.map +1 -1
  2. package/lib/exercises/math/calcul/fractions/fractionsOperations.js +6 -2
  3. package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivitySubstract.d.ts +12 -0
  4. package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivitySubstract.d.ts.map +1 -0
  5. package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivitySubstract.js +128 -0
  6. package/lib/exercises/math/calculLitteral/distributivity/identitiesWithNonIntegers.d.ts +10 -0
  7. package/lib/exercises/math/calculLitteral/distributivity/identitiesWithNonIntegers.d.ts.map +1 -0
  8. package/lib/exercises/math/calculLitteral/distributivity/identitiesWithNonIntegers.js +138 -0
  9. package/lib/exercises/math/calculLitteral/distributivity/index.d.ts +2 -0
  10. package/lib/exercises/math/calculLitteral/distributivity/index.d.ts.map +1 -1
  11. package/lib/exercises/math/calculLitteral/distributivity/index.js +2 -0
  12. package/lib/exercises/math/geometry/angles/index.d.ts +2 -0
  13. package/lib/exercises/math/geometry/angles/index.d.ts.map +1 -0
  14. package/lib/exercises/math/geometry/angles/index.js +17 -0
  15. package/lib/exercises/math/geometry/angles/recognizeAngleType.d.ts +11 -0
  16. package/lib/exercises/math/geometry/angles/recognizeAngleType.d.ts.map +1 -0
  17. package/lib/exercises/math/geometry/angles/recognizeAngleType.js +272 -0
  18. package/lib/exercises/math/geometry/euclidianConstructions/pointImageFromTranslation.js +1 -1
  19. package/lib/exercises/math/geometry/index.d.ts +1 -0
  20. package/lib/exercises/math/geometry/index.d.ts.map +1 -1
  21. package/lib/exercises/math/geometry/index.js +1 -0
  22. package/lib/exercises/math/geometry/volumes/parallelepipedVolume.d.ts.map +1 -1
  23. package/lib/exercises/math/geometry/volumes/parallelepipedVolume.js +0 -1
  24. package/lib/exercises/math/probaStat/stats1var/index.d.ts +6 -0
  25. package/lib/exercises/math/probaStat/stats1var/index.d.ts.map +1 -1
  26. package/lib/exercises/math/probaStat/stats1var/index.js +6 -0
  27. package/lib/exercises/math/probaStat/stats1var/interquartilesList.d.ts +7 -0
  28. package/lib/exercises/math/probaStat/stats1var/interquartilesList.d.ts.map +1 -0
  29. package/lib/exercises/math/probaStat/stats1var/interquartilesList.js +93 -0
  30. package/lib/exercises/math/probaStat/stats1var/interquartilesTable.d.ts +8 -0
  31. package/lib/exercises/math/probaStat/stats1var/interquartilesTable.d.ts.map +1 -0
  32. package/lib/exercises/math/probaStat/stats1var/interquartilesTable.js +98 -0
  33. package/lib/exercises/math/probaStat/stats1var/quartilesList.js +1 -1
  34. package/lib/exercises/math/probaStat/stats1var/standardDeviationList.d.ts +7 -0
  35. package/lib/exercises/math/probaStat/stats1var/standardDeviationList.d.ts.map +1 -0
  36. package/lib/exercises/math/probaStat/stats1var/standardDeviationList.js +131 -0
  37. package/lib/exercises/math/probaStat/stats1var/standardDeviationTable.d.ts +8 -0
  38. package/lib/exercises/math/probaStat/stats1var/standardDeviationTable.d.ts.map +1 -0
  39. package/lib/exercises/math/probaStat/stats1var/standardDeviationTable.js +144 -0
  40. package/lib/exercises/math/probaStat/stats1var/varianceList.d.ts +7 -0
  41. package/lib/exercises/math/probaStat/stats1var/varianceList.d.ts.map +1 -0
  42. package/lib/exercises/math/probaStat/stats1var/varianceList.js +121 -0
  43. package/lib/exercises/math/probaStat/stats1var/varianceTable.d.ts +8 -0
  44. package/lib/exercises/math/probaStat/stats1var/varianceTable.d.ts.map +1 -0
  45. package/lib/exercises/math/probaStat/stats1var/varianceTable.js +133 -0
  46. package/lib/exercises/vea/sqrtVEA.d.ts +2 -1
  47. package/lib/exercises/vea/sqrtVEA.d.ts.map +1 -1
  48. package/lib/exercises/vea/sqrtVEA.js +6 -3
  49. package/lib/index.d.ts +30 -0
  50. package/lib/index.d.ts.map +1 -1
  51. package/lib/math/geometry/angle.d.ts +22 -1
  52. package/lib/math/geometry/angle.d.ts.map +1 -1
  53. package/lib/math/geometry/angle.js +138 -1
  54. package/lib/math/geometry/line.d.ts +2 -0
  55. package/lib/math/geometry/line.d.ts.map +1 -1
  56. package/lib/math/geometry/line.js +16 -0
  57. package/lib/math/geometry/point.d.ts +1 -0
  58. package/lib/math/geometry/point.d.ts.map +1 -1
  59. package/lib/math/geometry/point.js +4 -0
  60. package/lib/math/geometry/vector.d.ts +3 -0
  61. package/lib/math/geometry/vector.d.ts.map +1 -1
  62. package/lib/math/geometry/vector.js +9 -0
  63. package/lib/math/polynomials/generalAffine.d.ts +3 -0
  64. package/lib/math/polynomials/generalAffine.d.ts.map +1 -1
  65. package/lib/math/polynomials/generalAffine.js +4 -0
  66. package/lib/math/utils/quartiles.d.ts +3 -0
  67. package/lib/math/utils/quartiles.d.ts.map +1 -0
  68. package/lib/math/utils/quartiles.js +47 -0
  69. package/lib/math/utils/standardDeviation.d.ts +3 -0
  70. package/lib/math/utils/standardDeviation.d.ts.map +1 -0
  71. package/lib/math/utils/standardDeviation.js +13 -0
  72. package/lib/math/utils/variance.d.ts +1 -0
  73. package/lib/math/utils/variance.d.ts.map +1 -1
  74. package/lib/math/utils/variance.js +9 -1
  75. package/lib/playground.d.ts.map +1 -1
  76. package/lib/tree/nodes/node.d.ts +4 -2
  77. package/lib/tree/nodes/node.d.ts.map +1 -1
  78. package/lib/tree/nodes/node.js +2 -0
  79. package/lib/tree/nodes/nodeConstructor.d.ts.map +1 -1
  80. package/lib/tree/nodes/nodeConstructor.js +4 -0
  81. package/lib/tree/nodes/operators/addNode.d.ts.map +1 -1
  82. package/lib/tree/nodes/operators/addNode.js +123 -90
  83. package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
  84. package/lib/tree/nodes/operators/multiplyNode.js +8 -0
  85. package/lib/tree/nodes/polynomials/monomNode.d.ts +47 -0
  86. package/lib/tree/nodes/polynomials/monomNode.d.ts.map +1 -0
  87. package/lib/tree/nodes/polynomials/monomNode.js +216 -0
  88. package/lib/tree/parsers/affineParser.js +1 -1
  89. package/lib/tree/parsers/monomParser.d.ts +2 -2
  90. package/lib/tree/parsers/monomParser.d.ts.map +1 -1
  91. package/lib/tree/parsers/monomParser.js +84 -6
  92. package/lib/tree/parsers/polynomialParser.d.ts +3 -0
  93. package/lib/tree/parsers/polynomialParser.d.ts.map +1 -0
  94. package/lib/tree/parsers/polynomialParser.js +50 -0
  95. package/lib/tree/parsers/powerParser.d.ts +1 -1
  96. package/lib/tree/parsers/trinomParser.js +1 -1
  97. package/lib/utils/average.d.ts +1 -0
  98. package/lib/utils/average.d.ts.map +1 -1
  99. package/lib/utils/average.js +9 -1
  100. package/lib/utils/latex/approxOrEqual.d.ts +2 -0
  101. package/lib/utils/latex/approxOrEqual.d.ts.map +1 -0
  102. package/lib/utils/latex/approxOrEqual.js +11 -0
  103. package/lib/utils/variance.d.ts +2 -0
  104. package/lib/utils/variance.d.ts.map +1 -0
  105. package/lib/utils/variance.js +12 -0
  106. package/package.json +1 -1
@@ -1 +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;AA8EF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAgBrD,CAAC"}
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;AAqFF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAgBrD,CAAC"}
@@ -20,7 +20,6 @@ const getPropositions = (n, { answer }) => {
20
20
  return (0, exercise_1.shuffleProps)(propositions, n);
21
21
  };
22
22
  const getAnswer = (identifiers) => {
23
- console.log(identifiers);
24
23
  const statement = nodeConstructor_1.NodeConstructor.fromIdentifiers(identifiers.statementIdentifiers);
25
24
  return statement.simplify().toTex();
26
25
  };
@@ -52,7 +51,12 @@ const getFractionsOperationsQuestion = (ops) => {
52
51
  rational_1.RationalConstructor.randomIrreductible().toTree(),
53
52
  ];
54
53
  const statement = firstOp(secondOp(rationals[0], rationals[1]), rationals[2]);
55
- statement.shuffle();
54
+ //éviter division par une soustraction qui donne 0
55
+ if (firstOpIndex !== 3 ||
56
+ secondOpIndex !== 1 ||
57
+ rationals[0].evaluate() - rationals[1].evaluate() !== 0) {
58
+ statement.shuffle();
59
+ }
56
60
  const ids = statement.toIdentifiers();
57
61
  const identifiers = {
58
62
  statementIdentifiers: ids,
@@ -0,0 +1,12 @@
1
+ import { Exercise } from "../../../../exercises/exercise";
2
+ import { GeneralAffineIdentifiers } from "../../../../math/polynomials/generalAffine";
3
+ type Identifiers = {
4
+ type: number;
5
+ affine1: GeneralAffineIdentifiers;
6
+ affine2: GeneralAffineIdentifiers;
7
+ affine3: GeneralAffineIdentifiers;
8
+ affine4?: GeneralAffineIdentifiers;
9
+ };
10
+ export declare const doubleDistributivitySubstract: Exercise<Identifiers>;
11
+ export {};
12
+ //# sourceMappingURL=doubleDistributivitySubstract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doubleDistributivitySubstract.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/doubleDistributivitySubstract.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAGL,wBAAwB,EACzB,MAAM,sCAAsC,CAAC;AAU9C,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IAEb,OAAO,EAAE,wBAAwB,CAAC;IAClC,OAAO,EAAE,wBAAwB,CAAC;IAElC,OAAO,EAAE,wBAAwB,CAAC;IAElC,OAAO,CAAC,EAAE,wBAAwB,CAAC;CACpC,CAAC;AAiIF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,CAmB/D,CAAC"}
@@ -0,0 +1,128 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.doubleDistributivitySubstract = void 0;
4
+ const exercise_1 = require("../../../../exercises/exercise");
5
+ const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
6
+ const generalAffine_1 = require("../../../../math/polynomials/generalAffine");
7
+ const randint_1 = require("../../../../math/utils/random/randint");
8
+ const addNode_1 = require("../../../../tree/nodes/operators/addNode");
9
+ const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
10
+ const powerNode_1 = require("../../../../tree/nodes/operators/powerNode");
11
+ const substractNode_1 = require("../../../../tree/nodes/operators/substractNode");
12
+ const trinomNode_1 = require("../../../../tree/nodes/polynomials/trinomNode");
13
+ //(ax+b)(cx+d)-ex(gx+h)
14
+ //(ax+b)(cx+d)-(ex+f)(gx+h)
15
+ //(ax+b)(cx+d)-(ex+-f)^2
16
+ const getPropositions = (n, { answer, affine1, affine2, affine3, type, affine4 }) => {
17
+ const propositions = [];
18
+ (0, exercise_1.addValidProp)(propositions, answer);
19
+ let affs = [
20
+ generalAffine_1.GeneralAffineConstructor.fromIdentifiers(affine1),
21
+ generalAffine_1.GeneralAffineConstructor.fromIdentifiers(affine2),
22
+ generalAffine_1.GeneralAffineConstructor.fromIdentifiers(affine3),
23
+ ].map((e) => e.toTree());
24
+ if (affine4) {
25
+ affs.push(generalAffine_1.GeneralAffineConstructor.fromIdentifiers(affine4).toTree());
26
+ }
27
+ if (type === 3)
28
+ (0, exercise_1.tryToAddWrongProp)(propositions, (0, addNode_1.add)((0, multiplyNode_1.multiply)(affs[0], affs[1]), (0, powerNode_1.square)(affs[2]))
29
+ .simplify({
30
+ forbidFactorize: true,
31
+ towardsDistribute: true,
32
+ })
33
+ .toTex());
34
+ else
35
+ (0, exercise_1.tryToAddWrongProp)(propositions, (0, addNode_1.add)((0, multiplyNode_1.multiply)(affs[0], affs[1]), (0, multiplyNode_1.multiply)(affs[2], affs[3]))
36
+ .simplify({
37
+ forbidFactorize: true,
38
+ towardsDistribute: true,
39
+ })
40
+ .toTex());
41
+ while (propositions.length < n) {
42
+ (0, exercise_1.tryToAddWrongProp)(propositions, trinomNode_1.TrinomNodeConstructor.random().toTex());
43
+ }
44
+ return (0, exercise_1.shuffleProps)(propositions, n);
45
+ };
46
+ const getAnswerNode = (identifiers) => {
47
+ return getStatementNode(identifiers).simplify({
48
+ forbidFactorize: true,
49
+ towardsDistribute: true,
50
+ });
51
+ };
52
+ const getAnswer = (identifiers) => {
53
+ return getAnswerNode(identifiers).toTex();
54
+ };
55
+ const getStatementNode = (identifiers) => {
56
+ let affs = [
57
+ generalAffine_1.GeneralAffineConstructor.fromIdentifiers(identifiers.affine1),
58
+ generalAffine_1.GeneralAffineConstructor.fromIdentifiers(identifiers.affine2),
59
+ generalAffine_1.GeneralAffineConstructor.fromIdentifiers(identifiers.affine3),
60
+ ].map((e) => e.toTree());
61
+ if (identifiers.affine4) {
62
+ affs.push(generalAffine_1.GeneralAffineConstructor.fromIdentifiers(identifiers.affine4).toTree());
63
+ }
64
+ if (identifiers.affine4)
65
+ return (0, substractNode_1.substract)((0, multiplyNode_1.multiply)(affs[0], affs[1]), (0, multiplyNode_1.multiply)(affs[2], affs[3]));
66
+ return (0, substractNode_1.substract)((0, multiplyNode_1.multiply)(affs[0], affs[1]), (0, powerNode_1.square)(affs[2]));
67
+ };
68
+ const getInstruction = (identifiers) => {
69
+ return `Développer et réduire :
70
+
71
+ $$
72
+ ${getStatementNode(identifiers).toTex()}
73
+ $$
74
+ `;
75
+ };
76
+ // const getHint: GetHint<Identifiers> = (identifiers) => {};
77
+ // const getCorrection: GetCorrection<Identifiers> = (identifiers) => {};
78
+ const getKeys = (identifiers) => {
79
+ return ["x"];
80
+ };
81
+ const isAnswerValid = (ans, { answer, ...identifiers }) => {
82
+ const texs = getAnswerNode(identifiers).toAllValidTexs({});
83
+ return texs.includes(ans);
84
+ };
85
+ const getDoubleDistributivitySubstractQuestion = (ops) => {
86
+ const type = (0, randint_1.randint)(1, 4);
87
+ const affine1 = generalAffine_1.GeneralAffineConstructor.randomInts({ allowBNull: false });
88
+ const affine2 = generalAffine_1.GeneralAffineConstructor.randomInts({ allowBNull: false });
89
+ const affine3 = type === 1
90
+ ? new generalAffine_1.GeneralAffine((0, randint_1.randint)(-10, 11, [0]), 0)
91
+ : generalAffine_1.GeneralAffineConstructor.randomInts({ allowBNull: false });
92
+ const affine4 = type === 3
93
+ ? undefined
94
+ : generalAffine_1.GeneralAffineConstructor.randomInts({ allowBNull: false });
95
+ const identifiers = {
96
+ type,
97
+ affine1: affine1.toIdentifiers(),
98
+ affine2: affine2.toIdentifiers(),
99
+ affine3: affine3.toIdentifiers(),
100
+ affine4: affine4?.toIdentifiers(),
101
+ };
102
+ const question = {
103
+ answer: getAnswer(identifiers),
104
+ instruction: getInstruction(identifiers),
105
+ keys: getKeys(identifiers),
106
+ answerFormat: "tex",
107
+ identifiers,
108
+ // hint: getHint(identifiers),
109
+ // correction: getCorrection(identifiers),
110
+ };
111
+ return question;
112
+ };
113
+ exports.doubleDistributivitySubstract = {
114
+ id: "doubleDistributivitySubstract",
115
+ connector: "=",
116
+ label: "Double distributivité : soustraction de deux produits",
117
+ isSingleStep: false,
118
+ generator: (nb, opts) => (0, getDistinctQuestions_1.getDistinctQuestions)(() => getDoubleDistributivitySubstractQuestion(opts), nb),
119
+ qcmTimer: 60,
120
+ freeTimer: 60,
121
+ getPropositions,
122
+ isAnswerValid,
123
+ subject: "Mathématiques",
124
+ getInstruction,
125
+ // getHint,
126
+ // getCorrection,
127
+ getAnswer,
128
+ };
@@ -0,0 +1,10 @@
1
+ import { Exercise } from "../../../../exercises/exercise";
2
+ import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor";
3
+ type Identifiers = {
4
+ type: number;
5
+ a: NodeIdentifiers;
6
+ b: NodeIdentifiers;
7
+ };
8
+ export declare const identitiesWithNonIntegers: Exercise<Identifiers>;
9
+ export {};
10
+ //# sourceMappingURL=identitiesWithNonIntegers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identitiesWithNonIntegers.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/identitiesWithNonIntegers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAMlC,OAAO,EAEL,eAAe,EAEhB,MAAM,kCAAkC,CAAC;AAS1C,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,eAAe,CAAC;IACnB,CAAC,EAAE,eAAe,CAAC;CACpB,CAAC;AA2HF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAgB3D,CAAC"}
@@ -0,0 +1,138 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.identitiesWithNonIntegers = 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 real_1 = require("../../../../math/numbers/reals/real");
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 multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
12
+ const powerNode_1 = require("../../../../tree/nodes/operators/powerNode");
13
+ const substractNode_1 = require("../../../../tree/nodes/operators/substractNode");
14
+ const trinomNode_1 = require("../../../../tree/nodes/polynomials/trinomNode");
15
+ const polynomialParser_1 = require("../../../../tree/parsers/polynomialParser");
16
+ const random_1 = require("../../../../utils/alea/random");
17
+ const getPropositions = (n, { answer, a, b, type }) => {
18
+ const propositions = [];
19
+ (0, exercise_1.addValidProp)(propositions, answer);
20
+ (0, exercise_1.tryToAddWrongProp)(propositions, getAnswer({
21
+ a,
22
+ b,
23
+ type: ((type + 1) % 3) + 1,
24
+ }));
25
+ while (propositions.length < n) {
26
+ (0, exercise_1.tryToAddWrongProp)(propositions, trinomNode_1.TrinomNodeConstructor.random().toTex());
27
+ }
28
+ return (0, exercise_1.shuffleProps)(propositions, n);
29
+ };
30
+ const getAnswer = (identifiers) => {
31
+ const answer = getStatementNode(identifiers)
32
+ .simplify({
33
+ towardsDistribute: true,
34
+ forbidFactorize: true,
35
+ forceDistributeFractions: true,
36
+ })
37
+ .toTex();
38
+ return answer;
39
+ };
40
+ const getStatementNode = (identifiers) => {
41
+ const { type, a, b } = identifiers;
42
+ const aNode = (0, nodeConstructor_1.reifyAlgebraic)(a);
43
+ const bNode = (0, nodeConstructor_1.reifyAlgebraic)(b);
44
+ if (type === 1) {
45
+ return (0, powerNode_1.square)((0, addNode_1.add)((0, multiplyNode_1.multiply)(aNode, "x"), bNode));
46
+ }
47
+ else if (type === 2) {
48
+ return (0, powerNode_1.square)((0, substractNode_1.substract)((0, multiplyNode_1.multiply)(aNode, "x"), bNode));
49
+ }
50
+ else {
51
+ return (0, multiplyNode_1.multiply)((0, addNode_1.add)((0, multiplyNode_1.multiply)(aNode, "x"), bNode), (0, substractNode_1.substract)((0, multiplyNode_1.multiply)(aNode, "x"), bNode));
52
+ }
53
+ };
54
+ const getInstruction = (identifiers) => {
55
+ const statement = getStatementNode(identifiers);
56
+ return `Développer et simplifier :
57
+
58
+ $$
59
+ ${statement.toTex()}
60
+ $$`;
61
+ };
62
+ // const getHint: GetHint<Identifiers> = (identifiers) => {};
63
+ // const getCorrection: GetCorrection<Identifiers> = (identifiers) => {};
64
+ const getKeys = (identifiers) => {
65
+ return ["x"];
66
+ };
67
+ const isAnswerValid = (ans, { answer, ...identifiers }) => {
68
+ try {
69
+ //this is either genius or dumb
70
+ const parsed = (0, polynomialParser_1.polynomialParser)(ans);
71
+ if (!parsed)
72
+ return false;
73
+ return (parsed
74
+ .simplify({
75
+ forbidFactorize: true,
76
+ forceDistributeFractions: true,
77
+ towardsDistribute: true,
78
+ })
79
+ .toTex() === answer);
80
+ }
81
+ catch (err) {
82
+ return false;
83
+ }
84
+ };
85
+ //type1 (ax+b)^2
86
+ //type2 (ax-b)^2
87
+ //type3 (ax+b)(ax-b)
88
+ //a est frac/sqrt -> b entier
89
+ //b est frac/sqrt -> a entier
90
+ const getIdentitiesWithNonIntegersQuestion = (ops) => {
91
+ const identityType = (0, randint_1.randint)(1, 4);
92
+ const typeA = (0, random_1.random)(["entier", "sqrt", "frac"]);
93
+ const typeB = typeA === "entier" ? (0, random_1.random)(["sqrt", "frac"]) : "entier";
94
+ const buildNb = (type) => {
95
+ if (type === "entier") {
96
+ return (0, randint_1.randint)(1, 11).toTree();
97
+ }
98
+ else if (type === "sqrt") {
99
+ return real_1.SquareRootConstructor.randomIrreductible(10).toTree();
100
+ }
101
+ else {
102
+ return rational_1.RationalConstructor.randomIrreductible().toTree();
103
+ }
104
+ };
105
+ const a = buildNb(typeA);
106
+ const b = buildNb(typeB);
107
+ const identifiers = {
108
+ type: identityType,
109
+ a: a.toIdentifiers(),
110
+ b: b.toIdentifiers(),
111
+ };
112
+ const question = {
113
+ answer: getAnswer(identifiers),
114
+ instruction: getInstruction(identifiers),
115
+ keys: getKeys(identifiers),
116
+ answerFormat: "tex",
117
+ identifiers,
118
+ // hint: getHint(identifiers),
119
+ // correction: getCorrection(identifiers),
120
+ };
121
+ return question;
122
+ };
123
+ exports.identitiesWithNonIntegers = {
124
+ id: "identitiesWithNonIntegers",
125
+ connector: "=",
126
+ label: "Identités remarquables avec coefficients non entiers",
127
+ isSingleStep: true,
128
+ generator: (nb, opts) => (0, getDistinctQuestions_1.getDistinctQuestions)(() => getIdentitiesWithNonIntegersQuestion(opts), nb),
129
+ qcmTimer: 60,
130
+ freeTimer: 60,
131
+ getPropositions,
132
+ isAnswerValid,
133
+ subject: "Mathématiques",
134
+ getInstruction,
135
+ // getHint,
136
+ // getCorrection,
137
+ getAnswer,
138
+ };
@@ -7,4 +7,6 @@ export { thirdIdentity } from "./thirdIdentity";
7
7
  export * from "./doubleDistributivityWithCoeff";
8
8
  export * from "./canonicalFormDevelopment";
9
9
  export * from "./simpleDistriXCoeff";
10
+ export * from "./doubleDistributivitySubstract";
11
+ export * from "./identitiesWithNonIntegers";
10
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,cAAc,iCAAiC,CAAC;AAChD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/distributivity/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,cAAc,iCAAiC,CAAC;AAChD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,iCAAiC,CAAC;AAChD,cAAc,6BAA6B,CAAC"}
@@ -27,3 +27,5 @@ Object.defineProperty(exports, "thirdIdentity", { enumerable: true, get: functio
27
27
  __exportStar(require("./doubleDistributivityWithCoeff"), exports);
28
28
  __exportStar(require("./canonicalFormDevelopment"), exports);
29
29
  __exportStar(require("./simpleDistriXCoeff"), exports);
30
+ __exportStar(require("./doubleDistributivitySubstract"), exports);
31
+ __exportStar(require("./identitiesWithNonIntegers"), exports);
@@ -0,0 +1,2 @@
1
+ export * from "./recognizeAngleType";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/angles/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./recognizeAngleType"), exports);
@@ -0,0 +1,11 @@
1
+ import { Exercise } from "../../../../exercises/exercise";
2
+ import { PointIdentifiers } from "../../../../math/geometry/point";
3
+ type Identifiers = {
4
+ points: PointIdentifiers[];
5
+ angleType: string;
6
+ angleIndex: number;
7
+ apexIndex: number;
8
+ };
9
+ export declare const recognizeAngleType: Exercise<Identifiers>;
10
+ export {};
11
+ //# sourceMappingURL=recognizeAngleType.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recognizeAngleType.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/angles/recognizeAngleType.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,0BAA0B,CAAC;AASlC,OAAO,EAGL,gBAAgB,EACjB,MAAM,2BAA2B,CAAC;AAWnC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AA8TF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAkBpD,CAAC"}
@@ -0,0 +1,272 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.recognizeAngleType = void 0;
4
+ const exercise_1 = require("../../../../exercises/exercise");
5
+ const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
6
+ const geogebraConstructor_1 = require("../../../../geogebra/geogebraConstructor");
7
+ const angle_1 = require("../../../../math/geometry/angle");
8
+ const line_1 = require("../../../../math/geometry/line");
9
+ const point_1 = require("../../../../math/geometry/point");
10
+ const randfloat_1 = require("../../../../math/utils/random/randfloat");
11
+ const randint_1 = require("../../../../math/utils/random/randint");
12
+ const numberNode_1 = require("../../../../tree/nodes/numbers/numberNode");
13
+ const random_1 = require("../../../../utils/alea/random");
14
+ const isLetter_1 = require("../../../../utils/strings/isLetter");
15
+ const randomLetter_1 = require("../../../../utils/strings/randomLetter");
16
+ const getAngle = (identifiers) => {
17
+ const indexes = getAnglePointsIndexes(identifiers.angleIndex, identifiers.apexIndex);
18
+ return new angle_1.Angle(indexes.map((i) => point_1.PointConstructor.fromIdentifiers(identifiers.points[i])));
19
+ };
20
+ const getAnglePointsIndexes = (angleIndex, apexIndex) => {
21
+ const angles = [
22
+ [apexIndex + 2, apexIndex, apexIndex + 1],
23
+ [(apexIndex + 3 + 12) % 12, apexIndex, apexIndex + 2],
24
+ [(apexIndex - 3 + 12) % 12, apexIndex, (apexIndex + 3 + 12) % 12],
25
+ [apexIndex + 1, apexIndex, (apexIndex - 3 + 12) % 12],
26
+ ];
27
+ //les angles 0 ne peuvent pas etre alterne-interne
28
+ return angles[angleIndex];
29
+ };
30
+ const getPropositions = (n, { answer, angleIndex, angleType, apexIndex, points }) => {
31
+ const propositions = [];
32
+ (0, exercise_1.addValidProp)(propositions, answer);
33
+ let anglesPointsIndexes = [];
34
+ switch (angleType) {
35
+ case "alterne-interne":
36
+ //angles 0 exclus
37
+ if (angleIndex === 1) {
38
+ //angle+1 de l'apex supérieur
39
+ //angles 1: une solution :
40
+ anglesPointsIndexes = [
41
+ getAnglePointsIndexes(angleIndex, (apexIndex + 3) % 12),
42
+ getAnglePointsIndexes((angleIndex + 2) % 4, (apexIndex + 3) % 12),
43
+ getAnglePointsIndexes((angleIndex + 3) % 4, (apexIndex + 3) % 12),
44
+ ];
45
+ }
46
+ if (angleIndex === 2) {
47
+ //angles 2 ont deux solution :
48
+ //-- apex inférieur : angle -1
49
+ //-- apex supérieur : angle +1
50
+ //on choisit l'apex supérieur arbitrairement
51
+ anglesPointsIndexes = [
52
+ getAnglePointsIndexes(angleIndex, (apexIndex + 3 + 12) % 12),
53
+ getAnglePointsIndexes((angleIndex + 2) % 4, (apexIndex + 3 + 12) % 12),
54
+ getAnglePointsIndexes((angleIndex + 3) % 4, (apexIndex + 3 + 12) % 12),
55
+ ];
56
+ }
57
+ //angles 3 : une solution :
58
+ //-- angle-1 de l'apex inférieur
59
+ if (angleIndex === 3) {
60
+ anglesPointsIndexes = [
61
+ getAnglePointsIndexes(angleIndex, (apexIndex - 3 + 12) % 12),
62
+ getAnglePointsIndexes((angleIndex + 2) % 4, (apexIndex - 3 + 12) % 12),
63
+ getAnglePointsIndexes((angleIndex + 1) % 4, (apexIndex - 3 + 12) % 12),
64
+ ];
65
+ }
66
+ break;
67
+ case "correspondant":
68
+ //deux solutions :
69
+ //-- apex supérieur: angle-1
70
+ //-- apex inférieur : angle +1
71
+ //on choisit l'apex supérieur arbitrairement
72
+ anglesPointsIndexes = [
73
+ getAnglePointsIndexes(angleIndex, (apexIndex + 3 + 12) % 12),
74
+ getAnglePointsIndexes((angleIndex + 1) % 4, (apexIndex + 3 + 12) % 12),
75
+ getAnglePointsIndexes((angleIndex + 2) % 4, (apexIndex + 3 + 12) % 12),
76
+ ];
77
+ break;
78
+ case "opposé par le sommet":
79
+ default:
80
+ //sol == angle +2 du meme apex
81
+ anglesPointsIndexes = [
82
+ getAnglePointsIndexes(angleIndex, apexIndex),
83
+ getAnglePointsIndexes((angleIndex + 1) % 4, apexIndex),
84
+ getAnglePointsIndexes((angleIndex + 3) % 4, apexIndex),
85
+ ];
86
+ break;
87
+ }
88
+ anglesPointsIndexes.forEach((indexes) => {
89
+ (0, exercise_1.tryToAddWrongProp)(propositions, new angle_1.Angle(indexes.map((i) => point_1.PointConstructor.fromIdentifiers(points[i]))).toTex());
90
+ });
91
+ return (0, exercise_1.shuffleProps)(propositions, n);
92
+ };
93
+ const getAnswerAngle = (identifiers) => {
94
+ const { angleIndex, angleType, apexIndex, points } = identifiers;
95
+ let anglePointsIndexes = [];
96
+ switch (angleType) {
97
+ case "alterne-interne":
98
+ //angles 0 exclus
99
+ if (angleIndex === 1) {
100
+ //angles 1: une solution :
101
+ //angle+1 de l'apex supérieur
102
+ anglePointsIndexes = getAnglePointsIndexes((angleIndex + 1) % 4, (identifiers.apexIndex + 3) % 12);
103
+ }
104
+ if (angleIndex === 2) {
105
+ //angles 2 ont deux solution :
106
+ //-- apex inférieur : angle -1
107
+ //-- apex supérieur : angle +1
108
+ //on choisit l'apex supérieur arbitrairement
109
+ anglePointsIndexes = getAnglePointsIndexes((angleIndex + 1) % 4, (identifiers.apexIndex + 3 + 12) % 12);
110
+ }
111
+ //angles 3 : une solution :
112
+ //-- angle-1 de l'apex inférieur
113
+ if (angleIndex === 3) {
114
+ anglePointsIndexes = getAnglePointsIndexes((angleIndex - 1 + 4) % 4, (identifiers.apexIndex - 3 + 12) % 12);
115
+ }
116
+ break;
117
+ case "correspondant":
118
+ //deux solutions :
119
+ //-- apex supérieur: angle-1
120
+ //-- apex inférieur : angle +1
121
+ //on choisit l'apex supérieur arbitrairement
122
+ anglePointsIndexes = getAnglePointsIndexes((angleIndex - 1 + 4) % 4, (identifiers.apexIndex + 3 + 12) % 12);
123
+ break;
124
+ case "opposé par le sommet":
125
+ default:
126
+ //angle +2 du meme apex
127
+ anglePointsIndexes = getAnglePointsIndexes((angleIndex + 2) % 4, identifiers.apexIndex);
128
+ break;
129
+ }
130
+ const angle = new angle_1.Angle(anglePointsIndexes.map((i) => point_1.PointConstructor.fromIdentifiers(points[i])));
131
+ return angle;
132
+ };
133
+ const getAnswer = (identifiers) => {
134
+ return getAnswerAngle(identifiers).toTex();
135
+ };
136
+ const getInstruction = (identifiers) => {
137
+ const angleTex = getAngle(identifiers).toTex();
138
+ return `Donner un angle ${identifiers.angleType} à l'angle $${angleTex}$.`;
139
+ };
140
+ // const getHint: GetHint<Identifiers> = (identifiers) => {};
141
+ // const getCorrection: GetCorrection<Identifiers> = (identifiers) => {};
142
+ const getGGBOptions = (identifiers) => {
143
+ const points = identifiers.points.map(point_1.PointConstructor.fromIdentifiers);
144
+ const lines = [
145
+ new line_1.Line(points[0], points[3]),
146
+ new line_1.Line(points[3], points[6]),
147
+ new line_1.Line(points[6], points[9]),
148
+ new line_1.Line(points[9], points[0]),
149
+ ];
150
+ const angle = getAngle(identifiers);
151
+ const ggb = new geogebraConstructor_1.GeogebraConstructor({
152
+ commands: [
153
+ ...points.flatMap((p) => p.toGGBCommand()),
154
+ ...lines.flatMap((l) => l.toGGBCommands(false)),
155
+ ...angle.toCommands({ color: "red" }),
156
+ ],
157
+ hideAxes: true,
158
+ hideGrid: true,
159
+ });
160
+ return ggb.getOptions({
161
+ coords: [-5, 5, -5, 5],
162
+ });
163
+ };
164
+ const getKeys = (identifiers) => {
165
+ const points = identifiers.points.map(point_1.PointConstructor.fromIdentifiers);
166
+ //! devrait on mettre widehat
167
+ return points.map((p) => p.name);
168
+ };
169
+ const isAnswerValid = (ans, { answer, angleIndex, angleType, apexIndex, points }) => {
170
+ let formated = ans;
171
+ if (ans.includes("widehat")) {
172
+ formated = formated.replaceAll("\\widehat{", "").replaceAll("}", "");
173
+ }
174
+ const pointsNames = Array.from(new Set(formated.split("")));
175
+ if (pointsNames.length !== 3 || pointsNames.some((char) => !(0, isLetter_1.isLetter)(char)))
176
+ return false;
177
+ const studentPoints = pointsNames.map((char) => point_1.PointConstructor.fromIdentifiers(points.find((p) => p.name === char)));
178
+ const answerAngle = getAngle({ angleIndex, apexIndex, points });
179
+ const studentAngle = new angle_1.Angle(studentPoints);
180
+ //? on va accpter aussi des angles correspondants ou alternes-internes qui ne sont pas définis par les sécantes tracées
181
+ //? c'est chelou mais dans le fond ça fait sens (c'est vrai mathémtiquement)
182
+ switch (angleType) {
183
+ case "opposé par le sommet":
184
+ return studentAngle.isSummitOpposite(answerAngle);
185
+ case "alterne-interne":
186
+ return studentAngle.isAlterneInterne(answerAngle);
187
+ break;
188
+ case "correspondant":
189
+ default:
190
+ return studentAngle.isCorrespondant(answerAngle);
191
+ break;
192
+ }
193
+ return false;
194
+ };
195
+ //deux paires de sécantes
196
+ const getRecognizeAngleTypeQuestion = (opts) => {
197
+ const angleType = (0, random_1.random)([
198
+ "alterne-interne",
199
+ "correspondant",
200
+ "opposé par le sommet",
201
+ ]);
202
+ const names = [];
203
+ for (let i = 0; i < 12; i++) {
204
+ names.push((0, randomLetter_1.randomLetter)(true, names));
205
+ }
206
+ const buildIntersectionsPoints = (index) => {
207
+ //les 4 intersections sont (+-2, +-2)
208
+ let [x, y] = [index < 3 || index > 8 ? -2 : 2, index < 6 ? 2 : -2];
209
+ //bruit
210
+ x += (0, randfloat_1.randfloat)(-1, 1, 1);
211
+ y += (0, randfloat_1.randfloat)(-1, 1, 1);
212
+ return new point_1.Point(names[index], x.toTree(), y.toTree());
213
+ };
214
+ const intersections = [0, 3, 6, 9].map(buildIntersectionsPoints);
215
+ const buildAnglesPoints = (index) => {
216
+ const intersectionIndex = Math.floor(index / 3);
217
+ const apex = intersections[intersectionIndex];
218
+ const next = intersections[(intersectionIndex + 1) % 4];
219
+ const prev = intersections[(intersectionIndex - 1 + 4) % 4];
220
+ let [x, y] = [apex.x.evaluate(), apex.y.evaluate()];
221
+ if (index % 2 === 0) {
222
+ const line = new line_1.Line(apex, intersectionIndex % 2 === 0 ? prev : next);
223
+ //lignes verticales (ordonnées +-1)
224
+ y = y + (y < 0 ? -1 : 1);
225
+ return line.getPointWithY(new numberNode_1.NumberNode(y), names[index]);
226
+ }
227
+ else {
228
+ //lignes horizontales (abscisse +-1)
229
+ const line = new line_1.Line(apex, intersectionIndex % 2 === 0 ? next : prev);
230
+ x = x + (x < 0 ? -1 : 1);
231
+ return line.getPointWithX(new numberNode_1.NumberNode(x), names[index]);
232
+ }
233
+ };
234
+ const points = names.map((n, i) => i % 3 === 0 ? intersections[Math.floor(i / 3)] : buildAnglesPoints(i));
235
+ const apex = (0, random_1.random)([0, 3, 6, 9]);
236
+ //les angles 0 ne peuvent pas etre alterne-interne
237
+ let angleIndex = (0, randint_1.randint)(angleType !== "alterne-interne" ? 0 : 1, 4);
238
+ const identifiers = {
239
+ angleType,
240
+ apexIndex: apex,
241
+ angleIndex,
242
+ points: points.map((p) => p.toIdentifiers()),
243
+ };
244
+ const question = {
245
+ answer: getAnswer(identifiers),
246
+ instruction: getInstruction(identifiers),
247
+ keys: getKeys(identifiers),
248
+ answerFormat: "tex",
249
+ identifiers,
250
+ // hint: getHint(identifiers),
251
+ // correction: getCorrection(identifiers),
252
+ ggbOptions: getGGBOptions(identifiers),
253
+ };
254
+ return question;
255
+ };
256
+ exports.recognizeAngleType = {
257
+ id: "recognizeAngleType",
258
+ label: "Reconnaître un angle alterne-interne, correspondant, opposé par le sommet",
259
+ isSingleStep: true,
260
+ generator: (nb, opts) => (0, getDistinctQuestions_1.getDistinctQuestions)(() => getRecognizeAngleTypeQuestion(opts), nb),
261
+ qcmTimer: 60,
262
+ freeTimer: 60,
263
+ getPropositions,
264
+ isAnswerValid,
265
+ subject: "Mathématiques",
266
+ // getHint,
267
+ // getCorrection,
268
+ getInstruction,
269
+ getAnswer,
270
+ getGGBOptions,
271
+ hasGeogebra: true,
272
+ };