math-exercises 3.0.74 → 3.0.76

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 (84) hide show
  1. package/lib/exercises/math/calcul/arithmetics/calculateDistanceBetweenNumbers.d.ts +8 -0
  2. package/lib/exercises/math/calcul/arithmetics/calculateDistanceBetweenNumbers.d.ts.map +1 -0
  3. package/lib/exercises/math/calcul/arithmetics/calculateDistanceBetweenNumbers.js +102 -0
  4. package/lib/exercises/math/calcul/arithmetics/index.d.ts +1 -0
  5. package/lib/exercises/math/calcul/arithmetics/index.d.ts.map +1 -1
  6. package/lib/exercises/math/calcul/arithmetics/index.js +1 -0
  7. package/lib/exercises/math/calcul/arithmetics/isInequalityTrue.js +2 -2
  8. package/lib/exercises/math/calcul/operations/operationsPrioritiesParenthesis.js +1 -1
  9. package/lib/exercises/math/calcul/sign/index.d.ts +1 -0
  10. package/lib/exercises/math/calcul/sign/index.d.ts.map +1 -1
  11. package/lib/exercises/math/calcul/sign/index.js +1 -0
  12. package/lib/exercises/math/calcul/sign/inverseOrOpposite.d.ts +8 -0
  13. package/lib/exercises/math/calcul/sign/inverseOrOpposite.d.ts.map +1 -0
  14. package/lib/exercises/math/calcul/sign/inverseOrOpposite.js +89 -0
  15. package/lib/exercises/math/calculLitteral/inequations/squareFunctionInequation.d.ts.map +1 -1
  16. package/lib/exercises/math/calculLitteral/inequations/squareFunctionInequation.js +15 -0
  17. package/lib/exercises/math/functions/affines/leadingCoefficientCalculV1.d.ts.map +1 -1
  18. package/lib/exercises/math/functions/affines/leadingCoefficientCalculV1.js +52 -0
  19. package/lib/exercises/math/functions/basics/inverseImageFunctionGeogebra.d.ts.map +1 -1
  20. package/lib/exercises/math/functions/basics/inverseImageFunctionGeogebra.js +24 -0
  21. package/lib/exercises/math/functions/parity/parityFromAlgebra.d.ts.map +1 -1
  22. package/lib/exercises/math/functions/parity/parityFromAlgebra.js +57 -2
  23. package/lib/exercises/math/functions/parity/parityFromGraph.d.ts.map +1 -1
  24. package/lib/exercises/math/functions/parity/parityFromGraph.js +16 -0
  25. package/lib/exercises/math/geometry/euclidian/pythagoreOrThales.js +34 -31
  26. package/lib/exercises/math/geometry/thales/thalesCalcul.d.ts.map +1 -1
  27. package/lib/exercises/math/geometry/thales/thalesCalcul.js +79 -8
  28. package/lib/exercises/math/geometry/vectors/paralellismViaColinearity.d.ts.map +1 -1
  29. package/lib/exercises/math/geometry/vectors/paralellismViaColinearity.js +39 -1
  30. package/lib/exercises/math/geometry/vectors/parallelogramViaEqualVectors.d.ts.map +1 -1
  31. package/lib/exercises/math/geometry/vectors/parallelogramViaEqualVectors.js +32 -1
  32. package/lib/exercises/math/geometry/vectors/vectorLinearCombination.d.ts.map +1 -1
  33. package/lib/exercises/math/geometry/vectors/vectorLinearCombination.js +40 -2
  34. package/lib/exercises/math/probaStat/probaFromTableNoContext.d.ts.map +1 -1
  35. package/lib/exercises/math/probaStat/probaFromTableNoContext.js +1 -1
  36. package/lib/exercises/math/probaStat/probaFromTableWithContext.js +87 -127
  37. package/lib/exercises/math/probaStat/stats1var/choseReasoningForIndicator.d.ts.map +1 -1
  38. package/lib/exercises/math/probaStat/stats1var/choseReasoningForIndicator.js +17 -10
  39. package/lib/exercises/math/probaStat/stats1var/median.d.ts.map +1 -1
  40. package/lib/exercises/math/probaStat/stats1var/median.js +35 -0
  41. package/lib/exercises/math/probaStat/stats1var/medianList.d.ts.map +1 -1
  42. package/lib/exercises/math/probaStat/stats1var/medianList.js +18 -0
  43. package/lib/exercises/math/probaStat/stats1var/quartiles.d.ts.map +1 -1
  44. package/lib/exercises/math/probaStat/stats1var/quartiles.js +37 -0
  45. package/lib/exercises/math/probaStat/stats1var/quartilesList.d.ts.map +1 -1
  46. package/lib/exercises/math/probaStat/stats1var/quartilesList.js +23 -0
  47. package/lib/exercises/math/python/conditionIf.d.ts.map +1 -1
  48. package/lib/exercises/math/python/conditionIf.js +32 -1
  49. package/lib/exercises/math/python/conditionIfElse.d.ts +10 -0
  50. package/lib/exercises/math/python/conditionIfElse.d.ts.map +1 -0
  51. package/lib/exercises/math/python/conditionIfElse.js +119 -0
  52. package/lib/exercises/math/python/forLoop.d.ts.map +1 -1
  53. package/lib/exercises/math/python/forLoop.js +28 -0
  54. package/lib/exercises/math/python/inOutCalcul.d.ts.map +1 -1
  55. package/lib/exercises/math/python/inOutCalcul.js +31 -4
  56. package/lib/exercises/math/python/index.d.ts +2 -0
  57. package/lib/exercises/math/python/index.d.ts.map +1 -1
  58. package/lib/exercises/math/python/index.js +2 -0
  59. package/lib/exercises/math/python/pyForLoop1Exercise.d.ts.map +1 -1
  60. package/lib/exercises/math/python/pyForLoop1Exercise.js +29 -0
  61. package/lib/exercises/math/python/pyWhileLoop1Exercise.d.ts.map +1 -1
  62. package/lib/exercises/math/python/pyWhileLoop1Exercise.js +1 -0
  63. package/lib/exercises/math/python/pythonFunctionTrinom.js +1 -1
  64. package/lib/exercises/math/python/variableAffectation.d.ts +10 -0
  65. package/lib/exercises/math/python/variableAffectation.d.ts.map +1 -0
  66. package/lib/exercises/math/python/variableAffectation.js +144 -0
  67. package/lib/exercises/math/python/whileLoop.d.ts +0 -1
  68. package/lib/exercises/math/python/whileLoop.d.ts.map +1 -1
  69. package/lib/exercises/math/python/whileLoop.js +37 -6
  70. package/lib/exercises/math/python/whileLoopCount.js +2 -2
  71. package/lib/index.d.ts +15 -1
  72. package/lib/index.d.ts.map +1 -1
  73. package/lib/latexTester.js +1 -0
  74. package/lib/math/polynomials/affine.d.ts +2 -1
  75. package/lib/math/polynomials/affine.d.ts.map +1 -1
  76. package/lib/math/polynomials/affine.js +5 -2
  77. package/lib/tree/nodes/functions/oppositeNode.d.ts +2 -2
  78. package/lib/tree/nodes/functions/oppositeNode.d.ts.map +1 -1
  79. package/lib/tree/nodes/functions/oppositeNode.js +4 -2
  80. package/lib/tree/nodes/node.d.ts +2 -0
  81. package/lib/tree/nodes/node.d.ts.map +1 -1
  82. package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
  83. package/lib/tree/nodes/operators/fractionNode.js +8 -7
  84. package/package.json +1 -1
