math-exercises 3.0.190 → 3.0.192

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 (125) hide show
  1. package/lib/exercises/math/dataRepresentations/barChart/barChartInterpreting.d.ts +53 -0
  2. package/lib/exercises/math/dataRepresentations/barChart/barChartInterpreting.d.ts.map +1 -0
  3. package/lib/exercises/math/dataRepresentations/barChart/barChartInterpreting.js +543 -0
  4. package/lib/exercises/math/dataRepresentations/barChart/barChartReading.d.ts +94 -0
  5. package/lib/exercises/math/dataRepresentations/barChart/barChartReading.d.ts.map +1 -0
  6. package/lib/exercises/math/dataRepresentations/barChart/barChartReading.js +280 -0
  7. package/lib/exercises/math/dataRepresentations/barChart/index.d.ts +3 -0
  8. package/lib/exercises/math/dataRepresentations/barChart/index.d.ts.map +1 -0
  9. package/lib/exercises/math/dataRepresentations/barChart/index.js +2 -0
  10. package/lib/exercises/math/dataRepresentations/boxPlot/boxPlotInterpreting.d.ts +7 -0
  11. package/lib/exercises/math/dataRepresentations/boxPlot/boxPlotInterpreting.d.ts.map +1 -0
  12. package/lib/exercises/math/dataRepresentations/boxPlot/boxPlotInterpreting.js +223 -0
  13. package/lib/exercises/math/dataRepresentations/boxPlot/boxPlotReading.d.ts +9 -0
  14. package/lib/exercises/math/dataRepresentations/boxPlot/boxPlotReading.d.ts.map +1 -0
  15. package/lib/exercises/math/dataRepresentations/boxPlot/boxPlotReading.js +133 -0
  16. package/lib/exercises/math/dataRepresentations/boxPlot/boxPlotReadingPercentages.d.ts +11 -0
  17. package/lib/exercises/math/dataRepresentations/boxPlot/boxPlotReadingPercentages.d.ts.map +1 -0
  18. package/lib/exercises/math/dataRepresentations/boxPlot/boxPlotReadingPercentages.js +198 -0
  19. package/lib/exercises/math/dataRepresentations/boxPlot/compareBoxPlot.d.ts +13 -0
  20. package/lib/exercises/math/dataRepresentations/boxPlot/compareBoxPlot.d.ts.map +1 -0
  21. package/lib/exercises/math/dataRepresentations/boxPlot/compareBoxPlot.js +192 -0
  22. package/lib/exercises/math/dataRepresentations/boxPlot/index.d.ts +5 -0
  23. package/lib/exercises/math/dataRepresentations/boxPlot/index.d.ts.map +1 -0
  24. package/lib/exercises/math/dataRepresentations/boxPlot/index.js +4 -0
  25. package/lib/exercises/math/dataRepresentations/index.d.ts +4 -7
  26. package/lib/exercises/math/dataRepresentations/index.d.ts.map +1 -1
  27. package/lib/exercises/math/dataRepresentations/index.js +4 -11
  28. package/lib/exercises/math/dataRepresentations/scatterPlot/index.d.ts +6 -0
  29. package/lib/exercises/math/dataRepresentations/scatterPlot/index.d.ts.map +1 -0
  30. package/lib/exercises/math/dataRepresentations/scatterPlot/index.js +5 -0
  31. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotBuildScatterPlotFromDataTable.d.ts +12 -0
  32. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotBuildScatterPlotFromDataTable.d.ts.map +1 -0
  33. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotBuildScatterPlotFromDataTable.js +206 -0
  34. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotCommenting.d.ts +9 -0
  35. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotCommenting.d.ts.map +1 -0
  36. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotCommenting.js +210 -0
  37. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotFillDataTableFromScatterPlotData.d.ts +10 -0
  38. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotFillDataTableFromScatterPlotData.d.ts.map +1 -0
  39. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotFillDataTableFromScatterPlotData.js +252 -0
  40. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotFillDataTableWithDataClassesFromScatterPlotData.d.ts +12 -0
  41. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotFillDataTableWithDataClassesFromScatterPlotData.d.ts.map +1 -0
  42. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotFillDataTableWithDataClassesFromScatterPlotData.js +352 -0
  43. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotInterpreting.d.ts +11 -0
  44. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotInterpreting.d.ts.map +1 -0
  45. package/lib/exercises/math/dataRepresentations/scatterPlot/scatterPlotInterpreting.js +403 -0
  46. package/lib/exercises/math/dataRepresentations/tables/buildDoubleTableFromContext.d.ts +7 -0
  47. package/lib/exercises/math/dataRepresentations/tables/buildDoubleTableFromContext.d.ts.map +1 -0
  48. package/lib/exercises/math/dataRepresentations/tables/buildDoubleTableFromContext.js +222 -0
  49. package/lib/exercises/math/dataRepresentations/tables/fillDoubleTable.d.ts +7 -0
  50. package/lib/exercises/math/dataRepresentations/tables/fillDoubleTable.d.ts.map +1 -0
  51. package/lib/exercises/math/dataRepresentations/tables/fillDoubleTable.js +187 -0
  52. package/lib/exercises/math/dataRepresentations/tables/index.d.ts +4 -0
  53. package/lib/exercises/math/dataRepresentations/tables/index.d.ts.map +1 -0
  54. package/lib/exercises/math/dataRepresentations/tables/index.js +3 -0
  55. package/lib/exercises/math/dataRepresentations/tables/tableReading.d.ts +8 -0
  56. package/lib/exercises/math/dataRepresentations/tables/tableReading.d.ts.map +1 -0
  57. package/lib/exercises/math/dataRepresentations/tables/tableReading.js +109 -0
  58. package/lib/exercises/math/derivation/applications/findYearForDecreasingPopulation.d.ts +8 -0
  59. package/lib/exercises/math/derivation/applications/findYearForDecreasingPopulation.d.ts.map +1 -0
  60. package/lib/exercises/math/derivation/applications/findYearForDecreasingPopulation.js +145 -0
  61. package/lib/exercises/math/derivation/applications/index.d.ts +1 -0
  62. package/lib/exercises/math/derivation/applications/index.d.ts.map +1 -1
  63. package/lib/exercises/math/derivation/applications/index.js +1 -0
  64. package/lib/exercises/math/derivation/tangent/tangentEquationFromFunctionExpression.js +1 -1
  65. package/lib/exercises/math/derivation/variations/signVarTableFromFunctionExpression.d.ts.map +1 -1
  66. package/lib/exercises/math/derivation/variations/signVarTableFromFunctionExpression.js +4 -1
  67. package/lib/exercises/math/functions/affines/affineCompareTwoImagesFromVariations.d.ts +13 -0
  68. package/lib/exercises/math/functions/affines/affineCompareTwoImagesFromVariations.d.ts.map +1 -0
  69. package/lib/exercises/math/functions/affines/affineCompareTwoImagesFromVariations.js +205 -0
  70. package/lib/exercises/math/functions/affines/affineVarTableOnBoundedInterval.d.ts +9 -0
  71. package/lib/exercises/math/functions/affines/affineVarTableOnBoundedInterval.d.ts.map +1 -0
  72. package/lib/exercises/math/functions/affines/affineVarTableOnBoundedInterval.js +157 -0
  73. package/lib/exercises/math/functions/affines/affineVariations.d.ts +12 -0
  74. package/lib/exercises/math/functions/affines/affineVariations.d.ts.map +1 -0
  75. package/lib/exercises/math/functions/affines/affineVariations.js +176 -0
  76. package/lib/exercises/math/functions/affines/affineVariationsFromGraph.d.ts +8 -0
  77. package/lib/exercises/math/functions/affines/affineVariationsFromGraph.d.ts.map +1 -0
  78. package/lib/exercises/math/functions/affines/affineVariationsFromGraph.js +203 -0
  79. package/lib/exercises/math/functions/affines/affineVariationsFromTwoImages.d.ts +12 -0
  80. package/lib/exercises/math/functions/affines/affineVariationsFromTwoImages.d.ts.map +1 -0
  81. package/lib/exercises/math/functions/affines/affineVariationsFromTwoImages.js +259 -0
  82. package/lib/exercises/math/functions/exponentials/exponentialFunctionImage.d.ts +9 -0
  83. package/lib/exercises/math/functions/exponentials/exponentialFunctionImage.d.ts.map +1 -0
  84. package/lib/exercises/math/functions/exponentials/exponentialFunctionImage.js +99 -0
  85. package/lib/exercises/math/functions/exponentials/index.d.ts +5 -0
  86. package/lib/exercises/math/functions/exponentials/index.d.ts.map +1 -1
  87. package/lib/exercises/math/functions/exponentials/index.js +5 -0
  88. package/lib/exercises/math/functions/exponentials/realPowersFraction.d.ts +10 -0
  89. package/lib/exercises/math/functions/exponentials/realPowersFraction.d.ts.map +1 -0
  90. package/lib/exercises/math/functions/exponentials/realPowersFraction.js +125 -0
  91. package/lib/exercises/math/functions/exponentials/realPowersMixOperations.d.ts +12 -0
  92. package/lib/exercises/math/functions/exponentials/realPowersMixOperations.d.ts.map +1 -0
  93. package/lib/exercises/math/functions/exponentials/realPowersMixOperations.js +148 -0
  94. package/lib/exercises/math/functions/exponentials/realPowersPower.d.ts +10 -0
  95. package/lib/exercises/math/functions/exponentials/realPowersPower.d.ts.map +1 -0
  96. package/lib/exercises/math/functions/exponentials/realPowersPower.js +128 -0
  97. package/lib/exercises/math/functions/exponentials/realPowersProduct.d.ts +10 -0
  98. package/lib/exercises/math/functions/exponentials/realPowersProduct.d.ts.map +1 -0
  99. package/lib/exercises/math/functions/exponentials/realPowersProduct.js +128 -0
  100. package/lib/exercises/math/probaStat/conditional/fillTableConditionalProbabilitySituation.d.ts.map +1 -1
  101. package/lib/exercises/math/probaStat/conditional/fillTableConditionalProbabilitySituation.js +7 -2
  102. package/lib/exercises/math/probaStat/stats1var/marginalAndConditionalFrequency.d.ts.map +1 -1
  103. package/lib/exercises/math/probaStat/stats1var/marginalAndConditionalFrequency.js +131 -61
  104. package/lib/exercises/math/sequences/geometric/geometricFindNextTermFromTwoConsecutiveTerms.d.ts +12 -0
  105. package/lib/exercises/math/sequences/geometric/geometricFindNextTermFromTwoConsecutiveTerms.d.ts.map +1 -0
  106. package/lib/exercises/math/sequences/geometric/geometricFindNextTermFromTwoConsecutiveTerms.js +217 -0
  107. package/lib/exercises/math/sequences/geometric/geometricFindRecurrenceFormula.d.ts +10 -0
  108. package/lib/exercises/math/sequences/geometric/geometricFindRecurrenceFormula.d.ts.map +1 -0
  109. package/lib/exercises/math/sequences/geometric/geometricFindRecurrenceFormula.js +186 -0
  110. package/lib/exercises/math/sequences/geometric/graph/geometricPlaceFirstPoints.d.ts +14 -0
  111. package/lib/exercises/math/sequences/geometric/graph/geometricPlaceFirstPoints.d.ts.map +1 -0
  112. package/lib/exercises/math/sequences/geometric/graph/geometricPlaceFirstPoints.js +189 -0
  113. package/lib/exercises/math/sequences/geometric/graph/index.d.ts +2 -0
  114. package/lib/exercises/math/sequences/geometric/graph/index.d.ts.map +1 -0
  115. package/lib/exercises/math/sequences/geometric/graph/index.js +1 -0
  116. package/lib/index.d.ts +53 -25
  117. package/lib/index.d.ts.map +1 -1
  118. package/lib/tree/nodes/algebraicNode.d.ts +3 -0
  119. package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
  120. package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
  121. package/lib/tree/nodes/operators/fractionNode.js +5 -3
  122. package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
  123. package/lib/tree/nodes/operators/multiplyNode.js +5 -3
  124. package/lib/tree/nodes/operators/powerNode.js +1 -1
  125. package/package.json +1 -1
