math-exercises 3.0.189 → 3.0.191

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 (138) hide show
  1. package/lib/exercises/math/calcul/decimals/decimalFractionToDecimal.d.ts.map +1 -1
  2. package/lib/exercises/math/calcul/decimals/decimalFractionToDecimal.js +5 -4
  3. package/lib/exercises/math/calculLitteral/equation/factorizeEquation.d.ts.map +1 -1
  4. package/lib/exercises/math/calculLitteral/equation/factorizeEquation.js +9 -8
  5. package/lib/exercises/math/calculLitteral/equation/isEqualityTrue.d.ts.map +1 -1
  6. package/lib/exercises/math/calculLitteral/equation/isEqualityTrue.js +7 -6
  7. package/lib/exercises/math/dataRepresentations/barChartInterpreting.d.ts.map +1 -1
  8. package/lib/exercises/math/dataRepresentations/barChartInterpreting.js +5 -4
  9. package/lib/exercises/math/dataRepresentations/scatterPlot/index.d.ts +6 -0
  10. package/lib/exercises/math/dataRepresentations/scatterPlot/index.d.ts.map +1 -0
  11. package/lib/exercises/math/dataRepresentations/scatterPlot/index.js +5 -0
  12. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotBuildScatterPlotFromDataTable.d.ts +12 -0
  13. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotBuildScatterPlotFromDataTable.d.ts.map +1 -0
  14. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotBuildScatterPlotFromDataTable.js +206 -0
  15. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotCommenting.d.ts +9 -0
  16. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotCommenting.d.ts.map +1 -0
  17. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotCommenting.js +210 -0
  18. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotFillDataTableFromScatterPlotData.d.ts +10 -0
  19. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotFillDataTableFromScatterPlotData.d.ts.map +1 -0
  20. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotFillDataTableFromScatterPlotData.js +252 -0
  21. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotFillDataTableWithDataClassesFromScatterPlotData.d.ts +12 -0
  22. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotFillDataTableWithDataClassesFromScatterPlotData.d.ts.map +1 -0
  23. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotFillDataTableWithDataClassesFromScatterPlotData.js +352 -0
  24. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotInterpreting.d.ts +11 -0
  25. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotInterpreting.d.ts.map +1 -0
  26. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotInterpreting.js +403 -0
  27. package/lib/exercises/math/derivation/derivative/derivativeEquationSolving1.d.ts.map +1 -1
  28. package/lib/exercises/math/derivation/derivative/derivativeEquationSolving1.js +3 -2
  29. package/lib/exercises/math/derivation/derivative/derivativeEquationSolving3.d.ts.map +1 -1
  30. package/lib/exercises/math/derivation/derivative/derivativeEquationSolving3.js +3 -2
  31. package/lib/exercises/math/derivation/derivative/valueDerivativeFromFunctionExpression.d.ts.map +1 -1
  32. package/lib/exercises/math/derivation/derivative/valueDerivativeFromFunctionExpression.js +3 -2
  33. package/lib/exercises/math/derivation/problems/problemMaximizeProfitFindProduction.d.ts.map +1 -1
  34. package/lib/exercises/math/derivation/problems/problemMaximizeProfitFindProduction.js +3 -2
  35. package/lib/exercises/math/derivation/problems/problemMovementOnLineFindSpeedAtPoint.d.ts.map +1 -1
  36. package/lib/exercises/math/derivation/problems/problemMovementOnLineFindSpeedAtPoint.js +3 -2
  37. package/lib/exercises/math/derivation/tangent/tangentEquationFromFunctionExpression.d.ts.map +1 -1
  38. package/lib/exercises/math/derivation/tangent/tangentEquationFromFunctionExpression.js +4 -3
  39. package/lib/exercises/math/derivation/variations/findAbscissaOfExtremaFromFunctionExpression.d.ts.map +1 -1
  40. package/lib/exercises/math/derivation/variations/findAbscissaOfExtremaFromFunctionExpression.js +4 -3
  41. package/lib/exercises/math/derivation/variations/findExtremaFromFunctionExpression.d.ts.map +1 -1
  42. package/lib/exercises/math/derivation/variations/findExtremaFromFunctionExpression.js +4 -3
  43. package/lib/exercises/math/derivation/variations/plausibleDerivativeGraphFromFunctionGraphByManipulatingPolynomial.d.ts.map +1 -1
  44. package/lib/exercises/math/derivation/variations/plausibleDerivativeGraphFromFunctionGraphByManipulatingPolynomial.js +3 -2
  45. package/lib/exercises/math/derivation/variations/plausibleFunctionGraphFromDerivativeGraphByManipulatingPolynomial.d.ts.map +1 -1
  46. package/lib/exercises/math/derivation/variations/plausibleFunctionGraphFromDerivativeGraphByManipulatingPolynomial.js +3 -2
  47. package/lib/exercises/math/derivation/variations/signVarTableFromFunctionExpression.d.ts.map +1 -1
  48. package/lib/exercises/math/derivation/variations/signVarTableFromFunctionExpression.js +8 -4
  49. package/lib/exercises/math/functions/affines/affineCompareTwoImagesFromVariations.d.ts +13 -0
  50. package/lib/exercises/math/functions/affines/affineCompareTwoImagesFromVariations.d.ts.map +1 -0
  51. package/lib/exercises/math/functions/affines/affineCompareTwoImagesFromVariations.js +205 -0
  52. package/lib/exercises/math/functions/affines/affineVarTableOnBoundedInterval.d.ts +9 -0
  53. package/lib/exercises/math/functions/affines/affineVarTableOnBoundedInterval.d.ts.map +1 -0
  54. package/lib/exercises/math/functions/affines/affineVarTableOnBoundedInterval.js +157 -0
  55. package/lib/exercises/math/functions/affines/affineVariations.d.ts +12 -0
  56. package/lib/exercises/math/functions/affines/affineVariations.d.ts.map +1 -0
  57. package/lib/exercises/math/functions/affines/affineVariations.js +176 -0
  58. package/lib/exercises/math/functions/affines/affineVariationsFromGraph.d.ts +8 -0
  59. package/lib/exercises/math/functions/affines/affineVariationsFromGraph.d.ts.map +1 -0
  60. package/lib/exercises/math/functions/affines/affineVariationsFromGraph.js +203 -0
  61. package/lib/exercises/math/functions/affines/affineVariationsFromTwoImages.d.ts +12 -0
  62. package/lib/exercises/math/functions/affines/affineVariationsFromTwoImages.d.ts.map +1 -0
  63. package/lib/exercises/math/functions/affines/affineVariationsFromTwoImages.js +259 -0
  64. package/lib/exercises/math/functions/affines/coordsOfPointOnAffineFindX.d.ts.map +1 -1
  65. package/lib/exercises/math/functions/affines/coordsOfPointOnAffineFindX.js +8 -6
  66. package/lib/exercises/math/functions/exponentials/estimateExponentialFunctionImageFromGeometricScatterplot.d.ts +2 -0
  67. package/lib/exercises/math/functions/exponentials/estimateExponentialFunctionImageFromGeometricScatterplot.d.ts.map +1 -0
  68. package/lib/exercises/math/functions/exponentials/estimateExponentialFunctionImageFromGeometricScatterplot.js +155 -0
  69. package/lib/exercises/math/functions/exponentials/exponentialFunctionImage.d.ts +9 -0
  70. package/lib/exercises/math/functions/exponentials/exponentialFunctionImage.d.ts.map +1 -0
  71. package/lib/exercises/math/functions/exponentials/exponentialFunctionImage.js +99 -0
  72. package/lib/exercises/math/functions/exponentials/exponentialsRawVariations.d.ts +8 -0
  73. package/lib/exercises/math/functions/exponentials/exponentialsRawVariations.d.ts.map +1 -0
  74. package/lib/exercises/math/functions/exponentials/exponentialsRawVariations.js +99 -0
  75. package/lib/exercises/math/functions/exponentials/index.d.ts +8 -0
  76. package/lib/exercises/math/functions/exponentials/index.d.ts.map +1 -1
  77. package/lib/exercises/math/functions/exponentials/index.js +9 -0
  78. package/lib/exercises/math/functions/exponentials/plausibleExponentialFunctionExpressionFromGraph.d.ts +12 -0
  79. package/lib/exercises/math/functions/exponentials/plausibleExponentialFunctionExpressionFromGraph.d.ts.map +1 -0
  80. package/lib/exercises/math/functions/exponentials/plausibleExponentialFunctionExpressionFromGraph.js +138 -0
  81. package/lib/exercises/math/functions/exponentials/readExponentialFunctionParamsOnGraph.d.ts +8 -0
  82. package/lib/exercises/math/functions/exponentials/readExponentialFunctionParamsOnGraph.d.ts.map +1 -0
  83. package/lib/exercises/math/functions/exponentials/readExponentialFunctionParamsOnGraph.js +142 -0
  84. package/lib/exercises/math/functions/exponentials/realPowersFraction.d.ts +10 -0
  85. package/lib/exercises/math/functions/exponentials/realPowersFraction.d.ts.map +1 -0
  86. package/lib/exercises/math/functions/exponentials/realPowersFraction.js +125 -0
  87. package/lib/exercises/math/functions/exponentials/realPowersMixOperations.d.ts +12 -0
  88. package/lib/exercises/math/functions/exponentials/realPowersMixOperations.d.ts.map +1 -0
  89. package/lib/exercises/math/functions/exponentials/realPowersMixOperations.js +148 -0
  90. package/lib/exercises/math/functions/exponentials/realPowersPower.d.ts +10 -0
  91. package/lib/exercises/math/functions/exponentials/realPowersPower.d.ts.map +1 -0
  92. package/lib/exercises/math/functions/exponentials/realPowersPower.js +128 -0
  93. package/lib/exercises/math/functions/exponentials/realPowersProduct.d.ts +10 -0
  94. package/lib/exercises/math/functions/exponentials/realPowersProduct.d.ts.map +1 -0
  95. package/lib/exercises/math/functions/exponentials/realPowersProduct.js +128 -0
  96. package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLineV2.d.ts.map +1 -1
  97. package/lib/exercises/math/geometry/cartesian/placeAbscissOnSemiLineV2.js +7 -6
  98. package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiBH.d.ts.map +1 -1
  99. package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiBH.js +3 -2
  100. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductComputeBH.d.ts.map +1 -1
  101. package/lib/exercises/math/geometry/vectors/scalarProduct/scalarProductComputeBH.js +7 -6
  102. package/lib/exercises/math/percent/percentToDecimal.d.ts.map +1 -1
  103. package/lib/exercises/math/percent/percentToDecimal.js +5 -4
  104. package/lib/exercises/math/probaStat/basicStats/calculateFrequencyInList.d.ts.map +1 -1
  105. package/lib/exercises/math/probaStat/basicStats/calculateFrequencyInList.js +5 -4
  106. package/lib/exercises/math/probaStat/probaFromTableWithContext.d.ts.map +1 -1
  107. package/lib/exercises/math/probaStat/probaFromTableWithContext.js +7 -8
  108. package/lib/exercises/math/probaStat/stats1var/medianWithList.d.ts.map +1 -1
  109. package/lib/exercises/math/probaStat/stats1var/medianWithList.js +5 -4
  110. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRankFromSituation.d.ts.map +1 -1
  111. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRankFromSituation.js +9 -9
  112. package/lib/exercises/math/sequences/geometric/geometricFindNextTermFromTwoConsecutiveTerms.d.ts +12 -0
  113. package/lib/exercises/math/sequences/geometric/geometricFindNextTermFromTwoConsecutiveTerms.d.ts.map +1 -0
  114. package/lib/exercises/math/sequences/geometric/geometricFindNextTermFromTwoConsecutiveTerms.js +217 -0
  115. package/lib/exercises/math/sequences/geometric/geometricFindRecurrenceFormula.d.ts +10 -0
  116. package/lib/exercises/math/sequences/geometric/geometricFindRecurrenceFormula.d.ts.map +1 -0
  117. package/lib/exercises/math/sequences/geometric/geometricFindRecurrenceFormula.js +186 -0
  118. package/lib/exercises/math/sequences/geometric/graph/geometricPlaceFirstPoints.d.ts +14 -0
  119. package/lib/exercises/math/sequences/geometric/graph/geometricPlaceFirstPoints.d.ts.map +1 -0
  120. package/lib/exercises/math/sequences/geometric/graph/geometricPlaceFirstPoints.js +189 -0
  121. package/lib/exercises/math/sequences/geometric/graph/index.d.ts +2 -0
  122. package/lib/exercises/math/sequences/geometric/graph/index.d.ts.map +1 -0
  123. package/lib/exercises/math/sequences/geometric/graph/index.js +1 -0
  124. package/lib/exercises/utils/options/arrayedOptions.d.ts +2 -0
  125. package/lib/exercises/utils/options/arrayedOptions.d.ts.map +1 -0
  126. package/lib/exercises/utils/options/arrayedOptions.js +16 -0
  127. package/lib/index.d.ts +33 -0
  128. package/lib/index.d.ts.map +1 -1
  129. package/lib/math/utils/sequences/situations/seqArithmeticSituations.d.ts.map +1 -1
  130. package/lib/math/utils/sequences/situations/seqArithmeticSituations.js +20 -20
  131. package/lib/tree/nodes/algebraicNode.d.ts +3 -0
  132. package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
  133. package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
  134. package/lib/tree/nodes/operators/fractionNode.js +5 -3
  135. package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
  136. package/lib/tree/nodes/operators/multiplyNode.js +5 -3
  137. package/lib/tree/nodes/operators/powerNode.js +1 -1
  138. package/package.json +1 -1