@@ -0,0 +1,8 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ a: number;
4
+ b: number;
5
+ };
6
+ export declare const calculateDistanceBetweenNumbers: Exercise<Identifiers>;
7
+ export {};
8
+ //# sourceMappingURL=calculateDistanceBetweenNumbers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calculateDistanceBetweenNumbers.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/arithmetics/calculateDistanceBetweenNumbers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAarC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAyFF,eAAO,MAAM,+BAA+B,EAAE,QAAQ,CAAC,WAAW,CAoBjE,CAAC"}
@@ -0,0 +1,102 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { randfloat } from "../../../../math/utils/random/randfloat.js";
4
+ import { randint } from "../../../../math/utils/random/randint.js";
5
+ import { abs } from "../../../../tree/nodes/functions/absNode.js";
6
+ import { add } from "../../../../tree/nodes/operators/addNode.js";
7
+ import { substract } from "../../../../tree/nodes/operators/substractNode.js";
8
+ import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
9
+ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
10
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
11
+ import { alignTex } from "../../../../utils/latex/alignTex.js";
12
+ const getPropositions = (n, { answer, a, b }) => {
13
+ const propositions = [];
14
+ addValidProp(propositions, answer);
15
+ // Au cas où l'élève répond à la question en inversant les deux nombres
16
+ tryToAddWrongProp(propositions, add(b, -a).simplify().evaluate().frenchify());
17
+ // Au cas où l'élève répond à la question en ajoutant les deux nombres
18
+ tryToAddWrongProp(propositions, add(a, b).simplify().evaluate().frenchify());
19
+ while (propositions.length < n) {
20
+ const randomAnswer = coinFlip() ? randint(-10, 10) : randfloat(-10, 10, 2);
21
+ tryToAddWrongProp(propositions, randomAnswer.frenchify());
22
+ }
23
+ return shuffleProps(propositions, n);
24
+ };
25
+ const getAnswer = (identifiers) => {
26
+ const { a, b } = identifiers;
27
+ const sub = add(a, -b);
28
+ const absNode = abs(sub).simplify().evaluate();
29
+ return absNode.frenchify();
30
+ };
31
+ const getInstruction = (identifiers) => {
32
+ const { a, b } = identifiers;
33
+ return `Calculer la distance entre $${a.frenchify()}$ et $${b.frenchify()}$.`;
34
+ };
35
+ const getHint = (identifiers) => {
36
+ return `La distance entre deux nombres $a$ et $b$ est
37
+ :
38
+
39
+ $$
40
+ |a - b|
41
+ $$
42
+ `;
43
+ };
44
+ const getCorrection = (identifiers) => {
45
+ const { a, b } = identifiers;
46
+ const sub = substract(a, b);
47
+ const absNode = abs(sub);
48
+ const answer = getAnswer(identifiers);
49
+ return `La distance entre $${a.frenchify()}$ et $${b.frenchify()}$ est :
50
+
51
+ ${alignTex([
52
+ [absNode.toTex(), "=", abs(sub.simplify()).toTex()],
53
+ ["", "=", answer],
54
+ ])}`;
55
+ };
56
+ const getKeys = (identifiers) => {
57
+ return [];
58
+ };
59
+ const isAnswerValid = (ans, { answer }) => {
60
+ try {
61
+ const ansNode = parseAlgebraic(ans);
62
+ const answerNode = parseAlgebraic(answer);
63
+ return ansNode.equals(answerNode);
64
+ }
65
+ catch (err) {
66
+ return handleVEAError(err);
67
+ }
68
+ };
69
+ const getCalculateDistanceBetweenNumbersQuestion = (ops) => {
70
+ const a = coinFlip() ? randint(-10, 10) : randfloat(-10, 10, 2);
71
+ const b = coinFlip() ? randint(-10, 10, [a]) : randfloat(-10, 10, 2, [a]);
72
+ const identifiers = { a, b };
73
+ return getQuestionFromIdentifiers(identifiers);
74
+ };
75
+ const getQuestionFromIdentifiers = (identifiers) => {
76
+ return {
77
+ answer: getAnswer(identifiers),
78
+ instruction: getInstruction(identifiers),
79
+ keys: getKeys(identifiers),
80
+ answerFormat: "tex",
81
+ identifiers,
82
+ hint: getHint(identifiers),
83
+ correction: getCorrection(identifiers),
84
+ };
85
+ };
86
+ export const calculateDistanceBetweenNumbers = {
87
+ id: "calculateDistanceBetweenNumbers",
88
+ label: "Calculer la distance entre deux nombres",
89
+ isSingleStep: true,
90
+ generator: (nb, opts) => getDistinctQuestions(() => getCalculateDistanceBetweenNumbersQuestion(opts), nb),
91
+ qcmTimer: 60,
92
+ freeTimer: 60,
93
+ getPropositions,
94
+ isAnswerValid,
95
+ subject: "Mathématiques",
96
+ getInstruction,
97
+ getHint,
98
+ getCorrection,
99
+ getAnswer,
100
+ getQuestionFromIdentifiers,
101
+ hasHintAndCorrection: true,
102
+ };
@@ -17,4 +17,5 @@ export * from "./isPointOnReciprocalFunction.js";
17
17
  export * from "./isPointOnFunction.js";
