math-exercises 3.0.88 → 3.0.90
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/exercise.d.ts +1 -1
- package/lib/exercises/exercise.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/findZeroesProductQuotient.d.ts +11 -0
- package/lib/exercises/math/calcul/arithmetics/findZeroesProductQuotient.d.ts.map +1 -0
- package/lib/exercises/math/calcul/arithmetics/findZeroesProductQuotient.js +213 -0
- package/lib/exercises/math/calcul/arithmetics/index.d.ts +1 -0
- package/lib/exercises/math/calcul/arithmetics/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/index.js +1 -0
- package/lib/exercises/math/calcul/arithmetics/isInequalityTrue.js +2 -2
- package/lib/exercises/math/calculLitteral/distributivity/simpleDistriXCoeff.d.ts.map +1 -1
- package/lib/exercises/math/conversion/lengthConversion.js +1 -1
- package/lib/exercises/math/functions/affines/affineFromExercise.d.ts +9 -0
- package/lib/exercises/math/functions/affines/affineFromExercise.d.ts.map +1 -0
- package/lib/exercises/math/functions/affines/affineFromExercise.js +111 -0
- package/lib/exercises/math/functions/affines/index.d.ts +1 -0
- package/lib/exercises/math/functions/affines/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/index.js +1 -0
- package/lib/exercises/math/functions/basics/index.d.ts +1 -0
- package/lib/exercises/math/functions/basics/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/index.js +2 -0
- package/lib/exercises/math/functions/basics/signOfFunction.d.ts +8 -0
- package/lib/exercises/math/functions/basics/signOfFunction.d.ts.map +1 -0
- package/lib/exercises/math/functions/basics/signOfFunction.js +122 -0
- package/lib/exercises/math/functions/parity/finishParityFunctionGraph.d.ts +9 -0
- package/lib/exercises/math/functions/parity/finishParityFunctionGraph.d.ts.map +1 -0
- package/lib/exercises/math/functions/parity/finishParityFunctionGraph.js +154 -0
- package/lib/exercises/math/functions/parity/index.d.ts +1 -0
- package/lib/exercises/math/functions/parity/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/parity/index.js +1 -0
- package/lib/exercises/math/functions/sign/affineProductSignTable.d.ts +9 -0
- package/lib/exercises/math/functions/sign/affineProductSignTable.d.ts.map +1 -0
- package/lib/exercises/math/functions/sign/affineProductSignTable.js +201 -0
- package/lib/exercises/math/functions/sign/affineSignTable.d.ts +8 -0
- package/lib/exercises/math/functions/sign/affineSignTable.d.ts.map +1 -0
- package/lib/exercises/math/functions/sign/affineSignTable.js +111 -0
- package/lib/exercises/math/functions/sign/index.d.ts +4 -0
- package/lib/exercises/math/functions/sign/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/sign/index.js +4 -0
- package/lib/exercises/math/functions/sign/readSignTable.d.ts +10 -0
- package/lib/exercises/math/functions/sign/readSignTable.d.ts.map +1 -0
- package/lib/exercises/math/functions/sign/readSignTable.js +124 -0
- package/lib/exercises/math/functions/sign/signTableFromGraph.d.ts +11 -0
- package/lib/exercises/math/functions/sign/signTableFromGraph.d.ts.map +1 -0
- package/lib/exercises/math/functions/sign/signTableFromGraph.js +141 -0
- package/lib/exercises/math/functions/square/squareImageInterval.d.ts.map +1 -1
- package/lib/exercises/math/functions/square/squareImageInterval.js +7 -1
- package/lib/exercises/math/functions/variations/compareImagesInVarTable.d.ts +11 -0
- package/lib/exercises/math/functions/variations/compareImagesInVarTable.d.ts.map +1 -0
- package/lib/exercises/math/functions/variations/compareImagesInVarTable.js +153 -0
- package/lib/exercises/math/functions/variations/index.d.ts +2 -0
- package/lib/exercises/math/functions/variations/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/variations/index.js +2 -0
- package/lib/exercises/math/functions/variations/varTableFromGraph.d.ts +9 -0
- package/lib/exercises/math/functions/variations/varTableFromGraph.d.ts.map +1 -0
- package/lib/exercises/math/functions/variations/varTableFromGraph.js +184 -0
- package/lib/exercises/math/geometry/vectors/colinearity/alignementViaColinearity.d.ts +12 -0
- package/lib/exercises/math/geometry/vectors/colinearity/alignementViaColinearity.d.ts.map +1 -0
- package/lib/exercises/math/geometry/vectors/colinearity/alignementViaColinearity.js +127 -0
- package/lib/exercises/math/geometry/vectors/colinearity/colinearity.d.ts +11 -0
- package/lib/exercises/math/geometry/vectors/colinearity/colinearity.d.ts.map +1 -0
- package/lib/exercises/math/geometry/vectors/colinearity/colinearity.js +118 -0
- package/lib/exercises/math/geometry/vectors/colinearity/colinearityFromBasis.d.ts +11 -0
- package/lib/exercises/math/geometry/vectors/colinearity/colinearityFromBasis.d.ts.map +1 -0
- package/lib/exercises/math/geometry/vectors/colinearity/colinearityFromBasis.js +158 -0
- package/lib/exercises/math/geometry/vectors/colinearity/index.d.ts +4 -0
- package/lib/exercises/math/geometry/vectors/colinearity/index.d.ts.map +1 -0
- package/lib/exercises/math/geometry/vectors/colinearity/index.js +3 -0
- package/lib/exercises/math/geometry/vectors/distributeAndReduceVectors.d.ts +9 -0
- package/lib/exercises/math/geometry/vectors/distributeAndReduceVectors.d.ts.map +1 -0
- package/lib/exercises/math/geometry/vectors/distributeAndReduceVectors.js +174 -0
- package/lib/exercises/math/geometry/vectors/index.d.ts +2 -2
- package/lib/exercises/math/geometry/vectors/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/index.js +2 -2
- package/lib/exercises/math/index.d.ts +1 -0
- package/lib/exercises/math/index.d.ts.map +1 -1
- package/lib/exercises/math/index.js +1 -0
- package/lib/exercises/math/primitive/polynomialPrimitive.d.ts.map +1 -1
- package/lib/exercises/math/primitive/polynomialPrimitive.js +10 -1
- package/lib/exercises/math/probaStat/basicProbas/rouletteProbas.js +1 -1
- package/lib/exercises/math/python/variableAffectation.js +2 -2
- package/lib/exercises/math/tests/index.d.ts +2 -0
- package/lib/exercises/math/tests/index.d.ts.map +1 -0
- package/lib/exercises/math/tests/index.js +1 -0
- package/lib/exercises/math/tests/testMultiLineSignTable.d.ts +9 -0
- package/lib/exercises/math/tests/testMultiLineSignTable.d.ts.map +1 -0
- package/lib/exercises/math/tests/testMultiLineSignTable.js +156 -0
- package/lib/exercises/math/tests/testSignTable.d.ts +8 -0
- package/lib/exercises/math/tests/testSignTable.d.ts.map +1 -0
- package/lib/exercises/math/tests/testSignTable.js +90 -0
- package/lib/exercises/math/tests/testVarTable.d.ts +11 -0
- package/lib/exercises/math/tests/testVarTable.d.ts.map +1 -0
- package/lib/exercises/math/tests/testVarTable.js +147 -0
- package/lib/exercises/math/trigonometry/index.d.ts +1 -0
- package/lib/exercises/math/trigonometry/index.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/index.js +1 -0
- package/lib/exercises/math/trigonometry/trigoFundamentalEquation.d.ts +9 -0
- package/lib/exercises/math/trigonometry/trigoFundamentalEquation.d.ts.map +1 -0
- package/lib/exercises/math/trigonometry/trigoFundamentalEquation.js +151 -0
- package/lib/geogebra/parsers/ggbPointsToPoints.d.ts +3 -0
- package/lib/geogebra/parsers/ggbPointsToPoints.d.ts.map +1 -0
- package/lib/geogebra/parsers/ggbPointsToPoints.js +12 -0
- package/lib/index.d.ts +73 -12
- package/lib/index.d.ts.map +1 -1
- package/lib/latexTester.js +2 -0
- package/lib/math/numbers/reals/real.d.ts.map +1 -1
- package/lib/math/numbers/reals/real.js +7 -2
- package/lib/playground.d.ts.map +1 -1
- package/lib/tests/exoTest.d.ts.map +1 -1
- package/lib/tests/exoTest.js +9 -3
- package/lib/tests/questionTest.d.ts.map +1 -1
- package/lib/tests/questionTest.js +19 -10
- package/lib/tree/nodes/operators/addNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/addNode.js +3 -1
- package/lib/tree/parsers/latexParser.d.ts.map +1 -1
- package/lib/tree/parsers/latexParser.js +10 -0
- package/lib/types/keyIds.d.ts +1 -1
- package/lib/types/keyIds.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, } from "../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { GeogebraConstructor } from "../../../geogebra/geogebraConstructor.js";
|
|
4
|
+
import { randint } from "../../../math/utils/random/randint.js";
|
|
5
|
+
import { handleVEAError } from "../../../utils/errors/handleVEAError.js";
|
|
6
|
+
const getFunc = (identifiers) => {
|
|
7
|
+
const { k, x1, x2, C } = identifiers;
|
|
8
|
+
return (x) => 2 * k * x ** 3 - 3 * k * (x1 + x2) * x ** 2 + 6 * x1 * x2 * k * x + C;
|
|
9
|
+
};
|
|
10
|
+
const getPropositions = (n, { answer }) => {
|
|
11
|
+
const propositions = [];
|
|
12
|
+
addValidProp(propositions, answer);
|
|
13
|
+
while (propositions.length < n) {
|
|
14
|
+
throw Error("QCM not implemented");
|
|
15
|
+
}
|
|
16
|
+
return shuffleProps(propositions, n);
|
|
17
|
+
};
|
|
18
|
+
const getGGBOptions = (identifiers) => {
|
|
19
|
+
const { k, x1, x2, C } = identifiers;
|
|
20
|
+
const commands = [
|
|
21
|
+
`f(x) = 2*${k}*x^3 - 3*${k}*(${x1}+(${x2}))*x^2 + 6*${x1}*${x2}*${k}*x + ${C}`,
|
|
22
|
+
];
|
|
23
|
+
const ggb = new GeogebraConstructor({
|
|
24
|
+
commands,
|
|
25
|
+
});
|
|
26
|
+
return ggb.getOptions({
|
|
27
|
+
coords: [-10, 10, -10, 10],
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
const getAnswerTable = (identifiers) => {
|
|
31
|
+
const { k, x1, x2, C } = identifiers;
|
|
32
|
+
const fct = getFunc(identifiers);
|
|
33
|
+
const fx1 = fct(x1);
|
|
34
|
+
const fx2 = fct(x2);
|
|
35
|
+
const vars = k > 0
|
|
36
|
+
? ["\\nearrow", "\\searrow", "\\nearrow"]
|
|
37
|
+
: ["\\searrow", "\\nearrow", "\\searrow"];
|
|
38
|
+
return [
|
|
39
|
+
[
|
|
40
|
+
"$x$",
|
|
41
|
+
"-\\infty",
|
|
42
|
+
"\\ ",
|
|
43
|
+
x1.toTree().toTex(),
|
|
44
|
+
"\\ ",
|
|
45
|
+
x2.toTree().toTex(),
|
|
46
|
+
"\\ ",
|
|
47
|
+
"+\\infty",
|
|
48
|
+
],
|
|
49
|
+
[
|
|
50
|
+
"\\ ",
|
|
51
|
+
"\\ ",
|
|
52
|
+
"\\ ",
|
|
53
|
+
k > 0 ? fx1.toTree().toTex() : "\\ ",
|
|
54
|
+
"\\ ",
|
|
55
|
+
k > 0 ? "\\ " : fx2.toTree().toTex(),
|
|
56
|
+
"\\ ",
|
|
57
|
+
"\\ ",
|
|
58
|
+
],
|
|
59
|
+
["$f(x)$", "\\ ", vars[0], "\\ ", vars[1], "\\ ", vars[2], "\\ "],
|
|
60
|
+
[
|
|
61
|
+
"\\ ",
|
|
62
|
+
"\\ ",
|
|
63
|
+
"\\ ",
|
|
64
|
+
k > 0 ? fx2.toTree().toTex() : "\\ ",
|
|
65
|
+
"\\ ",
|
|
66
|
+
k > 0 ? "\\ " : fx1.toTree().toTex(),
|
|
67
|
+
"\\ ",
|
|
68
|
+
"\\ ",
|
|
69
|
+
],
|
|
70
|
+
];
|
|
71
|
+
};
|
|
72
|
+
const getInstruction = (identifiers) => {
|
|
73
|
+
return `Dresser le tableau de variations de la fonction $f$ définie sur $\\mathbb{R}$ dont la courbe représentative est donnée ci-dessous :`;
|
|
74
|
+
};
|
|
75
|
+
const getHint = (identifiers) => {
|
|
76
|
+
return `indice`;
|
|
77
|
+
};
|
|
78
|
+
const getCorrection = (identifiers) => {
|
|
79
|
+
return `correction : le tableau attendu est donc :
|
|
80
|
+
|
|
81
|
+
`;
|
|
82
|
+
};
|
|
83
|
+
const getKeys = (identifiers) => {
|
|
84
|
+
return ["inf"];
|
|
85
|
+
};
|
|
86
|
+
const isAnswerTableValid = (ans, { answerTable }) => {
|
|
87
|
+
try {
|
|
88
|
+
return ans.every((row, i) => row.every((cell, j) => cell === answerTable[i][j]));
|
|
89
|
+
}
|
|
90
|
+
catch (err) {
|
|
91
|
+
return handleVEAError(err);
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
const getTestSignTableQuestion = (ops) => {
|
|
95
|
+
const k = randint(-4, 5, [0]);
|
|
96
|
+
let x1 = randint(-9, 10);
|
|
97
|
+
let x2 = randint(-9, 10, [x1]);
|
|
98
|
+
if (x1 > x2)
|
|
99
|
+
[x1, x2] = [x2, x1];
|
|
100
|
+
const C = randint(-9, 10);
|
|
101
|
+
const initTable = [
|
|
102
|
+
["$x$", "", "\\ ", "", "\\ ", "", "\\ ", ""],
|
|
103
|
+
["$\\ $", "\\ ", "\\ ", "\\ ", "\\ ", "\\ ", "\\ ", "\\ "],
|
|
104
|
+
["$f(x)$", "\\ ", "", "", "", "", "", "\\ "],
|
|
105
|
+
["$\\ $", "\\ ", "\\ ", "\\ ", "\\ ", "\\ ", "\\ ", "\\ "],
|
|
106
|
+
];
|
|
107
|
+
const identifiers = {
|
|
108
|
+
k,
|
|
109
|
+
x1,
|
|
110
|
+
x2,
|
|
111
|
+
C,
|
|
112
|
+
initTable,
|
|
113
|
+
};
|
|
114
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
115
|
+
};
|
|
116
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
117
|
+
return {
|
|
118
|
+
answerTable: getAnswerTable(identifiers),
|
|
119
|
+
instruction: getInstruction(identifiers),
|
|
120
|
+
keys: getKeys(identifiers),
|
|
121
|
+
answerFormat: "tex",
|
|
122
|
+
identifiers,
|
|
123
|
+
hint: getHint(identifiers),
|
|
124
|
+
correction: getCorrection(identifiers),
|
|
125
|
+
initTable: identifiers.initTable,
|
|
126
|
+
ggbOptions: getGGBOptions(identifiers),
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
export const testVarTable = {
|
|
130
|
+
id: "testVarTable",
|
|
131
|
+
label: "Test Tableau Variations basique",
|
|
132
|
+
isSingleStep: true,
|
|
133
|
+
generator: (nb, opts) => getDistinctQuestions(() => getTestSignTableQuestion(opts), nb),
|
|
134
|
+
qcmTimer: 60,
|
|
135
|
+
freeTimer: 60,
|
|
136
|
+
getPropositions,
|
|
137
|
+
isAnswerTableValid,
|
|
138
|
+
subject: "Mathématiques",
|
|
139
|
+
getInstruction,
|
|
140
|
+
getHint,
|
|
141
|
+
getCorrection,
|
|
142
|
+
getAnswerTable,
|
|
143
|
+
getQuestionFromIdentifiers,
|
|
144
|
+
hasHintAndCorrection: true,
|
|
145
|
+
answerType: "varTable",
|
|
146
|
+
hasGeogebra: true,
|
|
147
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/trigonometry/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kCAAkC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/trigonometry/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kCAAkC,CAAC;AACjD,cAAc,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Exercise } from "../../../exercises/exercise.js";
|
|
2
|
+
import { NodeIdentifiers } from "../../../tree/nodes/nodeConstructor.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
givenValue: NodeIdentifiers;
|
|
5
|
+
isCosGiven: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare const trigoFundamentalEquation: Exercise<Identifiers>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=trigoFundamentalEquation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trigoFundamentalEquation.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/trigonometry/trigoFundamentalEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAW7C,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,eAAe,CAAC;IAC5B,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AAwIF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,CAmB1D,CAAC"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { RationalConstructor } from "../../../math/numbers/rationals/rational.js";
|
|
4
|
+
import { randfloat } from "../../../math/utils/random/randfloat.js";
|
|
5
|
+
import { sqrt } from "../../../tree/nodes/functions/sqrtNode.js";
|
|
6
|
+
import { reifyAlgebraic, } from "../../../tree/nodes/nodeConstructor.js";
|
|
7
|
+
import { frac } from "../../../tree/nodes/operators/fractionNode.js";
|
|
8
|
+
import { square } 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 { probaFlip } from "../../../utils/alea/probaFlip.js";
|
|
13
|
+
import { random } from "../../../utils/alea/random.js";
|
|
14
|
+
import { handleVEAError } from "../../../utils/errors/handleVEAError.js";
|
|
15
|
+
const getPropositions = (n, { answer, givenValue }) => {
|
|
16
|
+
const propositions = [];
|
|
17
|
+
addValidProp(propositions, answer);
|
|
18
|
+
const value = reifyAlgebraic(givenValue);
|
|
19
|
+
tryToAddWrongProp(propositions, substract(1, value).simplify().toTex());
|
|
20
|
+
while (propositions.length < n) {
|
|
21
|
+
tryToAddWrongProp(propositions, randfloat(0, 1, 1).frenchify());
|
|
22
|
+
}
|
|
23
|
+
return shuffleProps(propositions, n);
|
|
24
|
+
};
|
|
25
|
+
const getAnswerNode = (identifiers) => {
|
|
26
|
+
const { givenValue, isCosGiven } = identifiers;
|
|
27
|
+
const squared = substract(1, square(reifyAlgebraic(givenValue))).simplify();
|
|
28
|
+
return sqrt(squared).simplify();
|
|
29
|
+
};
|
|
30
|
+
const getAnswer = (identifiers) => {
|
|
31
|
+
return getAnswerNode(identifiers).toTex();
|
|
32
|
+
};
|
|
33
|
+
const getInstruction = (identifiers) => {
|
|
34
|
+
const { givenValue, isCosGiven } = identifiers;
|
|
35
|
+
const node = isCosGiven
|
|
36
|
+
? `\\cos(\\alpha) = ${reifyAlgebraic(givenValue).toTex()}`
|
|
37
|
+
: `\\sin(\\alpha) = ${reifyAlgebraic(givenValue).toTex()}`;
|
|
38
|
+
return `$\\alpha$ est la mesure en degrés d'un angle aigu dans un triangle rectangle.
|
|
39
|
+
|
|
40
|
+
Calculer $${isCosGiven ? "\\sin" : "\\cos"}(\\alpha)$ sachant que :
|
|
41
|
+
|
|
42
|
+
$$
|
|
43
|
+
${node}
|
|
44
|
+
$$
|
|
45
|
+
|
|
46
|
+
Donner la valeur exacte ou une valeur arrondie au centième.`;
|
|
47
|
+
};
|
|
48
|
+
const getHint = (identifiers) => {
|
|
49
|
+
return `Utilise la relation :
|
|
50
|
+
|
|
51
|
+
$$
|
|
52
|
+
\\cos^2(\\alpha) + \\sin^2(\\alpha) = 1
|
|
53
|
+
$$`;
|
|
54
|
+
};
|
|
55
|
+
const getCorrection = (identifiers) => {
|
|
56
|
+
const { givenValue, isCosGiven } = identifiers;
|
|
57
|
+
const valueNode = reifyAlgebraic(givenValue);
|
|
58
|
+
const squareValue = square(valueNode).simplify();
|
|
59
|
+
const node = isCosGiven
|
|
60
|
+
? `\\cos(\\alpha) = ${valueNode.toTex()}`
|
|
61
|
+
: `\\sin(\\alpha) = ${valueNode.toTex()}`;
|
|
62
|
+
const squareNode = isCosGiven
|
|
63
|
+
? `\\cos^2(\\alpha) = ${squareValue.toTex()}`
|
|
64
|
+
: `\\sin^2(\\alpha) = ${squareValue.toTex()}`;
|
|
65
|
+
const fct = isCosGiven ? "\\sin" : "\\cos";
|
|
66
|
+
return `On utilise la relation suivante :
|
|
67
|
+
|
|
68
|
+
$$
|
|
69
|
+
\\cos^2(\\alpha) + \\sin^2(\\alpha) = 1
|
|
70
|
+
$$
|
|
71
|
+
|
|
72
|
+
Puisque $${node}$, on a donc :
|
|
73
|
+
|
|
74
|
+
$$
|
|
75
|
+
${squareNode}
|
|
76
|
+
$$
|
|
77
|
+
|
|
78
|
+
Donc :
|
|
79
|
+
|
|
80
|
+
$$
|
|
81
|
+
${fct}^2(\\alpha) = 1 - ${squareValue.toTex()} = ${substract(1, squareValue)
|
|
82
|
+
.simplify()
|
|
83
|
+
.toTex()}
|
|
84
|
+
$$
|
|
85
|
+
|
|
86
|
+
Puisque l'angle est aigu, on cherche une valeur positive.
|
|
87
|
+
|
|
88
|
+
On en déduit donc :
|
|
89
|
+
|
|
90
|
+
$$
|
|
91
|
+
${fct}(\\alpha) = ${getAnswer(identifiers)}
|
|
92
|
+
$$
|
|
93
|
+
`;
|
|
94
|
+
};
|
|
95
|
+
const getKeys = (identifiers) => {
|
|
96
|
+
return [];
|
|
97
|
+
};
|
|
98
|
+
const isAnswerValid = (ans, { answer, ...identifiers }) => {
|
|
99
|
+
try {
|
|
100
|
+
const parsed = parseAlgebraic(ans);
|
|
101
|
+
const answerNode = getAnswerNode(identifiers);
|
|
102
|
+
const simp = parsed.simplify().toTex();
|
|
103
|
+
return (simp === answer ||
|
|
104
|
+
Math.abs(parsed.evaluate() - answerNode.evaluate()) < 0.01);
|
|
105
|
+
}
|
|
106
|
+
catch (err) {
|
|
107
|
+
return handleVEAError(err);
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
const getTrigoFundamentalEquationQuestion = (ops) => {
|
|
111
|
+
const isCosGiven = coinFlip();
|
|
112
|
+
const givenValue = probaFlip(0.3)
|
|
113
|
+
? randfloat(0, 1, 1).toTree()
|
|
114
|
+
: coinFlip()
|
|
115
|
+
? RationalConstructor.randomIrreductibleProba().toTree()
|
|
116
|
+
: frac(sqrt(random([2, 3])), 2);
|
|
117
|
+
const identifiers = {
|
|
118
|
+
isCosGiven,
|
|
119
|
+
givenValue: givenValue.toIdentifiers(),
|
|
120
|
+
};
|
|
121
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
122
|
+
};
|
|
123
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
124
|
+
return {
|
|
125
|
+
answer: getAnswer(identifiers),
|
|
126
|
+
instruction: getInstruction(identifiers),
|
|
127
|
+
keys: getKeys(identifiers),
|
|
128
|
+
answerFormat: "tex",
|
|
129
|
+
identifiers,
|
|
130
|
+
hint: getHint(identifiers),
|
|
131
|
+
correction: getCorrection(identifiers),
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
export const trigoFundamentalEquation = {
|
|
135
|
+
id: "trigoFundamentalEquation",
|
|
136
|
+
connector: "=",
|
|
137
|
+
label: "Calculer le cosinus d'un angle à partir de son sinus (ou inversement)",
|
|
138
|
+
isSingleStep: true,
|
|
139
|
+
generator: (nb, opts) => getDistinctQuestions(() => getTrigoFundamentalEquationQuestion(opts), nb),
|
|
140
|
+
qcmTimer: 60,
|
|
141
|
+
freeTimer: 60,
|
|
142
|
+
getPropositions,
|
|
143
|
+
isAnswerValid,
|
|
144
|
+
subject: "Mathématiques",
|
|
145
|
+
getInstruction,
|
|
146
|
+
getHint,
|
|
147
|
+
getCorrection,
|
|
148
|
+
getAnswer,
|
|
149
|
+
getQuestionFromIdentifiers,
|
|
150
|
+
hasHintAndCorrection: true,
|
|
151
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ggbPointsToPoints.d.ts","sourceRoot":"","sources":["../../../src/geogebra/parsers/ggbPointsToPoints.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAoB,MAAM,8BAA8B,CAAC;AAGvE,eAAO,MAAM,iBAAiB,aAAc,MAAM,EAAE,YASnD,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Point } from "../../math/geometry/point.js";
|
|
2
|
+
import { ggbPointToCoords } from "./ggbPointToCoords.js";
|
|
3
|
+
export const ggbPointsToPoints = (commands) => {
|
|
4
|
+
const points = commands.filter((s) => s.match(/^[A-Z]=\(/));
|
|
5
|
+
const finalPoints = points.map((p) => {
|
|
6
|
+
const split = p.split("=");
|
|
7
|
+
const name = split[0];
|
|
8
|
+
const { x, y } = ggbPointToCoords(split[1]);
|
|
9
|
+
return new Point(p.split("=")[0], x, y);
|
|
10
|
+
});
|
|
11
|
+
return finalPoints;
|
|
12
|
+
};
|
package/lib/index.d.ts
CHANGED
|
@@ -72,6 +72,12 @@ declare const mathExercises: (Exercise<{
|
|
|
72
72
|
}, {}> | Exercise<{
|
|
73
73
|
point: import("./math/geometry/point.js").PointIdentifiers;
|
|
74
74
|
bounding: number;
|
|
75
|
+
}, {}> | Exercise<{
|
|
76
|
+
type: number;
|
|
77
|
+
a: number;
|
|
78
|
+
b?: number;
|
|
79
|
+
c?: number;
|
|
80
|
+
d?: number;
|
|
75
81
|
}, {}> | Exercise<{
|
|
76
82
|
integerFirst: boolean;
|
|
77
83
|
integer: number;
|
|
@@ -831,6 +837,10 @@ declare const mathExercises: (Exercise<{
|
|
|
831
837
|
xB: number;
|
|
832
838
|
yA: number;
|
|
833
839
|
yB: number;
|
|
840
|
+
}, {}> | Exercise<{
|
|
841
|
+
phrase: number;
|
|
842
|
+
initial: number;
|
|
843
|
+
growth: number;
|
|
834
844
|
}, {}> | Exercise<{
|
|
835
845
|
xValue: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
836
846
|
polynomeCoeffs: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers[];
|
|
@@ -897,6 +907,9 @@ declare const mathExercises: (Exercise<{
|
|
|
897
907
|
inegalitySymbol: import("./math/inequations/inequation.js").InegalitySymbols;
|
|
898
908
|
a: number;
|
|
899
909
|
b: number;
|
|
910
|
+
}, {}> | Exercise<{
|
|
911
|
+
a: number;
|
|
912
|
+
type: number;
|
|
900
913
|
}, {}> | Exercise<{
|
|
901
914
|
coeffs: number[];
|
|
902
915
|
initTable: string[][];
|
|
@@ -1062,6 +1075,10 @@ declare const mathExercises: (Exercise<{
|
|
|
1062
1075
|
}, {}> | Exercise<{
|
|
1063
1076
|
type: string;
|
|
1064
1077
|
fctCmd: string;
|
|
1078
|
+
}, {}> | Exercise<{
|
|
1079
|
+
isEven: boolean;
|
|
1080
|
+
isLeftSideGiven: boolean;
|
|
1081
|
+
givenPointsCoords: number[][];
|
|
1065
1082
|
}, {}> | Exercise<{
|
|
1066
1083
|
a: number;
|
|
1067
1084
|
b: number;
|
|
@@ -1120,11 +1137,38 @@ declare const mathExercises: (Exercise<{
|
|
|
1120
1137
|
}, {
|
|
1121
1138
|
instructionType: string;
|
|
1122
1139
|
}> | Exercise<{
|
|
1140
|
+
affineCoeffs: number[];
|
|
1141
|
+
initTable: string[][];
|
|
1142
|
+
}, {}> | Exercise<{
|
|
1143
|
+
affine1Coeffs: number[];
|
|
1144
|
+
affine2Coeffs: number[];
|
|
1145
|
+
initTable: string[][];
|
|
1146
|
+
}, {}> | Exercise<{
|
|
1147
|
+
signs: string[];
|
|
1148
|
+
xs: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers[];
|
|
1149
|
+
x: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
1150
|
+
}, {}> | Exercise<{
|
|
1151
|
+
initTable: string[][];
|
|
1152
|
+
a: number;
|
|
1153
|
+
x1: number;
|
|
1154
|
+
x2: number;
|
|
1155
|
+
x3: number;
|
|
1156
|
+
}, {}> | Exercise<{
|
|
1123
1157
|
xValues: number[];
|
|
1124
1158
|
yValues: number[];
|
|
1125
1159
|
isAskingX: boolean;
|
|
1126
1160
|
isAskingMin: boolean;
|
|
1127
1161
|
intervalXIndexes: number[];
|
|
1162
|
+
}, {}> | Exercise<{
|
|
1163
|
+
type: number;
|
|
1164
|
+
coeffs: number[];
|
|
1165
|
+
initTable: string[][];
|
|
1166
|
+
}, {}> | Exercise<{
|
|
1167
|
+
xs: number[];
|
|
1168
|
+
ys: number[];
|
|
1169
|
+
vars: string[];
|
|
1170
|
+
a: number;
|
|
1171
|
+
b: number;
|
|
1128
1172
|
}, {}> | Exercise<{
|
|
1129
1173
|
a: number;
|
|
1130
1174
|
b: number;
|
|
@@ -1286,18 +1330,6 @@ declare const mathExercises: (Exercise<{
|
|
|
1286
1330
|
B: number[];
|
|
1287
1331
|
startLetter: string;
|
|
1288
1332
|
endLetter: string;
|
|
1289
|
-
}, {}> | Exercise<{
|
|
1290
|
-
xu: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
1291
|
-
yu: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
1292
|
-
xv: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
1293
|
-
yv: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
1294
|
-
}, {}> | Exercise<{
|
|
1295
|
-
xA: number;
|
|
1296
|
-
xB: number;
|
|
1297
|
-
xC: number;
|
|
1298
|
-
yA: number;
|
|
1299
|
-
yB: number;
|
|
1300
|
-
yC: number;
|
|
1301
1333
|
}, {}> | Exercise<{
|
|
1302
1334
|
xA: number;
|
|
1303
1335
|
xB: number;
|
|
@@ -1401,6 +1433,26 @@ declare const mathExercises: (Exercise<{
|
|
|
1401
1433
|
coeff: number;
|
|
1402
1434
|
}, {}> | Exercise<{
|
|
1403
1435
|
pointsIdentifiers: import("./math/geometry/point.js").PointIdentifiers[];
|
|
1436
|
+
}, {}> | Exercise<{
|
|
1437
|
+
xu: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
1438
|
+
yu: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
1439
|
+
xv: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
1440
|
+
yv: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
1441
|
+
}, {}> | Exercise<{
|
|
1442
|
+
xA: number;
|
|
1443
|
+
xB: number;
|
|
1444
|
+
xC: number;
|
|
1445
|
+
yA: number;
|
|
1446
|
+
yB: number;
|
|
1447
|
+
yC: number;
|
|
1448
|
+
}, {}> | Exercise<{
|
|
1449
|
+
a: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
1450
|
+
b: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
1451
|
+
c: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
1452
|
+
d: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
1453
|
+
}, {}> | Exercise<{
|
|
1454
|
+
expression: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
1455
|
+
type: number;
|
|
1404
1456
|
}, {}> | Exercise<{
|
|
1405
1457
|
trinom: number[];
|
|
1406
1458
|
}, {}> | Exercise<{
|
|
@@ -2260,6 +2312,9 @@ declare const mathExercises: (Exercise<{
|
|
|
2260
2312
|
}, {}> | Exercise<{
|
|
2261
2313
|
degree: number;
|
|
2262
2314
|
leftBoundPiMultiple: number;
|
|
2315
|
+
}, {}> | Exercise<{
|
|
2316
|
+
givenValue: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
2317
|
+
isCosGiven: boolean;
|
|
2263
2318
|
}, {}> | Exercise<{
|
|
2264
2319
|
initialValue: number;
|
|
2265
2320
|
step: number;
|
|
@@ -2358,6 +2413,12 @@ declare const mathExercises: (Exercise<{
|
|
|
2358
2413
|
}, {}> | Exercise<{
|
|
2359
2414
|
points: number[][];
|
|
2360
2415
|
labels: string[];
|
|
2416
|
+
}, {}> | Exercise<{
|
|
2417
|
+
k: number;
|
|
2418
|
+
x1: number;
|
|
2419
|
+
x2: number;
|
|
2420
|
+
C: number;
|
|
2421
|
+
initTable: string[][];
|
|
2361
2422
|
}, {}>)[];
|
|
2362
2423
|
declare const pcExercises: (Exercise<{
|
|
2363
2424
|
atomicMass: number;
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,aAAa,MAAM,2BAA2B,CAAC;AAE3D,OAAO,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,QAAA,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,aAAa,MAAM,2BAA2B,CAAC;AAE3D,OAAO,4BAA4B,CAAC;AACpC,OAAO,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
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"real.d.ts","sourceRoot":"","sources":["../../../../src/math/numbers/reals/real.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"real.d.ts","sourceRoot":"","sources":["../../../../src/math/numbers/reals/real.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AASlE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAClD,8BAAsB,eAAe;IACnC,MAAM,CAAC,MAAM;CAUd;AACD,qBAAa,IAAK,YAAW,MAAM;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,UAAU,CAAC;gBACL,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM;IAKtC,MAAM,CAAC,CAAC,EAAE,MAAM;IAGhB,MAAM,IAAI,aAAa;CAIxB;AAED,8BAAsB,qBAAqB;IACzC;;OAEG;IACH,MAAM,CAAC,kBAAkB,CAAC,EACxB,kBAA0B,EAC1B,SAAc,GACf;;;KAAA,GAAG,UAAU;IASd,MAAM,CAAC,kBAAkB,CAAC,GAAG,GAAE,MAAW,GAAG,UAAU;CAIxD;AAED,qBAAa,UAAW,SAAQ,IAAI;IAClC,OAAO,EAAE,MAAM,CAAC;gBACJ,OAAO,EAAE,MAAM;IAK3B,cAAc;IAMd,mBAAmB,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC;IAkBvC,sDAAsD;IACtD,aAAa,IAAI,MAAM;IAMvB,QAAQ,IAAI,MAAM;IA+BlB,KAAK,IAAI,MAAM;IAIf,MAAM;CAGP"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { isSquare } from "../../../math/utils/arithmetic/isSquare.js";
|
|
2
2
|
import { primeFactors } from "../../../math/utils/arithmetic/primeFactors.js";
|
|
3
3
|
import { randint } from "../../../math/utils/random/randint.js";
|
|
4
|
+
import { round } from "../../../math/utils/round.js";
|
|
4
5
|
import { SqrtNode } from "../../../tree/nodes/functions/sqrtNode.js";
|
|
5
6
|
import { NumberNode } from "../../../tree/nodes/numbers/numberNode.js";
|
|
6
7
|
import { PiNode } from "../../../tree/nodes/numbers/piNode.js";
|
|
@@ -100,8 +101,12 @@ export class SquareRoot extends Real {
|
|
|
100
101
|
return new Integer(0);
|
|
101
102
|
if (this.operand === 1)
|
|
102
103
|
return new Integer(1);
|
|
103
|
-
if (Math.floor(this.operand) !== this.operand)
|
|
104
|
-
|
|
104
|
+
if (Math.floor(this.operand) !== this.operand) {
|
|
105
|
+
const ev = Math.sqrt(this.operand);
|
|
106
|
+
if (round(ev, 8) === ev)
|
|
107
|
+
return new Decimal(ev);
|
|
108
|
+
return this;
|
|
109
|
+
}
|
|
105
110
|
const [outsideSqrt, insideSqrt] = this.getSimplifiedCoeffs();
|
|
106
111
|
const simplified = insideSqrt !== 1
|
|
107
112
|
? new Real(outsideSqrt * Math.sqrt(insideSqrt), `${outsideSqrt === 1 ? "" : `${outsideSqrt}`}\\sqrt{${insideSqrt}}`)
|
package/lib/playground.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playground.d.ts","sourceRoot":"","sources":["../src/playground.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"playground.d.ts","sourceRoot":"","sources":["../src/playground.ts"],"names":[],"mappings":"AAuCA,eAAO,MAAM,UAAU,YAAW,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exoTest.d.ts","sourceRoot":"","sources":["../../src/tests/exoTest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAIvD,eAAO,MAAM,OAAO,QAAS,QAAQ;;;;
|
|
1
|
+
{"version":3,"file":"exoTest.d.ts","sourceRoot":"","sources":["../../src/tests/exoTest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAIvD,eAAO,MAAM,OAAO,QAAS,QAAQ;;;;CA+FpC,CAAC"}
|
package/lib/tests/exoTest.js
CHANGED
|
@@ -21,14 +21,18 @@ export const exoTest = (exo) => {
|
|
|
21
21
|
generatorTime = after - before;
|
|
22
22
|
if (exo.answerType !== "free" &&
|
|
23
23
|
exo.answerType !== "GGB" &&
|
|
24
|
-
exo.answerType !== "valueTable"
|
|
24
|
+
exo.answerType !== "valueTable" &&
|
|
25
|
+
exo.answerType !== "varTable" &&
|
|
26
|
+
exo.answerType !== "signTable") {
|
|
25
27
|
if (!exo.getPropositions)
|
|
26
28
|
throw new Error(`exo ${exo.id} has no getPropositions`);
|
|
27
29
|
}
|
|
28
30
|
if (exo.answerType !== "QCM" &&
|
|
29
31
|
exo.answerType !== "QCU" &&
|
|
30
32
|
exo.answerType !== "GGB" &&
|
|
31
|
-
exo.answerType !== "valueTable"
|
|
33
|
+
exo.answerType !== "valueTable" &&
|
|
34
|
+
exo.answerType !== "varTable" &&
|
|
35
|
+
exo.answerType !== "signTable") {
|
|
32
36
|
if (!exo.isAnswerValid)
|
|
33
37
|
throw new Error(`exo ${exo.id} has no isAnswerValid`);
|
|
34
38
|
}
|
|
@@ -36,7 +40,9 @@ export const exoTest = (exo) => {
|
|
|
36
40
|
if (!exo.isGGBAnswerValid)
|
|
37
41
|
throw new Error(`exo ${exo.id} has no isGGBAnswerValid`);
|
|
38
42
|
}
|
|
39
|
-
if (exo.answerType === "valueTable"
|
|
43
|
+
if (exo.answerType === "valueTable" ||
|
|
44
|
+
exo.answerType === "varTable" ||
|
|
45
|
+
exo.answerType === "signTable") {
|
|
40
46
|
if (!exo.isAnswerTableValid)
|
|
41
47
|
throw new Error(`exo ${exo.id} has no isAnswerTableValid`);
|
|
42
48
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"questionTest.d.ts","sourceRoot":"","sources":["../../src/tests/questionTest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAIjE,eAAO,MAAM,YAAY,QAAS,QAAQ,YAAY,QAAQ;;;
|
|
1
|
+
{"version":3,"file":"questionTest.d.ts","sourceRoot":"","sources":["../../src/tests/questionTest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAIjE,eAAO,MAAM,YAAY,QAAS,QAAQ,YAAY,QAAQ;;;CAkN7D,CAAC"}
|
|
@@ -43,7 +43,9 @@ export const questionTest = (exo, question) => {
|
|
|
43
43
|
if (!question.studentGgbOptions?.coords?.length)
|
|
44
44
|
throw new Error(`exo ${exo.id} has no studentGgbOptions Coords`);
|
|
45
45
|
}
|
|
46
|
-
else if (exo.answerType === "valueTable"
|
|
46
|
+
else if (exo.answerType === "valueTable" ||
|
|
47
|
+
exo.answerType === "varTable" ||
|
|
48
|
+
exo.answerType === "signTable") {
|
|
47
49
|
if (!question.answerTable?.length)
|
|
48
50
|
throw new Error(`exo ${exo.id} has no answerTable`);
|
|
49
51
|
}
|
|
@@ -62,14 +64,17 @@ export const questionTest = (exo, question) => {
|
|
|
62
64
|
}
|
|
63
65
|
}
|
|
64
66
|
if (question.answerTable) {
|
|
65
|
-
for (
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if (!latexTester(cell, true))
|
|
67
|
+
for (let i = 0; i < question.answerTable.length; i++) {
|
|
68
|
+
for (let j = 0; j < question.answerTable[0].length; j++) {
|
|
69
|
+
const cell = question.answerTable[i][j];
|
|
70
|
+
if (cell.match(dotDecimalPattern))
|
|
71
|
+
throw new Error(`exo ${exo.id} has invalid number format`);
|
|
72
|
+
if (cell.includes("[object Object]"))
|
|
72
73
|
throw new Error(`exo ${exo.id} has invalid answer`);
|
|
74
|
+
if (question.answerFormat !== "raw") {
|
|
75
|
+
if (!latexTester(cell, j === 0 ? false : true))
|
|
76
|
+
throw new Error(`exo ${exo.id} has invalid answer`);
|
|
77
|
+
}
|
|
73
78
|
}
|
|
74
79
|
}
|
|
75
80
|
}
|
|
@@ -120,7 +125,9 @@ export const questionTest = (exo, question) => {
|
|
|
120
125
|
if (exo.answerType !== "QCM" &&
|
|
121
126
|
exo.answerType !== "QCU" &&
|
|
122
127
|
exo.answerType !== "GGB" &&
|
|
123
|
-
exo.answerType !== "valueTable"
|
|
128
|
+
exo.answerType !== "valueTable" &&
|
|
129
|
+
exo.answerType !== "signTable" &&
|
|
130
|
+
exo.answerType !== "varTable") {
|
|
124
131
|
if (!question.keys)
|
|
125
132
|
throw new Error(`exo ${exo.id} has no keys`);
|
|
126
133
|
const answer = question.answer;
|
|
@@ -134,7 +141,9 @@ export const questionTest = (exo, question) => {
|
|
|
134
141
|
}
|
|
135
142
|
if (exo.answerType !== "free" &&
|
|
136
143
|
exo.answerType !== "GGB" &&
|
|
137
|
-
exo.answerType !== "valueTable"
|
|
144
|
+
exo.answerType !== "valueTable" &&
|
|
145
|
+
exo.answerType !== "varTable" &&
|
|
146
|
+
exo.answerType !== "signTable") {
|
|
138
147
|
let before = Date.now();
|
|
139
148
|
console.log("will generate props : ", exo.id, "ids :", question.identifiers);
|
|
140
149
|
const props = exo.getPropositions(4, {
|