@@ -0,0 +1,125 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, propWhile, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { randfloat } from "../../../../math/utils/random/randfloat.js";
4
+ import { reifyAlgebraic, } from "../../../../tree/nodes/nodeConstructor.js";
5
+ import { add } from "../../../../tree/nodes/operators/addNode.js";
6
+ import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
7
+ import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
8
+ import { power } from "../../../../tree/nodes/operators/powerNode.js";
9
+ import { substract } from "../../../../tree/nodes/operators/substractNode.js";
10
+ import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
11
+ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
12
+ import { doWhile } from "../../../../utils/doWhile.js";
13
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
14
+ import { isInt } from "../../../../utils/isInt.js";
15
+ const getPropositions = (n, { answer, aIds, xIds, yIds }) => {
16
+ const propositions = [];
17
+ addValidProp(propositions, answer);
18
+ const a = reifyAlgebraic(aIds);
19
+ const x = reifyAlgebraic(xIds);
20
+ const y = reifyAlgebraic(yIds);
21
+ tryToAddWrongProp(propositions, power(a, add(x, y)).simplify().toTex());
22
+ tryToAddWrongProp(propositions, power(a, multiply(x, y)).simplify().toTex());
23
+ propWhile(propositions, n, () => {
24
+ tryToAddWrongProp(propositions, power(a, randfloat(0.1, 5, 1)).simplify().toTex());
25
+ });
26
+ return shuffleProps(propositions, n);
27
+ };
28
+ const getAnswer = (identifiers) => {
29
+ const { aIds, xIds, yIds } = identifiers;
30
+ const a = reifyAlgebraic(aIds);
31
+ const x = reifyAlgebraic(xIds);
32
+ const y = reifyAlgebraic(yIds);
33
+ return power(a, substract(x, y)).simplify().toTex();
34
+ };
35
+ const getInstruction = (identifiers) => {
36
+ const { aIds, xIds, yIds } = identifiers;
37
+ const a = reifyAlgebraic(aIds);
38
+ const x = reifyAlgebraic(xIds);
39
+ const y = reifyAlgebraic(yIds);
40
+ return `Écrire sous la forme d'une seule puissance :
41
+
42
+ $$
43
+ ${frac(power(a, x), power(a, y)).toTex()}
44
+ $$`;
45
+ };
46
+ const getHint = () => {
47
+ return `Utilise la propriété suivante : pour tous nombres réels positifs $x$ et $y$ et pour tout nombre réel $a>0$, on a :
48
+
49
+ $$
50
+ \\frac{a^x}{a^y}= a^{x-y}
51
+ $$`;
52
+ };
53
+ const getCorrection = (identifiers) => {
54
+ const { aIds, xIds, yIds } = identifiers;
55
+ const a = reifyAlgebraic(aIds);
56
+ const x = reifyAlgebraic(xIds);
57
+ const y = reifyAlgebraic(yIds);
58
+ return `Pour tous nombres réels positifs $x$ et $y$ et pour tout nombre réel $a>0$, on a :
59
+
60
+ $$
61
+ \\frac{a^x}{a^y}= a^{x-y}
62
+ $$
63
+
64
+ Ici, on a donc :
65
+
66
+ $$
67
+ ${frac(power(a, x), power(a, y)).toTex()} = ${power(a, substract(x, y)).toTex()} = ${getAnswer(identifiers)}
68
+ $$`;
69
+ };
70
+ const getKeys = () => {
71
+ return [];
72
+ };
73
+ const isAnswerValid = (ans, { answer }) => {
74
+ try {
75
+ const parsed = parseAlgebraic(ans);
76
+ if (!parsed)
77
+ return false;
78
+ return parsed.simplify({ forbidPowerDivision: true }).toTex() === answer;
79
+ }
80
+ catch (err) {
81
+ return handleVEAError(err);
82
+ }
83
+ };
84
+ const getRealPowersFractionQuestion = () => {
85
+ const a = randfloat(0.1, 5, 1, [1]);
86
+ let x = doWhile(() => randfloat(0.1, 5, 1), (v) => isInt(v));
87
+ let y = randfloat(0.1, 5, 1);
88
+ if (coinFlip())
89
+ [x, y] = [y, x]; //comme ca l'éventuel entier est n'importe ou
90
+ const identifiers = {
91
+ aIds: a.toTree().toIdentifiers(),
92
+ xIds: x.toTree().toIdentifiers(),
93
+ yIds: y.toTree().toIdentifiers(),
94
+ };
95
+ return getQuestionFromIdentifiers(identifiers);
96
+ };
97
+ const getQuestionFromIdentifiers = (identifiers) => {
98
+ return {
99
+ answer: getAnswer(identifiers),
100
+ instruction: getInstruction(identifiers),
101
+ keys: getKeys(identifiers),
102
+ answerFormat: "tex",
103
+ identifiers,
104
+ hint: getHint(identifiers),
105
+ correction: getCorrection(identifiers),
106
+ };
107
+ };
108
+ export const realPowersFraction = {
109
+ id: "realPowersFraction",
110
+ connector: "=",
111
+ label: "Simplifier une division de puissances réelles",
112
+ isSingleStep: true,
113
+ generator: (nb, opts) => getDistinctQuestions(() => getRealPowersFractionQuestion(opts), nb),
114
+ qcmTimer: 60,
115
+ freeTimer: 60,
116
+ getPropositions,
117
+ isAnswerValid,
118
+ subject: "Mathématiques",
119
+ getInstruction,
120
+ getHint,
121
+ getCorrection,
122
+ getAnswer,
123
+ getQuestionFromIdentifiers,
124
+ hasHintAndCorrection: true,
125
+ };
@@ -0,0 +1,12 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
3
+ type Identifiers = {
4
+ aIds: NodeIdentifiers;
5
+ xIds: NodeIdentifiers;
6
+ yIds: NodeIdentifiers;
7
+ zIds: NodeIdentifiers;
8
+ tIds: NodeIdentifiers;
9
+ };
10
+ export declare const realPowersMixOperations: Exercise<Identifiers>;
11
+ export {};
12
+ //# sourceMappingURL=realPowersMixOperations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"realPowersMixOperations.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/exponentials/realPowersMixOperations.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAY7C,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,eAAe,CAAC;IACtB,IAAI,EAAE,eAAe,CAAC;IACtB,IAAI,EAAE,eAAe,CAAC;IACtB,IAAI,EAAE,eAAe,CAAC;IACtB,IAAI,EAAE,eAAe,CAAC;CACvB,CAAC;AAwIF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAkBzD,CAAC"}
@@ -0,0 +1,148 @@
1
+ import { addValidProp, shuffleProps, propWhile, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { randfloat } from "../../../../math/utils/random/randfloat.js";
4
+ import { reifyAlgebraic, } from "../../../../tree/nodes/nodeConstructor.js";
5
+ import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
6
+ import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
7
+ import { power } from "../../../../tree/nodes/operators/powerNode.js";
8
+ import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
9
+ import { shuffle } from "../../../../utils/alea/shuffle.js";
10
+ import { doWhile } from "../../../../utils/doWhile.js";
11
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
12
+ import { isInt } from "../../../../utils/isInt.js";
13
+ import { alignTex } from "../../../../utils/latex/alignTex.js";
14
+ const getPropositions = (n, { answer, aIds }) => {
15
+ const propositions = [];
16
+ addValidProp(propositions, answer);
17
+ const a = reifyAlgebraic(aIds);
18
+ propWhile(propositions, n, () => {
19
+ tryToAddWrongProp(propositions, power(a, randfloat(0.1, 5, 1)).simplify().toTex());
20
+ });
21
+ return shuffleProps(propositions, n);
22
+ };
23
+ const getAnswer = (identifiers) => {
24
+ const statement = getStatement(identifiers);
25
+ return statement.simplify().toTex();
26
+ };
27
+ const getStatement = (identifiers) => {
28
+ const { aIds, tIds, xIds, yIds, zIds } = identifiers;
29
+ const a = reifyAlgebraic(aIds);
30
+ const x = reifyAlgebraic(xIds);
31
+ const y = reifyAlgebraic(yIds);
32
+ const z = reifyAlgebraic(zIds);
33
+ const t = reifyAlgebraic(tIds);
34
+ return frac(multiply(power(power(a, x), y), power(a, z)), power(a, t));
35
+ };
36
+ const getInstruction = (identifiers) => {
37
+ return `Écrire sous la forme d'une seule puissance :
38
+
39
+ $$
40
+ ${getStatement(identifiers).toTex()}
41
+ $$`;
42
+ };
43
+ const getHint = () => {
44
+ return `Utilise les propriétés suivantes : pour tous nombres réels positifs $x$ et $y$ et pour tout nombre réel $a>0$, on a :
45
+
46
+ - $a^x\\times a^y = a^{x+y}$
47
+ - $\\frac{a^x}{a^y}= a^{x-y}$
48
+ - $\\left(a^x\\right)^y = a^{x\\times y}$`;
49
+ };
50
+ const getCorrection = (identifiers) => {
51
+ //(a^x)^y*a^z / a^t
52
+ const statement = getStatement(identifiers);
53
+ return `Pour tous nombres réels positifs $x$ et $y$ et pour tout nombre réel $a>0$, on a :
54
+
55
+ - $a^x\\times a^y = a^{x+y}$
56
+ - $\\frac{a^x}{a^y}= a^{x-y}$
57
+ - $\\left(a^x\\right)^y = a^{x\\times y}$
58
+
59
+ Ici, on a donc :
60
+
61
+ ${alignTex([
62
+ [
63
+ statement.toTex(),
64
+ "=",
65
+ statement
66
+ .simplify({
67
+ forbidPowerDivision: true,
68
+ forbidPowerMultiply: true,
69
+ })
70
+ .toTex(),
71
+ ],
72
+ [
73
+ "",
74
+ "=",
75
+ statement
76
+ .simplify({
77
+ forbidPowerDivision: true,
78
+ })
79
+ .toTex(),
80
+ ],
81
+ ["", "=", getAnswer(identifiers)],
82
+ ])}`;
83
+ };
84
+ const getKeys = () => {
85
+ return [];
86
+ };
87
+ const isAnswerValid = (ans, { answer }) => {
88
+ try {
89
+ const parsed = parseAlgebraic(ans);
90
+ if (!parsed)
91
+ return false;
92
+ return (parsed
93
+ .simplify({
94
+ forbidPowerDivision: true,
95
+ forbidPowerMultiply: true,
96
+ forbidPowerPower: true,
97
+ })
98
+ .toTex() === answer);
99
+ }
100
+ catch (err) {
101
+ return handleVEAError(err);
102
+ }
103
+ };
104
+ const getRealPowersMixOperationsQuestion = () => {
105
+ const a = randfloat(0.1, 5, 1, [1]);
106
+ let x = doWhile(() => randfloat(0.1, 5, 1), (v) => isInt(v));
107
+ let y = randfloat(0.1, 5, 1);
108
+ let z = randfloat(0.1, 5, 1);
109
+ let t = randfloat(0.1, 5, 1);
110
+ [x, y, z, t] = shuffle([x, y, z, t]);
111
+ const identifiers = {
112
+ aIds: a.toTree().toIdentifiers(),
113
+ xIds: x.toTree().toIdentifiers(),
114
+ yIds: y.toTree().toIdentifiers(),
115
+ tIds: t.toTree().toIdentifiers(),
116
+ zIds: z.toTree().toIdentifiers(),
117
+ };
118
+ return getQuestionFromIdentifiers(identifiers);
119
+ };
120
+ const getQuestionFromIdentifiers = (identifiers) => {
121
+ return {
122
+ answer: getAnswer(identifiers),
123
+ instruction: getInstruction(identifiers),
124
+ keys: getKeys(identifiers),
125
+ answerFormat: "tex",
126
+ identifiers,
127
+ hint: getHint(identifiers),
128
+ correction: getCorrection(identifiers),
129
+ };
130
+ };
131
+ export const realPowersMixOperations = {
132
+ id: "realPowersMixOperations",
133
+ connector: "=",
134
+ label: "Simplifier un mélange de calculs avec des puissances réelles",
135
+ isSingleStep: true,
136
+ generator: (nb, opts) => getDistinctQuestions(() => getRealPowersMixOperationsQuestion(opts), nb),
137
+ qcmTimer: 60,
138
+ freeTimer: 60,
139
+ getPropositions,
140
+ isAnswerValid,
141
+ subject: "Mathématiques",
142
+ getInstruction,
143
+ getHint,
144
+ getCorrection,
145
+ getAnswer,
146
+ getQuestionFromIdentifiers,
147
+ hasHintAndCorrection: true,
148
+ };
@@ -0,0 +1,10 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
3
+ type Identifiers = {
4
+ aIds: NodeIdentifiers;
5
+ xIds: NodeIdentifiers;
6
+ yIds: NodeIdentifiers;
7
+ };
8
+ export declare const realPowersPower: Exercise<Identifiers>;
9
+ export {};
10
+ //# sourceMappingURL=realPowersPower.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"realPowersPower.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/exponentials/realPowersPower.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAY7C,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,eAAe,CAAC;IACtB,IAAI,EAAE,eAAe,CAAC;IACtB,IAAI,EAAE,eAAe,CAAC;CACvB,CAAC;AA0HF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAkBjD,CAAC"}
@@ -0,0 +1,128 @@
1
+ import { addValidProp, shuffleProps, tryToAddWrongProp, propWhile, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { randfloat } from "../../../../math/utils/random/randfloat.js";
4
+ import { reifyAlgebraic, } from "../../../../tree/nodes/nodeConstructor.js";
5
+ import { add } from "../../../../tree/nodes/operators/addNode.js";
6
+ import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
7
+ import { power } from "../../../../tree/nodes/operators/powerNode.js";
8
+ import { substract } from "../../../../tree/nodes/operators/substractNode.js";
9
+ import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
10
+ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
11
+ import { doWhile } from "../../../../utils/doWhile.js";
12
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
13
+ import { isInt } from "../../../../utils/isInt.js";
14
+ const getPropositions = (n, { answer, aIds, xIds, yIds }) => {
15
+ const propositions = [];
16
+ addValidProp(propositions, answer);
17
+ const a = reifyAlgebraic(aIds);
18
+ const x = reifyAlgebraic(xIds);
19
+ const y = reifyAlgebraic(yIds);
20
+ tryToAddWrongProp(propositions, power(a, substract(x, y)).simplify().toTex());
21
+ tryToAddWrongProp(propositions, power(a, add(x, y)).simplify().toTex());
22
+ propWhile(propositions, n, () => {
23
+ tryToAddWrongProp(propositions, power(a, randfloat(0.1, 5, 1)).simplify().toTex());
24
+ });
25
+ return shuffleProps(propositions, n);
26
+ };
27
+ const getAnswer = (identifiers) => {
28
+ const { aIds, xIds, yIds } = identifiers;
29
+ const a = reifyAlgebraic(aIds);
30
+ const x = reifyAlgebraic(xIds);
31
+ const y = reifyAlgebraic(yIds);
32
+ return power(a, multiply(x, y)).simplify().toTex();
33
+ };
34
+ const getInstruction = (identifiers) => {
35
+ const { aIds, xIds, yIds } = identifiers;
36
+ const a = reifyAlgebraic(aIds);
37
+ const x = reifyAlgebraic(xIds);
38
+ const y = reifyAlgebraic(yIds);
39
+ return `Écrire sous la forme d'une seule puissance :
40
+
41
+ $$
42
+ ${power(power(a, x), y).toTex()}
43
+ $$`;
44
+ };
45
+ const getHint = () => {
46
+ return `Utilise la propriété suivante : pour tous nombres réels positifs $x$ et $y$ et pour tout nombre réel $a>0$, on a :
47
+
48
+ $$
49
+ \\left(a^x\\right)^y = a^{x\\times y}
50
+ $$`;
51
+ };
52
+ const getCorrection = (identifiers) => {
53
+ const { aIds, xIds, yIds } = identifiers;
54
+ const a = reifyAlgebraic(aIds);
55
+ const x = reifyAlgebraic(xIds);
56
+ const y = reifyAlgebraic(yIds);
57
+ return `Pour tous nombres réels positifs $x$ et $y$ et pour tout nombre réel $a>0$, on a :
58
+
59
+ $$
60
+ \\left(a^x\\right)^y = a^{x\\times y}
61
+ $$
62
+
63
+ Ici, on a donc :
64
+
65
+ $$
66
+ ${power(power(a, x), y).toTex()} = ${power(a, multiply(x, y)).toTex()} = ${getAnswer(identifiers)}
67
+ $$`;
68
+ };
69
+ const getKeys = () => {
70
+ return [];
71
+ };
72
+ const isAnswerValid = (ans, { answer }) => {
73
+ try {
74
+ const parsed = parseAlgebraic(ans);
75
+ if (!parsed)
76
+ return false;
77
+ return (parsed
78
+ .simplify({
79
+ forbidPowerPower: true,
80
+ })
81
+ .toTex() === answer);
82
+ }
83
+ catch (err) {
84
+ return handleVEAError(err);
85
+ }
86
+ };
87
+ const getRealPowersFractionQuestion = () => {
88
+ const a = randfloat(0.1, 5, 1, [1]);
89
+ let x = doWhile(() => randfloat(0.1, 5, 1), (v) => isInt(v));
90
+ let y = randfloat(0.1, 5, 1);
91
+ if (coinFlip())
92
+ [x, y] = [y, x]; //comme ca l'éventuel entier est n'importe ou
93
+ const identifiers = {
94
+ aIds: a.toTree().toIdentifiers(),
95
+ xIds: x.toTree().toIdentifiers(),
96
+ yIds: y.toTree().toIdentifiers(),
97
+ };
98
+ return getQuestionFromIdentifiers(identifiers);
99
+ };
100
+ const getQuestionFromIdentifiers = (identifiers) => {
101
+ return {
102
+ answer: getAnswer(identifiers),
103
+ instruction: getInstruction(identifiers),
104
+ keys: getKeys(identifiers),
105
+ answerFormat: "tex",
106
+ identifiers,
107
+ hint: getHint(identifiers),
108
+ correction: getCorrection(identifiers),
109
+ };
110
+ };
111
+ export const realPowersPower = {
112
+ id: "realPowersPower",
113
+ connector: "=",
114
+ label: "Simplifier une puissance de puissances réelles",
115
+ isSingleStep: true,
116
+ generator: (nb, opts) => getDistinctQuestions(() => getRealPowersFractionQuestion(opts), nb),
117
+ qcmTimer: 60,
118
+ freeTimer: 60,
119
+ getPropositions,
120
+ isAnswerValid,
121
+ subject: "Mathématiques",
122
+ getInstruction,
123
+ getHint,
124
+ getCorrection,
125
+ getAnswer,
126
+ getQuestionFromIdentifiers,
127
+ hasHintAndCorrection: true,
128
+ };
@@ -0,0 +1,10 @@
1
+ import { Exercise } from "../../../../exercises/exercise.js";
2
+ import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
3
+ type Identifiers = {
4
+ aIds: NodeIdentifiers;
5
+ xIds: NodeIdentifiers;
6
+ yIds: NodeIdentifiers;
7
+ };
8
+ export declare const realPowersProduct: Exercise<Identifiers>;
9
+ export {};
10
+ //# sourceMappingURL=realPowersProduct.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"realPowersProduct.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/exponentials/realPowersProduct.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAY7C,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,eAAe,CAAC;IACtB,IAAI,EAAE,eAAe,CAAC;IACtB,IAAI,EAAE,eAAe,CAAC;CACvB,CAAC;AAuHF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAkBnD,CAAC"}
@@ -0,0 +1,128 @@
1
+ import { addValidProp, shuffleProps, propWhile, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
2
+ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
3
+ import { randfloat } from "../../../../math/utils/random/randfloat.js";
4
+ import { reifyAlgebraic, } from "../../../../tree/nodes/nodeConstructor.js";
5
+ import { add } from "../../../../tree/nodes/operators/addNode.js";
6
+ import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
7
+ import { power } from "../../../../tree/nodes/operators/powerNode.js";
8
+ import { substract } from "../../../../tree/nodes/operators/substractNode.js";
9
+ import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
10
+ import { coinFlip } from "../../../../utils/alea/coinFlip.js";
11
+ import { doWhile } from "../../../../utils/doWhile.js";
12
+ import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
13
+ import { isInt } from "../../../../utils/isInt.js";
14
+ const getPropositions = (n, { answer, aIds, xIds, yIds }) => {
15
+ const propositions = [];
16
+ addValidProp(propositions, answer);
17
+ const a = reifyAlgebraic(aIds);
18
+ const x = reifyAlgebraic(xIds);
19
+ const y = reifyAlgebraic(yIds);
20
+ tryToAddWrongProp(propositions, power(a, substract(x, y).simplify()).toTex());
21
+ tryToAddWrongProp(propositions, power(a, multiply(x, y).simplify()).toTex());
22
+ propWhile(propositions, n, () => {
23
+ tryToAddWrongProp(propositions, power(a, randfloat(0.1, 5, 1)).toTex());
24
+ });
25
+ return shuffleProps(propositions, n);
26
+ };
27
+ const getAnswer = (identifiers) => {
28
+ const { aIds, xIds, yIds } = identifiers;
29
+ const a = reifyAlgebraic(aIds);
30
+ const x = reifyAlgebraic(xIds);
31
+ const y = reifyAlgebraic(yIds);
32
+ return power(a, add(x, y)).simplify().toTex();
33
+ };
34
+ const getInstruction = (identifiers) => {
35
+ const { aIds, xIds, yIds } = identifiers;
36
+ const a = reifyAlgebraic(aIds);
37
+ const x = reifyAlgebraic(xIds);
38
+ const y = reifyAlgebraic(yIds);
39
+ return `Écrire sous la forme d'une seule puissance :
40
+
41
+ $$
42
+ ${multiply(power(a, x), power(a, y)).toTex()}
43
+ $$`;
44
+ };
45
+ const getHint = () => {
46
+ return `Utilise la propriété suivante : pour tous nombres réels positifs $x$ et $y$ et pour tout nombre réel $a>0$, on a :
47
+
48
+ $$
49
+ a^x\\times a^y = a^{x+y}
50
+ $$`;
51
+ };
52
+ const getCorrection = (identifiers) => {
53
+ const { aIds, xIds, yIds } = identifiers;
54
+ const a = reifyAlgebraic(aIds);
55
+ const x = reifyAlgebraic(xIds);
56
+ const y = reifyAlgebraic(yIds);
57
+ return `Pour tous nombres réels positifs $x$ et $y$ et pour tout nombre réel $a>0$, on a :
58
+
59
+ $$
60
+ a^x\\times a^y = a^{x+y}
61
+ $$
62
+
63
+ Ici, on a donc :
64
+
65
+ $$
66
+ ${multiply(power(a, x), power(a, y)).toTex()} = ${power(a, add(x, y)).toTex()} = ${getAnswer(identifiers)}
67
+ $$`;
68
+ };
69
+ const getKeys = () => {
70
+ return [];
71
+ };
72
+ const isAnswerValid = (ans, { answer }) => {
73
+ try {
74
+ const parsed = parseAlgebraic(ans);
75
+ if (!parsed)
76
+ return false;
77
+ return (parsed
78
+ .simplify({
79
+ forbidPowerMultiply: true,
80
+ })
81
+ .toTex() === answer);
82
+ }
83
+ catch (err) {
84
+ return handleVEAError(err);
85
+ }
86
+ };
87
+ const getRealPowersProductQuestion = () => {
88
+ const a = randfloat(0.1, 5, 1, [1]);
89
+ let x = doWhile(() => randfloat(0.1, 5, 1), (v) => isInt(v));
90
+ let y = randfloat(0.1, 5, 1);
91
+ if (coinFlip())
92
+ [x, y] = [y, x]; //comme ca l'éventuel entier est n'importe ou
93
+ const identifiers = {
94
+ aIds: a.toTree().toIdentifiers(),
95
+ xIds: x.toTree().toIdentifiers(),
96
+ yIds: y.toTree().toIdentifiers(),
97
+ };
98
+ return getQuestionFromIdentifiers(identifiers);
99
+ };
100
+ const getQuestionFromIdentifiers = (identifiers) => {
101
+ return {
102
+ answer: getAnswer(identifiers),
103
+ instruction: getInstruction(identifiers),
104
+ keys: getKeys(identifiers),
105
+ answerFormat: "tex",
106
+ identifiers,
107
+ hint: getHint(identifiers),
108
+ correction: getCorrection(identifiers),
109
+ };
110
+ };
111
+ export const realPowersProduct = {
112
+ id: "realPowersProduct",
113
+ connector: "=",
114
+ label: "Simplifier un produit de puissances réelles",
115
+ isSingleStep: true,
116
+ generator: (nb, opts) => getDistinctQuestions(() => getRealPowersProductQuestion(opts), nb),
117
+ qcmTimer: 60,
118
+ freeTimer: 60,
119
+ getPropositions,
120
+ isAnswerValid,
121
+ subject: "Mathématiques",
122
+ getInstruction,
123
+ getHint,
124
+ getCorrection,
125
+ getAnswer,
126
+ getQuestionFromIdentifiers,
127
+ hasHintAndCorrection: true,
128
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"fillTableConditionalProbabilitySituation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/conditional/fillTableConditionalProbabilitySituation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,6BAA6B,CAAC;AAUrC,OAAO,EAGL,wBAAwB,EACzB,MAAM,iCAAiC,CAAC;AAEzC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,wBAAwB,CAAC;CAClC,CAAC;AAsOF,eAAO,MAAM,wCAAwC,EAAE,QAAQ,CAAC,WAAW,CAqB1E,CAAC"}
1
+ {"version":3,"file":"fillTableConditionalProbabilitySituation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/conditional/fillTableConditionalProbabilitySituation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,6BAA6B,CAAC;AAUrC,OAAO,EAGL,wBAAwB,EACzB,MAAM,iCAAiC,CAAC;AAEzC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,wBAAwB,CAAC;CAClC,CAAC;AA2OF,eAAO,MAAM,wCAAwC,EAAE,QAAQ,CAAC,WAAW,CAqB1E,CAAC"}
@@ -37,7 +37,12 @@ const getAnswerTable = (identifiers) => {
37
37
  .toTex()}`,
38
38
  `${substract(1, mainEventProbaDec).simplify().toTex()}`,
39
39
  ],
40
- ["Total", `${pb.toTex()}`, `${substract(1, pb).simplify().toTex()}`, "1"],
40
+ [
41
+ "\\text{Total}",
42
+ `${pb.toTex()}`,
43
+ `${substract(1, pb).simplify().toTex()}`,
44
+ "1",
45
+ ],
41
46
  ];
42
47
  };
43
48
  const getInstruction = (identifiers) => {
@@ -199,7 +204,7 @@ const getQuestionFromIdentifiers = (identifiers) => {
199
204
  ],
200
205
  [`$${situation.mainEvent}$`, "", "", ""],
201
206
  [`$\\overline{${situation.mainEvent}}$`, "", "", ""],
202
- ["Total", "", "", "1"],
207
+ ["\\text{Total}", "", "", "1"],
203
208
  ],
204
209
  };
205
210
  };
@@ -1 +1 @@
1
- {"version":3,"file":"marginalAndConditionalFrequency.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats1var/marginalAndConditionalFrequency.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,QAAQ,EAYT,MAAM,sBAAsB,CAAC;AAG9B,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAmMF,eAAO,MAAM,+BAA+B,EAAE,QAAQ,CAAC,WAAW,CAajE,CAAC"}
1
+ {"version":3,"file":"marginalAndConditionalFrequency.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats1var/marginalAndConditionalFrequency.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,QAAQ,EAcT,MAAM,sBAAsB,CAAC;AAG9B,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAyPF,eAAO,MAAM,+BAA+B,EAAE,QAAQ,CAAC,WAAW,CAcjE,CAAC"}