18
18
  export * from "./whichMultipleAmI.js";
19
19
  export * from "./isMultipleOrDivisor.js";
20
+ export * from "./calculateDistanceBetweenNumbers.js";
20
21
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/arithmetics/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kCAAkC,CAAC;AACjD,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/arithmetics/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kCAAkC,CAAC;AACjD,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sCAAsC,CAAC"}
@@ -17,3 +17,4 @@ export * from "./isPointOnReciprocalFunction.js";
17
17
  export * from "./isPointOnFunction.js";
18
18
  export * from "./whichMultipleAmI.js";
19
19
  export * from "./isMultipleOrDivisor.js";
20
+ export * from "./calculateDistanceBetweenNumbers.js";
@@ -37,10 +37,10 @@ $$
37
37
  ${leftNode.toTex()} ${inequalitySign ? "<" : ">"} ${rightNode.toTex()}
38
38
  $$
39
39
 
40
- Cette inéquation est-elle vraie pour pour $x = ${x}$ ?`;
40
+ Cette inéquation est-elle vraie pour $x = ${x}$ ?`;
41
41
  };
42
42
  const getHint = (identifiers) => {
43
- return `Remplacer $x$ par $${identifiers.x}$ dans les deux membres. Ensuite, vérifie si l'inégalité est vraie ou non.`;
43
+ return `Remplace $x$ par $${identifiers.x}$ dans les deux membres. Ensuite, vérifie si l'inégalité est vraie ou non.`;
44
44
  };
