math-exercises 2.1.14 → 2.1.15
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.
- package/lib/exercises/math/functions/affines/affineAdjustment.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/affineAdjustment.js +16 -16
- package/lib/exercises/math/functions/affines/affineAdjustmentComplete.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/affineAdjustmentComplete.js +16 -16
- package/lib/exercises/math/functions/affines/affineAdjustmentRsquared.js +12 -12
- package/lib/exercises/math/probaStat/stats2var/fineAdjustementExercise.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats2var/fineAdjustementExercise.js +19 -8
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"affineAdjustment.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/affineAdjustment.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAclC,KAAK,WAAW,GAAG;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;
|
|
1
|
+
{"version":3,"file":"affineAdjustment.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/affineAdjustment.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAclC,KAAK,WAAW,GAAG;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAuJF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,CAc1D,CAAC"}
|
|
@@ -28,22 +28,22 @@ function generateLinearData(n) {
|
|
|
28
28
|
return data;
|
|
29
29
|
}
|
|
30
30
|
const getAffineAdjustmentQuestion = () => {
|
|
31
|
-
const data = generateLinearData(
|
|
31
|
+
const data = generateLinearData(6);
|
|
32
32
|
data.sort((a, b) => a.x - b.x);
|
|
33
33
|
const xValues = data.map((point) => point.x);
|
|
34
34
|
const yValues = data.map((point) => point.y);
|
|
35
|
-
const G1x = (0, round_1.round)((xValues[0] + xValues[1] + xValues[2]
|
|
36
|
-
const G2x = (0, round_1.round)((xValues[
|
|
37
|
-
const G1y = (0, round_1.round)((yValues[0] + yValues[1] + yValues[2]
|
|
38
|
-
const G2y = (0, round_1.round)((yValues[
|
|
35
|
+
const G1x = (0, round_1.round)((xValues[0] + xValues[1] + xValues[2]) / 3, 1);
|
|
36
|
+
const G2x = (0, round_1.round)((xValues[3] + xValues[4] + xValues[5]) / 3, 1);
|
|
37
|
+
const G1y = (0, round_1.round)((yValues[0] + yValues[1] + yValues[2]) / 3, 1);
|
|
38
|
+
const G2y = (0, round_1.round)((yValues[3] + yValues[4] + yValues[5]) / 3, 1);
|
|
39
39
|
const a = (G2y - G1y) / (G2x - G1x);
|
|
40
|
-
const afixed = (0, round_1.round)(a,
|
|
40
|
+
const afixed = (0, round_1.round)(a, 1);
|
|
41
41
|
const b = G2y - a * G2x;
|
|
42
|
-
const bfixed = (0, round_1.round)(b,
|
|
42
|
+
const bfixed = (0, round_1.round)(b, 1);
|
|
43
43
|
const answer = new equalNode_1.EqualNode(new variableNode_1.VariableNode("y"), new addNode_1.AddNode(new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode(afixed), new variableNode_1.VariableNode("x")), new numberNode_1.NumberNode(bfixed)).simplify({ forbidFactorize: true })).toTex();
|
|
44
44
|
let dataTable = `
|
|
45
|
-
| $x$ | ${xValues.join(" | ")} |
|
|
46
|
-
|
|
45
|
+
| $x$ | ${xValues.map((n) => n.frenchify()).join(" | ")} |
|
|
46
|
+
|-|-|-|-|-|-|-|
|
|
47
47
|
| $y$ | ${yValues.map((n) => n.frenchify()).join(" | ")} |
|
|
48
48
|
`;
|
|
49
49
|
const question = {
|
|
@@ -61,15 +61,15 @@ const getPropositions = (n, { answer, G1x, G2x, G1y, G2y }) => {
|
|
|
61
61
|
const propositions = [];
|
|
62
62
|
(0, exercise_1.addValidProp)(propositions, answer, "tex");
|
|
63
63
|
const a = (G2y - G1y) / (G2x - G1x);
|
|
64
|
-
const afixed = (0, round_1.round)(a,
|
|
64
|
+
const afixed = (0, round_1.round)(a, 1);
|
|
65
65
|
const b = G2y - a * G2x;
|
|
66
|
-
const bfixed = (0, round_1.round)(b,
|
|
66
|
+
const bfixed = (0, round_1.round)(b, 1);
|
|
67
67
|
const wrongAnswer1 = new equalNode_1.EqualNode(new variableNode_1.VariableNode("y"), new substractNode_1.SubstractNode(new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode(afixed), new variableNode_1.VariableNode("x")), new numberNode_1.NumberNode(bfixed)).simplify({ forbidFactorize: true }));
|
|
68
68
|
const awrong = (G2x - G1x) / (G2y - G1y);
|
|
69
69
|
const bwrong = G1y - a * G1x;
|
|
70
|
-
const wrongAnswer2 = new equalNode_1.EqualNode(new variableNode_1.VariableNode("y"), new addNode_1.AddNode(new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode((0, round_1.round)(awrong,
|
|
71
|
-
const wrongAnswer3 = new equalNode_1.EqualNode(new variableNode_1.VariableNode("y"), new addNode_1.AddNode(new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode(afixed), new variableNode_1.VariableNode("x")), new numberNode_1.NumberNode((0, round_1.round)(bwrong,
|
|
72
|
-
const wrongAnswer4 = new equalNode_1.EqualNode(new variableNode_1.VariableNode("y"), new addNode_1.AddNode(new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode((0, round_1.round)(awrong,
|
|
70
|
+
const wrongAnswer2 = new equalNode_1.EqualNode(new variableNode_1.VariableNode("y"), new addNode_1.AddNode(new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode((0, round_1.round)(awrong, 1)), new variableNode_1.VariableNode("x")), new numberNode_1.NumberNode(bfixed)).simplify({ forbidFactorize: true }));
|
|
71
|
+
const wrongAnswer3 = new equalNode_1.EqualNode(new variableNode_1.VariableNode("y"), new addNode_1.AddNode(new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode(afixed), new variableNode_1.VariableNode("x")), new numberNode_1.NumberNode((0, round_1.round)(bwrong, 1))).simplify({ forbidFactorize: true }));
|
|
72
|
+
const wrongAnswer4 = new equalNode_1.EqualNode(new variableNode_1.VariableNode("y"), new addNode_1.AddNode(new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode((0, round_1.round)(awrong, 1)), new variableNode_1.VariableNode("x")), new numberNode_1.NumberNode((0, round_1.round)(bwrong, 1))).simplify({ forbidFactorize: true }));
|
|
73
73
|
(0, exercise_1.tryToAddWrongProp)(propositions, wrongAnswer1.toTex());
|
|
74
74
|
(0, exercise_1.tryToAddWrongProp)(propositions, wrongAnswer2.toTex());
|
|
75
75
|
(0, exercise_1.tryToAddWrongProp)(propositions, wrongAnswer3.toTex());
|
|
@@ -84,9 +84,9 @@ const getPropositions = (n, { answer, G1x, G2x, G1y, G2y }) => {
|
|
|
84
84
|
};
|
|
85
85
|
const isAnswerValid = (ans, { G1x, G2x, G1y, G2y }) => {
|
|
86
86
|
const a = (G2y - G1y) / (G2x - G1x);
|
|
87
|
-
const afixed = (0, round_1.round)(a,
|
|
87
|
+
const afixed = (0, round_1.round)(a, 1);
|
|
88
88
|
const b = G2y - a * G2x;
|
|
89
|
-
const bfixed = (0, round_1.round)(b,
|
|
89
|
+
const bfixed = (0, round_1.round)(b, 1);
|
|
90
90
|
const valid = new equalNode_1.EqualNode(new variableNode_1.VariableNode("y"), new addNode_1.AddNode(new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode(afixed), new variableNode_1.VariableNode("x")), new numberNode_1.NumberNode(bfixed)).simplify({ forbidFactorize: true }));
|
|
91
91
|
const latexs = valid.toAllValidTexs({ allowRawRightChildAsSolution: true });
|
|
92
92
|
return latexs.includes(ans);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"affineAdjustmentComplete.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/affineAdjustmentComplete.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAelC,KAAK,WAAW,GAAG;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;
|
|
1
|
+
{"version":3,"file":"affineAdjustmentComplete.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/affineAdjustmentComplete.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAelC,KAAK,WAAW,GAAG;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAqLF,eAAO,MAAM,gCAAgC,EAAE,QAAQ,CAAC,WAAW,CAelE,CAAC"}
|
|
@@ -40,27 +40,27 @@ function calculateRSquared(xValues, yValues) {
|
|
|
40
40
|
const denominator = Math.sqrt((n * sumX2 - sumX * sumX) * (n * sumY2 - sumY * sumY));
|
|
41
41
|
const r = numerator / denominator;
|
|
42
42
|
const rSquared = r * r;
|
|
43
|
-
return rSquared;
|
|
43
|
+
return (0, round_1.round)(rSquared, 2);
|
|
44
44
|
}
|
|
45
45
|
const getAffineAdjustmentCompleteQuestion = () => {
|
|
46
|
-
const data = generateLinearData(
|
|
46
|
+
const data = generateLinearData(6);
|
|
47
47
|
data.sort((a, b) => a.x - b.x);
|
|
48
48
|
const xValues = data.map((point) => point.x);
|
|
49
49
|
const yValues = data.map((point) => point.y);
|
|
50
|
-
const G1x = (0, round_1.round)((xValues[0] + xValues[1] + xValues[2]
|
|
51
|
-
const G2x = (0, round_1.round)((xValues[
|
|
52
|
-
const G1y = (0, round_1.round)((yValues[0] + yValues[1] + yValues[2]
|
|
53
|
-
const G2y = (0, round_1.round)((yValues[
|
|
50
|
+
const G1x = (0, round_1.round)((xValues[0] + xValues[1] + xValues[2]) / 3, 1);
|
|
51
|
+
const G2x = (0, round_1.round)((xValues[3] + xValues[4] + xValues[5]) / 3, 1);
|
|
52
|
+
const G1y = (0, round_1.round)((yValues[0] + yValues[1] + yValues[2]) / 3, 1);
|
|
53
|
+
const G2y = (0, round_1.round)((yValues[3] + yValues[4] + yValues[5]) / 3, 1);
|
|
54
54
|
const rSquared = calculateRSquared(xValues, yValues);
|
|
55
55
|
const a = (G2y - G1y) / (G2x - G1x);
|
|
56
|
-
const afixed = (0, round_1.round)(a,
|
|
56
|
+
const afixed = (0, round_1.round)(a, 1);
|
|
57
57
|
const b = G2y - a * G2x;
|
|
58
|
-
const bfixed = (0, round_1.round)(b,
|
|
58
|
+
const bfixed = (0, round_1.round)(b, 1);
|
|
59
59
|
const answerEq = new equalNode_1.EqualNode(new variableNode_1.VariableNode("y"), new addNode_1.AddNode(new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode(afixed), new variableNode_1.VariableNode("x")), new numberNode_1.NumberNode(bfixed)).simplify({ forbidFactorize: true })).toTex();
|
|
60
|
-
const answerR = new equalNode_1.EqualNode(new powerNode_1.PowerNode(new variableNode_1.VariableNode("R"), new numberNode_1.NumberNode(2)),
|
|
60
|
+
const answerR = new equalNode_1.EqualNode(new powerNode_1.PowerNode(new variableNode_1.VariableNode("R"), new numberNode_1.NumberNode(2)), rSquared.toTree()).toTex();
|
|
61
61
|
let dataTable = `
|
|
62
62
|
| $x$ | ${xValues.join(" | ")} |
|
|
63
|
-
|
|
63
|
+
|-|-|-|-|-|-|-|
|
|
64
64
|
| $y$ | ${yValues.map((n) => n.frenchify()).join(" | ")} |
|
|
65
65
|
`;
|
|
66
66
|
const question = {
|
|
@@ -78,16 +78,16 @@ const getPropositions = (n, { answer, G1x, G2x, G1y, G2y, rSquared }) => {
|
|
|
78
78
|
const propositions = [];
|
|
79
79
|
(0, exercise_1.addValidProp)(propositions, answer, "tex");
|
|
80
80
|
const a = (G2y - G1y) / (G2x - G1x);
|
|
81
|
-
const afixed = (0, round_1.round)(a,
|
|
81
|
+
const afixed = (0, round_1.round)(a, 1);
|
|
82
82
|
const b = G2y - a * G2x;
|
|
83
|
-
const bfixed = (0, round_1.round)(b,
|
|
83
|
+
const bfixed = (0, round_1.round)(b, 1);
|
|
84
84
|
const answerEq = new equalNode_1.EqualNode(new variableNode_1.VariableNode("y"), new addNode_1.AddNode(new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode(afixed), new variableNode_1.VariableNode("x")), new numberNode_1.NumberNode(bfixed)).simplify({ forbidFactorize: true })).toTex();
|
|
85
|
-
const answerR = new equalNode_1.EqualNode(new powerNode_1.PowerNode(new variableNode_1.VariableNode("R"), new numberNode_1.NumberNode(2)),
|
|
85
|
+
const answerR = new equalNode_1.EqualNode(new powerNode_1.PowerNode(new variableNode_1.VariableNode("R"), new numberNode_1.NumberNode(2)), rSquared.toTree()).toTex();
|
|
86
86
|
const wrongAnswerEq1 = new equalNode_1.EqualNode(new variableNode_1.VariableNode("y"), new substractNode_1.SubstractNode(new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode(afixed), new variableNode_1.VariableNode("x")), new numberNode_1.NumberNode(bfixed)).simplify({ forbidFactorize: true })).toTex();
|
|
87
87
|
const awrong = (G2x - G1x) / (G2y - G1y);
|
|
88
|
-
const wrongAnswerEq2 = new equalNode_1.EqualNode(new variableNode_1.VariableNode("y"), new addNode_1.AddNode(new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode((0, round_1.round)(awrong,
|
|
89
|
-
const wrongAnswerR1 = new equalNode_1.EqualNode(new variableNode_1.VariableNode("R"),
|
|
90
|
-
const wrongAnswerR2 = new equalNode_1.EqualNode(new powerNode_1.PowerNode(new variableNode_1.VariableNode("R"), new numberNode_1.NumberNode(2)), (
|
|
88
|
+
const wrongAnswerEq2 = new equalNode_1.EqualNode(new variableNode_1.VariableNode("y"), new addNode_1.AddNode(new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode((0, round_1.round)(awrong, 1)), new variableNode_1.VariableNode("x")), new numberNode_1.NumberNode(bfixed)).simplify({ forbidFactorize: true })).toTex();
|
|
89
|
+
const wrongAnswerR1 = new equalNode_1.EqualNode(new variableNode_1.VariableNode("R"), rSquared.toTree()).toTex();
|
|
90
|
+
const wrongAnswerR2 = new equalNode_1.EqualNode(new powerNode_1.PowerNode(new variableNode_1.VariableNode("R"), new numberNode_1.NumberNode(2)), (rSquared + 0.01).toTree()).toTex();
|
|
91
91
|
const wrongAnswer1 = `${answerEq}\\newline ${wrongAnswerR1}`;
|
|
92
92
|
const wrongAnswer2 = `${answerEq}\\newline ${wrongAnswerR2}`;
|
|
93
93
|
const wrongAnswer3 = `${wrongAnswerEq1}\\newline ${answerR}`;
|
|
@@ -37,18 +37,18 @@ function calculateRSquared(xValues, yValues) {
|
|
|
37
37
|
const denominator = Math.sqrt((n * sumX2 - sumX * sumX) * (n * sumY2 - sumY * sumY));
|
|
38
38
|
const r = numerator / denominator;
|
|
39
39
|
const rSquared = r * r;
|
|
40
|
-
return rSquared;
|
|
40
|
+
return (0, round_1.round)(rSquared, 2);
|
|
41
41
|
}
|
|
42
42
|
const getAffineAdjustmentRsquaredQuestion = () => {
|
|
43
|
-
const data = generateLinearData(
|
|
43
|
+
const data = generateLinearData(6);
|
|
44
44
|
data.sort((a, b) => a.x - b.x);
|
|
45
|
-
const xValues = data.map((point) => (0, round_1.round)(point.x,
|
|
46
|
-
const yValues = data.map((point) => (0, round_1.round)(point.y,
|
|
45
|
+
const xValues = data.map((point) => (0, round_1.round)(point.x, 1));
|
|
46
|
+
const yValues = data.map((point) => (0, round_1.round)(point.y, 1));
|
|
47
47
|
const rSquared = calculateRSquared(xValues, yValues);
|
|
48
|
-
const answer = new equalNode_1.EqualNode(new powerNode_1.PowerNode(new variableNode_1.VariableNode("R"), new numberNode_1.NumberNode(2)),
|
|
48
|
+
const answer = new equalNode_1.EqualNode(new powerNode_1.PowerNode(new variableNode_1.VariableNode("R"), new numberNode_1.NumberNode(2)), rSquared.toTree()).toTex();
|
|
49
49
|
let dataTable = `
|
|
50
50
|
| $x$ | ${xValues.join(" | ")} |
|
|
51
|
-
|
|
51
|
+
|-|-|-|-|-|-|-|
|
|
52
52
|
| $y$ | ${yValues.map((n) => n.frenchify()).join(" | ")} |
|
|
53
53
|
`;
|
|
54
54
|
const question = {
|
|
@@ -65,21 +65,21 @@ const getAffineAdjustmentRsquaredQuestion = () => {
|
|
|
65
65
|
const getPropositions = (n, { answer, rSquared }) => {
|
|
66
66
|
const propositions = [];
|
|
67
67
|
(0, exercise_1.addValidProp)(propositions, answer, "tex");
|
|
68
|
-
const wrongAnswer1 = new equalNode_1.EqualNode(new variableNode_1.VariableNode("R"),
|
|
69
|
-
const wrongAnswer2 = new equalNode_1.EqualNode(new powerNode_1.PowerNode(new variableNode_1.VariableNode("R"), new numberNode_1.NumberNode(2)), (
|
|
70
|
-
const wrongAnswer3 = new equalNode_1.EqualNode(new variableNode_1.VariableNode("R"), (-
|
|
68
|
+
const wrongAnswer1 = new equalNode_1.EqualNode(new variableNode_1.VariableNode("R"), rSquared.toTree()).toTex();
|
|
69
|
+
const wrongAnswer2 = new equalNode_1.EqualNode(new powerNode_1.PowerNode(new variableNode_1.VariableNode("R"), new numberNode_1.NumberNode(2)), (rSquared + 0.01).toTree()).toTex();
|
|
70
|
+
const wrongAnswer3 = new equalNode_1.EqualNode(new variableNode_1.VariableNode("R"), (rSquared - 0.01).toTree()).toTex();
|
|
71
71
|
(0, exercise_1.tryToAddWrongProp)(propositions, wrongAnswer1);
|
|
72
72
|
(0, exercise_1.tryToAddWrongProp)(propositions, wrongAnswer2);
|
|
73
73
|
(0, exercise_1.tryToAddWrongProp)(propositions, wrongAnswer3);
|
|
74
74
|
while (propositions.length < n) {
|
|
75
|
-
const wrongAnswer = new equalNode_1.EqualNode(new powerNode_1.PowerNode(new variableNode_1.VariableNode("R"), new numberNode_1.NumberNode(
|
|
75
|
+
const wrongAnswer = new equalNode_1.EqualNode(new powerNode_1.PowerNode(new variableNode_1.VariableNode("R"), new numberNode_1.NumberNode(1)), (0, round_1.round)(Math.random(), 2).toTree()).toTex();
|
|
76
76
|
(0, exercise_1.tryToAddWrongProp)(propositions, wrongAnswer);
|
|
77
77
|
}
|
|
78
78
|
return (0, exercise_1.shuffleProps)(propositions, n);
|
|
79
79
|
};
|
|
80
80
|
const isAnswerValid = (ans, { rSquared }) => {
|
|
81
|
-
const
|
|
82
|
-
const latexs =
|
|
81
|
+
const validanswer = new equalNode_1.EqualNode(new powerNode_1.PowerNode(new variableNode_1.VariableNode("R"), new numberNode_1.NumberNode(2)), rSquared.toTree());
|
|
82
|
+
const latexs = validanswer.toAllValidTexs({
|
|
83
83
|
allowRawRightChildAsSolution: true,
|
|
84
84
|
allowFractionToDecimal: true,
|
|
85
85
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fineAdjustementExercise.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats2var/fineAdjustementExercise.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAWlC,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,OAAO,CAAC;CACtB,CAAC;
|
|
1
|
+
{"version":3,"file":"fineAdjustementExercise.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/probaStat/stats2var/fineAdjustementExercise.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAWlC,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,OAAO,CAAC;CACtB,CAAC;AAqHF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAezD,CAAC"}
|
|
@@ -49,19 +49,19 @@ const getPropositions = (n, { answer, isJustified }) => {
|
|
|
49
49
|
generateProposition(isJustified).forEach((value) => (0, exercise_1.tryToAddWrongProp)(propositions, value, "raw"));
|
|
50
50
|
let randomNb;
|
|
51
51
|
while (propositions.length < n) {
|
|
52
|
-
randomNb = (0, randfloat_1.randfloat)(
|
|
52
|
+
randomNb = (0, randfloat_1.randfloat)(0, 0.5, 2);
|
|
53
53
|
(0, exercise_1.tryToAddWrongProp)(propositions, `Un ajustement affine est justifié. Le coefficient de détermination vaut ${randomNb}`);
|
|
54
54
|
}
|
|
55
55
|
return (0, exercise_1.shuffleProps)(propositions, n);
|
|
56
56
|
};
|
|
57
57
|
const generateProposition = (isJustified) => {
|
|
58
|
-
let randCoeff = (0, randfloat_1.randfloat)(
|
|
58
|
+
let randCoeff = (0, randfloat_1.randfloat)(0, 0.7, 2);
|
|
59
59
|
let node = new numberNode_1.NumberNode(randCoeff);
|
|
60
60
|
const firstProposition = `Un ajustement affine est justifié. Le coefficient de détermination vaut ${node.toTex()}`;
|
|
61
61
|
randCoeff = (0, randfloat_1.randfloat)(0.9, 1.0, 2);
|
|
62
62
|
node = new numberNode_1.NumberNode(randCoeff);
|
|
63
63
|
const secondProposition = `Un ajustement affine n'est pas justifié. Le coefficient de détermination vaut ${node.toTex()}`;
|
|
64
|
-
randCoeff = isJustified ? (0, randfloat_1.randfloat)(
|
|
64
|
+
randCoeff = isJustified ? (0, randfloat_1.randfloat)(0, 0.7, 2) : (0, randfloat_1.randfloat)(0.9, 1.0, 2);
|
|
65
65
|
node = new numberNode_1.NumberNode(randCoeff);
|
|
66
66
|
const thirdProposition = `Un ajustement affine ${isJustified ? `n'est pas justifié` : `est justifié`}. Le coefficient de détermination vaut ${node.toTex()}`;
|
|
67
67
|
return [firstProposition, secondProposition, thirdProposition];
|
|
@@ -74,11 +74,22 @@ const generateExercise = () => {
|
|
|
74
74
|
const cloudPoints = flip
|
|
75
75
|
? CloudPoints_1.CloudPointsConstructor.random(8)
|
|
76
76
|
: CloudPoints_1.CloudPointsConstructor.randomLinear(8);
|
|
77
|
-
const coeff = cloudPoints.getCorrelationCoeff();
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
77
|
+
const coeff = cloudPoints.getCorrelationCoeff().value;
|
|
78
|
+
let determinationCoeff = new numberNode_1.NumberNode(+(coeff * coeff).toFixed(2));
|
|
79
|
+
if (determinationCoeff.value === 0) {
|
|
80
|
+
determinationCoeff = new numberNode_1.NumberNode(0.1);
|
|
81
|
+
}
|
|
82
|
+
if (determinationCoeff.value === 1) {
|
|
83
|
+
determinationCoeff = new numberNode_1.NumberNode(0.99);
|
|
84
|
+
}
|
|
85
|
+
const correctAnswer = determinationCoeff.value >= 0.9
|
|
86
|
+
? `Un ajustement affine est justifié. Le coefficient de détermination vaut ${determinationCoeff.toTex()}`
|
|
87
|
+
: `Un ajustement affine n'est pas justifié. Le coefficient de détermination vaut ${determinationCoeff.toTex()}`;
|
|
88
|
+
return {
|
|
89
|
+
cloudPoints,
|
|
90
|
+
isJustified: determinationCoeff.value >= 0.9,
|
|
91
|
+
correctAnswer,
|
|
92
|
+
};
|
|
82
93
|
};
|
|
83
94
|
exports.fineAdjustementExercise = {
|
|
84
95
|
id: "fineAdjustementExercise",
|