math-exercises 3.0.202 → 3.0.203

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 (100) hide show
  1. package/lib/exercises/math/derivation/derivative/trigo/productOfSinAXPlusBCosCXPlusDDerivative.js +1 -1
  2. package/lib/exercises/math/derivation/derivative/trigo/sinAndCosMixedWithSquareDerivative.js +1 -1
  3. package/lib/exercises/math/derivation/derivative/trigo/sinCosDerivativeRewriteUsingCos2PlusSin2Equals1.d.ts.map +1 -1
  4. package/lib/exercises/math/derivation/derivative/trigo/sinCosDerivativeRewriteUsingCos2PlusSin2Equals1.js +1 -1
  5. package/lib/exercises/math/geometry/angles/anglesUsingIsParallel.d.ts.map +1 -1
  6. package/lib/exercises/math/geometry/angles/anglesUsingIsParallel.js +172 -51
  7. package/lib/exercises/math/geometry/angles/index.d.ts +1 -0
  8. package/lib/exercises/math/geometry/angles/index.d.ts.map +1 -1
  9. package/lib/exercises/math/geometry/angles/index.js +1 -1
  10. package/lib/exercises/math/limits/index.d.ts +1 -5
  11. package/lib/exercises/math/limits/index.d.ts.map +1 -1
  12. package/lib/exercises/math/limits/index.js +1 -5
  13. package/lib/exercises/math/limits/limitReading.d.ts.map +1 -1
  14. package/lib/exercises/math/limits/limitReading.js +70 -0
  15. package/lib/exercises/math/limits/polynomLimit.d.ts.map +1 -1
  16. package/lib/exercises/math/limits/polynomLimit.js +55 -4
  17. package/lib/exercises/math/limits/polynomLimitNoFI.d.ts.map +1 -1
  18. package/lib/exercises/math/limits/polynomLimitNoFI.js +35 -2
  19. package/lib/exercises/math/limits/sequenceGeometricLimit.d.ts.map +1 -1
  20. package/lib/exercises/math/limits/sequenceGeometricLimit.js +45 -9
  21. package/lib/exercises/math/limits/sequencePolynomLimit.d.ts.map +1 -1
  22. package/lib/exercises/math/limits/sequencePolynomLimit.js +56 -3
  23. package/lib/exercises/math/limits/sequencePolynomNoFILimit.d.ts.map +1 -1
  24. package/lib/exercises/math/limits/sequencePolynomNoFILimit.js +32 -0
  25. package/lib/exercises/math/limits/sequencePolynomProductLimit.d.ts.map +1 -1
  26. package/lib/exercises/math/limits/sequencePolynomProductLimit.js +33 -3
  27. package/lib/exercises/math/limits/sequenceRationalFracLimit.d.ts.map +1 -1
  28. package/lib/exercises/math/limits/sequenceRationalFracLimit.js +2 -2
  29. package/lib/exercises/math/limits/sequences/index.d.ts +6 -0
  30. package/lib/exercises/math/limits/sequences/index.d.ts.map +1 -0
  31. package/lib/exercises/math/limits/sequences/index.js +5 -0
  32. package/lib/exercises/math/limits/sequences/sequenceGeometricLimit.d.ts +9 -0
  33. package/lib/exercises/math/limits/sequences/sequenceGeometricLimit.d.ts.map +1 -0
  34. package/lib/exercises/math/limits/sequences/sequenceGeometricLimit.js +110 -0
  35. package/lib/exercises/math/limits/sequences/sequencePolynomLimit.d.ts +7 -0
  36. package/lib/exercises/math/limits/sequences/sequencePolynomLimit.d.ts.map +1 -0
  37. package/lib/exercises/math/limits/sequences/sequencePolynomLimit.js +116 -0
  38. package/lib/exercises/math/limits/sequences/sequencePolynomNoFILimit.d.ts +7 -0
  39. package/lib/exercises/math/limits/sequences/sequencePolynomNoFILimit.d.ts.map +1 -0
  40. package/lib/exercises/math/limits/sequences/sequencePolynomNoFILimit.js +95 -0
  41. package/lib/exercises/math/limits/sequences/sequencePolynomProductLimit.d.ts +8 -0
  42. package/lib/exercises/math/limits/sequences/sequencePolynomProductLimit.d.ts.map +1 -0
  43. package/lib/exercises/math/limits/sequences/sequencePolynomProductLimit.js +111 -0
  44. package/lib/exercises/math/limits/sequences/sequenceRationalFracLimit.d.ts +8 -0
  45. package/lib/exercises/math/limits/sequences/sequenceRationalFracLimit.d.ts.map +1 -0
  46. package/lib/exercises/math/limits/sequences/sequenceRationalFracLimit.js +114 -0
  47. package/lib/exercises/math/sequences/index.d.ts +1 -0
  48. package/lib/exercises/math/sequences/index.d.ts.map +1 -1
  49. package/lib/exercises/math/sequences/index.js +1 -0
  50. package/lib/exercises/math/sequences/proofByInduction/index.d.ts +5 -0
  51. package/lib/exercises/math/sequences/proofByInduction/index.d.ts.map +1 -0
  52. package/lib/exercises/math/sequences/proofByInduction/index.js +4 -0
  53. package/lib/exercises/math/sequences/proofByInduction/proofByInductionCheckInitialization.d.ts +10 -0
  54. package/lib/exercises/math/sequences/proofByInduction/proofByInductionCheckInitialization.d.ts.map +1 -0
  55. package/lib/exercises/math/sequences/proofByInduction/proofByInductionCheckInitialization.js +236 -0
  56. package/lib/exercises/math/sequences/proofByInduction/proofByInductionReorderProof.d.ts +13 -0
  57. package/lib/exercises/math/sequences/proofByInduction/proofByInductionReorderProof.d.ts.map +1 -0
  58. package/lib/exercises/math/sequences/proofByInduction/proofByInductionReorderProof.js +244 -0
  59. package/lib/exercises/math/sequences/proofByInduction/proofByInductionSituations.d.ts +98 -0
  60. package/lib/exercises/math/sequences/proofByInduction/proofByInductionSituations.d.ts.map +1 -0
  61. package/lib/exercises/math/sequences/proofByInduction/proofByInductionSituations.js +175 -0
  62. package/lib/exercises/math/sequences/proofByInduction/proofByInductionWriteMissingStep.d.ts +13 -0
  63. package/lib/exercises/math/sequences/proofByInduction/proofByInductionWriteMissingStep.d.ts.map +1 -0
  64. package/lib/exercises/math/sequences/proofByInduction/proofByInductionWriteMissingStep.js +317 -0
  65. package/lib/exercises/math/sequences/proofByInduction/proofByInductionWritePropAtRankKPlus1.d.ts +13 -0
  66. package/lib/exercises/math/sequences/proofByInduction/proofByInductionWritePropAtRankKPlus1.d.ts.map +1 -0
  67. package/lib/exercises/math/sequences/proofByInduction/proofByInductionWritePropAtRankKPlus1.js +265 -0
  68. package/lib/exercises/vea/polynomialVEA.d.ts.map +1 -1
  69. package/lib/exercises/vea/polynomialVEA.js +4 -0
  70. package/lib/index.d.ts +49 -13
  71. package/lib/index.d.ts.map +1 -1
  72. package/lib/math/geometry/point.d.ts.map +1 -1
  73. package/lib/math/geometry/point.js +1 -1
  74. package/lib/math/utils/functions/functionDecomposition.d.ts +2 -2
  75. package/lib/math/utils/functions/functionDecomposition.d.ts.map +1 -1
  76. package/lib/tests/exoTest.d.ts.map +1 -1
  77. package/lib/tests/exoTest.js +7 -11
  78. package/lib/tests/questionTest.d.ts.map +1 -1
  79. package/lib/tests/questionTest.js +7 -3
  80. package/lib/tests/singleExo.test.d.ts.map +1 -1
  81. package/lib/tests/singleExo.test.js +2 -2
  82. package/lib/tree/nodes/node.d.ts +2 -1
  83. package/lib/tree/nodes/node.d.ts.map +1 -1
  84. package/lib/tree/nodes/node.js +1 -0
  85. package/lib/tree/nodes/student/iDontKnowNode.d.ts +26 -0
  86. package/lib/tree/nodes/student/iDontKnowNode.d.ts.map +1 -0
  87. package/lib/tree/nodes/student/iDontKnowNode.js +63 -0
  88. package/lib/tree/parsers/latexParser.d.ts +3 -2
  89. package/lib/tree/parsers/latexParser.d.ts.map +1 -1
  90. package/lib/tree/parsers/latexParser.js +7 -0
  91. package/lib/tree/parsers/monomParser.d.ts +1 -1
  92. package/lib/tree/parsers/monomParser.d.ts.map +1 -1
  93. package/lib/tree/parsers/polynomialParser.d.ts +1 -1
  94. package/lib/tree/parsers/polynomialParser.d.ts.map +1 -1
  95. package/lib/tree/parsers/trinomParser.d.ts +1 -1
  96. package/lib/tree/parsers/trinomParser.d.ts.map +1 -1
  97. package/lib/tree/utilities/nodeComparator.d.ts +3 -1
  98. package/lib/tree/utilities/nodeComparator.d.ts.map +1 -1
  99. package/lib/tree/utilities/nodeComparator.js +63 -5
  100. package/package.json +1 -1