45
45
  const reverseSign = (sign) => {
46
46
  let x = "";
@@ -86,7 +86,7 @@ const getOperationsPrioritiesParenthesisQuestion = () => {
86
86
  const isAdd2 = coinFlip();
87
87
  statement = new (isAdd ? AddNode : SubstractNode)(a.toTree(), new (isAdd2 ? AddNode : SubstractNode)(b.toTree(), new (isDivide ? DivideNode : MultiplyNode)(c.toTree(), d.toTree(), {
88
88
  forceTimesSign: true,
89
- }), { forceParenthesis: isAdd }));
89
+ }), { forceParenthesis: true }));
90
90
  break;
91
91
  }
92
92
  const identifiers = { nodeIds: statement.toIdentifiers(), type };
@@ -1,3 +1,4 @@
1
1
  export * from "./signFromAx.js";
2
2
  export * from "./absoluteNumber.js";
3
+ export * from "./inverseOrOpposite.js";
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/sign/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/sign/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC"}
@@ -1,2 +1,3 @@
1
1
  export * from "./signFromAx.js";
2
2
  export * from "./absoluteNumber.js";
3
+ export * from "./inverseOrOpposite.js";
@@ -0,0 +1,8 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ type Identifiers = {
3
+ a: number;
4
+ isOpposite: boolean;
5
+ };
6
+ export declare const inverseOrOpposite: Exercise<Identifiers>;
7
+ export {};
8
+ //# sourceMappingURL=inverseOrOpposite.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inverseOrOpposite.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/sign/inverseOrOpposite.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IAEV,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AA2EF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAiBnD,CAAC"}
@@ -0,0 +1,89 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { randint } from "../../../../math/utils/random/randint.js";
4
+ import { opposite } from "../../../../tree/nodes/functions/oppositeNode.js";
5
+ import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
6
+ import { substract } from "../../../../tree/nodes/operators/substractNode.js";
7
+ import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
8
+ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
9
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
10
+ const getPropositions = (n, { answer, a }) => {
11
+ const propositions = [];
12
+ addValidProp(propositions, answer);
13
+ tryToAddWrongProp(propositions, substract(1, a).simplify().toTex());
14
+ tryToAddWrongProp(propositions, `${-a}`);
15
+ tryToAddWrongProp(propositions, frac(1, a).toTex());
16
+ tryToAddWrongProp(propositions, frac(1, -a).toTex());
17
+ return shuffleProps(propositions, n);
18
+ };
19
+ const getAnswer = (identifiers) => {
20
+ const { a, isOpposite } = identifiers;
21
+ return isOpposite ? `${-a}` : frac(1, a).simplify().toTex();
22
+ };
23
+ const getInstruction = (identifiers) => {
24
+ const { a, isOpposite } = identifiers;
25
+ return `Quel est l'${isOpposite ? "opposé" : "inverse"} de $${a}$ ?`;
26
+ };
27
+ const getHint = (identifiers) => {
28
+ return `L'opposé d'un nombre $x$ est $-x$.
29
+
30
+ L'inverse d'un nombre $x$ (différent de $0$) est $\\frac{1}{x}$.`;
31
+ };
32
+ const getCorrection = (identifiers) => {
33
+ const { a, isOpposite } = identifiers;
34
+ const node = isOpposite ? opposite(a) : frac(1, a);
35
+ const nodeTex = node.toTex({
36
+ allowDoubleMinus: true,
37
+ allowMinusAnywhereInFraction: true,
38
+ });
39
+ const simp = node.simplify();
40
+ const isSimplifiable = nodeTex !== simp.toTex();
41
+ return `L'${isOpposite ? "opposé" : "inverse"} de $${a}$ est :
42
+
43
+ $$
44
+ ${nodeTex} ${isSimplifiable ? `= ${simp.toTex()}` : ""}
45
+ $$`;
46
+ };
47
+ const isAnswerValid = (ans, { answer }) => {
48
+ try {
49
+ const parsed = parseAlgebraic(ans);
50
+ return parsed.simplify({ decimalToFractions: true }).toTex() === answer;
51
+ }
52
+ catch (err) {
53
+ return handleVEAError(err);
54
+ }
55
+ };
56
+ const getInverseOrOppositeQuestion = (ops) => {
57
+ const a = randint(-50, 50, [0]);
58
+ const isOpposite = coinFlip();
59
+ const identifiers = { a, isOpposite };
60
+ return getQuestionFromIdentifiers(identifiers);
61
+ };
62
+ const getQuestionFromIdentifiers = (identifiers) => {
63
+ return {
64
+ answer: getAnswer(identifiers),
65
+ instruction: getInstruction(identifiers),
66
+ keys: [],
67
+ answerFormat: "tex",
68
+ identifiers,
69
+ hint: getHint(identifiers),
70
+ correction: getCorrection(identifiers),
71
+ };
72
+ };
73
+ export const inverseOrOpposite = {
74
+ id: "inverseOrOpposite",
75
+ label: "Distinguer inverse et opposé",
76
+ isSingleStep: true,
77
+ generator: (nb, opts) => getDistinctQuestions(() => getInverseOrOppositeQuestion(opts), nb),
78
+ qcmTimer: 60,
79
+ freeTimer: 60,
80
+ getPropositions,
81
+ isAnswerValid,
82
+ subject: "Mathématiques",
83
+ getInstruction,
84
+ getHint,
85
+ getCorrection,
86
+ getAnswer,
87
+ getQuestionFromIdentifiers,
88
+ hasHintAndCorrection: true,
89
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"squareFunctionInequation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/inequations/squareFunctionInequation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,gBAAgB,EAGjB,MAAM,sCAAsC,CAAC;AAY9C,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,gBAAgB,EAAE,gBAAgB,CAAC;CACpC,CAAC;AA0FF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,CAa1D,CAAC"}
1
+ {"version":3,"file":"squareFunctionInequation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/inequations/squareFunctionInequation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,gBAAgB,EAGjB,MAAM,sCAAsC,CAAC;AAa9C,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,gBAAgB,EAAE,gBAAgB,CAAC;CACpC,CAAC;AA6GF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,CAa1D,CAAC"}
@@ -30,6 +30,19 @@ $$
30
30
  x^2 ${inequationSymbol} ${k}
