math-exercises 3.0.186 → 3.0.188

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 (79) hide show
  1. package/lib/exercises/math/derivation/derivative/exp/expDerivativeProductFExp.d.ts.map +1 -1
  2. package/lib/exercises/math/derivation/derivative/exp/expDerivativeProductFExp.js +22 -6
  3. package/lib/exercises/math/derivation/derivative/exp/expDerivativeQuotientFExp.d.ts.map +1 -1
  4. package/lib/exercises/math/derivation/derivative/exp/expDerivativeQuotientFExp.js +16 -8
  5. package/lib/exercises/math/derivation/derivativeNumber/derivativeNumberAndImageReading.d.ts +9 -0
  6. package/lib/exercises/math/derivation/derivativeNumber/derivativeNumberAndImageReading.d.ts.map +1 -0
  7. package/lib/exercises/math/derivation/derivativeNumber/derivativeNumberAndImageReading.js +155 -0
  8. package/lib/exercises/math/derivation/derivativeNumber/index.d.ts +1 -0
  9. package/lib/exercises/math/derivation/derivativeNumber/index.d.ts.map +1 -1
  10. package/lib/exercises/math/derivation/derivativeNumber/index.js +1 -0
  11. package/lib/exercises/math/derivation/problems/problemMaximizeBoxVolumeFindX.d.ts.map +1 -1
  12. package/lib/exercises/math/derivation/problems/problemMaximizeBoxVolumeFindX.js +80 -29
  13. package/lib/exercises/math/derivation/problems/problemMaximizeProfitFindProduction.d.ts.map +1 -1
  14. package/lib/exercises/math/derivation/problems/problemMaximizeProfitFindProduction.js +30 -2
  15. package/lib/exercises/math/derivation/problems/problemMovementOnLineFindSpeedAtPoint.d.ts.map +1 -1
  16. package/lib/exercises/math/derivation/problems/problemMovementOnLineFindSpeedAtPoint.js +59 -16
  17. package/lib/exercises/math/derivation/tangent/derivativeReadingByManipulatingSecant.d.ts.map +1 -1
  18. package/lib/exercises/math/derivation/tangent/derivativeReadingByManipulatingSecant.js +0 -4
  19. package/lib/exercises/math/derivation/tangent/tangentEquationFromFunctionExpression.d.ts.map +1 -1
  20. package/lib/exercises/math/derivation/tangent/tangentEquationFromFunctionExpression.js +23 -9
  21. package/lib/exercises/math/derivation/variations/findAbscissaOfExtremaFromFunctionExpression.d.ts.map +1 -1
  22. package/lib/exercises/math/derivation/variations/findAbscissaOfExtremaFromFunctionExpression.js +5 -29
  23. package/lib/exercises/math/derivation/variations/findExtremaFromFunctionExpression.d.ts.map +1 -1
  24. package/lib/exercises/math/derivation/variations/findExtremaFromFunctionExpression.js +2 -7
  25. package/lib/exercises/math/functions/basics/inverseImageFunction.js +1 -1
  26. package/lib/exercises/math/functions/sign/affineSignTable.d.ts.map +1 -1
  27. package/lib/exercises/math/functions/sign/affineSignTable.js +1 -1
  28. package/lib/exercises/math/functions/sign/equationFromSignTable.d.ts +1 -0
  29. package/lib/exercises/math/functions/sign/equationFromSignTable.d.ts.map +1 -1
  30. package/lib/exercises/math/functions/sign/equationFromSignTable.js +60 -33
  31. package/lib/exercises/math/functions/sign/partialSignTableFromGraph.d.ts +6 -4
  32. package/lib/exercises/math/functions/sign/partialSignTableFromGraph.d.ts.map +1 -1
  33. package/lib/exercises/math/functions/sign/partialSignTableFromGraph.js +160 -63
  34. package/lib/exercises/math/functions/sign/readSignTable.d.ts +4 -1
  35. package/lib/exercises/math/functions/sign/readSignTable.d.ts.map +1 -1
  36. package/lib/exercises/math/functions/sign/readSignTable.js +32 -9
  37. package/lib/exercises/math/functions/sign/signTableFromGraph.d.ts +6 -4
  38. package/lib/exercises/math/functions/sign/signTableFromGraph.d.ts.map +1 -1
  39. package/lib/exercises/math/functions/sign/signTableFromGraph.js +160 -57
  40. package/lib/exercises/math/percent/evolutions/averageEvolutionRateFromStartAndEndValue.d.ts +9 -0
  41. package/lib/exercises/math/percent/evolutions/averageEvolutionRateFromStartAndEndValue.d.ts.map +1 -0
  42. package/lib/exercises/math/percent/evolutions/averageEvolutionRateFromStartAndEndValue.js +135 -0
  43. package/lib/exercises/math/percent/evolutions/index.d.ts +1 -0
  44. package/lib/exercises/math/percent/evolutions/index.d.ts.map +1 -1
  45. package/lib/exercises/math/percent/evolutions/index.js +1 -0
  46. package/lib/exercises/math/powers/equationOnePlusTPowerN.d.ts +9 -0
  47. package/lib/exercises/math/powers/equationOnePlusTPowerN.d.ts.map +1 -0
  48. package/lib/exercises/math/powers/equationOnePlusTPowerN.js +118 -0
  49. package/lib/exercises/math/powers/estimateNthRoot.d.ts +13 -0
  50. package/lib/exercises/math/powers/estimateNthRoot.d.ts.map +1 -0
  51. package/lib/exercises/math/powers/estimateNthRoot.js +126 -0
  52. package/lib/exercises/math/powers/index.d.ts +3 -0
  53. package/lib/exercises/math/powers/index.d.ts.map +1 -1
  54. package/lib/exercises/math/powers/index.js +3 -0
  55. package/lib/exercises/math/powers/solveNthRootEquation.d.ts +9 -0
  56. package/lib/exercises/math/powers/solveNthRootEquation.d.ts.map +1 -0
  57. package/lib/exercises/math/powers/solveNthRootEquation.js +111 -0
  58. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRecurrenceFormulaFromSituation.d.ts.map +1 -1
  59. package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRecurrenceFormulaFromSituation.js +2 -2
  60. package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoConsecutiveTerms.js +1 -1
  61. package/lib/exercises/math/sequences/geometric/geometricFindRandomTermFromTwoConsecutiveTerms.js +1 -1
  62. package/lib/exercises/vea/percentVEA.d.ts +6 -1
  63. package/lib/exercises/vea/percentVEA.d.ts.map +1 -1
  64. package/lib/exercises/vea/percentVEA.js +15 -1
  65. package/lib/index.d.ts +34 -9
  66. package/lib/index.d.ts.map +1 -1
  67. package/lib/math/utils/sequences/situations/seqArithmeticSituations.d.ts.map +1 -1
  68. package/lib/math/utils/sequences/situations/seqArithmeticSituations.js +5 -8
  69. package/lib/math/utils/sequences/situations/seqArithmeticUtils.d.ts +1 -1
  70. package/lib/math/utils/sequences/situations/seqArithmeticUtils.d.ts.map +1 -1
  71. package/lib/math/utils/sequences/situations/seqArithmeticUtils.js +1 -3
  72. package/lib/math/utils/sequences/situations/seqGeometricSituations.d.ts.map +1 -1
  73. package/lib/math/utils/sequences/situations/seqGeometricSituations.js +8 -10
  74. package/lib/tests/questionTest.d.ts.map +1 -1
  75. package/lib/tests/questionTest.js +8 -0
  76. package/lib/tree/nodes/sets/closure.d.ts +1 -0
  77. package/lib/tree/nodes/sets/closure.d.ts.map +1 -1
  78. package/lib/tree/nodes/sets/closure.js +12 -0
  79. package/package.json +1 -1
