math-exercises 3.0.176 → 3.0.178

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 (136) hide show
  1. package/lib/exercises/math/derivation/variations/readExtremaAbscissFromDerivativeCurve.js +1 -1
  2. package/lib/exercises/math/functions/trinoms/sign/index.d.ts +1 -0
  3. package/lib/exercises/math/functions/trinoms/sign/index.d.ts.map +1 -1
  4. package/lib/exercises/math/functions/trinoms/sign/index.js +1 -0
  5. package/lib/exercises/math/functions/trinoms/sign/signOfProductOfAffineAndTrinom.d.ts +8 -0
  6. package/lib/exercises/math/functions/trinoms/sign/signOfProductOfAffineAndTrinom.d.ts.map +1 -0
  7. package/lib/exercises/math/functions/trinoms/sign/signOfProductOfAffineAndTrinom.js +233 -0
  8. package/lib/exercises/math/geometry/angles/parallelogramFourthAngle.d.ts.map +1 -1
  9. package/lib/exercises/math/geometry/angles/parallelogramFourthAngle.js +10 -10
  10. package/lib/exercises/math/geometry/quadrilaterals/parallelogramAngles.js +8 -8
  11. package/lib/exercises/math/geometry/triangles/similar/isSimilarTrianglesWithAngles.js +6 -6
  12. package/lib/exercises/math/geometry/triangles/triangleThirdAngleValue.js +8 -8
  13. package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiAngle.js +1 -1
  14. package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiSideLength.js +2 -2
  15. package/lib/exercises/math/geometry/vectors/scalarProduct/angleFromScalarProduct.js +2 -2
  16. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductOrthoInSquare.d.ts.map +1 -1
  17. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductOrthoInSquare.js +31 -6
  18. package/lib/exercises/math/probaStat/randomVariable/index.d.ts.map +1 -1
  19. package/lib/exercises/math/probaStat/randomVariable/index.js +1 -0
  20. package/lib/exercises/math/probaStat/trees/index.d.ts +1 -3
  21. package/lib/exercises/math/probaStat/trees/index.d.ts.map +1 -1
  22. package/lib/exercises/math/probaStat/trees/index.js +8 -3
  23. package/lib/exercises/math/probaStat/trees/probabilityTree.d.ts +3 -9
  24. package/lib/exercises/math/probaStat/trees/probabilityTree.d.ts.map +1 -1
  25. package/lib/exercises/math/probaStat/trees/probabilityTree.js +45 -419
  26. package/lib/exercises/math/probaStat/trees/probabilityTreeV2.d.ts +25 -0
  27. package/lib/exercises/math/probaStat/trees/probabilityTreeV2.d.ts.map +1 -0
  28. package/lib/exercises/math/probaStat/trees/probabilityTreeV2.js +625 -0
  29. package/lib/exercises/math/python/index.d.ts +1 -0
  30. package/lib/exercises/math/python/index.d.ts.map +1 -1
  31. package/lib/exercises/math/python/index.js +1 -0
  32. package/lib/exercises/math/python/sequences/pySequenceThresholdInstructionCompletion.d.ts.map +1 -1
  33. package/lib/exercises/math/python/sequences/pySequenceThresholdInstructionCompletion.js +11 -8
  34. package/lib/exercises/math/sequences/arithmetic/arithmeticFindExplicitFormulaFromTwoTerms.d.ts.map +1 -1
  35. package/lib/exercises/math/sequences/arithmetic/arithmeticFindExplicitFormulaFromTwoTerms.js +4 -3
  36. package/lib/exercises/math/sequences/arithmetic/index.d.ts +4 -3
  37. package/lib/exercises/math/sequences/arithmetic/index.d.ts.map +1 -1
  38. package/lib/exercises/math/sequences/arithmetic/index.js +4 -3
  39. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindExplicitFormulaFromSituation.d.ts.map +1 -1
  40. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindExplicitFormulaFromSituation.js +3 -2
  41. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRankFromSituation.d.ts.map +1 -1
  42. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRankFromSituation.js +8 -6
  43. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindThresholdFromSituation.d.ts.map +1 -1
  44. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindThresholdFromSituation.js +6 -5
  45. package/lib/exercises/math/sequences/arithmetic/situations/index.d.ts +0 -2
  46. package/lib/exercises/math/sequences/arithmetic/situations/index.d.ts.map +1 -1
  47. package/lib/exercises/math/sequences/arithmetic/situations/index.js +2 -2
  48. package/lib/exercises/math/sequences/arithmetic/sum/arithmeticComputeSumWithDots.d.ts +1 -0
  49. package/lib/exercises/math/sequences/arithmetic/sum/arithmeticComputeSumWithDots.d.ts.map +1 -1
  50. package/lib/exercises/math/sequences/arithmetic/sum/arithmeticComputeSumWithDots.js +65 -14
  51. package/lib/exercises/math/sequences/arithmetic/sum/index.d.ts +0 -1
  52. package/lib/exercises/math/sequences/arithmetic/sum/index.d.ts.map +1 -1
  53. package/lib/exercises/math/sequences/arithmetic/sum/index.js +1 -1
  54. package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoConsecutiveTerms.d.ts +14 -0
  55. package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoConsecutiveTerms.d.ts.map +1 -0
  56. package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoConsecutiveTerms.js +291 -0
  57. package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoTerms.d.ts.map +1 -1
  58. package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoTerms.js +4 -3
  59. package/lib/exercises/math/sequences/geometric/geometricFindRandomTermFromTwoConsecutiveTerms.d.ts +15 -0
  60. package/lib/exercises/math/sequences/geometric/geometricFindRandomTermFromTwoConsecutiveTerms.d.ts.map +1 -0
  61. package/lib/exercises/math/sequences/geometric/geometricFindRandomTermFromTwoConsecutiveTerms.js +249 -0
  62. package/lib/exercises/math/sequences/geometric/geometricFindRandomTermFromTwoTerms.js +1 -1
  63. package/lib/exercises/math/sequences/geometric/index.d.ts +6 -2
  64. package/lib/exercises/math/sequences/geometric/index.d.ts.map +1 -1
  65. package/lib/exercises/math/sequences/geometric/index.js +6 -2
  66. package/lib/exercises/math/sequences/geometric/situations/geometricFindExplicitFormulaFromSituation.d.ts.map +1 -1
  67. package/lib/exercises/math/sequences/geometric/situations/geometricFindExplicitFormulaFromSituation.js +3 -2
  68. package/lib/exercises/math/sequences/geometric/situations/geometricFindTermFromSituation.js +1 -1
  69. package/lib/exercises/math/sequences/geometric/sum/geometricComputeSumWithDots.js +2 -2
  70. package/lib/exercises/math/sequences/graph/placeFirstSequencePoints.js +2 -2
  71. package/lib/exercises/math/sequences/index.d.ts +1 -0
  72. package/lib/exercises/math/sequences/index.d.ts.map +1 -1
  73. package/lib/exercises/math/sequences/index.js +1 -0
  74. package/lib/exercises/math/sequences/seqArithmGeom/seqArithmGeomRecurrenceFormulaUsage.d.ts.map +1 -1
  75. package/lib/exercises/math/sequences/seqArithmGeom/seqArithmGeomRecurrenceFormulaUsage.js +5 -9
  76. package/lib/exercises/math/spaceGeometry/sphere/sphereLatLonReading.2d.js +1 -1
  77. package/lib/exercises/math/trigonometry/circle/findAngleFromCosAndSin.d.ts.map +1 -1
  78. package/lib/exercises/math/trigonometry/circle/findAngleFromCosAndSin.js +17 -8
  79. package/lib/exercises/math/trigonometry/circle/index.d.ts +2 -0
  80. package/lib/exercises/math/trigonometry/circle/index.d.ts.map +1 -1
  81. package/lib/exercises/math/trigonometry/circle/index.js +2 -1
  82. package/lib/exercises/math/trigonometry/circle/mainRemarkableValues.d.ts.map +1 -1
  83. package/lib/exercises/math/trigonometry/circle/mainRemarkableValues.js +57 -0
  84. package/lib/exercises/math/trigonometry/circle/remarkableValues.d.ts.map +1 -1
  85. package/lib/exercises/math/trigonometry/circle/remarkableValues.js +88 -0
  86. package/lib/exercises/math/trigonometry/circle/selectQuadrantOnTrigoCircle.d.ts +5 -0
  87. package/lib/exercises/math/trigonometry/circle/selectQuadrantOnTrigoCircle.d.ts.map +1 -1
  88. package/lib/exercises/math/trigonometry/circle/selectQuadrantOnTrigoCircle.js +92 -94
  89. package/lib/exercises/math/trigonometry/functions/associateAngleSimplification.d.ts +11 -0
  90. package/lib/exercises/math/trigonometry/functions/associateAngleSimplification.d.ts.map +1 -0
  91. package/lib/exercises/math/trigonometry/functions/associateAngleSimplification.js +166 -0
  92. package/lib/exercises/math/trigonometry/functions/basicEquationCos.d.ts.map +1 -1
  93. package/lib/exercises/math/trigonometry/functions/basicEquationCos.js +54 -9
  94. package/lib/exercises/math/trigonometry/functions/basicEquationSin.d.ts.map +1 -1
  95. package/lib/exercises/math/trigonometry/functions/basicEquationSin.js +54 -8
  96. package/lib/exercises/math/trigonometry/functions/equationSinOnRandomInterval.js +1 -2
  97. package/lib/exercises/math/trigonometry/functions/index.d.ts +1 -0
  98. package/lib/exercises/math/trigonometry/functions/index.d.ts.map +1 -1
  99. package/lib/exercises/math/trigonometry/functions/index.js +1 -0
  100. package/lib/exercises/math/trigonometry/triangle/trigonometryAngleCalcul.js +2 -2
  101. package/lib/exercises/pc/snellDescartes.js +2 -2
  102. package/lib/index.d.ts +165 -36
  103. package/lib/index.d.ts.map +1 -1
  104. package/lib/latexTester.d.ts.map +1 -1
  105. package/lib/latexTester.js +8 -5
  106. package/lib/math/polynomials/affine.d.ts +1 -0
  107. package/lib/math/polynomials/affine.d.ts.map +1 -1
  108. package/lib/math/polynomials/affine.js +5 -0
  109. package/lib/math/utils/arithmetic/primeFactors.js +1 -1
  110. package/lib/math/utils/functions/functionComposition.d.ts.map +1 -1
  111. package/lib/math/utils/functions/functionComposition.js +18 -1
  112. package/lib/math/utils/random/randTupleInt.d.ts +1 -0
  113. package/lib/math/utils/random/randTupleInt.d.ts.map +1 -1
  114. package/lib/math/utils/random/randTupleInt.js +1 -1
  115. package/lib/math/utils/sequences/situations/seqArithmeticSituations.d.ts +18 -4
  116. package/lib/math/utils/sequences/situations/seqArithmeticSituations.d.ts.map +1 -1
  117. package/lib/math/utils/sequences/situations/seqArithmeticSituations.js +437 -336
  118. package/lib/math/utils/sequences/situations/seqArithmeticUtils.d.ts.map +1 -1
  119. package/lib/math/utils/sequences/situations/seqArithmeticUtils.js +3 -1
  120. package/lib/math/utils/sequences/situations/seqGeometricSituations.d.ts +5 -0
  121. package/lib/math/utils/sequences/situations/seqGeometricSituations.d.ts.map +1 -1
  122. package/lib/math/utils/sequences/situations/seqGeometricSituations.js +58 -25
  123. package/lib/prototypesEnhancement.d.ts +1 -0
  124. package/lib/prototypesEnhancement.d.ts.map +1 -1
  125. package/lib/prototypesEnhancement.js +3 -0
  126. package/lib/tests/pdfs/mdCodeToLatex.d.ts.map +1 -1
  127. package/lib/tests/pdfs/mdCodeToLatex.js +8 -15
  128. package/lib/tests/questionTest.d.ts.map +1 -1
  129. package/lib/tests/questionTest.js +6 -3
  130. package/lib/tree/nodes/algebraicNode.d.ts +1 -0
  131. package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
  132. package/lib/tree/nodes/geometry/degree.js +1 -1
  133. package/lib/tree/nodes/operators/addNode.d.ts.map +1 -1
  134. package/lib/tree/nodes/operators/addNode.js +4 -2
  135. package/lib/tree/parsers/degreeParser.js +2 -2
  136. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"seqArithmeticUtils.d.ts","sourceRoot":"","sources":["../../../../../src/math/utils/sequences/situations/seqArithmeticUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AA4MpE,eAAO,MAAM,kBAAkB;4BAnMA,MAAM,UAAU,MAAM,QAAQ,MAAM;+BAIjC,MAAM,UAAU,MAAM,QAAQ,MAAM;4CAK3D,MAAM,UACP,MAAM,aACH,MAAM;+CAaP,MAAM,UACR,MAAM,cACF,MAAM;uCAWT,MAAM,UACP,MAAM,aACH,MAAM,aACN,MAAM;uCAUR,MAAM,UACP,MAAM,cACF,MAAM,cACN,MAAM;0CAQT,MAAM,UACP,MAAM,aACH,MAAM,kBACD,MAAM,oBACJ,gBAAgB;6CAwBzB,MAAM,UACP,MAAM,aACH,MAAM,kBACD,MAAM,oBACJ,gBAAgB;6BAiEzB,MAAM,UACP,MAAM,aACH,MAAM,WACR,MAAM;gCAgBN,MAAM,UACP,MAAM,aACH,MAAM,WACR,MAAM;CA0BhB,CAAC"}