31
31
  $$`;
32
32
  };
33
+ // const getHint: GetHint<Identifiers> = (identifiers) => {
34
+ // return ``;
35
+ // };
36
+ // const getCorrection: GetCorrection<Identifiers> = (identifiers) => {
37
+ // const { k, inequationSymbol } = identifiers;
38
+ // return `On applique la fonction racine carrée à l'inégalité :
39
+ // ${alignTex([
40
+ // ["x^2", inequationSymbol, k.frenchify()],
41
+ // ["\\sqrt{x^2}", inequationSymbol, sqrt(k).toTex()],
42
+ // ["|x|", inequationSymbol, sqrt(k).simplify().toTex()],
43
+ // ])}
44
+ // `;
45
+ // };
33
46
  const getSquareFunctionInequationQuestion = () => {
34
47
  const k = coinFlip() ? randint(1, 11) ** 2 : randint(1, 100);
35
48
  const inequationSymbol = InequationSymbolConstructor.random();
@@ -43,6 +56,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
43
56
  keys: ["S", "equal", "lbracket", "rbracket", "semicolon", "infty", "cup"],
44
57
  answerFormat: "tex",
45
58
  identifiers,
59
+ // hint: getHint(identifiers),
60
+ // correction: getCorrection(identifiers),
46
61
  };
47
62
  return question;
48
63
  };
@@ -1 +1 @@
1
- {"version":3,"file":"leadingCoefficientCalculV1.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/leadingCoefficientCalculV1.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAOrC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAiHF,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,WAAW,CAc5D,CAAC"}
1
+ {"version":3,"file":"leadingCoefficientCalculV1.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/leadingCoefficientCalculV1.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAuKF,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,WAAW,CAe5D,CAAC"}
@@ -3,6 +3,8 @@ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQue
3
3
  import { rationalVEA } from "../../../../exercises/vea/rationalVEA.js";
4
4
  import { Rational } from "../../../../math/numbers/rationals/rational.js";
5
5
  import { randint } from "../../../../math/utils/random/randint.js";