@@ -37,10 +37,6 @@ const getAnswer = (identifiers) => {
37
37
  };
38
38
  const getHint = () => {
39
39
  return `Le nombre dérivé de $f$ en $x$, aussi noté $f'(x)$, est le coefficient directeur la tangente à la courbe représentative de $f$ au point d'abscisse $x$.
40
-
41
- Résoudre l'équation $f'(x) = k$,
42
- c'est trouver toutes les abscisses $x$
43
- pour lesquelles le coefficient directeur la tangente à la courbe représentative de $f$ vaut $k$.
44
40
 
45
41
  La tangente au point $C$ est la droite que l'on obtient quand $A$ et $B$ sont infiniment proches de $C$, en restant tous deux distincts.
46
42
  `;
@@ -1 +1 @@
1
- {"version":3,"file":"tangentEquationFromFunctionExpression.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/tangent/tangentEquationFromFunctionExpression.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAUrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAgF7C,KAAK,WAAW,GAAG;IACjB,aAAa,EAAE,eAAe,CAAC;IAC/B,QAAQ,EAAE,eAAe,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAsWF,KAAK,OAAO,GAAG;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAgDF,eAAO,MAAM,qCAAqC,EAAE,QAAQ,CAC1D,WAAW,EACX,OAAO,CAqBR,CAAC"}
1
+ {"version":3,"file":"tangentEquationFromFunctionExpression.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/tangent/tangentEquationFromFunctionExpression.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAUrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAgF7C,KAAK,WAAW,GAAG;IACjB,aAAa,EAAE,eAAe,CAAC;IAC/B,QAAQ,EAAE,eAAe,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAqXF,KAAK,OAAO,GAAG;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAgDF,eAAO,MAAM,qCAAqC,EAAE,QAAQ,CAC1D,WAAW,EACX,OAAO,CAqBR,CAAC"}
@@ -200,10 +200,15 @@ const getPropositions = (n, { answer, ...identifiers }) => {
200
200
  {
201
201
  const nodeX = "x".toTree();
202
202
  const nodeTWrong = add(multiply(nodeValueDerivative, nodeX), nodeValueImage);
203
- const texWrong = `y = ${nodeTWrong
204
- .simplify({ towardsDistribute: true, forbidFactorize: true })
205
- .toTex()}`;
206
- tryToAddWrongProp(propositionsMandatory, texWrong);
203
+ try {
204
+ const texWrong = `y = ${nodeTWrong
205
+ .simplify({ towardsDistribute: true, forbidFactorize: true })
206
+ .toTex()}`;
207
+ tryToAddWrongProp(propositionsMandatory, texWrong);
208
+ }
209
+ catch (_) {
210
+ (() => { })();
211
+ }
207
212
  }
208
213
  //filler
209
214
  const propositionsFiller = [];
@@ -222,10 +227,15 @@ const getPropositions = (n, { answer, ...identifiers }) => {
222
227
  ].forEach(([nodeXAskedWrong, nodeValueImageWrong, nodeValueDerivativeWrong]) => {
223
228
  const nodeX = "x".toTree();
224
229
  const nodeTWrong = add(multiply(nodeValueDerivativeWrong, substract(nodeX, nodeXAskedWrong)), nodeValueImageWrong);
225
- const texWrong = `y = ${nodeTWrong
226
- .simplify({ towardsDistribute: true, forbidFactorize: true })
227
- .toTex()}`;
228
- tryToAddWrongProp(propositionsFiller, texWrong);
230
+ try {
231
+ const texWrong = `y = ${nodeTWrong
232
+ .simplify({ towardsDistribute: true, forbidFactorize: true })
233
+ .toTex()}`;
234
+ tryToAddWrongProp(propositionsFiller, texWrong);
235
+ }
236
+ catch (_) {
237
+ (() => { })();
238
+ }
229
239
  });
230
240
  }
231
241
  propWhile(propositionsFiller, n, () => {
@@ -288,7 +298,11 @@ const isIdentifiersQCPassed = (identifiers) => {
288
298
  }
289
299
  return isExploding;
290
300
  };
291
- return !isExploding(identifiers);
301
+ const isVEAOk = (identifiers) => {
302
+ const answer = getAnswer(identifiers);
303
+ return isAnswerValid(answer, { answer, ...identifiers });
304
+ };
305
+ return !isExploding(identifiers) && isVEAOk(identifiers);
292
306
  };
293
307
  const getTangentEquationFromFunctionExpressionQuestion = (optsIn) => {
294
308
  const arrayedOptions = optsIn ?? arrayedOptsDefault;
@@ -1 +1 @@
1
- {"version":3,"file":"findAbscissaOfExtremaFromFunctionExpression.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/variations/findAbscissaOfExtremaFromFunctionExpression.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AA4R7C,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,eAAe,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAiNF,KAAK,OAAO,GAAG;IACb,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAyCF,eAAO,MAAM,2CAA2C,EAAE,QAAQ,CAChE,WAAW,EACX,OAAO,CAqBR,CAAC"}
1
+ {"version":3,"file":"findAbscissaOfExtremaFromFunctionExpression.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/variations/findAbscissaOfExtremaFromFunctionExpression.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AA4R7C,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,eAAe,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AA2LF,KAAK,OAAO,GAAG;IACb,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAoCF,eAAO,MAAM,2CAA2C,EAAE,QAAQ,CAChE,WAAW,EACX,OAAO,CAqBR,CAAC"}
@@ -282,29 +282,10 @@ const getAnswerNode = (identifiers) => {
282
282
  const getAnswer = (identifiers) => {
283
283
  return getAnswerNode(identifiers).toTex();
284
284
  };
285
- const getHint = (identifiers) => {
286
- const { typeF } = identifiers;
287
- const strHintDerivative = (() => {
288
- switch (typeF) {
289
- case "polynôme (degré $2$)":
290
- return `Soient $a$, $b$ et $c$ trois réels. La dérivée de $x \\mapsto ax^2+bx+c$ est $x \\mapsto 2ax+b$.`;
291
- case "polynôme (degré $3$)":
292
- return `Soient $a$, $b$, $c$ et $d$ quatre réels. La dérivée de $x \\mapsto ax^3+bx^2+cx+d$ est $x \\mapsto 3ax^2+2bx+c$.`;
293
- case "$\\frac{ax^2+bx+c}{dx+m}$":
294
- return `Soient $a$, $b$, $c$, $d$ et $m$ cinq réels. La dérivée de $x \\mapsto \\frac{ax^2+bx+c}{dx+m}$ est $x \\mapsto \\frac{(2ax+b)(dx+m)-(ax^2+bx+c)d}{(dx+m)^2}$.`;
295
- case "$\\frac{dx+m}{ax^2+bx+c}$":
296
- return `Soient $a$, $b$, $c$, $d$ et $m$ cinq réels. La dérivée de $x \\mapsto \\frac{dx+m}{ax^2+bx+c}$ est $x \\mapsto \\frac{d(ax^2+bx+c)-(dx+m)(2ax+b)}{(ax^2+bx+c)^2}$.`;
297
- default:
298
- throw new Error("Unsupported typeF: " + typeF);
299
- }
300
- })();
301
- return `Si $f$ est une fonction dérivable en $a$, alors l'équation de la tangente à la courbe de $f$ au point d'abscisse $a$ est donné par:
302
-
303
- $$
304
- y = f'(a)(x-a)+f(a)
305
- $$
285
+ const getHint = () => {
286
+ return `Les abscisses des extremums locaux d'une fonction dérivable sont les valeurs $x$ telles que $f'(x)=0$ et $f'$ change de signe en $x$.
306
287
 
307
- ${strHintDerivative}
288
+ Calcule donc la fonction dérivée $f'$ de $f$. Puis, résous l'équation $f'(x) = 0$.
308
289
  `;
309
290
  };
310
291
  const getCorrection = (identifiers) => {
@@ -390,13 +371,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
390
371
  };
391
372
  };
392
373
  const arrayedOptsDefault = {
393
- typeF: [
394
- "polynôme (degré $2$)",
395
- "polynôme (degré $3$)",
396
- "$\\frac{ax^2+bx+c}{dx+m}$",
397
- "$\\frac{dx+m}{ax^2+bx+c}$",
398
- ],
399
- typeRoots: ["entières", "rationnelles"],
374
+ typeF: ["polynôme (degré $2$)", "polynôme (degré $3$)"],
375
+ typeRoots: ["entières"],
400
376
  };
401
377
  const options = [
402
378
  {
@@ -1 +1 @@
1
- {"version":3,"file":"findExtremaFromFunctionExpression.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/variations/findExtremaFromFunctionExpression.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AA+R7C,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,eAAe,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAwUF,KAAK,OAAO,GAAG;IACb,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAyCF,eAAO,MAAM,iCAAiC,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAqB1E,CAAC"}
1
+ {"version":3,"file":"findExtremaFromFunctionExpression.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/variations/findExtremaFromFunctionExpression.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAiBT,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AA+R7C,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,eAAe,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAwUF,KAAK,OAAO,GAAG;IACb,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAoCF,eAAO,MAAM,iCAAiC,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAqB1E,CAAC"}
@@ -498,13 +498,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
498
498
  };
499
499
  };
500
500
  const arrayedOptsDefault = {
501
- typeF: [
502
- "polynôme (degré $2$)",
503
- "polynôme (degré $3$)",
504
- "$\\frac{ax^2+bx+c}{dx+m}$",
505
- "$\\frac{dx+m}{ax^2+bx+c}$",
506
- ],
507
- typeRoots: ["entières", "rationnelles"],
501
+ typeF: ["polynôme (degré $2$)", "polynôme (degré $3$)"],
502
+ typeRoots: ["entières"],
508
503
  };
509
504
  const options = [
510
505
  {
@@ -105,7 +105,7 @@ export const inverseImageFunction = {
105
105
  id: "inverseImageFunction",
106
106
  connector: "\\iff",
107
107
  getPropositions,
108
- label: "Calculer des antécédents",
108
+ label: "Calculer des antécédents (fonctions affines)",
109
109
  isSingleStep: true,
110
110
  generator: (nb) => getDistinctQuestions(getInverseImageFunction, nb),
111
111
  qcmTimer: 60,
@@ -1 +1 @@
1
- {"version":3,"file":"affineSignTable.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/sign/affineSignTable.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAQrC,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,SAAS,EAAE,MAAM,EAAE,EAAE,CAAC;CACvB,CAAC;AAqGF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAkBjD,CAAC"}
1
+ {"version":3,"file":"affineSignTable.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/sign/affineSignTable.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAQrC,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,SAAS,EAAE,MAAM,EAAE,EAAE,CAAC;CACvB,CAAC;AAqGF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAmBjD,CAAC"}
@@ -90,7 +90,7 @@ const getQuestionFromIdentifiers = (identifiers) => {
90
90
  };
91
91
  export const affineSignTable = {
92
92
  id: "affineSignTable",
93
- label: "Dresser le tableau de signes d'une fonction affine",
93
+ label: "Dresser le tableau de signes d'une fonction affine à partir de son expression algébrique",
94
94
  isSingleStep: true,
95
95
  generator: (nb, opts) => getDistinctQuestions(() => getTestSignTableQuestion(opts), nb),
96
96
  qcmTimer: 60,
@@ -8,6 +8,7 @@ type Identifiers = {
8
8
  };
9
9
  type Options = {
10
10
  questionType: string;
11
+ functionType: string;
11
12
  };
12
13
  export declare const equationFromSignTable: Exercise<Identifiers, Options>;
13
14
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"equationFromSignTable.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/sign/equationFromSignTable.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAUrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAc7C,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,EAAE,EAAE,eAAe,EAAE,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAuQF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAsBhE,CAAC"}
1
+ {"version":3,"file":"equationFromSignTable.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/sign/equationFromSignTable.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAUrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAc7C,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,EAAE,EAAE,eAAe,EAAE,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAwRF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAsBhE,CAAC"}
@@ -6,7 +6,7 @@ import { EquationSolutionNode } from "../../../../tree/nodes/equations/equationS
6
6
  import { InequationSolutionNode } from "../../../../tree/nodes/inequations/inequationSolutionNode.js";
7
7
  import { reifyAlgebraic, } from "../../../../tree/nodes/nodeConstructor.js";
8
8
  import { MinusInfinityNode, PlusInfinityNode, } from "../../../../tree/nodes/numbers/infiniteNode.js";
9
- import { ClosureType } from "../../../../tree/nodes/sets/closure.js";
9
+ import { Closure } from "../../../../tree/nodes/sets/closure.js";
10
10
  import { DiscreteSetNode } from "../../../../tree/nodes/sets/discreteSetNode.js";
11
11
  import { IntervalNode } from "../../../../tree/nodes/sets/intervalNode.js";
12
12
  import { UnionIntervalNode } from "../../../../tree/nodes/sets/unionIntervalNode.js";
@@ -38,38 +38,32 @@ const getIntervalsSolution = (identifiers) => {
38
38
  const xNodes = xs.map((e) => reifyAlgebraic(e));
39
39
  const isSup = inequation.isSup;
40
40
  const isStrict = inequation.isStrict;
41
- if (isSup) {
42
- if (signs[0] === "+") {
43
- return [
44
- new IntervalNode(xNodes[0], xNodes[1], isStrict ? ClosureType.OO : ClosureType.OF),
45
- new IntervalNode(xNodes[2], xNodes[3], isStrict ? ClosureType.OO : ClosureType.FO),
46
- ];
47
- }
48
- else {
49
- return [
50
- new IntervalNode(xNodes[1], xNodes[2], isStrict ? ClosureType.OO : ClosureType.FF),
51
- ];
52
- }
41
+ const rawSigns = signs.filter((s) => s !== "0");
42
+ const rightSignIndexes = [];
43
+ for (let i = 0; i < rawSigns.length; i++) {
44
+ if (isSup === (rawSigns[i] === "+"))
45
+ rightSignIndexes.push(i);
53
46
  }
54
- else {
55
- if (signs[0] === "-") {
56
- return [
57
- new IntervalNode(xNodes[0], xNodes[1], isStrict ? ClosureType.OO : ClosureType.OF),
58
- new IntervalNode(xNodes[2], xNodes[3], isStrict ? ClosureType.OO : ClosureType.FO),
59
- ];
60
- }
61
- else {
62
- return [
63
- new IntervalNode(xNodes[1], xNodes[2], isStrict ? ClosureType.OO : ClosureType.FF),
64
- ];
65
- }
47
+ const intervals = [];
48
+ for (let i = 0; i < rightSignIndexes.length; i++) {
49
+ const index = rightSignIndexes[i];
50
+ const start = xNodes[index];
51
+ const end = xNodes[index + 1];
52
+ const leftOpen = index === 0 || isStrict;
53
+ const rightOpen = index === rawSigns.length - 1 || isStrict;
54
+ intervals.push(new IntervalNode(start, end, Closure.fromBooleans(!leftOpen, !rightOpen)));
66
55
  }
56
+ return intervals;
67
57
  };
68
58
  const getAnswerNode = (identifiers) => {
69
59
  const { xs, type } = identifiers;
70
60
  const xNodes = xs.map((e) => reifyAlgebraic(e));
71
61
  if (type === 0) {
72
- return new EquationSolutionNode(new DiscreteSetNode([xNodes[1], xNodes[2]]));
62
+ if (xs.length === 3)
63
+ return new EquationSolutionNode(new DiscreteSetNode([xNodes[1]]));
64
+ if (xs.length === 4)
65
+ return new EquationSolutionNode(new DiscreteSetNode([xNodes[1], xNodes[2]]));
66
+ return new EquationSolutionNode(new DiscreteSetNode([xNodes[1], xNodes[2], xNodes[3]]));
73
67
  }
74
68
  else {
75
69
  const intervals = getIntervalsSolution(identifiers);
@@ -126,7 +120,12 @@ const getCorrection = (identifiers) => {
126
120
  const { xs, type, ineqSymbol } = identifiers;
127
121
  const xNodes = xs.map((e) => reifyAlgebraic(e));
128
122
  if (type === 0) {
129
- return `D'après le tableau de signes de $f$, les antécédents de $0$ par $f$ sont $${xNodes[1].toTex()}$ et $${xNodes[2].toTex()}$.
123
+ const corr = xNodes.length === 5
124
+ ? `D'après le tableau de signes de $f$, les antécédents de $0$ par $f$ sont $${xNodes[1].toTex()}$, $${xNodes[2].toTex()}$ et $${xNodes[3].toTex()}$.`
125
+ : xNodes.length === 4
126
+ ? `D'après le tableau de signes de $f$, les antécédents de $0$ par $f$ sont $${xNodes[1].toTex()}$ et $${xNodes[2].toTex()}$.`
127
+ : `D'après le tableau de signes de $f$, l'antécédent de $0$ par $f$ est $${xNodes[1].toTex()}$.`;
128
+ return `${corr}
130
129
 
131
130
  L'ensemble des solutions de $f(x)=0$ est donc :
132
131
 
@@ -152,12 +151,28 @@ ${getAnswer(identifiers)}
152
151
  $$`;
153
152
  };
154
153
  const getReadSignTableQuestion = (opts) => {
155
- const a = randint(-10, 0);
156
- const b = randint(0, 10);
157
- const xs = [MinusInfinityNode, a.toTree(), b.toTree(), PlusInfinityNode];
154
+ const x1 = randint(-9, 10);
155
+ const x2 = randint(-9, 10, [x1]);
156
+ const x3 = randint(-9, 10, [x1, x2]);
157
+ const sorted = [x1, x2, x3].sort((a, b) => a - b);
158
+ const functionType = opts?.functionType === "Affine"
159
+ ? 0
160
+ : opts?.functionType === "Degré $3$"
161
+ ? 2
162
+ : 1;
163
+ const roots = functionType === 0
164
+ ? [x1]
165
+ : functionType === 1
166
+ ? [sorted[0], sorted[1]]
167
+ : sorted;
168
+ const xs = [
169
+ MinusInfinityNode,
170
+ ...roots.map((e) => e.toTree()),
171
+ PlusInfinityNode,
172
+ ];
158
173
  const signs = coinFlip()
159
- ? ["+", "0", "-", "0", "+"]
160
- : ["-", "0", "+", "0", "-"];
174
+ ? ["+", "0", "-", "0", "+", "0", "-"]
175
+ : ["-", "0", "+", "0", "-", "0", "+"];
161
176
  const type = !opts?.questionType || opts.questionType === "Les deux"
162
177
  ? randint(0, 2)
163
178
  : opts.questionType === "Inéquations"
@@ -168,7 +183,11 @@ const getReadSignTableQuestion = (opts) => {
168
183
  type,
169
184
  ineqSymbol,
170
185
  xs: xs.map((e) => e.toIdentifiers()),
171
- signs,
186
+ signs: functionType === 0
187
+ ? signs.slice(0, 3)
188
+ : functionType === 1
189
+ ? signs.slice(0, 5)
190
+ : signs,
172
191
  };
173
192
  return getQuestionFromIdentifiers(identifiers, opts);
174
193
  };
@@ -206,6 +225,14 @@ const options = [
206
225
  defaultValue: "Les deux",
207
226
  values: ["Équation $f(x) = 0$", "Inéquations", "Les deux"],
208
227
  },
228
+ {
229
+ id: "functionType",
230
+ label: "Type de fonction",
231
+ target: GeneratorOptionTarget.generation,
232
+ type: GeneratorOptionType.select,
233
+ values: ["Affine", "Degré $2$", "Degré $3$"],
234
+ defaultValue: "Degré $2$",
235
+ },
209
236
  ];
210
237
  const getQuestionFromIdentifiers = (identifiers, opts) => {
211
238
  return {
@@ -1,12 +1,14 @@
1
1
  import { Exercise } from "../../../../exercises/exercise.js";
2
2
  type Identifiers = {
3
- initTable: string[][];
4
3
  a: number;
5
4
  x1: number;
6
- x2: number;
7
- x3: number;
5
+ x2?: number;
6
+ x3?: number;
8
7
  lineAsked: number;
9
8
  };
10
- export declare const partialSignTableFromGraph: Exercise<Identifiers>;
9
+ type Options = {
10
+ functionType: string;
11
+ };
12
+ export declare const partialSignTableFromGraph: Exercise<Identifiers, Options>;
11
13
  export {};
12
14
  //# sourceMappingURL=partialSignTableFromGraph.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"partialSignTableFromGraph.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/sign/partialSignTableFromGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AAOrC,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,MAAM,EAAE,EAAE,CAAC;IACtB,CAAC,EAAE,MAAM,CAAC;IACV,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAmJF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAoB3D,CAAC"}
1
+ {"version":3,"file":"partialSignTableFromGraph.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/sign/partialSignTableFromGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAQrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAoPF,KAAK,OAAO,GAAG;IACb,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAWF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAqBpE,CAAC"}