1
+ {"version":3,"file":"seqArithmeticUtils.d.ts","sourceRoot":"","sources":["../../../../../src/math/utils/sequences/situations/seqArithmeticUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AA8MpE,eAAO,MAAM,kBAAkB;4BArMA,MAAM,UAAU,MAAM,QAAQ,MAAM;+BAIjC,MAAM,UAAU,MAAM,QAAQ,MAAM;4CAK3D,MAAM,UACP,MAAM,aACH,MAAM;+CAaP,MAAM,UACR,MAAM,cACF,MAAM;uCAWT,MAAM,UACP,MAAM,aACH,MAAM,aACN,MAAM;uCAUR,MAAM,UACP,MAAM,cACF,MAAM,cACN,MAAM;0CAQT,MAAM,UACP,MAAM,aACH,MAAM,kBACD,MAAM,oBACJ,gBAAgB;6CAwBzB,MAAM,UACP,MAAM,aACH,MAAM,kBACD,MAAM,oBACJ,gBAAgB;6BAmEzB,MAAM,UACP,MAAM,aACH,MAAM,WACR,MAAM;gCAgBN,MAAM,UACP,MAAM,aACH,MAAM,WACR,MAAM;CA0BhB,CAAC"}
@@ -71,7 +71,9 @@ const getAnswerNodeSumThresholdRank = (initial, reason, firstRank, valueThreshol
71
71
  const b = firstValue - a;
72
72
  const c = -valueThreshold;
73
73
  const trinom = new Trinom(a, b, c);
74
- const [_nodeKLow, nodeKHigh] = trinom.getRootsNode();
74
+ const [_nodeKLow, nodeKHigh] = trinom
75
+ .getRootsNode()
76
+ .toSorted((node1, node2) => node1.evaluate() - node2.evaluate());
75
77
  const kHigh = nodeKHigh.evaluate();
76
78
  const inequationSymbolForRank = reason < 0 ? inequationSymbol.toReversed() : inequationSymbol;
77
79
  const value = (() => {
@@ -5,6 +5,10 @@ export type SituationGeometricVariation = {
5
5
  getHint: (firstRank: number, ...otherArgs: unknown[]) => string;
6
6
  getCorrectionStuff: (initial: number, reason: number, firstRank: number, ...otherArgs: unknown[]) => Record<string, unknown>;
7
7
  };
8
+ export type RankDecoder = {
9
+ rankFromTarget: (nodeTarget: AlgebraicNode, firstRank: number) => number;
10
+ targetFromRank: (rank: number, firstRank: number) => AlgebraicNode;
11
+ };
8
12
  export type SituationGeometricSuperfluousData = {
9
13
  rand: number;
10
14
  values: number[];
@@ -15,6 +19,7 @@ export type SituationGeometric = {
15
19
  randReason: () => number;
16
20
  randSuperfluousData: () => SituationGeometricSuperfluousData;
17
21
  randThreshold: (initial: number, reason: number, firstRank: number) => number;
22
+ rankDecoder: RankDecoder;
18
23
  getStrSituation: (initial: number, reason: number, firstRank: number, superfluousData?: SituationGeometricSuperfluousData) => string;
19
24
  variationFindExplicitFormula: SituationGeometricVariation;
20
25
  variationFindRecurrenceFormula: SituationGeometricVariation;
@@ -1 +1 @@
1
- {"version":3,"file":"seqGeometricSituations.d.ts","sourceRoot":"","sources":["../../../../../src/math/utils/sequences/situations/seqGeometricSituations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAWlE,MAAM,MAAM,2BAA2B,GAAG;IACxC,cAAc,CAAC,EAAE,CACf,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,GAAG,SAAS,EAAE,OAAO,EAAE,KACpB,MAAM,CAAC;IAEZ,aAAa,EAAE,CACb,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,GAAG,SAAS,EAAE,OAAO,EAAE,KACpB,aAAa,CAAC;IACnB,OAAO,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE,OAAO,EAAE,KAAK,MAAM,CAAC;IAChE,kBAAkB,EAAE,CAClB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,GAAG,SAAS,EAAE,OAAO,EAAE,KACpB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,iCAAiC,GAAG;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,QAAQ,GAAG,kBAAkB,GAAG,KAAK,GAAG,eAAe,CAAC;IAC9D,WAAW,EAAE,MAAM,MAAM,CAAC;IAC1B,UAAU,EAAE,MAAM,MAAM,CAAC;IACzB,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;IAC7D,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;IAE9E,eAAe,EAAE,CACf,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,eAAe,CAAC,EAAE,iCAAiC,KAChD,MAAM,CAAC;IAEZ,4BAA4B,EAAE,2BAA2B,CAAC;IAC1D,8BAA8B,EAAE,2BAA2B,CAAC;IAC5D,uBAAuB,EAAE,2BAA2B,CAAC;CAItD,CAAC;AA2zCF,eAAO,MAAM,mBAAmB;;sCAxyCb,MAAM,UACP,MAAM,aACH,MAAM,gBACH,OAAO,EAAE;;;;;sCA2Bd,MAAM,UACP,MAAM,aACH,MAAM,gBACH,OAAO,EAAE;;;;;;;sCAiChB,MAAM,UACP,MAAM,aACH,MAAM,gBACH,OAAO,EAAE;;;;IAquC9B,CAAC"}
1
+ {"version":3,"file":"seqGeometricSituations.d.ts","sourceRoot":"","sources":["../../../../../src/math/utils/sequences/situations/seqGeometricSituations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAYlE,MAAM,MAAM,2BAA2B,GAAG;IACxC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AAE,WAAW,CAAC;IAEzB,eAAe,EAAE,CACf,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,eAAe,CAAC,EAAE,iCAAiC,KAChD,MAAM,CAAC;IAEZ,4BAA4B,EAAE,2BAA2B,CAAC;IAC1D,8BAA8B,EAAE,2BAA2B,CAAC;IAE5D,uBAAuB,EAAE,2BAA2B,CAAC;CAItD,CAAC;AA+2CF,eAAO,MAAM,mBAAmB;;sCA51Cb,MAAM,UACP,MAAM,aACH,MAAM,gBACH,OAAO,EAAE;;;;;sCA2Bd,MAAM,UACP,MAAM,aACH,MAAM,gBACH,OAAO,EAAE;;;;;;;sCAiChB,MAAM,UACP,MAAM,aACH,MAAM,gBACH,OAAO,EAAE;;;;IAyxC9B,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { add } from "../../../../tree/nodes/operators/addNode.js";
1
2
  import { substract } from "../../../../tree/nodes/operators/substractNode.js";
2
3
  import { alignTex } from "../../../../utils/latex/alignTex.js";
3
4
  import { randfloat } from "../../random/randfloat.js";
@@ -107,12 +108,16 @@ const templatesSituationsGeometric = [
107
108
  values,
108
109
  };
109
110
  },
111
+ rankDecoder: {
112
+ targetFromRank: (rank, firstRank) => (2026 + rank - firstRank).toTree(),
113
+ rankFromTarget: (nodeTarget, firstRank) => nodeTarget.evaluate() - 2026 + firstRank,
114
+ },
110
115
  getStrSituation: (initial, reason, firstRank, superfluousData) => {
111
116
  const evoPercentage = (reason - 1) * 100;
112
117
  const strEvoPercentage = evoPercentage.frPretty(2);
113
118
  if (superfluousData === undefined) {
114
119
  return `Au premier janvier $2026$, Armand dépose $${initial.frenchify()} \\textrm{€}$ sur un compte épargne rémunéré au taux de $${strEvoPercentage}\\%$.
115
- On note $u_n$ le capital disponible sur son compte épargne au premier janvier de l'année $2026+${substract("n".toTree(), firstRank)
120
+ On note $u_n$ le capital disponible sur son compte épargne au premier janvier de l'année $${add(2026, substract("n".toTree(), firstRank))
116
121
  .simplify()
117
122
  .toTex()}$.`;
118
123
  }
@@ -123,7 +128,7 @@ On note $u_n$ le capital disponible sur son compte épargne au premier janvier d
123
128
  const [mockeponCardsPrice] = superfluousData.values;
124
129
  return `Au premier janvier $2026$, Armand dépose $${initial.frenchify()} \\textrm{€}$ sur un compte épargne rémunéré au taux de $${strEvoPercentage}\\%$.
125
130
  La même journée, il a acheté pour $${mockeponCardsPrice} \\textrm{€}$ de cartes MockéPon.
126
- On note $u_n$ le capital disponible sur son compte épargne au premier janvier de l'année $2026+${substract("n".toTree(), firstRank)
131
+ On note $u_n$ le capital disponible sur son compte épargne au premier janvier de l'année $${add(2026, substract("n".toTree(), firstRank))
127
132
  .simplify()
128
133
  .toTex()}$.`;
129
134
  }
@@ -133,7 +138,7 @@ On note $u_n$ le capital disponible sur son compte épargne au premier janvier d
133
138
  const [factorFriendWrtArmand] = superfluousData.values;
134
139
  return `Au premier janvier $2026$, Armand dépose $${initial.frenchify()} \\textrm{€}$ sur un compte épargne rémunéré au taux de $${strEvoPercentage}\\%$.
135
140
  La même journée, son ami Mustapha lui apprend que la rémunération du compte épargne de son père est $${factorFriendWrtArmand.frenchify()}$ fois plus grande.
136
- On note $u_n$ le capital disponible sur son compte épargne au premier janvier de l'année $2026+${substract("n".toTree(), firstRank)
141
+ On note $u_n$ le capital disponible sur son compte épargne au premier janvier de l'année $${add(2026, substract("n".toTree(), firstRank))
137
142
  .simplify()
138
143
  .toTex()}$.`;
139
144
  }
@@ -153,7 +158,7 @@ Inspire toi de ce calcul pour déterminer le capital au bout de $${getStrFactor(
153
158
  const strEvoPercentage = evoPercentage.frPretty(2);
154
159
  return {
155
160
  str: `Le pourcentage d'évolution est $${strEvoPercentage} \\%$ donc chaque année, le capital est multiplié par $${reason.frenchify()}$.
156
- Le capital en $\\textrm{€}$, au premier janvier de l'année $2026+${substract("n".toTree(), firstRank)
161
+ Le capital en $\\textrm{€}$, au premier janvier de l'année $${add(2026, substract("n".toTree(), firstRank))
157
162
  .simplify()
158
163
  .toTex()}$, est donc une suite géométrique de premier terme $${initial.frenchify()}$ et de raison $${reason.frenchify()}$.`,
159
164
  };
@@ -195,7 +200,7 @@ Utilise le terme général de $u_n$ pour déterminer le capital pour l'année $2
195
200
  const strEvoPercentage = evoPercentage.frPretty(2);
196
201
  return {
197
202
  str: `Le pourcentage d'évolution est $${strEvoPercentage} \\%$ donc chaque année, le capital est multiplié par $${reason.frenchify()}$.
198
- Le capital en $\\textrm{€}$, au premier janvier de l'année $2026+${substract("n".toTree(), firstRank)
203
+ Le capital en $\\textrm{€}$, au premier janvier de l'année $${add(2026, substract("n".toTree(), firstRank))
199
204
  .simplify()
200
205
  .toTex()}$, est donc une suite géométrique de premier terme $${initial.frenchify()}$ et de raison $${reason.frenchify()}$.`,
201
206
  };
@@ -230,13 +235,17 @@ Le capital en $\\textrm{€}$, au premier janvier de l'année $2026+${substract(
230
235
  values,
231
236
  };
232
237
  },
238
+ rankDecoder: {
239
+ targetFromRank: (rank, firstRank) => (2025 + rank - firstRank).toTree(),
240
+ rankFromTarget: (nodeTarget, firstRank) => nodeTarget.evaluate() - 2025 + firstRank,
241
+ },
233
242
  getStrSituation: (initial, reason, firstRank, superfluousData) => {
234
243
  const evoPercentage = (reason - 1) * 100;
235
244
  const strMinusEvoPercentage = (-evoPercentage).frPretty(0);
236
245
  if (superfluousData === undefined) {
237
246
  return `Au premier juillet $2025$, Killian a acheté une voiture au prix de $${initial.frenchify()} \\ \\textrm{€}$.
238
247
  On estime que la valeur d'une voiture diminue de $${strMinusEvoPercentage}\\%$ par an.
239
- Pour tout entier naturel $n>=${firstRank}$, on note $u_n$ la valeur estimée de la voiture de Killian au premier juillet de l'année $2025 + ${substract("n".toTree(), firstRank)
248
+ Pour tout entier naturel $n \\geq ${firstRank}$, on note $u_n$ la valeur estimée de la voiture de Killian au premier juillet de l'année $${add(2025, substract("n".toTree(), firstRank))
240
249
  .simplify()
241
250
  .toTex()}$.`;
242
251
  }
@@ -248,7 +257,7 @@ Pour tout entier naturel $n>=${firstRank}$, on note $u_n$ la valeur estimée de
248
257
  return `Au premier juillet $2025$, Killian a acheté une voiture au prix de $${initial.frenchify()} \\ \\textrm{€}$.
249
258
  Les options représentent $${equipmentPercentage.frenchify()}\\%$ de la valeur du véhicule.
250
259
  On estime que la valeur d'une voiture diminue de $${strMinusEvoPercentage}\\%$ par an.
251
- Pour tout entier naturel $n>=${firstRank}$, on note $u_n$ la valeur estimée de la voiture de Killian au premier juillet de l'année $2025 + ${substract("n".toTree(), firstRank)
260
+ Pour tout entier naturel $n \\geq ${firstRank}$, on note $u_n$ la valeur estimée de la voiture de Killian au premier juillet de l'année $${add(2025, substract("n".toTree(), firstRank))
252
261
  .simplify()
253
262
  .toTex()}$.`;
254
263
  }
@@ -259,7 +268,7 @@ Pour tout entier naturel $n>=${firstRank}$, on note $u_n$ la valeur estimée de
259
268
  return `Au premier juillet $2025$, Nahel a acheté une voiture au prix de $${friendsCarPrice.frenchify()} \\ \\textrm{€}$.
260
269
  Le même jour, Killian a acheté une voiture au prix de $${initial.frenchify()} \\ \\textrm{€}$.
261
270
  On estime que la valeur d'une voiture diminue de $${strMinusEvoPercentage}\\%$ par an.
262
- Pour tout entier naturel $n>=${firstRank}$, on note $u_n$ la valeur estimée de la voiture de Killian au premier juillet de l'année $2025 + ${substract("n".toTree(), firstRank)
271
+ Pour tout entier naturel $n \\geq ${firstRank}$, on note $u_n$ la valeur estimée de la voiture de Killian au premier juillet de l'année $${add(2025, substract("n".toTree(), firstRank))
263
272
  .simplify()
264
273
  .toTex()}$.`;
265
274
  }
@@ -274,12 +283,14 @@ Pour tout entier naturel $n>=${firstRank}$, on note $u_n$ la valeur estimée de
274
283
  getHint: (firstRank) => `Quel calcul permet de trouver la valeur de la voiture de Killian au bout de $2$ ans ?
275
284
 
276
285
  Inspire toi de ce calcul pour déterminer la valeur de la voiture de Killian au bout de $${getStrFactor(firstRank)}$ ans.`,
277
- getCorrectionStuff: (initial, reason, _firstRank) => {
286
+ getCorrectionStuff: (initial, reason, firstRank) => {
278
287
  const evoPercentage = (reason - 1) * 100;
279
288
  const strEvoPercentage = evoPercentage.frPretty(0);
280
289
  return {
281
290
  str: `Le pourcentage d'évolution est $${strEvoPercentage} \\%$ donc chaque année, la valeur de la voiture de Killian est multipliée par $${reason.frenchify()}$.
282
- La valeur de la voiture de Killian en $\\textrm{€}$, au premier juillet de l'année $2026+n$, est donc une suite géométrique de premier terme $${initial.frenchify()}$ et de raison $${reason.frenchify()}$.`,
291
+ La valeur de la voiture de Killian en $\\textrm{€}$, au premier juillet de l'année $${add(2025, substract("n".toTree(), firstRank))
292
+ .simplify()
293
+ .toTex()}$, est donc une suite géométrique de premier terme $${initial.frenchify()}$ et de raison $${reason.frenchify()}$.`,
283
294
  };
284
295
  },
285
296
  },
@@ -314,12 +325,14 @@ Par exemple, la valeur à la onzième année est égale à celle de la dixième
314
325
 
315
326
  Utilise le terme général de $u_n$ pour déterminer la valeur de la voiture de Killian au premier juillet de l'année $2025+${target.frenchify()}$.`;
316
327
  },
317
- getCorrectionStuff: (initial, reason, _firstRank) => {
328
+ getCorrectionStuff: (initial, reason, firstRank) => {
318
329
  const evoPercentage = (reason - 1) * 100;
319
330
  const strEvoPercentage = evoPercentage.frPretty(0);
320
331
  return {
321
332
  str: `Le pourcentage d'évolution est $${strEvoPercentage} \\%$ donc chaque année, la valeur de la voiture de Killian est multipliée par $${reason.frenchify()}$.
322
- La valeur de la voiture de Killian en $\\textrm{€}$, au premier juillet de l'année $2026+n$, est donc une suite géométrique de premier terme $${initial.frenchify()}$ et de raison $${reason.frenchify()}$.`,
333
+ La valeur de la voiture de Killian en $\\textrm{€}$, au premier juillet de l'année $${add(2025, substract("n".toTree(), firstRank))
334
+ .simplify()
335
+ .toTex()}$, est donc une suite géométrique de premier terme $${initial.frenchify()}$ et de raison $${reason.frenchify()}$.`,
323
336
  };
324
337
  },
325
338
  },
@@ -352,13 +365,17 @@ La valeur de la voiture de Killian en $\\textrm{€}$, au premier juillet de l'a
352
365
  values,
353
366
  };
354
367
  },
368
+ rankDecoder: {
369
+ targetFromRank: (rank, firstRank) => (0 + rank - firstRank).toTree(),
370
+ rankFromTarget: (nodeTarget, firstRank) => nodeTarget.evaluate() - 0 + firstRank,
371
+ },
355
372
  getStrSituation: (initial, reason, firstRank, superfluousData) => {
356
373
  const factorPercentage = reason * 100;
357
374
  const strFactorPercentage = factorPercentage.frPretty(0);
358
375
  if (superfluousData === undefined) {
359
376
  return `Une balle rebondissante est lachée d'une hauteur de $${initial.frenchify()} \\ \\textrm{m}$.
360
377
  À chaque rebond, elle atteint une hauteur égale à $${strFactorPercentage} \\%$ de la hauteur du rebond précédent.
361
- On note $u_{${firstRank}} = ${initial.frenchify()}$, et pour tout entier $n>=${firstRank + 1}$, $u_{n}$ la hauteur de la balle au $${substract("n".toTree(), firstRank)
378
+ On note $u_{${firstRank}} = ${initial.frenchify()}$, et pour tout entier $n \\geq ${firstRank + 1}$, $u_{n}$ la hauteur de la balle au $${substract("n".toTree(), firstRank)
362
379
  .simplify()
363
380
  .toTex()}$-ième rebond.`;
364
381
  }
@@ -370,7 +387,7 @@ On note $u_{${firstRank}} = ${initial.frenchify()}$, et pour tout entier $n>=${f
370
387
  return `Une balle rebondissante est lachée d'une hauteur de $${initial.frenchify()} \\ \\textrm{m}$.
371
388
  On la filme avec un téléphone placé à une hauteur de $${phoneHeight.frenchify()} \\ \\textrm{m}$.
372
389
  À chaque rebond, elle atteint une hauteur égale à $${strFactorPercentage} \\%$ de la hauteur du rebond précédent.
373
- On note $u_{${firstRank}} = ${initial.frenchify()}$, et pour tout entier $n>=${firstRank + 1}$, $u_{n}$ la hauteur de la balle au $${substract("n".toTree(), firstRank)
390
+ On note $u_{${firstRank}} = ${initial.frenchify()}$, et pour tout entier $n \\geq ${firstRank + 1}$, $u_{n}$ la hauteur de la balle au $${substract("n".toTree(), firstRank)
374
391
  .simplify()
375
392
  .toTex()}$-ième rebond.`;
376
393
  }
@@ -380,7 +397,7 @@ On note $u_{${firstRank}} = ${initial.frenchify()}$, et pour tout entier $n>=${f
380
397
  const [diameterOfBallInCm] = superfluousData.values;
381
398
  return `Une balle rebondissante de diamètre $${diameterOfBallInCm.frenchify()} \\ \\textrm{cm}$ est lachée d'une hauteur de $${initial.frenchify()} \\ \\textrm{m}$.
382
399
  À chaque rebond, elle atteint une hauteur égale à $${strFactorPercentage} \\%$ de la hauteur du rebond précédent.
383
- On note $u_{${firstRank}} = ${initial.frenchify()}$, et pour tout entier $n>=${firstRank + 1}$, $u_{n}$ la hauteur de la balle au $${substract("n".toTree(), firstRank)
400
+ On note $u_{${firstRank}} = ${initial.frenchify()}$, et pour tout entier $n \\geq ${firstRank + 1}$, $u_{n}$ la hauteur de la balle au $${substract("n".toTree(), firstRank)
384
401
  .simplify()
385
402
  .toTex()}$-ième rebond.`;
386
403
  }
@@ -475,6 +492,10 @@ La hauteur de la balle est donc une suite géométrique de premier terme $${init
475
492
  values,
476
493
  };
477
494
  },
495
+ rankDecoder: {
496
+ targetFromRank: (rank, firstRank) => (0 + rank - firstRank).toTree(),
497
+ rankFromTarget: (nodeTarget, firstRank) => nodeTarget.evaluate() - 0 + firstRank,
498
+ },
478
499
  getStrSituation: (initial, reason, firstRank, superfluousData) => {
479
500
  const evoPercentage = (reason - 1) * 100;
480
501
  const strEvoPercentage = evoPercentage.frPretty(0);
@@ -502,7 +523,7 @@ Pour tout entier naturel $n$, on note $u_n$ le nombre de bactéries au bout de $
502
523
  La première heure, la population compte $${initial.frenchify()}$ individus.
503
524
  Chaque heure, le nombre de bactéries augmente de $${strEvoPercentage}\\%$.
504
525
  On éclaire les bactéries toutes les $${lightIntervalInMin} \\ \\textrm{min}$ pendant $30 \\ \\textrm{s}$.
505
- Pour tout entier naturel $n>=${firstRank}$, on note $u_n$ le nombre de bactéries au bout de $${getStrFactor(firstRank)}$ heures.`;
526
+ Pour tout entier naturel $n \\geq ${firstRank}$, on note $u_n$ le nombre de bactéries au bout de $${getStrFactor(firstRank)}$ heures.`;
506
527
  }
507
528
  break;
508
529
  default:
@@ -593,11 +614,15 @@ Le nombre de bactéries est donc une suite géométrique de premier terme $${ini
593
614
  values,
594
615
  };
595
616
  },
617
+ rankDecoder: {
618
+ targetFromRank: (rank, firstRank) => (0 + rank - firstRank).toTree(),
619
+ rankFromTarget: (nodeTarget, firstRank) => nodeTarget.evaluate() - 0 + firstRank,
620
+ },
596
621
  getStrSituation: (initial, reason, firstRank, superfluousData) => {
597
622
  if (superfluousData === undefined) {
598
623
  return `Justine dévoile un secret à $${initial}$ de ses amies.
599
624
  On estime que chaque jour, chaque personne connaissant le secret le révèle à $${reason}$ nouvelles personnes qui ne connaissent pas encore le secret.
600
- Pour tout entier naturel $n>=${firstRank}$, on note $u_n$ le nombre de nouvelles personnes qui sont informées le jour $${substract("n".toTree(), firstRank)
625
+ Pour tout entier naturel $n \\geq ${firstRank}$, on note $u_n$ le nombre de nouvelles personnes qui sont informées le jour $${substract("n".toTree(), firstRank)
601
626
  .simplify()
602
627
  .toTex()}$.`;
603
628
  }
@@ -609,7 +634,7 @@ Pour tout entier naturel $n>=${firstRank}$, on note $u_n$ le nombre de nouvelles
609
634
  return `Justine a $${numberOfFriends}$ amies.
610
635
  Justine dévoile un secret à $${initial}$ de ses amies.
611
636
  On estime que chaque jour, chaque personne connaissant le secret le révèle à $${reason}$ nouvelles personnes qui ne connaissent pas encore le secret.
612
- Pour tout entier naturel $n>=${firstRank}$, on note $u_n$ le nombre de nouvelles personnes qui sont informées le jour $${substract("n".toTree(), firstRank)
637
+ Pour tout entier naturel $n \\geq ${firstRank}$, on note $u_n$ le nombre de nouvelles personnes qui sont informées le jour $${substract("n".toTree(), firstRank)
613
638
  .simplify()
614
639
  .toTex()}$.`;
615
640
  }
@@ -620,7 +645,7 @@ Pour tout entier naturel $n>=${firstRank}$, on note $u_n$ le nombre de nouvelles
620
645
  return `Justine dévoile un secret à $${initial}$ de ses amies.
621
646
  Elle ne le dévoile pas aux $${numberOfUnreliable}$ autres car elle ne leur fait pas trop confiance.
622
647
  On estime que chaque jour, chaque personne connaissant le secret le révèle à $${reason}$ nouvelles personnes qui ne connaissent pas encore le secret.
623
- Pour tout entier naturel $n>=${firstRank}$, on note $u_n$ le nombre de nouvelles personnes qui sont informées le jour $${substract("n".toTree(), firstRank)
648
+ Pour tout entier naturel $n \\geq ${firstRank}$, on note $u_n$ le nombre de nouvelles personnes qui sont informées le jour $${substract("n".toTree(), firstRank)
624
649
  .simplify()
625
650
  .toTex()}$.`;
626
651
  }
@@ -709,13 +734,17 @@ Le nombre de personnes informées est donc une suite géométrique de premier te
709
734
  values,
710
735
  };
711
736
  },
737
+ rankDecoder: {
738
+ targetFromRank: (rank, firstRank) => (2025 + rank - firstRank).toTree(),
739
+ rankFromTarget: (nodeTarget, firstRank) => nodeTarget.evaluate() - 2025 + firstRank,
740
+ },
712
741
  getStrSituation: (initial, reason, firstRank, superfluousData) => {
713
742
  const evoPercentage = (reason - 1) * 100;
714
743
  const strEvoPercentage = evoPercentage.frPretty(0);
715
744
  if (superfluousData === undefined) {
716
745
  return `Durant l'année $2025$, Sofiane a reçu un salaire de $${initial} \\ \\textrm{€}$.
717
746
  Son contrat prévoit une augmentation annuelle de $${strEvoPercentage}\\%$.
718
- On note $u_n$ le salaire perçu par Sofiane au cours de l'année $2025+${substract("n".toTree(), firstRank)
747
+ On note $u_n$ le salaire perçu par Sofiane au cours de l'année $${add(2025, substract("n".toTree(), firstRank))
719
748
  .simplify()
720
749
  .toTex()}$.`;
721
750
  }
@@ -728,7 +757,7 @@ On note $u_n$ le salaire perçu par Sofiane au cours de l'année $2025+${substra
728
757
  return `Durant l'année $2025$, Sofiane a reçu un salaire de $${initial} \\ \\textrm{€}$.
729
758
  Son contrat prévoit une augmentation annuelle de $${strEvoPercentage}\\%$.
730
759
  Son ami Hector a reçu un salaire de $${salaryOfFriend} \\ \\textrm{€}$ en $2025$.
731
- On note $u_n$ le salaire perçu par Sofiane au cours de l'année $2025+${substract("n".toTree(), firstRank)
760
+ On note $u_n$ le salaire perçu par Sofiane au cours de l'année $${add(2025, substract("n".toTree(), firstRank))
732
761
  .simplify()
733
762
  .toTex()}$.`;
734
763
  }
@@ -741,7 +770,7 @@ On note $u_n$ le salaire perçu par Sofiane au cours de l'année $2025+${substra
741
770
  return `Durant l'année $2025$, Sofiane a reçu un salaire de $${initial} \\ \\textrm{€}$.
742
771
  Son contrat prévoit une augmentation annuelle de $${strEvoPercentage}\\%$.
743
772
  Le contrat de son ami Hector prévoit pour Hector une augmentation annuelle de $${strEvoPercentageOfFriend}\\%$.
744
- On note $u_n$ le salaire perçu par Sofiane au cours de l'année $2025+${substract("n".toTree(), firstRank)
773
+ On note $u_n$ le salaire perçu par Sofiane au cours de l'année $${add(2025, substract("n".toTree(), firstRank))
745
774
  .simplify()
746
775
  .toTex()}$.`;
747
776
  }
@@ -755,7 +784,7 @@ On note $u_n$ le salaire perçu par Sofiane au cours de l'année $2025+${substra
755
784
  getAnswerNode: seqGeometricUtils.getAnswerNodeExplicitFormula,
756
785
  getHint: (firstRank) => `Quel calcul permet de trouver le salaire pour l'année $2027$ ?
757
786
 
758
- Inspire toi de ce calcul pour déterminer le salaire pour l'année $2025+${substract("n".toTree(), firstRank)
787
+ Inspire toi de ce calcul pour déterminer le salaire pour l'année $${add(2025, substract("n".toTree(), firstRank))
759
788
  .simplify()
760
789
  .toTex()}$.`,
761
790
  getCorrectionStuff: (initial, reason, firstRank) => {
@@ -763,7 +792,7 @@ Inspire toi de ce calcul pour déterminer le salaire pour l'année $2025+${subst
763
792
  const strEvoPercentage = evoPercentage.frPretty(2);
764
793
  return {
765
794
  str: `Le pourcentage d'évolution est $${strEvoPercentage} \\%$ donc chaque année, le salaire est multiplié par $${reason.frenchify()}$.
766
- Le salaire en $\\textrm{€}$ pour l'année $2025+${substract("n".toTree(), firstRank)
795
+ Le salaire en $\\textrm{€}$ pour l'année $${add(2025, substract("n".toTree(), firstRank))
767
796
  .simplify()
768
797
  .toTex()}$, est donc une suite géométrique de premier terme $${initial.frenchify()}$ et de raison $${reason.frenchify()}$.`,
769
798
  };
@@ -805,7 +834,7 @@ Utilise le terme général de $u_n$ pour déterminer le salaire pour l'année $2
805
834
  const strEvoPercentage = evoPercentage.frPretty(2);
806
835
  return {
807
836
  str: `Le pourcentage d'évolution est $${strEvoPercentage} \\%$ donc chaque année, le salaire est multiplié par $${reason.frenchify()}$.
808
- Le salaire en $\\textrm{€}$ pour l'année $2025+${substract("n".toTree(), firstRank)
837
+ Le salaire en $\\textrm{€}$ pour l'année $${add(2025, substract("n".toTree(), firstRank))
809
838
  .simplify()
810
839
  .toTex()}$, est donc une suite géométrique de premier terme $${initial.frenchify()}$ et de raison $${reason.frenchify()}$.`,
811
840
  };
@@ -840,6 +869,10 @@ Le salaire en $\\textrm{€}$ pour l'année $2025+${substract("n".toTree(), firs
840
869
  values,
841
870
  };
842
871
  },
872
+ rankDecoder: {
873
+ targetFromRank: (rank, firstRank) => (0 + rank - firstRank).toTree(),
874
+ rankFromTarget: (nodeTarget, firstRank) => nodeTarget.evaluate() - 0 + firstRank,
875
+ },
843
876
  getStrSituation: (initial, reason, _firstRank, superfluousData) => {
844
877
  const evoPercentage = (reason - 1) * 100;
845
878
  const strEvoPercentage = evoPercentage.frPretty(0);
@@ -6,6 +6,7 @@ declare global {
6
6
  interface Number {
7
7
  toTree: (opts?: NodeOptions) => NumberNode | ConstantNode;
8
8
  frenchify: () => string;
9
+ frPretty: (digits?: number) => string;
9
10
  toScientific: (decimals?: number) => AlgebraicNode;
10
11
  }
11
12
  interface String {
@@ -1 +1 @@
1
- {"version":3,"file":"prototypesEnhancement.d.ts","sourceRoot":"","sources":["../src/prototypesEnhancement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AAKpE,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAIhE,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,WAAW,KAAK,UAAU,GAAG,YAAY,CAAC;QAC1D,SAAS,EAAE,MAAM,MAAM,CAAC;QACxB,YAAY,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,KAAK,aAAa,CAAC;KACpD;IACD,UAAU,MAAM;QACd,MAAM,EAAE,MAAM,aAAa,CAAC;QAC5B,WAAW,EAAE,MAAM,MAAM,CAAC;KAC3B;CACF;AAqBD,OAAO,EAAE,CAAC"}
1
+ {"version":3,"file":"prototypesEnhancement.d.ts","sourceRoot":"","sources":["../src/prototypesEnhancement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AAKpE,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAIhE,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,WAAW,KAAK,UAAU,GAAG,YAAY,CAAC;QAC1D,SAAS,EAAE,MAAM,MAAM,CAAC;QACxB,QAAQ,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;QACtC,YAAY,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,KAAK,aAAa,CAAC;KACpD;IACD,UAAU,MAAM;QACd,MAAM,EAAE,MAAM,aAAa,CAAC;QAC5B,WAAW,EAAE,MAAM,MAAM,CAAC;KAC3B;CACF;AAwBD,OAAO,EAAE,CAAC"}
@@ -19,6 +19,9 @@ Number.prototype.toTree = function (opts) {
19
19
  Number.prototype.frenchify = function () {
20
20
  return (this.valueOf() + "").replace(".", ",");
21
21
  };
22
+ Number.prototype.frPretty = function (digits = 6) {
23
+ return this.toFixed(digits).replace(".", ",");
24
+ };
22
25
  Number.prototype.toScientific = function (decimals) {
23
26
  return toScientific(this.valueOf(), decimals);
24
27
  };
@@ -1 +1 @@
1
- {"version":3,"file":"mdCodeToLatex.d.ts","sourceRoot":"","sources":["../../../src/tests/pdfs/mdCodeToLatex.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,GAAI,MAAM,MAAM,WAsCzC,CAAC"}
1
+ {"version":3,"file":"mdCodeToLatex.d.ts","sourceRoot":"","sources":["../../../src/tests/pdfs/mdCodeToLatex.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,GAAI,MAAM,MAAM,WA+BzC,CAAC"}
@@ -1,27 +1,20 @@
1
1
  export const mdCodeToLatex = (text) => {
2
2
  let res = text;
3
3
  //finds things that starts with ``` and ends with ```
4
- const re = /```[\s\S]*?```/g;
5
- let match;
6
- let counter = 0;
7
- while ((match = re.exec(text)) != null) {
8
- counter++;
9
- if (counter > 1000)
10
- throw new Error("mdCodeToLatex too many iterations");
11
- const content = match[0]
4
+ const re = /(```[^`]*?```)/g; //[^`] prevents bizarre matches with strings like "```a``` ```b``` ```c```" (==prevents matching ```a``` ```b```)
5
+ const matches = text.match(re) ?? [];
6
+ res = matches.reduce((acc, match) => {
7
+ const content = match
12
8
  .replaceAll("```", "")
13
9
  .split("\n")
14
10
  .filter((n) => !!n)
15
11
  .join("\n");
16
- res =
17
- res.slice(0, match.index) +
18
- `$\\hspace{1cm}$ \\begin{lstlisting} \n` +
19
- content +
20
- "\\end{lstlisting} \n" +
21
- res.slice(match.index + match[0].length);
22
- }
12
+ const strReplacement = `$\\hspace{1cm}$ \\begin{lstlisting} \n ${content} \\end{lstlisting} \n`;
13
+ return acc.replace(match, strReplacement);
14
+ }, res);
23
15
  const singleRe = /`[\s\S]*?`/;
24
16
  let cnt = 0;
17
+ let match;
25
18
  while ((match = singleRe.exec(res)) != null) {
26
19
  cnt++;
27
20
  if (cnt > 1000)
@@ -1 +1 @@
1
- {"version":3,"file":"questionTest.d.ts","sourceRoot":"","sources":["../../src/tests/questionTest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAKjE,eAAO,MAAM,YAAY,GACvB,KAAK,QAAQ,CAAC,MAAM,CAAC,EACrB,UAAU,QAAQ,CAAC,MAAM,CAAC;;;CA8R3B,CAAC"}
1
+ {"version":3,"file":"questionTest.d.ts","sourceRoot":"","sources":["../../src/tests/questionTest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAKjE,eAAO,MAAM,YAAY,GACvB,KAAK,QAAQ,CAAC,MAAM,CAAC,EACrB,UAAU,QAAQ,CAAC,MAAM,CAAC;;;CAuS3B,CAAC"}
@@ -39,6 +39,7 @@ export const questionTest = (exo, question) => {
39
39
  throw new Error(`exo ${exo.id} : ${err}`);
40
40
  }
41
41
  const dotDecimalPattern = /\d+\.\d+/;
42
+ const pythonPattern = /\`.*\`/;
42
43
  if (question.studentGgbOptions?.coords?.length) {
43
44
  if (exo.answerType !== "GGB") {
44
45
  throw new Error(`exo ${exo.id} has studentGgbOptions but answerType is not GGB`);
@@ -81,8 +82,9 @@ export const questionTest = (exo, question) => {
81
82
  throw new Error(`exo ${exo.id} has no answer`);
82
83
  }
83
84
  if (question.answer) {
84
- if (question.answer.match(dotDecimalPattern))
85
- throw new Error(`exo ${exo.id} has invalid number format`);
85
+ if (question.answer.match(dotDecimalPattern) &&
86
+ !question.answer.match(pythonPattern))
87
+ throw new Error(`exo ${exo.id} has invalid number format, answer: ${question.answer}`);
86
88
  if (question.answer.includes("[object Object]"))
87
89
  throw new Error(`exo ${exo.id} has invalid answer`);
88
90
  if (question.answerFormat !== "raw") {
@@ -209,7 +211,8 @@ export const questionTest = (exo, question) => {
209
211
  props.forEach((prop) => {
210
212
  if (prop.statement.includes("undefined"))
211
213
  throw new Error(`exo ${exo.id} has invalid prop (undefined) : ${prop.statement}`);
212
- if (prop.statement.match(dotDecimalPattern))
214
+ if (prop.statement.match(dotDecimalPattern) &&
215
+ !prop.statement.match(pythonPattern))
213
216
  throw new Error(`exo ${exo.id} has invalid prop (dot) : ${prop.statement}`);
214
217
  if (prop.statement.includes("[object Object]"))
215
218
  throw new Error(`exo ${exo.id} has invalid prop (objectObject) : ${prop.statement}`);
@@ -15,6 +15,7 @@ export type SimplifyOptions = {
15
15
  forbidRationalSimplification?: boolean;
16
16
  forceSeparateSqrts?: boolean;
17
17
  forceAddFractions?: boolean;
18
+ noAddOrder?: boolean;
18
19
  };
19
20
  export type EvaluateOptions = {
20
21
  degreeMode?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"algebraicNode.d.ts","sourceRoot":"","sources":["../../../src/tree/nodes/algebraicNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE9C,MAAM,MAAM,eAAe,GAAG;IAC5B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,kCAAkC,CAAC,EAAE,OAAO,CAAC;IAC7C,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,4BAA4B,CAAC,EAAE,OAAO,CAAC;IACvC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAG7B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;IACxD,mBAAmB,EAAE,MAAM,MAAM,CAAC;CACnC;AACD,8BAAsB,cAAc;;IAElC,OAAO,CAAC,MAAM,CAAC,QAAQ;CAGxB;AACD,eAAO,MAAM,eAAe,GAAI,MAAM,IAAI,KAAG,IAAI,IAAI,aACI,CAAC"}
@@ -11,7 +11,7 @@ export class DegreeNode {
11
11
  constructor(value, tex, mathString) {
12
12
  this.value = value;
13
13
  this.tex =
14
- (tex?.replace(".", ",") || (value + "").replace(".", ",")) + `^{\\circ}`;
14
+ (tex?.replace(".", ",") || (value + "").replace(".", ",")) + `^\\circ`;
15
15
  this.mathString = mathString || this.value + "^\\{\\circ\\}";
16
16
  this.isNumeric = true;
17
17
  }
@@ -1 +1 @@
1
- {"version":3,"file":"addNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/addNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAChF,OAAO,EACL,uBAAuB,EACvB,WAAW,EAEZ,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAerE,wBAAgB,SAAS,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,OAAO,CAE/C;AAED,eAAO,MAAM,GAAG,GACd,GAAG,aAAa,GAAG,MAAM,GAAG,MAAM,EAClC,GAAG,aAAa,GAAG,MAAM,GAAG,MAAM,YAOnC,CAAC;AAEF,qBAAa,OAAQ,YAAW,uBAAuB;IACrD,EAAE,EAAE,WAAW,CAAC;IAChB,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,aAAa,CAAC;IAC1B,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;gBAEjB,SAAS,EAAE,aAAa,EACxB,UAAU,EAAE,aAAa,EACzB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EF,qBAAa,OAAQ,YAAW,uBAAuB;IACrD,EAAE,EAAE,WAAW,CAAC;IAChB,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,aAAa,CAAC;IAC1B,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;gBAEjB,SAAS,EAAE,aAAa,EACxB,UAAU,EAAE,aAAa,EACzB,IAAI,CAAC,EAAE,WAAW;IAUpB;;OAEG;IACH,OAAO,gBAIL;IAEF,YAAY,IAAI,MAAM;IAItB,iBAAiB,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,aAAa,EAAE;IAoCtD,SAAS,IAAI,MAAM,EAAE;IAIrB,cAAc,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,MAAM,EAAE;IAK5C,KAAK,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,MAAM;IAerC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAGtC,mBAAmB;IAUnB,QAAQ,CAAC,IAAI,CAAC,EAAE,eAAe,EAAE,IAAI,UAAQ,GAAG,aAAa;IAyJ7D,aAAa;;;;;;;;;IAOb,MAAM,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO;IAUpC,oBAAoB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC;IAMxD,UAAU,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,aAAa;IAMvD,mBAAmB,CAAC,IAAI,CAAC,EAAE,eAAe;CAK3C"}
@@ -266,7 +266,7 @@ export class AddNode {
266
266
  return new NumberNode(0);
267
267
  if (externals.length === 1)
268
268
  return externals[0];
269
- return operatorComposition(AddNode, externals.sort(addSort));
269
+ return operatorComposition(AddNode, externals.sort((a, b) => addSort(a, b, opts)));
270
270
  }
271
271
  toIdentifiers() {
272
272
  return {
@@ -296,7 +296,9 @@ export class AddNode {
296
296
  return this.toTex();
297
297
  }
298
298
  }
299
- const addSort = (a, b) => {
299
+ const addSort = (a, b, opts) => {
300
+ if (opts?.noAddOrder)
301
+ return 0;
300
302
  //! this is super risky,
301
303
  if (a.isNumeric !== b.isNumeric) {
302
304
  return Number(a.isNumeric) - Number(b.isNumeric);
@@ -1,8 +1,8 @@
1
1
  export const degreeParser = (ans, allowNoDegreeSign = true) => {
2
2
  if (!allowNoDegreeSign && !ans.includes("\\circ"))
3
3
  return false;
4
- const nb = ans.replace("^{\\circ}", "").unfrenchify();
4
+ const nb = ans.replace("^{\\circ}", "").replace("^\\circ", "").unfrenchify();
5
5
  if (isNaN(nb))
6
6
  return false;
7
- return nb.frenchify() + "^{\\circ}";
7
+ return nb.frenchify() + "^\\circ";
8
8
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "math-exercises",
3
3
  "type": "module",
4
- "version": "3.0.176",
4
+ "version": "3.0.178",
5
5
  "description": "Math exercises generator for middle school and high school",
6
6
  "main": "lib/index.js",
7
7
  "files": [