6
+ import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
7
+ import { substract } from "../../../../tree/nodes/operators/substractNode.js";
6
8
  import { shuffle } from "../../../../utils/alea/shuffle.js";
7
9
  const getInstruction = (identifiers, opts) => {
8
10
  const { xA, yA, xB, yB } = identifiers;
@@ -42,6 +44,53 @@ const getLeadingCoefficientCalculV1Question = (opts) => {
42
44
  const identifiers = { xA, xB, yA, yB };
43
45
  return getQuestionFromIdentifiers(identifiers, opts);
44
46
  };
47
+ const getHint = (identifiers, opts) => {
48
+ const { xA, yA, xB, yB } = identifiers;
49
+ const usePoints = opts?.usePoints;
50
+ const useLinear = opts?.useLinear;
51
+ if (useLinear) {
52
+ if (usePoints) {
53
+ return `Pour déterminer le coefficient directeur $a$ d'une fonction linéaire à partir d'un point $A(x_A; y_A)$ de sa droite représentative, on utilise la formule :
54
+
55
+ $$
56
+ a = \\frac{y_A}{x_A}
57
+ $$`;
58
+ }
59
+ return `Pour déterminer le coefficient directeur $a$ d'une fonction linéaire $f$ à partir d'une image $f(x)$, on utilise la formule :
60
+
61
+ $$
62
+ a = \\frac{f(x)}{x}
63
+ $$`;
64
+ }
65
+ if (usePoints)
66
+ return `Pour déterminer le coefficient directeur $a$ d'une fonction affine à partir de deux points $A(x_A; y_A)$ et $B(x_B;y_B)$ de sa droite représentative, on utilise la formule :
67
+
68
+ $$
69
+ a = \\frac{y_B-y_A}{x_B-x_A}
70
+ $$`;
71
+ return `Pour déterminer le coefficient directeur $a$ d'une fonction affine $f$ à partir de deux images $f(x_1)$ et $f(x_2)$, on utilise la formule :
72
+
73
+ $$
74
+ a = \\frac{f(x_2)-f(x_1)}{x_2-x_1}
75
+ $$`;
76
+ };
77
+ const getCorrection = (identifiers, opts) => {
78
+ const { xA, yA, xB, yB } = identifiers;
79
+ const usePoints = opts?.usePoints;
80
+ const useLinear = opts?.useLinear;
81
+ if (useLinear) {
82
+ return `Le coefficient directeur $a$ est égal à :
83
+
84
+ $$
85
+ a = ${frac(yB, xB).toSimplificationTex()}
86
+ $$`;
87
+ }
88
+ return `Le coefficient directeur $a$ est égal à :
89
+
90
+ $$
91
+ a = ${frac(substract(yB, yA), substract(xB, xA)).toSimplificationTex()}
92
+ $$`;
93
+ };
45
94
  const getQuestionFromIdentifiers = (identifiers, opts) => {
46
95
  const question = {
47
96
  instruction: getInstruction(identifiers, opts),
@@ -50,6 +99,8 @@ const getQuestionFromIdentifiers = (identifiers, opts) => {
50
99
  answerFormat: "tex",
51
100
  keys: [],
52
101
  identifiers,
102
+ hint: getHint(identifiers, opts),
103
+ correction: getCorrection(identifiers, opts),
53
104
  };
54
105
  return question;
55
106
  };
@@ -97,4 +148,5 @@ export const leadingCoefficientCalculV1 = {
97
148
  subject: "Mathématiques",
98
149
  options,
99
150
  getQuestionFromIdentifiers,
151
+ hasHintAndCorrection: true,
100
152
  };
@@ -1 +1 @@
1
- {"version":3,"file":"inverseImageFunctionGeogebra.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/inverseImageFunctionGeogebra.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAmBrC,KAAK,WAAW,GAAG;IAEjB,MAAM,EAAE,MAAM,CAAC;IAIf,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC;CACpB,CAAC;AAmNF,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,WAAW,CAkB9D,CAAC"}
1
+ {"version":3,"file":"inverseImageFunctionGeogebra.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/inverseImageFunctionGeogebra.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAmBrC,KAAK,WAAW,GAAG;IAEjB,MAAM,EAAE,MAAM,CAAC;IAIf,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC;CACpB,CAAC;AA6OF,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,WAAW,CAmB9D,CAAC"}
@@ -152,6 +152,27 @@ const getInverseImageFunctionGeogebra = () => {
152
152
  };
153
153
  return getQuestionFromIdentifiers(identifiers);
154
154
  };
155
+ const getHint = (identifiers) => {
156
+ const { points, yValue } = identifiers;
157
+ return `Repère, s'il y en a, les points de la courbe qui ont pour ordonnée $${yValue}$. Les antécédents de $${yValue}$ sont alors les abscisses de ces points.`;
158
+ };
159
+ const getCorrection = (identifiers) => {
160
+ const { points, yValue } = identifiers;
161
+ const validPoints = points.filter((p) => p[1] === yValue);
162
+ const pts = validPoints.map((e) => new Point("A", e[0], e[1]));
163
+ if (!validPoints.length) {
164
+ return `Aucun point de la courbe n'a pour ordonnée $${yValue}$ : cela signifie que $${yValue}$ n'a pas d'antécédent par $f$.`;
165
+ }
166
+ return `On lit les points de la courbe qui ont pour ordonnée $${yValue}$ : ${validPoints.length === 1
167
+ ? `il n'y a que le point de coordonnées $${pts[0].toCoords()}$`
168
+ : `ce sont les points de coordonnées $${pts[0].toCoords()}$ et $${pts[1].toCoords()}$`}.
169
+
170
+ Les antécédents par $f$ de $${yValue}$ sont donc :
171
+
172
+ $$
173
+ ${getAnswer(identifiers)}
174
+ $$`;
175
+ };
155
176
  const getQuestionFromIdentifiers = (identifiers) => {
156
177
  const question = {
157
178
  instruction: getInstruction(identifiers),
@@ -160,6 +181,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
160
181
  ggbOptions: getGGBOptions(identifiers),
161
182
  answerFormat: "tex",
162
183
  identifiers,
184
+ hint: getHint(identifiers),
185
+ correction: getCorrection(identifiers),
163
186
  };
164
187
  return question;
165
188
  };
@@ -218,4 +241,5 @@ export const inverseImageFunctionGeogebra = {
218
241
  getGGBOptions,
219
242
  getQuestionFromIdentifiers,
220
243
  rebuildIdentifiers,
244
+ hasHintAndCorrection: true,
221
245
  };
@@ -1 +1 @@
1
- {"version":3,"file":"parityFromAlgebra.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/parity/parityFromAlgebra.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AA0HF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAanD,CAAC"}
1
+ {"version":3,"file":"parityFromAlgebra.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/parity/parityFromAlgebra.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAerC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAkLF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAcnD,CAAC"}
@@ -9,9 +9,18 @@ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
9
9
  import { doWhile } from "../../../../utils/doWhile.js";
10
10
  import { probaFlip } from "../../../../utils/alea/probaFlip.js";
11
11
  import { probaLawFlip } from "../../../../utils/alea/probaLawFlip.js";
12
+ import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
13
+ import { opposite } from "../../../../tree/nodes/functions/oppositeNode.js";
14
+ import { alignTex } from "../../../../utils/latex/alignTex.js";
12
15
  const getInstruction = (identifiers) => {
13
16
  const fct = identifiers.fctTex;
14
- return `Soit $f(x) = ${fct}$. La fonction $f$ est-elle paire, impaire, ou ni paire ni impaire ?`;
17
+ return `Soit $f$ la fonction définie par :
18
+
19
+ $$
20
+ f(x) = ${fct}
21
+ $$
22
+
23
+ La fonction $f$ est-elle paire, impaire, ou ni paire ni impaire ?`;
15
24
  };
16
25
  const getAnswer = (identifiers) => {
17
26
  const type = identifiers.type;
@@ -30,8 +39,10 @@ const getQuestionFromIdentifiers = (identifiers) => {
30
39
  answer: getAnswer(identifiers),
31
40
  instruction: getInstruction(identifiers),
32
41
  keys: [],
33
- answerFormat: "tex",
42
+ answerFormat: "raw",
34
43
  identifiers,
44
+ hint: getHint(identifiers),
45
+ correction: getCorrection(identifiers),
35
46
  };
36
47
  return question;
37
48
  };
@@ -104,6 +115,49 @@ const getParityFromAlgebraQuestion = () => {
104
115
  const identifiers = { type, fctTex: fct };
105
116
  return getQuestionFromIdentifiers(identifiers);
106
117
  };
118
+ const getHint = (identifiers) => {
119
+ return `Une fonction $f$ est paire si pour tout $x$ de son ensemble de définition, on a : $f(-x) = f(x)$.
120
+
121
+ Une fonction $f$ est impaire si pour tout $x$ de son ensemble de définition, on a : $f(-x) = -f(x)$.`;
122
+ };
123
+ const getCorrection = (identifiers) => {
124
+ const type = identifiers.type;
125
+ const fct = parseAlgebraic(identifiers.fctTex);
126
+ const fctEv = fct.toDetailedEvaluation({ x: opposite("x") });
127
+ const fctEvSimp = fctEv.simplify({ calculatePowers: true });
128
+ const fctEvIsSimplifiable = fctEv.toTex() !== fctEvSimp.toTex();
129
+ const oppFct = opposite(fct);
130
+ const oppFctSimp = oppFct.simplify({
131
+ calculatePowers: true,
132
+ towardsDistribute: true,
133
+ forbidFactorize: true,
134
+ });
135
+ const oppFctIsSimplifiable = oppFct.toTex() !== oppFctSimp.toTex();
136
+ return `On exprime $f(-x)$ :
137
+
138
+ ${alignTex([
139
+ ["f(-x)", "=", fctEv.toTex()],
140
+ ["", "=", fctEvSimp.toTex()],
141
+ ])}
142
+
143
+ ${type === "even"
144
+ ? "Puisque $f(-x) = f(x)$, la fonction $f$ est paire."
145
+ : `Puisque $f(-x)\\neq f(x)$, la fonction $f$ n'est pas paire.
146
+
147
+ On calcule alors $-f(x)$ :
148
+
149
+ ${alignTex([
150
+ ["-f(x)", "=", oppFct.toTex()],
151
+ oppFctIsSimplifiable ? ["", "=", oppFctSimp.toTex()] : [],
152
+ ])}`}
153
+
154
+ ${type === "uneven"
155
+ ? "Puisque $f(-x) = -f(x)$, la fonction $f$ est impaire."
156
+ : type === "neither"
157
+ ? "Puisque $f(-x)\\neq -f(x)$, la fonction $f$ n'est pas impaire. La fonction $f$ n'est donc ni paire, ni impaire."
158
+ : ""}
159
+ `;
160
+ };
107
161
  const getPropositions = (n, { answer }) => {
108
162
  const propositions = [];
109
163
  addValidProp(propositions, answer, "raw");
@@ -128,4 +182,5 @@ export const parityFromAlgebra = {
128
182
  answerType: "QCU",
129
183
  subject: "Mathématiques",
130
184
  getQuestionFromIdentifiers,
185
+ hasHintAndCorrection: true,
131
186
  };
@@ -1 +1 @@
1
- {"version":3,"file":"parityFromGraph.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/parity/parityFromGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAcrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAkIF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAajD,CAAC"}
1
+ {"version":3,"file":"parityFromGraph.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/parity/parityFromGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAcrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAmJF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAcjD,CAAC"}
@@ -79,6 +79,19 @@ const getParityFromGraphQuestion = () => {
79
79
  const identifiers = { type, fctCmd: fct };
80
80
  return getQuestionFromIdentifiers(identifiers);
81
81
  };
82
+ const getHint = (identifiers) => {
83
+ return `Une fonction $f$ est paire si sa courbe représentative est symétrique par rapport à l'axe des ordonnées.
84
+
85
+ Une fonction $f$ est impaire si sa courbe représentative est symétrique par rapport à l'origine du repère.`;
86
+ };
87
+ const getCorrection = (identifiers) => {
88
+ const type = identifiers.type;
89
+ if (type === "even")
90
+ return `La courbe représentative de $f$ est symétrique par rapport à l'axe des ordonnées : la fonction $f$ est donc paire.`;
91
+ if (type === "uneven")
92
+ return `La courbe représentative de $f$ est symétrique par rapport à l'origine du repère : la fonction $f$ est donc impaire.`;
93
+ return `La courbe représentative de $f$ n'est ni symétrique par rapport à l'axe des ordonnées, ni symétrique par rapport à l'origine du repère : la fonction $f$ n'est donc ni paire, ni impaire.`;
94
+ };
82
95
  const getInstruction = (identifiers) => {
83
96
  return `La fonction $f$ représentée ci-dessous est-elle paire, impaire, ou ni paire ni impaire ?`;
84
97
  };
@@ -113,6 +126,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
113
126
  ggbOptions: getGGBOptions(identifiers),
114
127
  answerFormat: "tex",
115
128
  identifiers,
129
+ hint: getHint(identifiers),
130
+ correction: getCorrection(identifiers),
116
131
  };
117
132
  return question;
118
133
  };
@@ -136,5 +151,6 @@ export const parityFromGraph = {
136
151
  answerType: "QCU",
137
152
  hasGeogebra: true,
138
153
  subject: "Mathématiques",
154
+ hasHintAndCorrection: true,
139
155
  getQuestionFromIdentifiers,
140
156
  };