@@ -1,5 +1,6 @@
1
1
  import { addValidProp, shuffleProps, GeneratorOptionType, GeneratorOptionTarget, tryToAddWrongProp, propWhile, } from "../../../../../exercises/exercise.js";
2
2
  import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { defaultArrayedOptsWhereNeeded } from "../../../../../exercises/utils/options/arrayedOptions.js";
3
4
  import { orange } from "../../../../../geogebra/colors.js";
4
5
  import { GeogebraConstructor } from "../../../../../geogebra/geogebraConstructor.js";
5
6
  import { Angle } from "../../../../../math/geometry/angle.js";
@@ -248,10 +249,10 @@ const isAnswerValid = (ans, { answer, ...identifiers }) => {
248
249
  }
249
250
  };
250
251
  const getScalarProductComputeBHQuestion = (optsIn) => {
251
- const arrayedOptions = optsIn ?? optsDefault;
252
+ const arrayedOpts = defaultArrayedOptsWhereNeeded(optsIn, arrayedOptsDefault);
252
253
  const opts = {
253
- sectorOfPointH: random(arrayedOptions.sectorOfPointH),
254
- isPositiveCoordsOnly: arrayedOptions.isPositiveCoordsOnly,
254
+ sectorOfPointH: random(arrayedOpts.sectorOfPointH),
255
+ isPositiveCoordsOnly: arrayedOpts.isPositiveCoordsOnly,
255
256
  };
256
257
  const { sectorOfPointH, isPositiveCoordsOnly } = opts;
257
258
  function createRandomIdentifiers() {
@@ -406,7 +407,7 @@ const getQuestionFromIdentifiers = (identifiers, opts) => {
406
407
  };
407
408
  return question;
408
409
  };
409
- const optsDefault = {
410
+ const arrayedOptsDefault = {
410
411
  sectorOfPointH: ["Entre $B$ et $C$"],
411
412
  isPositiveCoordsOnly: true,
412
413
  };
@@ -417,14 +418,14 @@ const options = [
417
418
  target: GeneratorOptionTarget.generation,
418
419
  type: GeneratorOptionType.multiselect,
419
420
  values: ["Entre $B$ et $C$", "Après $C$", "Avant $B$"],
420
- defaultValue: optsDefault.sectorOfPointH,
421
+ defaultValue: arrayedOptsDefault.sectorOfPointH,
421
422
  },
422
423
  {
423
424
  id: "isPositiveCoordsOnly",
424
425
  label: "Coordonnées positives uniquement",
425
426
  target: GeneratorOptionTarget.generation,
426
427
  type: GeneratorOptionType.checkbox,
427
- defaultValue: optsDefault.isPositiveCoordsOnly,
428
+ defaultValue: arrayedOptsDefault.isPositiveCoordsOnly,
428
429
  },
429
430
  ];
430
431
  export const scalarProductComputeBH = {
@@ -1 +1 @@
1
- {"version":3,"file":"percentToDecimal.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/percent/percentToDecimal.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAmBT,MAAM,6BAA6B,CAAC;AAiBrC,KAAK,WAAW,GAAG;IACjB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AA4JF,KAAK,OAAO,GAAG;IACb,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAsBF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAe3D,CAAC"}
1
+ {"version":3,"file":"percentToDecimal.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/percent/percentToDecimal.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAmBT,MAAM,6BAA6B,CAAC;AAkBrC,KAAK,WAAW,GAAG;IACjB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AA2JF,KAAK,OAAO,GAAG;IACb,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAsBF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAe3D,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { GeneratorOptionTarget, GeneratorOptionType, addValidProp, propWhile, shuffleProps, tryToAddWrongProp, } from "../../../exercises/exercise.js";
2
2
  import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
3
+ import { defaultArrayedOptsWhereNeeded } from "../../../exercises/utils/options/arrayedOptions.js";
3
4
  import { Decimal, DecimalConstructor, } from "../../../math/numbers/decimals/decimal.js";
4
5
  import { Integer, IntegerConstructor, } from "../../../math/numbers/integer/integer.js";
5
6
  import { randint } from "../../../math/utils/random/randint.js";
@@ -82,9 +83,9 @@ const isAnswerValid = (ans, { answer, isPercentToDecimal }) => {
82
83
  }
83
84
  };
84
85
  const getPercentToDecimalQuestion = (optsIn) => {
85
- const arrayedOptions = optsIn ?? optsDefault;
86
+ const arrayedOpts = defaultArrayedOptsWhereNeeded(optsIn, arrayedOptsDefault);
86
87
  const opts = {
87
- conversionType: random(arrayedOptions.conversionType),
88
+ conversionType: random(arrayedOpts.conversionType),
88
89
  };
89
90
  const isPercentToDecimal = opts.conversionType === "Pourcentage vers Décimal";
90
91
  const isNatural = coinFlip();
@@ -119,7 +120,7 @@ const getQuestionFromIdentifiers = (identifiers, opts) => {
119
120
  };
120
121
  return question;
121
122
  };
122
- const optsDefault = {
123
+ const arrayedOptsDefault = {
123
124
  conversionType: ["Pourcentage vers Décimal", "Décimal vers Pourcentage"],
124
125
  };
125
126
  const options = [
@@ -129,7 +130,7 @@ const options = [
129
130
  target: GeneratorOptionTarget.generation,
130
131
  type: GeneratorOptionType.multiselect,
131
132
  values: ["Pourcentage vers Décimal", "Décimal vers Pourcentage"],
132
- defaultValue: optsDefault.conversionType,
133
+ defaultValue: arrayedOptsDefault.conversionType,
133
134
  },
134
135
  ];
135
136
  export const percentToDecimal = {
@@ -1 +1 @@
1
- {"version":3,"file":"calculateFrequencyInList.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/basicStats/calculateFrequencyInList.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAmBT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B,CAAC;AA8LF,KAAK,OAAO,GAAG;IACb,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B,CAAC;AAsBF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAgBnE,CAAC"}
1
+ {"version":3,"file":"calculateFrequencyInList.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/basicStats/calculateFrequencyInList.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAmBT,MAAM,6BAA6B,CAAC;AAarC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B,CAAC;AA8LF,KAAK,OAAO,GAAG;IACb,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B,CAAC;AAsBF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAgBnE,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { addValidProp, shuffleProps, tryToAddWrongProp, propWhile, GeneratorOptionTarget, GeneratorOptionType, } from "../../../../exercises/exercise.js";
2
2
  import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { defaultArrayedOptsWhereNeeded } from "../../../../exercises/utils/options/arrayedOptions.js";
3
4
  import { RationalConstructor } from "../../../../math/numbers/rationals/rational.js";
4
5
  import { randint } from "../../../../math/utils/random/randint.js";
5
6
  import { round } from "../../../../math/utils/round.js";
@@ -95,8 +96,8 @@ const isAnswerValid = (ans, { answer, ...identifiers }) => {
95
96
  }
96
97
  };
97
98
  const getCalculateFrequencyInListQuestion = (optsIn) => {
98
- const opts = optsIn ?? optsDefault;
99
- const allowedAnsType = opts.allowedAnsType;
99
+ const arrayedOpts = defaultArrayedOptsWhereNeeded(optsIn, arrayedOptsDefault);
100
+ const allowedAnsType = arrayedOpts.allowedAnsType;
100
101
  const target = randint(1, 10);
101
102
  const length = randint(6, 13);
102
103
  const values = [];
@@ -150,7 +151,7 @@ const getAllValidNodes = (identifiers) => {
150
151
  return identifiersCopy;
151
152
  })()));
152
153
  };
153
- const optsDefault = {
154
+ const arrayedOptsDefault = {
154
155
  allowedAnsType: ["exacte", "arrondie à 2 décimales"],
155
156
  };
156
157
  const options = [
@@ -160,7 +161,7 @@ const options = [
160
161
  target: GeneratorOptionTarget.generation,
161
162
  type: GeneratorOptionType.multiselect,
162
163
  values: ["exacte", "arrondie à 2 décimales"],
163
- defaultValue: optsDefault.allowedAnsType,
164
+ defaultValue: arrayedOptsDefault.allowedAnsType,
164
165
  },
165
166
  ];
166
167
  export const calculateFrequencyInList = {
@@ -1 +1 @@
1
- {"version":3,"file":"probaFromTableWithContext.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/probaFromTableWithContext.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAmBT,MAAM,6BAA6B,CAAC;AAgBrC,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE;QACN,WAAW,EAAE,MAAM,CAAC;QACpB,uBAAuB,EAAE,MAAM,CAAC;QAChC,uBAAuB,EAAE,MAAM,CAAC;QAChC,mCAAmC,EAAE,MAAM,CAAC;KAC7C,CAAC;IACF,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B,CAAC;AA+ZF,KAAK,OAAO,GAAG;IACb,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AA+BF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAiBpE,CAAC"}
1
+ {"version":3,"file":"probaFromTableWithContext.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/probaStat/probaFromTableWithContext.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAmBT,MAAM,6BAA6B,CAAC;AAiBrC,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE;QACN,WAAW,EAAE,MAAM,CAAC;QACpB,uBAAuB,EAAE,MAAM,CAAC;QAChC,uBAAuB,EAAE,MAAM,CAAC;QAChC,mCAAmC,EAAE,MAAM,CAAC;KAC7C,CAAC;IACF,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B,CAAC;AA6ZF,KAAK,OAAO,GAAG;IACb,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AA+BF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAiBpE,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { GeneratorOptionTarget, GeneratorOptionType, addValidProp, propWhile, shuffleProps, tryToAddWrongProp, } from "../../../exercises/exercise.js";
2
2
  import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
3
+ import { defaultArrayedOptsWhereNeeded } from "../../../exercises/utils/options/arrayedOptions.js";
3
4
  import { rationalVEA } from "../../../exercises/vea/rationalVEA.js";
4
5
  import { Rational } from "../../../math/numbers/rationals/rational.js";
5
6
  import { randint } from "../../../math/utils/random/randint.js";
@@ -74,8 +75,8 @@ const getAnswer = (identifiers) => {
74
75
  return getAnswerNode(identifiers).toTex();
75
76
  };
76
77
  const getProbaFromTableWithContextQuestion = (optsIn) => {
77
- const opts = optsIn ?? optsDefault;
78
- const allowedAnsType = opts.allowedAnsType;
78
+ const arrayedOpts = defaultArrayedOptsWhereNeeded(optsIn, arrayedOptsDefault);
79
+ const allowedAnsType = arrayedOpts.allowedAnsType;
79
80
  const aCapB = randint(1, 20);
80
81
  const aCapBBarre = randint(1, 20, [aCapB]);
81
82
  const aBarreCapB = randint(1, 20, [aCapB, aCapBBarre]);
@@ -93,9 +94,7 @@ const getProbaFromTableWithContextQuestion = (optsIn) => {
93
94
  const bBarreTotal = aBarreCapBBarre + aCapBBarre;
94
95
  let event = "";
95
96
  let proba = [];
96
- const frenchType = opts?.probaTypes?.length
97
- ? random(opts.probaTypes)
98
- : random(["Événement simple", "Intersection", "Union"]);
97
+ const frenchType = random(arrayedOpts.probaTypes);
99
98
  const type = frenchType === "Événement simple"
100
99
  ? "singleEvent"
101
100
  : frenchType.toLocaleLowerCase();
@@ -284,7 +283,7 @@ const createFormattedNode = (exactNode, strInternalAllowedAnswerTypes) => {
284
283
  return exactNode;
285
284
  }
286
285
  };
287
- const optsDefault = {
286
+ const arrayedOptsDefault = {
288
287
  allowedAnsType: ["exacte", "arrondie à 2 décimales"],
289
288
  probaTypes: ["Événement simple", "Intersection", "Union"],
290
289
  };
@@ -295,7 +294,7 @@ const options = [
295
294
  target: GeneratorOptionTarget.generation,
296
295
  type: GeneratorOptionType.multiselect,
297
296
  values: ["exacte", "arrondie à 2 décimales"],
298
- defaultValue: optsDefault.allowedAnsType,
297
+ defaultValue: arrayedOptsDefault.allowedAnsType,
299
298
  },
300
299
  {
301
300
  id: "probaTypes",
@@ -303,7 +302,7 @@ const options = [
303
302
  target: GeneratorOptionTarget.generation,
304
303
  type: GeneratorOptionType.multiselect,
305
304
  values: ["Événement simple", "Intersection", "Union"],
306
- defaultValue: optsDefault.probaTypes,
305
+ defaultValue: arrayedOptsDefault.probaTypes,
307
306
  },
308
307
  ];
309
308
  export const probaFromTableWithContext = {
@@ -1 +1 @@
1
- {"version":3,"file":"medianWithList.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats1var/medianWithList.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,QAAQ,EAkBT,MAAM,sBAAsB,CAAC;AAE9B,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAmJF,KAAK,OAAO,GAAG;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAsBF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAkBzD,CAAC;AAEF,eAAO,MAAM,8BAA8B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAiBzE,CAAC"}
1
+ {"version":3,"file":"medianWithList.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats1var/medianWithList.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,QAAQ,EAkBT,MAAM,sBAAsB,CAAC;AAE9B,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAmJF,KAAK,OAAO,GAAG;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAsBF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAkBzD,CAAC;AAEF,eAAO,MAAM,8BAA8B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAiBzE,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { defaultArrayedOptsWhereNeeded } from "../../../../exercises/utils/options/arrayedOptions.js";
1
2
  import { numberVEA } from "../../../../exercises/vea/numberVEA.js";
2
3
  import { randint } from "../../../../math/utils/random/randint.js";
3
4
  import { median } from "../../../../math/utils/stats/median.js";
@@ -81,9 +82,9 @@ const isAnswerValid = (ans, { answer, sortedValues }) => {
81
82
  }
82
83
  };
83
84
  const getMedianList = (optsIn) => {
84
- const arrayedOptions = optsIn;
85
+ const arrayedOpts = defaultArrayedOptsWhereNeeded(optsIn, arrayedOptsDefault);
85
86
  const opts = {
86
- nbValues: random(arrayedOptions.nbValues ?? optsDefault.nbValues),
87
+ nbValues: random(arrayedOpts.nbValues),
87
88
  isOrdered: optsIn?.isOrdered ?? false,
88
89
  };
89
90
  const length = Number(opts.nbValues);
@@ -123,7 +124,7 @@ const getQuestionFromIdentifiers = (identifiers, opts) => {
123
124
  };
124
125
  return question;
125
126
  };
126
- const optsDefault = {
127
+ const arrayedOptsDefault = {
127
128
  nbValues: ["7", "8"],
128
129
  };
129
130
  const options = [
@@ -133,7 +134,7 @@ const options = [
133
134
  target: GeneratorOptionTarget.generation,
134
135
  type: GeneratorOptionType.multiselect,
135
136
  values: ["4", "5", "7", "8", "11", "12", "19", "20"],
136
- defaultValue: optsDefault.nbValues,
137
+ defaultValue: arrayedOptsDefault.nbValues,
137
138
  },
138
139
  ];
139
140
  export const medianWithList = {
@@ -1 +1 @@
1
- {"version":3,"file":"arithmeticFindRankFromSituation.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/sequences/arithmetic/situations/arithmeticFindRankFromSituation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,sBAAsB,EACvB,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAEL,2BAA2B,EAC5B,MAAM,wDAAwD,CAAC;AAKhE,OAAO,EAEL,kCAAkC,EAEnC,MAAM,kEAAkE,CAAC;AAM1E,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,kCAAkC,CAAC;IACrD,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AA0OF,KAAK,OAAO,GAAG,sBAAsB,GAAG,2BAA2B,CAAC;AAcpE,eAAO,MAAM,+BAA+B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAmB1E,CAAC"}
1
+ {"version":3,"file":"arithmeticFindRankFromSituation.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/sequences/arithmetic/situations/arithmeticFindRankFromSituation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,sBAAsB,EACvB,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAEL,2BAA2B,EAC5B,MAAM,wDAAwD,CAAC;AAKhE,OAAO,EAEL,kCAAkC,EAEnC,MAAM,kEAAkE,CAAC;AAM1E,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,kCAAkC,CAAC;IACrD,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAsPF,KAAK,OAAO,GAAG,sBAAsB,GAAG,2BAA2B,CAAC;AAcpE,eAAO,MAAM,+BAA+B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAmB1E,CAAC"}
@@ -24,7 +24,7 @@ const getAnswerNode = (identifiers, opts) => {
24
24
  const { situationIndex, initial, reason, valueAsked } = identifiers;
25
25
  const situation = situations[situationIndex];
26
26
  const rankDecoder = situation.rankDecoder;
27
- return situation.variationFindRank.getAnswerStuff(initial, reason, firstRank, valueAsked, rankDecoder).answerNode;
27
+ return situation.variationFindRank.getAnswerStuff(initial, reason, firstRank, valueAsked, rankDecoder, situation.digitsValue, situation.digitsTarget).answerNode;
28
28
  };
29
29
  const getAnswer = (identifiers, optsIn) => {
30
30
  const opts = optsIn ?? optsDefault;
@@ -54,12 +54,12 @@ const getPropositions = (n, { answer, ...identifiers }, optsIn) => {
54
54
  const arrNodeWrong = [];
55
55
  //student: uses valueAsked as if it were rankAsked
56
56
  {
57
- const nodeWrong = situation.variationFindRandomTerm.getAnswerNode(initial, reason, firstRank, valueAsked, situation.rankDecoder);
58
- tryToAddWrongProp(propositions, nodeWrong.simplify().toTex());
57
+ const nodeWrong = situation.variationFindRandomTerm.getAnswerNode(initial, reason, firstRank, valueAsked, situation.rankDecoder, situation.digitsValue, situation.digitsTarget);
58
+ tryToAddWrongProp(propositions, round(nodeWrong.simplify().evaluate(), 0).toTree().toTex());
59
59
  arrNodeWrong.push(nodeWrong);
60
60
  }
61
61
  const rankValid = (() => {
62
- const { rankNode } = situation.variationFindRank.getAnswerStuff(initial, reason, firstRank, valueAsked, situation.rankDecoder);
62
+ const { rankNode } = situation.variationFindRank.getAnswerStuff(initial, reason, firstRank, valueAsked, situation.rankDecoder, situation.digitsValue, situation.digitsTarget);
63
63
  return round(rankNode.evaluate(), 0);
64
64
  })();
65
65
  //pseudo terror
@@ -67,7 +67,7 @@ const getPropositions = (n, { answer, ...identifiers }, optsIn) => {
67
67
  if (coinFlip()) {
68
68
  //student: rankValid - 1
69
69
  {
70
- const nodeWrong = (rankValid - 1).toTree();
70
+ const nodeWrong = round(rankValid - 1, 0).toTree();
71
71
  tryToAddWrongProp(propositions, nodeWrong.toTex());
72
72
  arrNodeWrong.push(nodeWrong);
73
73
  }
@@ -75,7 +75,7 @@ const getPropositions = (n, { answer, ...identifiers }, optsIn) => {
75
75
  else {
76
76
  //student: rankValid + 1
77
77
  {
78
- const nodeWrong = (rankValid + 1).toTree();
78
+ const nodeWrong = round(rankValid + 1, 0).toTree();
79
79
  tryToAddWrongProp(propositions, nodeWrong.toTex());
80
80
  arrNodeWrong.push(nodeWrong);
81
81
  }
@@ -83,7 +83,7 @@ const getPropositions = (n, { answer, ...identifiers }, optsIn) => {
83
83
  }
84
84
  //random around
85
85
  {
86
- const nodeWrong = Math.max(1, rankValid + randint(-5, 6, [0])).toTree();
86
+ const nodeWrong = round(Math.max(1, rankValid + randint(-5, 6, [0])), 0).toTree();
87
87
  tryToAddWrongProp(propositions, nodeWrong.toTex());
88
88
  arrNodeWrong.push(nodeWrong);
89
89
  }
@@ -94,7 +94,7 @@ const getPropositions = (n, { answer, ...identifiers }, optsIn) => {
94
94
  if (coinFlip()) {
95
95
  //student: rankValid - 1
96
96
  {
97
- const nodeWrong = (nodePicked.evaluate() - 1).toTree();
97
+ const nodeWrong = round(nodePicked.evaluate() - 1, 0).toTree();
98
98
  tryToAddWrongProp(propositions, nodeWrong.toTex());
99
99
  arrNodeWrong.push(nodeWrong);
100
100
  }
@@ -102,7 +102,7 @@ const getPropositions = (n, { answer, ...identifiers }, optsIn) => {
102
102
  else {
103
103
  //student: rankValid + 1
104
104
  {
105
- const nodeWrong = (nodePicked.evaluate() + 1).toTree();
105
+ const nodeWrong = round(nodePicked.evaluate() + 1, 0).toTree();
106
106
  tryToAddWrongProp(propositions, nodeWrong.toTex());
107
107
  arrNodeWrong.push(nodeWrong);
108
108
  }
@@ -0,0 +1,12 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ rank1: number;
4
+ value1: number;
5
+ rank2: number;
6
+ value2: number;
7
+ precisionInitial: number;
8
+ precisionReason: number;
9
+ };
10
+ export declare const geometricFindNextTermFromTwoConsecutiveTerms: Exercise<Identifiers>;
11
+ export {};
12
+ //# sourceMappingURL=geometricFindNextTermFromTwoConsecutiveTerms.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geometricFindNextTermFromTwoConsecutiveTerms.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/geometricFindNextTermFromTwoConsecutiveTerms.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAcrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AA2OF,eAAO,MAAM,4CAA4C,EAAE,QAAQ,CAAC,WAAW,CAmB5E,CAAC"}
@@ -0,0 +1,217 @@
1
+ import { addValidProp, tryToAddWrongProp, propWhile, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { numberVEA } from "../../../../exercises/vea/numberVEA.js";
4
+ import { randfloat } from "../../../../math/utils/random/randfloat.js";
5
+ import { randint } from "../../../../math/utils/random/randint.js";
6
+ import { round } from "../../../../math/utils/round.js";
7
+ import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
8
+ import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
9
+ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
10
+ import { random } from "../../../../utils/alea/random.js";
11
+ import { shuffle } from "../../../../utils/alea/shuffle.js";
12
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
13
+ import { alignTex } from "../../../../utils/latex/alignTex.js";
14
+ const getInstruction = (identifiers) => {
15
+ const { rank1, value1, rank2, value2 } = identifiers;
16
+ const rankAsked = round(rank2 + 1, 0);
17
+ return `Soit $u$ une suite géométrique telle que $u_{${rank1.frenchify()}} = ${value1.frenchify()}$ et $u_{${rank2.frenchify()}} = ${value2.frenchify()}$.
18
+
19
+ Que vaut $u_{${rankAsked.frenchify()}}$ ?`;
20
+ };
21
+ const getAnswerStuff = (identifiers) => {
22
+ const { value1, value2 } = identifiers;
23
+ const nodeReason = frac(value2, value1).simplify({ towardsDistribute: true });
24
+ const nodeAnswer = multiply(value2, nodeReason);
25
+ return {
26
+ nodeReason,
27
+ nodeAnswer,
28
+ };
29
+ };
30
+ const getAnswer = (identifiers) => {
31
+ return getAnswerStuff(identifiers)
32
+ .nodeAnswer.simplify({ towardsDistribute: true })
33
+ .toTex();
34
+ };
35
+ const getHint = (identifiers, _optsIn) => {
36
+ const { rank2 } = identifiers;
37
+ const rankAsked = round(rank2 + 1, 0);
38
+ return `Commence par déterminer la raison $q$ de la suite $u$.
39
+
40
+ Puis, utilise cette raison et un des termes connus de la suite pour déterminer $u_{${rankAsked.frenchify()}}$.`;
41
+ };
42
+ const getCorrection = (identifiers) => {
43
+ const { rank1, value1, rank2, value2 } = identifiers;
44
+ const rankAsked = round(rank2 + 1, 0);
45
+ const { nodeReason, nodeAnswer } = getAnswerStuff(identifiers);
46
+ return `On commence par déterminer la raison $q$ de la suite $u$.
47
+
48
+ On a :
49
+
50
+ ${alignTex([
51
+ ["q", "=", `\\frac{u_{${rank2}}}{u_{${rank1}}}`],
52
+ ["", "=", `\\frac{${value2.frenchify()}}{${value1.frenchify()}}`],
53
+ ["", "=", `${nodeReason.toTex()}`],
54
+ ])}
55
+
56
+ On peut alors déterminer $u_{${rankAsked.frenchify()}}$ en utilisant $u_{${rank2.frenchify()}}$ et $q$. En effet, on a :
57
+
58
+ ${alignTex([
59
+ [
60
+ `u_{${rankAsked.frenchify()}}`,
61
+ "=",
62
+ `u_{${rank2.frenchify()}} \\ \\times \\ q`,
63
+ ],
64
+ ["", "=", nodeAnswer.toTex()],
65
+ ["", "=", nodeAnswer.simplify({ towardsDistribute: true }).toTex()],
66
+ ])}
67
+
68
+ `;
69
+ };
70
+ const getPropositions = (n, { answer, ..._identifiers }) => {
71
+ const propositions = [];
72
+ addValidProp(propositions, answer);
73
+ propWhile(propositions, n, () => {
74
+ const identifiersWrong = createRandomIdentifiersCurated();
75
+ const texWrong = getAnswer(identifiersWrong);
76
+ tryToAddWrongProp(propositions, texWrong);
77
+ });
78
+ return shuffle(propositions);
79
+ };
80
+ const isAnswerValid = (ans, { answer }) => {
81
+ try {
82
+ return numberVEA(ans, answer);
83
+ }
84
+ catch (err) {
85
+ return handleVEAError(err);
86
+ }
87
+ };
88
+ const createRandomIdentifiersRaw = () => {
89
+ const isDivergent = coinFlip();
90
+ const isReasonNegative = coinFlip();
91
+ const signReason = isReasonNegative ? -1 : +1;
92
+ function createGeometricDivergent() {
93
+ const precisionInitial = 1;
94
+ const initial = randfloat(1, 10, precisionInitial, [1]);
95
+ const precisionReason = 0;
96
+ const reason = signReason * randint(2, 10);
97
+ return [initial, precisionInitial, reason, precisionReason];
98
+ }
99
+ function createGeometricConvergent() {
100
+ const poolReasonStuff = [
101
+ {
102
+ q: 0.5,
103
+ precision: 1,
104
+ invQ: 2,
105
+ },
106
+ {
107
+ q: 0.25,
108
+ precision: 2,
109
+ invQ: 4,
110
+ },
111
+ {
112
+ q: 0.2,
113
+ precision: 1,
114
+ invQ: 5,
115
+ },
116
+ {
117
+ q: 0.1,
118
+ precision: 1,
119
+ invQ: 10,
120
+ },
121
+ {
122
+ q: 0.05,
123
+ precision: 2,
124
+ invQ: 20,
125
+ },
126
+ ];
127
+ const { q, invQ, precision: precisionReason } = random(poolReasonStuff);
128
+ const reason = signReason * q;
129
+ const precisionInitial = 0;
130
+ const initial = round(randint(10, 20) * Math.pow(invQ, 8), precisionInitial);
131
+ return [initial, precisionInitial, reason, precisionReason];
132
+ }
133
+ const [initial, precisionInitial, reason, precisionReason] = (() => {
134
+ if (isDivergent) {
135
+ return createGeometricDivergent();
136
+ }
137
+ else {
138
+ return createGeometricConvergent();
139
+ }
140
+ })();
141
+ const rank1 = randint(1, 5);
142
+ const rank2 = rank1 + 1;
143
+ const rankAsked = rank2 + 1;
144
+ function valueForRank(initial, reason, rank) {
145
+ return initial * Math.pow(reason, rank);
146
+ }
147
+ const [value1, value2] = [rank1, rank2].map((rank) => round(valueForRank(initial, reason, rank), 4));
148
+ const identifiers = {
149
+ rank1,
150
+ value1,
151
+ rank2,
152
+ value2,
153
+ precisionInitial,
154
+ precisionReason,
155
+ rankAsked,
156
+ };
157
+ return identifiers;
158
+ };
159
+ const createRandomIdentifiersCurated = () => {
160
+ let identifiers;
161
+ let isValid = false;
162
+ let counter = -1;
163
+ while (!isValid && counter < 100) {
164
+ counter++;
165
+ const identifiersCandidate = createRandomIdentifiersRaw();
166
+ getAnswerStuff(identifiersCandidate);
167
+ const answer = getAnswer(identifiersCandidate);
168
+ isValid = !answer.includes("NaN");
169
+ if (isValid) {
170
+ identifiers = identifiersCandidate;
171
+ }
172
+ }
173
+ if (!isValid) {
174
+ //2.5 * 2^n
175
+ const identifiersDefault = {
176
+ rank1: 2,
177
+ value1: 10,
178
+ rank2: 5,
179
+ value2: 40,
180
+ precisionInitial: 1,
181
+ precisionReason: 0,
182
+ };
183
+ identifiers = identifiersDefault;
184
+ }
185
+ return identifiers;
186
+ };
187
+ const getGeometricFindNextTermFromTwoConsecutiveTermsQuestion = () => {
188
+ const identifiers = createRandomIdentifiersCurated();
189
+ return getQuestionFromIdentifiers(identifiers);
190
+ };
191
+ const getQuestionFromIdentifiers = (identifiers, opts) => {
192
+ const question = {
193
+ answer: getAnswer(identifiers, opts),
194
+ instruction: getInstruction(identifiers, opts),
195
+ keys: [],
196
+ answerFormat: "tex",
197
+ identifiers,
198
+ hint: getHint(identifiers, opts),
199
+ correction: getCorrection(identifiers, opts),
200
+ options: opts,
201
+ };
202
+ return question;
203
+ };
204
+ export const geometricFindNextTermFromTwoConsecutiveTerms = {
205
+ id: "geometricFindNextTermFromTwoConsecutiveTerms",
206
+ connector: "=",
207
+ label: "Connaissant deux termes consécutifs d'une suite géométrique, calculer le terme suivant",
208
+ isSingleStep: true,
209
+ generator: (nb, opts) => getDistinctQuestions(() => getGeometricFindNextTermFromTwoConsecutiveTermsQuestion(opts), nb),
210
+ qcmTimer: 60,
211
+ freeTimer: 60,
212
+ getPropositions,
213
+ isAnswerValid,
214
+ subject: "Mathématiques",
215
+ getQuestionFromIdentifiers,
216
+ hasHintAndCorrection: true,
217
+ };
@@ -0,0 +1,10 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ import { OptionFirstTermRankOne } from "../../../../exercises/options/optionFirstTermRankOne.js";
3
+ type Identifiers = {
4
+ reason: number;
5
+ firstValue: number;
6
+ };
7
+ type Options = OptionFirstTermRankOne;
8
+ export declare const geometricFindRecurrenceFormula: Exercise<Identifiers, Options>;
9
+ export {};
10
+ //# sourceMappingURL=geometricFindRecurrenceFormula.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geometricFindRecurrenceFormula.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/geometricFindRecurrenceFormula.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,sBAAsB,EACvB,MAAM,mDAAmD,CAAC;AAgB3D,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAuNF,KAAK,OAAO,GAAG,sBAAsB,CAAC;AAMtC,eAAO,MAAM,8BAA8B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAmBzE,CAAC"}