@@ -162,7 +162,7 @@ const isAnswerValid = (ans, { answer, ...identifiers }) => {
162
162
  try {
163
163
  const nodeAns = parseAlgebraic(ans);
164
164
  const nodeAnswer = getAnswerNode(identifiers);
165
- return NodeComparator.isEqualViaRandomEvaluations(nodeAns, nodeAnswer, 3);
165
+ return NodeComparator.isEqualViaRandomSubstitutions(nodeAns, nodeAnswer, 3);
166
166
  }
167
167
  catch (e) {
168
168
  handleVEAError(e);
@@ -306,7 +306,7 @@ const isAnswerValid = (ans, { answer, ...identifiers }) => {
306
306
  try {
307
307
  const nodeAns = parseAlgebraic(ans);
308
308
  const nodeAnswer = getAnswerNode(identifiers);
309
- return NodeComparator.isEqualViaRandomEvaluations(nodeAns, nodeAnswer, 3);
309
+ return NodeComparator.isEqualViaRandomSubstitutions(nodeAns, nodeAnswer, 3);
310
310
  }
311
311
  catch (e) {
312
312
  handleVEAError(e);
@@ -1 +1 @@
1
- {"version":3,"file":"sinCosDerivativeRewriteUsingCos2PlusSin2Equals1.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/derivation/derivative/trigo/sinCosDerivativeRewriteUsingCos2PlusSin2Equals1.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AASrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAoH7C,KAAK,WAAW,GAAG;IACjB,aAAa,EAAE,eAAe,CAAC;IAC/B,QAAQ,EAAE,eAAe,CAAC;IAC1B,QAAQ,EAAE,eAAe,CAAC;IAC1B,mBAAmB,EAAE,eAAe,CAAC;CACtC,CAAC;AAuaF,eAAO,MAAM,+CAA+C,EAAE,QAAQ,CAAC,WAAW,CAqB/E,CAAC"}
1
+ {"version":3,"file":"sinCosDerivativeRewriteUsingCos2PlusSin2Equals1.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/derivation/derivative/trigo/sinCosDerivativeRewriteUsingCos2PlusSin2Equals1.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AASrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAoH7C,KAAK,WAAW,GAAG;IACjB,aAAa,EAAE,eAAe,CAAC;IAC/B,QAAQ,EAAE,eAAe,CAAC;IAC1B,QAAQ,EAAE,eAAe,CAAC;IAC1B,mBAAmB,EAAE,eAAe,CAAC;CACtC,CAAC;AAkaF,eAAO,MAAM,+CAA+C,EAAE,QAAQ,CAAC,WAAW,CAqB/E,CAAC"}
@@ -392,7 +392,7 @@ const isAnswerValid = (ans, { answer, ...identifiers }) => {
392
392
  try {
393
393
  const nodeAns = parseAlgebraic(ans);
394
394
  const nodeAnswer = getAnswerNode(identifiers);
395
- return NodeComparator.isEqualViaRandomEvaluations(nodeAns, nodeAnswer, 3, 4);
395
+ return NodeComparator.isEqualViaRandomSubstitutions(nodeAns, nodeAnswer, 3);
396
396
  }
397
397
  catch (e) {
398
398
  handleVEAError(e);
@@ -1 +1 @@
1
- {"version":3,"file":"anglesUsingIsParallel.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/angles/anglesUsingIsParallel.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAmBT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAGL,eAAe,EAChB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAGL,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AAuItC,KAAK,eAAe,GAAG;IACrB,MAAM,EAAE,gBAAgB,CAAC;IACzB,KAAK,EAAE,eAAe,CAAC;IACvB,KAAK,EAAE,eAAe,CAAC;CACxB,CAAC;AA6HF,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EACL,mBAAmB,GACnB,gBAAgB,GAChB,mBAAmB,GACnB,QAAQ,CAAC;IAGb,kBAAkB,EAAE,eAAe,EAAE,CAAC;IACtC,aAAa,EAAE,MAAM,EAAE,CAAC;IAGxB,gBAAgB,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;CACxC,CAAC;AAwMF,KAAK,OAAO,GAAG;IACb,UAAU,EAAE,CACR,mBAAmB,GACnB,gBAAgB,GAChB,mBAAmB,GACnB,QAAQ,CACX,EAAE,CAAC;IACJ,aAAa,EAAE,OAAO,CAAC;IACvB,QAAQ,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;CAC3B,CAAC;AAsNF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAkBhE,CAAC"}
1
+ {"version":3,"file":"anglesUsingIsParallel.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/angles/anglesUsingIsParallel.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAmBT,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAGL,eAAe,EAChB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAGL,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AAoMtC,KAAK,eAAe,GAAG;IACrB,MAAM,EAAE,gBAAgB,CAAC;IACzB,KAAK,EAAE,eAAe,CAAC;IACvB,KAAK,EAAE,eAAe,CAAC;CACxB,CAAC;AA6HF,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EACL,mBAAmB,GACnB,gBAAgB,GAChB,mBAAmB,GACnB,QAAQ,CAAC;IAGb,kBAAkB,EAAE,eAAe,EAAE,CAAC;IACtC,aAAa,EAAE,MAAM,EAAE,CAAC;IAGxB,gBAAgB,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;CACxC,CAAC;AAweF,KAAK,OAAO,GAAG;IACb,UAAU,EAAE,CACR,mBAAmB,GACnB,gBAAgB,GAChB,mBAAmB,GACnB,QAAQ,CACX,EAAE,CAAC;IACJ,aAAa,EAAE,OAAO,CAAC;IACvB,QAAQ,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;CAC3B,CAAC;AAqCF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAiBhE,CAAC"}
@@ -9,10 +9,45 @@ import { randfloat } from "../../../../math/utils/random/randfloat.js";
9
9
  import { round } from "../../../../math/utils/round.js";
10
10
  import { PiNode } from "../../../../tree/nodes/numbers/piNode.js";
11
11
  import { add } from "../../../../tree/nodes/operators/addNode.js";
12
- import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
13
- import { substract } from "../../../../tree/nodes/operators/substractNode.js";
12
+ import { FractionNode } from "../../../../tree/nodes/operators/fractionNode.js";
13
+ import { multiply, MultiplyNode, } from "../../../../tree/nodes/operators/multiplyNode.js";
14
+ import { substract, SubstractNode, } from "../../../../tree/nodes/operators/substractNode.js";
15
+ import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
16
+ import { NodeComparator } from "../../../../tree/utilities/nodeComparator.js";
14
17
  import { coinFlip } from "../../../../utils/alea/coinFlip.js";
15
18
  import { random } from "../../../../utils/alea/random.js";
19
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
20
+ class MyLine extends Line {
21
+ pointA;
22
+ pointB;
23
+ isVertical;
24
+ a;
25
+ b;
26
+ name;
27
+ unformatedName;
28
+ ggbName;
29
+ constructor(pointA, pointB, name) {
30
+ super(new Point("A", 0, 0), new Point("B", 1, 1), "L");
31
+ this.pointA = pointA;
32
+ this.pointB = pointB;
33
+ this.unformatedName = name ?? `${pointA.name}${pointB.name}`;
34
+ this.name = name ?? `\\left(${pointA.name}${pointB.name}\\right)`;
35
+ this.ggbName = name ?? `line${pointA.name}${pointB.name}`;
36
+ this.isVertical = pointA.x.equals(pointB.x);
37
+ if (this.isVertical) {
38
+ this.a = undefined;
39
+ this.b = undefined;
40
+ }
41
+ else {
42
+ this.a = new FractionNode(new SubstractNode(this.pointB.y, this.pointA.y), new SubstractNode(this.pointB.x, this.pointA.x))
43
+ .evaluate()
44
+ .toTree();
45
+ this.b = new SubstractNode(this.pointA.y, new MultiplyNode(this.a, this.pointA.x))
46
+ .evaluate()
47
+ .toTree();
48
+ }
49
+ }
50
+ }
16
51
  const createVector = (from, to, name, precision = 5) => {
17
52
  return new Vector(name, round(substract(to.x, from.x).evaluate(), precision).toTree(), round(substract(to.y, from.y).evaluate(), precision).toTree());
18
53
  };
@@ -26,9 +61,16 @@ const degreesToRadians = (angleInDegrees, precision) => {
26
61
  const oneOver180 = 0.00555555555555555;
27
62
  return round(multiply(multiply(angleInDegrees, PiNode), oneOver180).evaluate(), precision);
28
63
  };
64
+ const rotateVector = (vec, angle, name) => {
65
+ //x' = cos(t)*x -sin(t)*y
66
+ //y' = sin(t)*x + cos(t)*y
67
+ const cos = Math.cos(angle);
68
+ const sin = Math.sin(angle);
69
+ return new Vector(name, substract(multiply(cos, vec.x), multiply(sin, vec.y)).evaluate().toTree(), add(multiply(sin, vec.x), multiply(cos, vec.y)).evaluate().toTree());
70
+ };
29
71
  const rotatePoint = (target, angle, center, name, precision = 2) => {
30
72
  const vSrc = createVector(center, target, "vSrc", precision);
31
- const vRotated = vSrc.rotate(angle, "vRotated");
73
+ const vRotated = rotateVector(vSrc, angle, "vRotated");
32
74
  return createPoint(add(center.x, vRotated.x).evaluate(), add(center.y, vRotated.y).evaluate(), name, precision);
33
75
  };
34
76
  const buildLines = (cAngleInDegreesTop, cAngleInDegreesBottom) => {
@@ -49,12 +91,12 @@ const buildLines = (cAngleInDegreesTop, cAngleInDegreesBottom) => {
49
91
  ].map((angleInDegrees) => degreesToRadians(angleInDegrees, precision));
50
92
  //build top line
51
93
  const heightAvgTopLine = 2;
52
- const lineTop = new Line(new Point("A", (-4 + randfloat(-1, 1, 1)).toTree(), (heightAvgTopLine + randfloat(-1, 1, 1)).toTree()), new Point("B", (4 + randfloat(-1, 1, 1)).toTree(), (heightAvgTopLine + randfloat(-1, 1, 1)).toTree()), "d_1");
94
+ const lineTop = new MyLine(new Point("A", (-4 + randfloat(-1, 1, 1)).toTree(), (heightAvgTopLine + randfloat(-1, 1, 1)).toTree()), new Point("B", (4 + randfloat(-1, 1, 1)).toTree(), (heightAvgTopLine + randfloat(-1, 1, 1)).toTree()), "d1");
53
95
  //build secant line
54
96
  const pointSTop = midPoint(lineTop.pointA, lineTop.pointB, "C", 5);
55
- const lineSecant = new Line(pointSTop, rotatePoint(lineTop.pointA, PiNode.value - cAngleTop, pointSTop, "D", 5), "s");
97
+ const lineSecant = new MyLine(pointSTop, rotatePoint(lineTop.pointA, PiNode.value - cAngleTop, pointSTop, "D", 5), "s");
56
98
  //build bottom line
57
- const lineBottom = new Line(lineSecant.pointB, rotatePoint(lineSecant.pointA, cAngleBottom, lineSecant.pointB, "E", 5), "d_2");
99
+ const lineBottom = new MyLine(lineSecant.pointB, rotatePoint(lineSecant.pointA, cAngleBottom, lineSecant.pointB, "E", 5), "d2");
58
100
  return {
59
101
  lineTop,
60
102
  lineSecant,
@@ -85,7 +127,7 @@ class IntersectionConstructor {
85
127
  const arrPointRotated = arrPointSrc.map((p) => {
86
128
  return rotatePoint(p, rotationAngle, rotationCenter, p.name, precision);
87
129
  });
88
- return new Intersection(arrPointRotated[0], new Line(arrPointRotated[1], arrPointRotated[2], intersectionSrc.lineH.name), new Line(arrPointRotated[3], arrPointRotated[4], intersectionSrc.lineV.name));
130
+ return new Intersection(arrPointRotated[0], new MyLine(arrPointRotated[1], arrPointRotated[2], intersectionSrc.lineH.name), new MyLine(arrPointRotated[3], arrPointRotated[4], intersectionSrc.lineV.name));
89
131
  }
90
132
  }
91
133
  class Intersection {
@@ -100,9 +142,9 @@ class Intersection {
100
142
  static createLineBothSideOfPoint(lineBase, pointCenter, lineIntersector, wrtAxis) {
101
143
  switch (wrtAxis) {
102
144
  case "x":
103
- return new Line(lineBase.intersect(lineIntersector.translate(-1, 0), pointCenter.name + "_xm"), lineBase.intersect(lineIntersector.translate(+1, 0), pointCenter.name + "_xM"), lineBase.name);
145
+ return new MyLine(lineBase.intersect(lineIntersector.translate(-1, 0), pointCenter.name + "xm"), lineBase.intersect(lineIntersector.translate(+1, 0), pointCenter.name + "xM"), lineBase.name);
104
146
  case "y":
105
- return new Line(lineBase.intersect(lineIntersector.translate(0, -1), pointCenter.name + "_ym"), lineBase.intersect(lineIntersector.translate(0, +1), pointCenter.name + "_yM"), lineBase.name);
147
+ return new MyLine(lineBase.intersect(lineIntersector.translate(0, -1), pointCenter.name + "ym"), lineBase.intersect(lineIntersector.translate(0, +1), pointCenter.name + "yM"), lineBase.name);
106
148
  }
107
149
  }
108
150
  getAngle(angleIndex) {
@@ -177,7 +219,6 @@ const getCorrection = (identifiers) => {
177
219
  return `alternes-internes`;
178
220
  case "correspondants":
179
221
  return `correspondants`;
180
- break;
181
222
  case "alternes-externes":
182
223
  return `alternes-externes`;
183
224
  case "autres":
@@ -222,13 +263,17 @@ const getGGBOptions = (identifiers, opts) => {
222
263
  arrIntersectionIds[0].lineV, //secant
223
264
  ]
224
265
  .map((lIds) => LineConstructor.fromIdentifiers(lIds))
266
+ .map((line, i) => {
267
+ line.ggbName = `d_${i}`;
268
+ return line;
269
+ })
225
270
  .flatMap((l, i) => l.toGGBCommands(false, {
226
271
  color: "black",
227
272
  showLabel: i < 2,
228
273
  }));
229
274
  const arrCommandAngles = arrAngle
230
275
  .map((angle, i) => {
231
- angle.name = `angle_${i}`;
276
+ angle.name = `angle${i}`;
232
277
  return angle;
233
278
  })
234
279
  .flatMap((a, i) => [
@@ -249,7 +294,7 @@ const getGGBOptions = (identifiers, opts) => {
249
294
  }),
250
295
  ]);
251
296
  const arrCommandOther = [
252
- `lb_parallel = Text("\\tex$d_1$${isParallel ? "∥" : "∦"}$d_2$", (${-4.5},${-3.1}), false, true, -1, -1)`,
297
+ `lbparallel = Text("\\tex$d_1$${isParallel ? "∥" : "∦"}$d_2$", (${-4.5},${-3.1}), false, true, -1, -1)`,
253
298
  ];
254
299
  const ggb = new GeogebraConstructor({
255
300
  commands: [
@@ -280,46 +325,22 @@ const getKeys = () => {
280
325
  ];
281
326
  };
282
327
  const isAnswerValid = (ans, { answer }) => {
283
- return ans === answer;
284
- };
285
- const optsDefault = {
286
- angleTypes: ["alternes-internes"],
287
- isFakeDisplay: true,
288
- nbDigits: "0",
328
+ if (ans === answer) {
329
+ return true;
330
+ }
331
+ try {
332
+ const nodeAns = parseAlgebraic(ans);
333
+ const nodeAnswer = parseAlgebraic(answer);
334
+ const isValid = NodeComparator.isEqualViaSub(nodeAns, nodeAnswer) ||
335
+ NodeComparator.isEqualViaFrac(nodeAns, nodeAnswer);
336
+ return isValid;
337
+ }
338
+ catch (err) {
339
+ return handleVEAError(err);
340
+ }
289
341
  };
290
- const options = [
291
- {
292
- id: "angleTypes",
293
- label: "Type d'angles",
294
- target: GeneratorOptionTarget.generation,
295
- type: GeneratorOptionType.multiselect,
296
- values: [
297
- "alternes-internes",
298
- "correspondants",
299
- "alternes-externes",
300
- "autres",
301
- ],
302
- defaultValue: optsDefault.angleTypes,
303
- },
304
- {
305
- id: "isFakeDisplay",
306
- label: "Affichage trompeur",
307
- target: GeneratorOptionTarget.generation,
308
- type: GeneratorOptionType.checkbox,
309
- defaultValue: optsDefault.isFakeDisplay,
310
- },
311
- {
312
- id: "nbDigits",
313
- label: "Nombre de décimales",
314
- target: GeneratorOptionTarget.generation,
315
- type: GeneratorOptionType.select,
316
- values: ["0", "1", "2"],
317
- defaultValue: optsDefault.nbDigits,
318
- },
319
- ];
320
- const getAnglesUsingIsParallelQuestion = (optsIn) => {
342
+ const createRandomIdentifiers = (opts) => {
321
343
  const isParallel = coinFlip();
322
- const opts = optsIn ?? optsDefault;
323
344
  //---create intersections---
324
345
  //this config will be used to create ggb lines
325
346
  function createConfigGeom(isParallelInGeom, isLookingParallel) {
@@ -412,6 +433,72 @@ const getAnglesUsingIsParallelQuestion = (optsIn) => {
412
433
  arrAngleIndex,
413
434
  arrAngleForLabel,
414
435
  };
436
+ return identifiers;
437
+ };
438
+ const isIdentifiersQCPassed = (identifiers) => {
439
+ const isExploding = (identifiers) => {
440
+ let isExploding = false;
441
+ try {
442
+ getAnswer(identifiers);
443
+ getCorrection(identifiers);
444
+ }
445
+ catch (_) {
446
+ isExploding = true;
447
+ }
448
+ return isExploding;
449
+ };
450
+ return !isExploding(identifiers);
451
+ };
452
+ const createQCPassedIdentifiers = (opts) => {
453
+ let identifiers;
454
+ let counter = -1;
455
+ let isValid = false;
456
+ while (!isValid && counter < 100) {
457
+ counter++;
458
+ let identifiersCandidate;
459
+ try {
460
+ identifiersCandidate = createRandomIdentifiers(opts);
461
+ isValid = isIdentifiersQCPassed(identifiersCandidate);
462
+ }
463
+ catch (_) {
464
+ isValid = false;
465
+ }
466
+ if (isValid) {
467
+ identifiers = identifiersCandidate;
468
+ }
469
+ }
470
+ {
471
+ identifiers = createRandomIdentifiers(opts);
472
+ isValid = true;
473
+ }
474
+ if (!isValid) {
475
+ const identifiersDefault = (() => {
476
+ const lineH1 = new MyLine(new Point("H11", -4, 3), new Point("H12", 8, 1), "h");
477
+ const lineV = new MyLine(new Point("V1", 1, 0), new Point("V2", 3, 4), "h");
478
+ const lineH2 = new MyLine(new Point("H21", -4, -2), new Point("H22", 6, -2), "h");
479
+ const intersection1 = IntersectionConstructor.fromBaselines("i1", lineH1, lineV);
480
+ const intersection2 = IntersectionConstructor.fromBaselines("i2", lineH2, lineV);
481
+ const angleType = "alternes-internes";
482
+ const arrAngleForLabel = [50, 130, 50, 130];
483
+ const arrAngleIndex = random([
484
+ [2, 0],
485
+ [3, 1],
486
+ ]);
487
+ return {
488
+ isParallel: false,
489
+ arrIntersectionIds: [intersection1, intersection2].map((intersection) => intersection.toIdentifiers()),
490
+ angleType,
491
+ arrAngleForLabel,
492
+ arrAngleIndex,
493
+ };
494
+ })();
495
+ identifiers = identifiersDefault;
496
+ }
497
+ return identifiers;
498
+ };
499
+ const getAnglesUsingIsParallelQuestion = (optsIn) => {
500
+ const opts = optsIn ?? optsDefault;
501
+ const identifiers = createQCPassedIdentifiers(opts);
415
502
  return getQuestionFromIdentifiers(identifiers, opts);
416
503
  };
417
504
  const getQuestionFromIdentifiers = (identifiers, opts) => {
@@ -427,6 +514,41 @@ const getQuestionFromIdentifiers = (identifiers, opts) => {
427
514
  };
428
515
  return question;
429
516
  };
517
+ const optsDefault = {
518
+ angleTypes: ["alternes-internes"],
519
+ isFakeDisplay: true,
520
+ nbDigits: "0",
521
+ };
522
+ const options = [
523
+ {
524
+ id: "angleTypes",
525
+ label: "Type d'angles",
526
+ target: GeneratorOptionTarget.generation,
527
+ type: GeneratorOptionType.multiselect,
528
+ values: [
529
+ "alternes-internes",
530
+ "correspondants",
531
+ "alternes-externes",
532
+ "autres",
533
+ ],
534
+ defaultValue: optsDefault.angleTypes,
535
+ },
536
+ {
537
+ id: "isFakeDisplay",
538
+ label: "Affichage trompeur",
539
+ target: GeneratorOptionTarget.generation,
540
+ type: GeneratorOptionType.checkbox,
541
+ defaultValue: optsDefault.isFakeDisplay,
542
+ },
543
+ {
544
+ id: "nbDigits",
545
+ label: "Nombre de décimales",
546
+ target: GeneratorOptionTarget.generation,
547
+ type: GeneratorOptionType.select,
548
+ values: ["0", "1", "2"],
549
+ defaultValue: optsDefault.nbDigits,
550
+ },
551
+ ];
430
552
  export const anglesUsingIsParallel = {
431
553
  id: "anglesUsingIsParallel",
432
554
  label: "Déterminer un angle issu d'une sécante en utilisant le parallélisme",
@@ -441,7 +563,6 @@ export const anglesUsingIsParallel = {
441
563
  getHint,
442
564
  getCorrection,
443
565
  hasHintAndCorrection: true,
444
- answerType: "QCU",
445
566
  getQuestionFromIdentifiers,
446
567
  hasGeogebra: true,
447
568
  };
@@ -1,3 +1,4 @@
1
1
  export * from "./recognizeAngleType.js";
2
2
  export * from "./parallelogramFourthAngle.js";
3
+ export * from "./anglesUsingIsParallel.js";
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/angles/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,+BAA+B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/angles/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,+BAA+B,CAAC;AAE9C,cAAc,4BAA4B,CAAC"}
@@ -1,4 +1,4 @@
1
1
  export * from "./recognizeAngleType.js";
2
2
  export * from "./parallelogramFourthAngle.js";
3
3
  //export * from "./isParallelUsingAngles.js";
4
- // export * from "./anglesUsingIsParallel.js";
4
+ export * from "./anglesUsingIsParallel.js";
@@ -2,13 +2,9 @@ export * from "./polynomLimit.js";
2
2
  export * from "./polynomLimitNoFI.js";
3
3
  export * from "./rationalFracForbiddenValueLimit.js";
4
4
  export * from "./rationalFracLimit.js";
5
- export * from "./sequenceGeometricLimit.js";
6
- export * from "./sequencePolynomLimit.js";
7
- export * from "./sequencePolynomNoFILimit.js";
8
- export * from "./sequencePolynomProductLimit.js";
9
- export * from "./sequenceRationalFracLimit.js";
10
5
  export * from "./limitReading.js";
11
6
  export * from "./frac1XTimesALogXPlusBLimit.js";
12
7
  export * from "./kLogXPlusTrinomLimit.js";
13
8
  export * from "./logOfPolynomialLimit.js";
9
+ export * from "./sequences/index.js";
14
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/limits/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sCAAsC,CAAC;AACrD,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mBAAmB,CAAC;AAClC,cAAc,iCAAiC,CAAC;AAChD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/limits/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sCAAsC,CAAC;AACrD,cAAc,wBAAwB,CAAC;AAEvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iCAAiC,CAAC;AAChD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC"}
@@ -2,12 +2,8 @@ export * from "./polynomLimit.js";
2
2
  export * from "./polynomLimitNoFI.js";
3
3
  export * from "./rationalFracForbiddenValueLimit.js";
4
4
  export * from "./rationalFracLimit.js";
5
- export * from "./sequenceGeometricLimit.js";
6
- export * from "./sequencePolynomLimit.js";
7
- export * from "./sequencePolynomNoFILimit.js";
8
- export * from "./sequencePolynomProductLimit.js";
9
- export * from "./sequenceRationalFracLimit.js";
10
5
  export * from "./limitReading.js";
11
6
  export * from "./frac1XTimesALogXPlusBLimit.js";
12
7
  export * from "./kLogXPlusTrinomLimit.js";
13
8
  export * from "./logOfPolynomialLimit.js";
9
+ export * from "./sequences/index.js";
@@ -1 +1 @@
1
- {"version":3,"file":"limitReading.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/limits/limitReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAmBrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,GAAG,GAAG,GAAG,GAAG,SAAS,CAAC;IAC5B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtB,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,UAAU,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC;CACzB,CAAC;AAoKF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,CAa9C,CAAC"}
1
+ {"version":3,"file":"limitReading.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/limits/limitReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAmBrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,GAAG,GAAG,GAAG,GAAG,SAAS,CAAC;IAC5B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtB,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,UAAU,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC;CACzB,CAAC;AAgPF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,CAc9C,CAAC"}
@@ -79,6 +79,73 @@ const getAnswer = (identifiers) => {
79
79
  }
80
80
  }
81
81
  };
82
+ const getHint = (identifiers) => {
83
+ const { from, to } = identifiers;
84
+ switch (to) {
85
+ case "-\\infty":
86
+ return `Observe les valeurs de $f(x)$ lorsque $x$ se rapproche de $-\\infty$ (c'est à dire, lorsque $x$ prend des valeurs de plus en plus grande dans les négatifs). Si $f(x)$ semble se rapprocher d'une valeur, alors cette valeur est la limite recherchée. Si $f(x)$ semble devenir de plus en plus grand, alors la limite est $+\\infty$ (ou $-\\infty$ si les valeurs sont négatives).`;
87
+ break;
88
+ case "+\\infty":
89
+ return `Observe les valeurs de $f(x)$ lorsque $x$ se rapproche de $+\\infty$ (c'est à dire, lorsque $x$ prend des valeurs de plus en plus grande dans les positifs). Si $f(x)$ semble se rapprocher d'une valeur, alors cette valeur est la limite recherchée. Si $f(x)$ semble devenir de plus en plus grand, alors la limite est $+\\infty$ (ou $-\\infty$ si les valeurs sont négatives).`;
90
+ break;
91
+ default:
92
+ if (from === "+") {
93
+ return `On cherche la limite de $f(x)$ lorsque $x$ se rapproche de $${to}$, tout en restant supérieur à $${to}$. Observe donc les valeurs de $f(x)$ en partant des valeurs de $x$ supérieures à $${to}$, et en te rapprochant de plus en plus de $${to}$.`;
94
+ }
95
+ else {
96
+ return `On cherche la limite de $f(x)$ lorsque $x$ se rapproche de $${to}$, tout en restant inférieur à $${to}$. Observe donc les valeurs de $f(x)$ en partant des valeurs de $x$ inférieures à $${to}$, et en te rapprochant de plus en plus de $${to}$.`;
97
+ }
98
+ }
99
+ return ``;
100
+ };
101
+ const getCorrection = (identifiers) => {
102
+ const { from, to } = identifiers;
103
+ const answer = getAnswer(identifiers);
104
+ let corr = "";
105
+ switch (to) {
106
+ case "-\\infty":
107
+ corr += `On observe les valeurs de $f(x)$ lorsque $x$ se rapproche de $-\\infty$ (c'est à dire, lorsque $x$ prend des valeurs de plus en plus grande dans les négatifs).`;
108
+ break;
109
+ case "+\\infty":
110
+ corr += `On observe les valeurs de $f(x)$ lorsque $x$ se rapproche de $+\\infty$ (c'est à dire, lorsque $x$ prend des valeurs de plus en plus grande dans les positifs).`;
111
+ break;
112
+ default:
113
+ if (from === "+") {
114
+ corr += `On cherche la limite de $f(x)$ lorsque $x$ se rapproche de $${to}$, tout en restant supérieur à $${to}$. On observe donc les valeurs de $f(x)$ en partant des valeurs de $x$ supérieures à $${to}$, et en se rapprochant de plus en plus de $${to}$.`;
115
+ }
116
+ else {
117
+ corr += `On cherche la limite de $f(x)$ lorsque $x$ se rapproche de $${to}$, tout en restant inférieur à $${to}$. On observe donc les valeurs de $f(x)$ en partant des valeurs de $x$ inférieures à $${to}$, et en se rapprochant de plus en plus de $${to}$.`;
118
+ }
119
+ }
120
+ switch (answer) {
121
+ case "+\\infty":
122
+ corr += `
123
+
124
+ On lit graphiquement que $f(x)$ prend des valeurs de plus en plus grandes dans les positifs, c'est à dire que ces valeurs semblent se rapprocher de $+\\infty$.
125
+ `;
126
+ break;
127
+ case "-\\infty":
128
+ corr += `
129
+
130
+ On lit graphiquement que $f(x)$ prend des valeurs de plus en plus grandes dans les négatifs, c'est à dire que ces valeurs semblent se rapprocher de $-\\infty$.
131
+ `;
132
+ break;
133
+ default:
134
+ corr += `
135
+
136
+ On lit graphiquement que $f(x)$ prend des valeurs de plus en plus proches de $${answer}$.
137
+ `;
138
+ break;
139
+ }
140
+ return (corr +
141
+ `
142
+
143
+ On en conclut donc que :
144
+
145
+ $$
146
+ ${new LimitNode(parseLatex(to), new VariableNode("f(x)"), from).toTex()} = ${answer}
147
+ $$`);
148
+ };
82
149
  const getQuestionFromIdentifiers = (identifiers) => {
83
150
  const question = {
84
151
  answer: getAnswer(identifiers),
@@ -87,6 +154,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
87
154
  ggbOptions: getGGBOptions(identifiers),
88
155
  answerFormat: "tex",
89
156
  identifiers,
157
+ hint: getHint(identifiers),
158
+ correction: getCorrection(identifiers),
90
159
  };
91
160
  return question;
92
161
  };
@@ -176,4 +245,5 @@ export const limitReading = {
176
245
  hasGeogebra: true,
177
246
  subject: "Mathématiques",
178
247
  getQuestionFromIdentifiers,
248
+ hasHintAndCorrection: true,
179
249
  };
@@ -1 +1 @@
1
- {"version":3,"file":"polynomLimit.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/limits/polynomLimit.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,EAAE,EAAE,UAAU,GAAG,UAAU,CAAC;CAC7B,CAAC;AA6DF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,CAY9C,CAAC"}
1
+ {"version":3,"file":"polynomLimit.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/limits/polynomLimit.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAcrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,EAAE,EAAE,UAAU,GAAG,UAAU,CAAC;CAC7B,CAAC;AAiHF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,CAa9C,CAAC"}
@@ -2,6 +2,11 @@ import { addValidProp, propWhile, tryToAddWrongProp, } from "../../../exercises/
2
2
  import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
3
3
  import { Polynomial, PolynomialConstructor, } from "../../../math/polynomials/polynomial.js";
4
4
  import { randint } from "../../../math/utils/random/randint.js";
5
+ import { AddNode } from "../../../tree/nodes/operators/addNode.js";
6
+ import { frac } from "../../../tree/nodes/operators/fractionNode.js";
7
+ import { multiply } from "../../../tree/nodes/operators/multiplyNode.js";
8
+ import { power } from "../../../tree/nodes/operators/powerNode.js";
9
+ import { operatorComposition } from "../../../tree/utilities/operatorComposition.js";
5
10
  import { coinFlip } from "../../../utils/alea/coinFlip.js";
6
11
  import { shuffle } from "../../../utils/alea/shuffle.js";
7
12
  const getInstruction = (identifiers) => {
@@ -19,8 +24,44 @@ const getAnswer = (identifiers) => {
19
24
  const answer = poly.getLimit(to);
20
25
  return answer;
21
26
  };
22
- // const getHint: GetHint<Identifiers> = (identifiers) => {};
23
- // const getCorrection: GetCorrection<Identifiers> = (identifiers) => {};
27
+ const getHint = () => {
28
+ return `Attention ! Ici, on est en présence d'une forme indéterminée du type "$\\infty - \\infty"$.
29
+
30
+ On ne peut pas immédiatemment déterminer la limite de $f(x)$.
31
+
32
+ Pour s'en sortir, il faut d'abord factoriser $f(x)$ par son terme de plus haut degré.`;
33
+ };
34
+ const getCorrection = (identifiers) => {
35
+ const { coeffs, to } = identifiers;
36
+ const order = coeffs.length - 1;
37
+ const highCoeff = coeffs[order];
38
+ const high = power("x", order);
39
+ const factoNodes = [...coeffs].reverse().map((e, i) => {
40
+ //coeff / n^(order-i)
41
+ return frac(e, power("x", i)).simplify();
42
+ });
43
+ const facto = operatorComposition(AddNode, factoNodes);
44
+ return `Ici, on est en présence d'une forme indéterminée du type "$\\infty - \\infty"$.
45
+
46
+ Pour déterminer la limite de $f(x)$, on factorise par son terme de plus haut degré :
47
+
48
+ $$
49
+ f(x) = ${multiply(high, facto).toTex()}
50
+ $$
51
+
52
+ On a alors :
53
+
54
+
55
+ - $\\displaystyle \\lim_{x \\to ${to}} ${high.toTex()} = ${to === "-\\infty" && order % 2 === 1 ? "-" : "+"}\\infty$
56
+
57
+ - $\\displaystyle \\lim_{x \\to ${to}} ${facto.toTex()} = ${highCoeff}$
58
+
59
+ Par produit des limites, on obtient donc :
60
+
61
+ $$
62
+ \\lim_{x \\to ${to}} f(x) = ${getAnswer(identifiers)}
63
+ $$`;
64
+ };
24
65
  const getQuestionFromIdentifiers = (identifiers) => {
25
66
  const question = {
26
67
  answer: getAnswer(identifiers),
@@ -28,11 +69,20 @@ const getQuestionFromIdentifiers = (identifiers) => {
28
69
  keys: ["infty"],
29
70
  answerFormat: "tex",
30
71
  identifiers,
72
+ hint: getHint(identifiers),
73
+ correction: getCorrection(identifiers),
31
74
  };
32
75
  return question;
33
76
  };
34
77
  const getPolynomLimitQuestion = () => {
35
- const poly = PolynomialConstructor.random(4);
78
+ const order = randint(2, 5);
79
+ const poly = PolynomialConstructor.randomWithOrder(order, "n");
80
+ const coeffs = [...poly.coefficients];
81
+ const signs = coeffs.slice(1).map((e) => (e > 0 ? "+" : "-"));
82
+ if (signs.every((s) => s === signs[0])) {
83
+ const index = randint(1, order);
84
+ coeffs[index] *= -1;
85
+ }
36
86
  const to = coinFlip() ? "+\\infty" : "-\\infty";
37
87
  const identifiers = { coeffs: poly.coefficients, to };
38
88
  return getQuestionFromIdentifiers(identifiers);
@@ -56,7 +106,7 @@ const isAnswerValid = (ans, { answer }) => {
56
106
  export const polynomLimit = {
57
107
  id: "polynomLimit",
58
108
  connector: "=",
59
- label: "Limite d'une fonction polynomiale",
109
+ label: "Limite d'une fonction polynomiale (avec F.I.)",
60
110
  isSingleStep: true,
61
111
  generator: (nb) => getDistinctQuestions(getPolynomLimitQuestion, nb),
62
112
  qcmTimer: 60,
@@ -65,4 +115,5 @@ export const polynomLimit = {
65
115
  isAnswerValid,
66
116
  subject: "Mathématiques",
67
117
  getQuestionFromIdentifiers,
118
+ hasHintAndCorrection: true,
68
119
  };
@@ -1 +1 @@
1
- {"version":3,"file":"polynomLimitNoFI.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/limits/polynomLimitNoFI.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,EAAE,EAAE,UAAU,GAAG,UAAU,CAAC;CAC7B,CAAC;AAgEF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAalD,CAAC"}
1
+ {"version":3,"file":"polynomLimitNoFI.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/limits/polynomLimitNoFI.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,EAAE,EAAE,UAAU,GAAG,UAAU,CAAC;CAC7B,CAAC;AAgGF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAclD,CAAC"}