math-exercises 3.0.33 → 3.0.34
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 -0
- package/lib/exercises/exercise.d.ts.map +1 -1
- package/lib/exercises/exercise.js +9 -0
- package/lib/exercises/math/calcul/addAndSub.d.ts.map +1 -1
- package/lib/exercises/math/calcul/addAndSub.js +35 -17
- package/lib/exercises/math/conversion/hoursToSecond.d.ts +9 -0
- package/lib/exercises/math/conversion/hoursToSecond.d.ts.map +1 -0
- package/lib/exercises/math/conversion/hoursToSecond.js +94 -0
- package/lib/exercises/math/conversion/index.d.ts +1 -0
- package/lib/exercises/math/conversion/index.d.ts.map +1 -1
- package/lib/exercises/math/conversion/index.js +1 -0
- package/lib/exercises/math/dataRepresentations/pieChartReading.d.ts.map +1 -1
- package/lib/exercises/math/dataRepresentations/pieChartReading.js +14 -3
- package/lib/exercises/math/derivation/derivative/thirdDegreeFunctionVariation.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/thirdDegreeFunctionVariation.js +41 -8
- package/lib/exercises/math/derivation/tangent/derivativeNumberReading.d.ts.map +1 -1
- package/lib/exercises/math/derivation/tangent/derivativeNumberReading.js +3 -1
- package/lib/exercises/math/derivation/tangent/derivativeTangentEquationReading.d.ts.map +1 -1
- package/lib/exercises/math/derivation/tangent/derivativeTangentEquationReading.js +3 -1
- package/lib/exercises/math/derivation/tangent/tangentEquations.d.ts.map +1 -1
- package/lib/exercises/math/derivation/tangent/tangentEquations.js +95 -26
- package/lib/exercises/math/functions/affines/leadingCoefficientCalculV1.js +2 -2
- package/lib/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationByFactorisation.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationFromCano.js +2 -2
- package/lib/exercises/math/functions/trinoms/factoForm/factorizedFormFromRoots.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/factoForm/factorizedFormFromRoots.js +39 -16
- package/lib/exercises/math/functions/trinoms/roots/niceRootsFromDevForm.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/roots/niceRootsFromDevForm.js +35 -16
- package/lib/exercises/math/functions/trinoms/roots/rootsFromDevForm.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/roots/rootsFromDevForm.js +31 -8
- package/lib/exercises/math/functions/trinoms/roots/rootsFromFactorizedForm.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/roots/rootsFromFactorizedForm.js +7 -5
- package/lib/exercises/math/percent/applyPercent.d.ts.map +1 -1
- package/lib/exercises/math/percent/applyPercent.js +8 -9
- package/lib/exercises/math/percent/averageEvolutionRate.d.ts.map +1 -1
- package/lib/exercises/math/percent/averageEvolutionRate.js +3 -3
- package/lib/exercises/math/percent/findStartValueAfterEvolution.d.ts.map +1 -1
- package/lib/exercises/math/percent/findStartValueAfterEvolution.js +4 -2
- package/lib/exercises/math/percent/percentWritings.js +1 -1
- package/lib/index.d.ts +4 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/playground.d.ts.map +1 -1
- package/lib/playground.js +2 -2
- package/lib/tree/nodes/numbers/percentNode.d.ts +1 -1
- package/lib/tree/nodes/numbers/percentNode.d.ts.map +1 -1
- package/lib/tree/nodes/numbers/percentNode.js +5 -4
- package/lib/tree/parsers/latexParser.d.ts.map +1 -1
- package/lib/tree/parsers/latexParser.js +11 -0
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { KeyId } from "../types/keyIds.js";
|
|
2
2
|
import { KeyProps } from "../types/keyProps.js";
|
|
3
|
+
export declare const propWhile: (propositions: Proposition[], n: number, doStuff: () => void) => void;
|
|
3
4
|
export declare const addValidProp: (props: Proposition[], statement: string, format?: "tex" | "raw") => void;
|
|
4
5
|
export declare const addWrongProp: (props: Proposition[], statement: string, format?: "tex" | "raw") => void;
|
|
5
6
|
export declare const tryToAddWrongProp: (props: Proposition[], statement: string, format?: "tex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T,qBAAqB,GACrB,oBAAoB,GACpB,UAAU,GACV,mBAAmB,GACnB,YAAY,GACZ,cAAc,GACd,YAAY,GACZ,cAAc,GACd,kBAAkB,GAClB,kBAAkB,GAClB,QAAQ,GACR,YAAY,GACZ,QAAQ,GACR,iBAAiB,GACjB,cAAc,GACd,cAAc,GACd,QAAQ,GACR,UAAU,GACV,uBAAuB,GACvB,oBAAoB,GACpB,eAAe,GACf,gBAAgB,GAChB,UAAU,CAAC;AAEf,MAAM,MAAM,SAAS,GACjB,mBAAmB,GACnB,sBAAsB,GACtB,QAAQ,GACR,kBAAkB,GAClB,WAAW,GACX,SAAS,GACT,cAAc,GACd,+CAA+C,GAC/C,OAAO,GACP,KAAK,GACL,wBAAwB,GACxB,SAAS,GACT,KAAK,GACL,aAAa,GACb,4BAA4B,GAC5B,oBAAoB,GACpB,WAAW,GACX,iBAAiB,GACjB,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"exercise.d.ts","sourceRoot":"","sources":["../../src/exercises/exercise.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAInD,eAAO,MAAM,SAAS,iBACN,WAAW,EAAE,KACxB,MAAM,WACA,MAAM,IAAI,SAQpB,CAAC;AACF,eAAO,MAAM,YAAY,UAChB,WAAW,EAAE,aACT,MAAM,WACT,KAAK,GAAG,KAAK,SAQtB,CAAC;AACF,eAAO,MAAM,YAAY,UAChB,WAAW,EAAE,aACT,MAAM,WACT,KAAK,GAAG,KAAK,SAQtB,CAAC;AACF,eAAO,MAAM,iBAAiB,UACrB,WAAW,EAAE,aACT,MAAM,WACT,KAAK,GAAG,KAAK,SAUtB,CAAC;AAEF,eAAO,MAAM,YAAY,UAChB,WAAW,EAAE,KACjB,MAAM,sBACW,MAAM,kBAQ3B,CAAC;AAEF,oBAAY,qBAAqB;IAC/B,UAAU,eAAe;IACzB,GA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alea/shuffle.js";
|
|
2
2
|
import { uuid } from "uuidv4";
|
|
3
|
+
export const propWhile = (propositions, n, doStuff) => {
|
|
4
|
+
let i = 0;
|
|
5
|
+
while (propositions.length < n) {
|
|
6
|
+
if (i > 1000)
|
|
7
|
+
throw new Error("Prop Loop infinite");
|
|
8
|
+
doStuff();
|
|
9
|
+
i++;
|
|
10
|
+
}
|
|
11
|
+
};
|
|
3
12
|
export const addValidProp = (props, statement, format = "tex") => {
|
|
4
13
|
props.push({
|
|
5
14
|
id: uuid(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addAndSub.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/calcul/addAndSub.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"addAndSub.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/calcul/addAndSub.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,QAAQ,EAWT,MAAM,mBAAmB,CAAC;AAgD3B,KAAK,WAAW,GAAG;IAAE,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAkBzC,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAcnD,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
|
|
2
|
+
import { numberVEA } from "../../../exercises/vea/numberVEA.js";
|
|
2
3
|
import { randint } from "../../../math/utils/random/randint.js";
|
|
3
4
|
import { NumberNode } from "../../../tree/nodes/numbers/numberNode.js";
|
|
4
5
|
import { AddNode } from "../../../tree/nodes/operators/addNode.js";
|
|
@@ -7,26 +8,44 @@ import { addValidProp, tryToAddWrongProp, } from "../../exercise.js";
|
|
|
7
8
|
/**
|
|
8
9
|
* a±b±c±d
|
|
9
10
|
*/
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const numbers = [];
|
|
13
|
-
for (let i = 0; i < nbOperations + 1; i++) {
|
|
14
|
-
numbers.push(randint(-15, 15, [0]));
|
|
15
|
-
}
|
|
11
|
+
const getStatementNode = (identifiers) => {
|
|
12
|
+
const { numbers } = identifiers;
|
|
16
13
|
const allNumbersNodes = numbers.map((nb) => new NumberNode(nb));
|
|
17
14
|
let statementTree = new AddNode(allNumbersNodes[0], allNumbersNodes[1]);
|
|
18
15
|
for (let i = 2; i < allNumbersNodes.length; i++) {
|
|
19
16
|
statementTree = new AddNode(statementTree, allNumbersNodes[i]);
|
|
20
17
|
}
|
|
18
|
+
return statementTree;
|
|
19
|
+
};
|
|
20
|
+
const getStartStatement = (identifiers) => {
|
|
21
|
+
return getStatementNode(identifiers).toTex();
|
|
22
|
+
};
|
|
23
|
+
const getInstruction = (identifiers) => {
|
|
24
|
+
return `Calculer :
|
|
25
|
+
|
|
26
|
+
$$
|
|
27
|
+
${getStartStatement(identifiers)}
|
|
28
|
+
$$`;
|
|
29
|
+
};
|
|
30
|
+
const getAnswer = (identifiers) => {
|
|
31
|
+
const { numbers } = identifiers;
|
|
21
32
|
const answer = numbers.reduce((a, b) => a + b) + "";
|
|
22
|
-
|
|
33
|
+
return answer;
|
|
34
|
+
};
|
|
35
|
+
const getAddAndSubQuestions = () => {
|
|
36
|
+
const nbOperations = randint(2, 4);
|
|
37
|
+
const numbers = [];
|
|
38
|
+
for (let i = 0; i < nbOperations + 1; i++) {
|
|
39
|
+
numbers.push(randint(-15, 15, [0]));
|
|
40
|
+
}
|
|
41
|
+
const identifiers = { numbers };
|
|
23
42
|
const question = {
|
|
24
|
-
instruction:
|
|
25
|
-
startStatement:
|
|
26
|
-
answer,
|
|
43
|
+
instruction: getInstruction(identifiers),
|
|
44
|
+
startStatement: getStartStatement(identifiers),
|
|
45
|
+
answer: getAnswer(identifiers),
|
|
27
46
|
keys: [],
|
|
28
47
|
answerFormat: "tex",
|
|
29
|
-
identifiers
|
|
48
|
+
identifiers,
|
|
30
49
|
};
|
|
31
50
|
return question;
|
|
32
51
|
};
|
|
@@ -40,17 +59,13 @@ const getPropositions = (n, { answer }) => {
|
|
|
40
59
|
}
|
|
41
60
|
return shuffle(propositions);
|
|
42
61
|
};
|
|
43
|
-
const isAnswerValid = (
|
|
44
|
-
|
|
45
|
-
const texs = answerTree.toAllValidTexs();
|
|
46
|
-
return texs.includes(studentAns);
|
|
62
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
63
|
+
return numberVEA(ans, answer);
|
|
47
64
|
};
|
|
48
65
|
export const addAndSubExercise = {
|
|
49
66
|
id: "addAndSub",
|
|
50
67
|
connector: "=",
|
|
51
68
|
label: "Additions et soustractions de nombres entiers",
|
|
52
|
-
levels: ["6ème", "5ème"],
|
|
53
|
-
sections: ["Calculs"],
|
|
54
69
|
isSingleStep: true,
|
|
55
70
|
generator: (nb) => getDistinctQuestions(getAddAndSubQuestions, nb),
|
|
56
71
|
qcmTimer: 60,
|
|
@@ -58,4 +73,7 @@ export const addAndSubExercise = {
|
|
|
58
73
|
getPropositions,
|
|
59
74
|
isAnswerValid,
|
|
60
75
|
subject: "Mathématiques",
|
|
76
|
+
getInstruction,
|
|
77
|
+
getAnswer,
|
|
78
|
+
getStartStatement,
|
|
61
79
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hoursToSecond.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/hoursToSecond.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAMrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAyFF,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,WAAW,CAiB/C,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { numberVEA } from "../../../exercises/vea/numberVEA.js";
|
|
4
|
+
import { randint } from "../../../math/utils/random/randint.js";
|
|
5
|
+
const getPropositions = (n, { answer, ...identifiers }) => {
|
|
6
|
+
const propositions = [];
|
|
7
|
+
const { hours, mins, seconds } = identifiers;
|
|
8
|
+
addValidProp(propositions, answer);
|
|
9
|
+
tryToAddWrongProp(propositions, hours * 60 + 60 * mins + seconds + "");
|
|
10
|
+
tryToAddWrongProp(propositions, seconds + "");
|
|
11
|
+
while (propositions.length < n) {
|
|
12
|
+
tryToAddWrongProp(propositions, randint(5000, 100000) + "");
|
|
13
|
+
}
|
|
14
|
+
return shuffleProps(propositions, n);
|
|
15
|
+
};
|
|
16
|
+
const getAnswer = (identifiers) => {
|
|
17
|
+
const { hours, mins, seconds } = identifiers;
|
|
18
|
+
return hours * 3600 + 60 * mins + seconds + "";
|
|
19
|
+
};
|
|
20
|
+
const getInstruction = (identifiers) => {
|
|
21
|
+
const { hours, mins, seconds } = identifiers;
|
|
22
|
+
return `Combien y a-t-il de secondes dans $${hours}\\text{h } ${mins} \\text{min } ${seconds}\\text{s }$ ?`;
|
|
23
|
+
};
|
|
24
|
+
const getHint = (identifiers) => {
|
|
25
|
+
return `Dans une minute, il y a $60$ secondes. Dans une heure, il y a $60$ minutes.`;
|
|
26
|
+
};
|
|
27
|
+
const getCorrection = (identifiers) => {
|
|
28
|
+
const { hours, mins, seconds } = identifiers;
|
|
29
|
+
return `Dans une minute, il y a $60$ secondes. Donc, le nombre de secondes dans $${mins}$ minutes est :
|
|
30
|
+
|
|
31
|
+
$$
|
|
32
|
+
60\\times ${mins} = ${60 * mins}
|
|
33
|
+
$$
|
|
34
|
+
|
|
35
|
+
Puis, dans une heure, il y a $60$ minutes, qui chacune compte $60$ secondes. Ainsi, dans une heure, il y a $60\\times 60 = 3600$ secondes.
|
|
36
|
+
|
|
37
|
+
Le nombre de secondes dans $${hours}$ heures est donc :
|
|
38
|
+
|
|
39
|
+
$$
|
|
40
|
+
3600\\times ${hours} = ${3600 * hours}
|
|
41
|
+
$$
|
|
42
|
+
|
|
43
|
+
Au final, dans $${hours}\\text{h } ${mins} \\text{min } ${seconds}\\text{s }$, il y a donc :
|
|
44
|
+
|
|
45
|
+
$$
|
|
46
|
+
${3600 * hours}+ ${60 * mins} + ${seconds} = ${getAnswer(identifiers)}
|
|
47
|
+
$$
|
|
48
|
+
|
|
49
|
+
secondes.
|
|
50
|
+
`;
|
|
51
|
+
};
|
|
52
|
+
const getKeys = (identifiers) => {
|
|
53
|
+
return [];
|
|
54
|
+
};
|
|
55
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
56
|
+
return numberVEA(ans, answer);
|
|
57
|
+
};
|
|
58
|
+
const getHoursToSecondQuestion = (ops) => {
|
|
59
|
+
const hours = randint(1, 24);
|
|
60
|
+
const mins = randint(1, 60);
|
|
61
|
+
const seconds = randint(1, 60);
|
|
62
|
+
const identifiers = {
|
|
63
|
+
hours,
|
|
64
|
+
mins,
|
|
65
|
+
seconds,
|
|
66
|
+
};
|
|
67
|
+
const question = {
|
|
68
|
+
answer: getAnswer(identifiers),
|
|
69
|
+
instruction: getInstruction(identifiers),
|
|
70
|
+
keys: getKeys(identifiers),
|
|
71
|
+
answerFormat: "tex",
|
|
72
|
+
identifiers,
|
|
73
|
+
hint: getHint(identifiers),
|
|
74
|
+
correction: getCorrection(identifiers),
|
|
75
|
+
};
|
|
76
|
+
return question;
|
|
77
|
+
};
|
|
78
|
+
export const hoursToSecond = {
|
|
79
|
+
id: "hoursToSecond",
|
|
80
|
+
connector: "=",
|
|
81
|
+
label: "Convertir une durée en 'h min s' en secondes",
|
|
82
|
+
isSingleStep: true,
|
|
83
|
+
generator: (nb, opts) => getDistinctQuestions(() => getHoursToSecondQuestion(opts), nb),
|
|
84
|
+
qcmTimer: 60,
|
|
85
|
+
freeTimer: 60,
|
|
86
|
+
getPropositions,
|
|
87
|
+
isAnswerValid,
|
|
88
|
+
subject: "Mathématiques",
|
|
89
|
+
getInstruction,
|
|
90
|
+
getHint,
|
|
91
|
+
getCorrection,
|
|
92
|
+
getAnswer,
|
|
93
|
+
hasHintAndCorrection: true,
|
|
94
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/conversion/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pieChartReading.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/dataRepresentations/pieChartReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAmBT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"pieChartReading.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/dataRepresentations/pieChartReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAmBT,MAAM,6BAA6B,CAAC;AAyBrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC;IACnB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAgMF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAkBjD,CAAC"}
|
|
@@ -7,6 +7,7 @@ import { Point } from "../../../math/geometry/point.js";
|
|
|
7
7
|
import { randfloat } from "../../../math/utils/random/randfloat.js";
|
|
8
8
|
import { randint } from "../../../math/utils/random/randint.js";
|
|
9
9
|
import { round } from "../../../math/utils/round.js";
|
|
10
|
+
import { parseAlgebraic } from "../../../tree/parsers/latexParser.js";
|
|
10
11
|
import { percentParser } from "../../../tree/parsers/percentParser.js";
|
|
11
12
|
import { handleVEAError } from "../../../utils/errors/handleVEAError.js";
|
|
12
13
|
import { getLetter } from "../../../utils/strings/getLetter.js";
|
|
@@ -37,7 +38,7 @@ const getInstruction = (identifiers) => {
|
|
|
37
38
|
|
|
38
39
|
Quelle proportion des communications effectuées, les communications audio représentent-elles ?
|
|
39
40
|
|
|
40
|
-
Arrondir au centième.`;
|
|
41
|
+
Arrondir au centième de pourcentage.`;
|
|
41
42
|
};
|
|
42
43
|
// const getHint: GetHint<Identifiers> = (identifiers) => {};
|
|
43
44
|
// const getCorrection: GetCorrection<Identifiers> = (identifiers) => {};
|
|
@@ -100,8 +101,18 @@ const getKeys = (identifiers) => {
|
|
|
100
101
|
};
|
|
101
102
|
const isAnswerValid = (ans, { answer }) => {
|
|
102
103
|
try {
|
|
103
|
-
|
|
104
|
-
|
|
104
|
+
//!à factoriser
|
|
105
|
+
//!pb est que parseAlgebraic ne gère pas encore les %
|
|
106
|
+
let parsed;
|
|
107
|
+
if (ans.includes("%")) {
|
|
108
|
+
parsed = percentParser(ans);
|
|
109
|
+
return parsed === answer;
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
parsed = parseAlgebraic(ans);
|
|
113
|
+
const nbAns = answer.replace("\\%", "").unfrenchify();
|
|
114
|
+
return Math.abs(parsed.evaluate() - nbAns / 100) < 0.0001;
|
|
115
|
+
}
|
|
105
116
|
}
|
|
106
117
|
catch (err) {
|
|
107
118
|
return handleVEAError(err);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thirdDegreeFunctionVariation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/thirdDegreeFunctionVariation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"thirdDegreeFunctionVariation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/thirdDegreeFunctionVariation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAoBrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IAEV,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAwKF,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,WAAW,CAmB9D,CAAC"}
|
|
@@ -23,20 +23,48 @@ const rebuildIdentifiers = (oldIds) => {
|
|
|
23
23
|
};
|
|
24
24
|
const getInstruction = (identifiers) => {
|
|
25
25
|
const { a, coin, racine1, racine2 } = identifiers;
|
|
26
|
-
return
|
|
27
|
-
|
|
26
|
+
return `Soit $f$ la fonction représentée ci-dessous.
|
|
27
|
+
|
|
28
|
+
Sur quel(s) intervalle(s) la fonction dérivée $f'$ de $f$ est-elle ${coin < 0 ? "négative" : "positive"} ?`;
|
|
28
29
|
};
|
|
29
|
-
const
|
|
30
|
+
const getHint = (identifiers) => {
|
|
31
|
+
return `Si la fonction $f$ est croissante sur un intervalle, alors sa fonction dérivée $f'$ sera positive sur cet intervalle.
|
|
32
|
+
|
|
33
|
+
À l'inverse, si la fonction $f$ est décroissante sur un intervalle, alors sa fonction dérivée $f'$ sera négative sur cet intervalle.`;
|
|
34
|
+
};
|
|
35
|
+
const getCorrection = (identifiers) => {
|
|
36
|
+
const { a, coin, racine1, racine2 } = identifiers;
|
|
37
|
+
const variation = coin < 0 ? "décroissante" : "croissante";
|
|
38
|
+
const sign = coin < 0 ? "négative" : "positive";
|
|
39
|
+
const intervals = getIntervalsSolution(identifiers);
|
|
40
|
+
return `Si la fonction $f$ est ${variation} sur un intervalle, alors sa fonction dérivée $f'$ sera ${sign} sur cet intervalle.
|
|
41
|
+
|
|
42
|
+
Ici, on lit graphiquement que $f$ est ${variation} sur $${intervals[0].toTex()}$${intervals[1] ? ` et sur $${intervals[1].toTex()}$` : ""}.
|
|
43
|
+
|
|
44
|
+
On en déduit que $f'$ est donc ${sign} sur :
|
|
45
|
+
|
|
46
|
+
$$
|
|
47
|
+
${getAnswer(identifiers)}
|
|
48
|
+
$$`;
|
|
49
|
+
};
|
|
50
|
+
const getIntervalsSolution = (identifiers) => {
|
|
30
51
|
const { a, coin, racine1, racine2 } = identifiers;
|
|
31
52
|
const racine1Tree = new NumberNode(racine1);
|
|
32
53
|
const racine2Tree = new NumberNode(racine2);
|
|
33
|
-
const
|
|
34
|
-
? new IntervalNode(racine1Tree, racine2Tree, ClosureType.FF)
|
|
35
|
-
:
|
|
54
|
+
const intervals = coin * a < 0
|
|
55
|
+
? [new IntervalNode(racine1Tree, racine2Tree, ClosureType.FF)]
|
|
56
|
+
: [
|
|
36
57
|
new IntervalNode(MinusInfinityNode, racine1Tree, ClosureType.OF),
|
|
37
58
|
new IntervalNode(racine2Tree, PlusInfinityNode, ClosureType.FO),
|
|
38
|
-
]
|
|
39
|
-
return
|
|
59
|
+
];
|
|
60
|
+
return intervals;
|
|
61
|
+
};
|
|
62
|
+
const getAnswer = (identifiers) => {
|
|
63
|
+
const intervals = getIntervalsSolution(identifiers);
|
|
64
|
+
if (intervals.length === 1)
|
|
65
|
+
return intervals[0].toTex();
|
|
66
|
+
else
|
|
67
|
+
return new UnionIntervalNode(intervals).toTex();
|
|
40
68
|
};
|
|
41
69
|
const getGGBOptions = (identifiers) => {
|
|
42
70
|
const { a, coin, racine1, racine2, c } = identifiers;
|
|
@@ -81,6 +109,8 @@ const getThirdDegreeFunctionVariation = () => {
|
|
|
81
109
|
answerFormat: "tex",
|
|
82
110
|
ggbOptions: getGGBOptions(identifiers),
|
|
83
111
|
identifiers,
|
|
112
|
+
hint: getHint(identifiers),
|
|
113
|
+
correction: getCorrection(identifiers),
|
|
84
114
|
};
|
|
85
115
|
return question;
|
|
86
116
|
};
|
|
@@ -132,4 +162,7 @@ export const thirdDegreeFunctionVariation = {
|
|
|
132
162
|
getAnswer,
|
|
133
163
|
getGGBOptions,
|
|
134
164
|
rebuildIdentifiers,
|
|
165
|
+
hasHintAndCorrection: true,
|
|
166
|
+
getHint,
|
|
167
|
+
getCorrection,
|
|
135
168
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"derivativeNumberReading.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/tangent/derivativeNumberReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAmBrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,EAAE,CAAC;IACZ,CAAC,EAAE,MAAM,EAAE,CAAC;IACZ,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;
|
|
1
|
+
{"version":3,"file":"derivativeNumberReading.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/tangent/derivativeNumberReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAmBrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,EAAE,CAAC;IACZ,CAAC,EAAE,MAAM,EAAE,CAAC;IACZ,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAkJF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAmBzD,CAAC"}
|
|
@@ -36,7 +36,9 @@ const getInstruction = (identifiers) => {
|
|
|
36
36
|
const xB = B[0];
|
|
37
37
|
const yA = A[1];
|
|
38
38
|
const yB = B[1];
|
|
39
|
-
return `Ci-dessous sont tracées la courbe $\\mathcal C_f$ de la fonction $f$ et la tangente à cette courbe au point d'abscisse $${xA}
|
|
39
|
+
return `Ci-dessous sont tracées la courbe $\\mathcal C_f$ de la fonction $f$ et la tangente à cette courbe au point d'abscisse $${xA}$.
|
|
40
|
+
|
|
41
|
+
Déterminer $f'(${xA})$.`;
|
|
40
42
|
};
|
|
41
43
|
const getAnswer = (identifiers) => {
|
|
42
44
|
const { A, B } = identifiers;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"derivativeTangentEquationReading.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/tangent/derivativeTangentEquationReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAwBrC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,GAAG,CAAC;IACb,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;
|
|
1
|
+
{"version":3,"file":"derivativeTangentEquationReading.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/tangent/derivativeTangentEquationReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAwBrC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,GAAG,CAAC;IACb,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAiQF,eAAO,MAAM,gCAAgC,EAAE,QAAQ,CAAC,WAAW,CAmBlE,CAAC;;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG"}
|
|
@@ -75,7 +75,9 @@ const getAnswer = ({ trinomCoeffs, xA, yA, yPrimeA, }) => {
|
|
|
75
75
|
return new EqualNode("y".toTree(), getAnswerTree({ xA, yA, yPrimeA, trinomCoeffs })).toTex();
|
|
76
76
|
};
|
|
77
77
|
const getInstruction = ({ xA }) => {
|
|
78
|
-
return `Ci-dessous sont tracées la courbe $\\mathcal C_f$ de la fonction $f$ et la tangente à cette courbe au point d'abscisse $${xA}
|
|
78
|
+
return `Ci-dessous sont tracées la courbe $\\mathcal C_f$ de la fonction $f$ et la tangente à cette courbe au point d'abscisse $${xA}$.
|
|
79
|
+
|
|
80
|
+
Déterminer l'équation de cette tangente.`;
|
|
79
81
|
};
|
|
80
82
|
const getHint = (identifiers) => {
|
|
81
83
|
return `L'équation de la tangente à la courbe de $f$ au point d'abscisse $a$ est :
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tangentEquations.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/tangent/tangentEquations.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"tangentEquations.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/tangent/tangentEquations.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAmBrC,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAmIF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAelD,CAAC"}
|
|
@@ -3,27 +3,85 @@ import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQue
|
|
|
3
3
|
import { Trinom, TrinomConstructor } from "../../../../math/polynomials/trinom.js";
|
|
4
4
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
5
5
|
import { EqualNode } from "../../../../tree/nodes/equations/equalNode.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { add } from "../../../../tree/nodes/operators/addNode.js";
|
|
7
|
+
import { multiply, MultiplyNode, } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
8
|
+
import { substract, SubstractNode, } from "../../../../tree/nodes/operators/substractNode.js";
|
|
8
9
|
import { VariableNode } from "../../../../tree/nodes/variables/variableNode.js";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
11
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
12
|
+
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
13
|
+
const getHint = (identifiers) => {
|
|
14
|
+
return `Si $f$ est une fonction dérivable en $a$, alors l'équation de la tangente à la courbe de $f$ au point d'abscisse $a$ est donné par:
|
|
15
|
+
|
|
16
|
+
$$
|
|
17
|
+
y = f'(a)(x-a)+f(a)
|
|
18
|
+
$$`;
|
|
19
|
+
};
|
|
20
|
+
const getCorrection = (identifiers) => {
|
|
21
|
+
const { abscisse, trinome } = identifiers;
|
|
22
|
+
const trinom = new Trinom(trinome[0], trinome[1], trinome[2]);
|
|
23
|
+
const derivee = trinom.derivate();
|
|
14
24
|
const imagederivee = derivee.calculate(abscisse);
|
|
25
|
+
const image = trinom.calculate(abscisse);
|
|
26
|
+
return `L'équation de la tangente à la courbe de $f$ au point d'abscisse $a$ est donné par:
|
|
27
|
+
|
|
28
|
+
$$
|
|
29
|
+
y = f'(a)(x-a)+f(a)
|
|
30
|
+
$$
|
|
31
|
+
|
|
32
|
+
Ici, on a $f'(x) = ${derivee
|
|
33
|
+
.toTree()
|
|
34
|
+
.toTex()}$, donc $f'(${abscisse}) = ${imagederivee}$.
|
|
35
|
+
|
|
36
|
+
D'autre part, $f(${abscisse}) = ${image}$.
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
L'équation de la tangente en $${abscisse}$ est donc :
|
|
40
|
+
|
|
41
|
+
${alignTex([
|
|
42
|
+
[
|
|
43
|
+
"y",
|
|
44
|
+
"=",
|
|
45
|
+
add(multiply(imagederivee, substract("x", abscisse)), image).toTex(),
|
|
46
|
+
],
|
|
47
|
+
["", "=", getAnswer(identifiers).split("=")[1]],
|
|
48
|
+
])}
|
|
49
|
+
`;
|
|
50
|
+
};
|
|
51
|
+
const getAnswer = (identifiers) => {
|
|
52
|
+
const { abscisse, trinome } = identifiers;
|
|
53
|
+
const trinom = new Trinom(trinome[0], trinome[1], trinome[2]);
|
|
54
|
+
const derivee = trinom.derivate();
|
|
55
|
+
const imagederivee = derivee.calculate(abscisse);
|
|
56
|
+
const image = trinom.calculate(abscisse);
|
|
15
57
|
const k = abscisse * imagederivee;
|
|
16
58
|
const constante = k - image;
|
|
17
59
|
const equation = new EqualNode(new VariableNode("y"), new SubstractNode(new MultiplyNode(imagederivee.toTree(), new VariableNode("x")), constante.toTree()).simplify());
|
|
18
|
-
|
|
60
|
+
return equation.toTex();
|
|
61
|
+
};
|
|
62
|
+
const getInstruction = (identifiers) => {
|
|
63
|
+
const { abscisse, trinome } = identifiers;
|
|
64
|
+
const trinom = new Trinom(trinome[0], trinome[1], trinome[2]);
|
|
65
|
+
return `Soit $f$ la fonction définie par :
|
|
66
|
+
|
|
67
|
+
$$
|
|
68
|
+
f(x) = ${trinom.toTree().toTex()}
|
|
69
|
+
$$
|
|
70
|
+
|
|
71
|
+
Déterminer l'équation de la tangente à la courbe de $f$ au point d'abscisse $${abscisse}$.`;
|
|
72
|
+
};
|
|
73
|
+
const getTangentEquationQuestion = () => {
|
|
74
|
+
const trinome = TrinomConstructor.random();
|
|
75
|
+
const abscisse = randint(-10, 10);
|
|
76
|
+
const identifiers = { abscisse, trinome: [trinome.a, trinome.b, trinome.c] };
|
|
19
77
|
const question = {
|
|
20
|
-
answer:
|
|
21
|
-
instruction:
|
|
22
|
-
.toTree()
|
|
23
|
-
.toTex()}$. Déterminer l'équation de la tangente à la courbe de $f$ au point d'abscisse $${abscisse}$.`,
|
|
78
|
+
answer: getAnswer(identifiers),
|
|
79
|
+
instruction: getInstruction(identifiers),
|
|
24
80
|
keys: ["y", "x", "equal"],
|
|
25
81
|
answerFormat: "tex",
|
|
26
|
-
identifiers
|
|
82
|
+
identifiers,
|
|
83
|
+
hint: getHint(identifiers),
|
|
84
|
+
correction: getCorrection(identifiers),
|
|
27
85
|
};
|
|
28
86
|
return question;
|
|
29
87
|
};
|
|
@@ -40,28 +98,39 @@ const getPropositions = (n, { answer }) => {
|
|
|
40
98
|
return shuffleProps(propositions, n);
|
|
41
99
|
};
|
|
42
100
|
const isAnswerValid = (ans, { answer, abscisse, trinome }) => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
101
|
+
try {
|
|
102
|
+
let valueAns = "";
|
|
103
|
+
const formated = ans.split("=");
|
|
104
|
+
if (formated.length === 1)
|
|
105
|
+
valueAns = formated[0];
|
|
106
|
+
else
|
|
107
|
+
valueAns = formated[1];
|
|
108
|
+
if (!valueAns)
|
|
109
|
+
return false;
|
|
110
|
+
const parsed = parseAlgebraic(valueAns);
|
|
111
|
+
return ("y=" +
|
|
112
|
+
parsed
|
|
113
|
+
.simplify({ towardsDistribute: true, forbidFactorize: true })
|
|
114
|
+
.toTex() ===
|
|
115
|
+
answer);
|
|
116
|
+
}
|
|
117
|
+
catch (err) {
|
|
118
|
+
return handleVEAError(err);
|
|
119
|
+
}
|
|
54
120
|
};
|
|
55
121
|
export const tangentEquations = {
|
|
56
122
|
id: "tangentEquations",
|
|
57
123
|
label: "Déterminer l'équation d'une tangente",
|
|
58
|
-
levels: ["1reSpé"],
|
|
59
124
|
isSingleStep: true,
|
|
60
|
-
sections: ["Dérivation"],
|
|
61
125
|
generator: (nb) => getDistinctQuestions(getTangentEquationQuestion, nb),
|
|
62
126
|
qcmTimer: 60,
|
|
63
127
|
freeTimer: 60,
|
|
64
128
|
getPropositions,
|
|
65
129
|
isAnswerValid,
|
|
66
130
|
subject: "Mathématiques",
|
|
131
|
+
getInstruction,
|
|
132
|
+
getAnswer,
|
|
133
|
+
getHint,
|
|
134
|
+
getCorrection,
|
|
135
|
+
hasHintAndCorrection: true,
|
|
67
136
|
};
|
|
@@ -11,10 +11,10 @@ const getInstruction = (identifiers, opts) => {
|
|
|
11
11
|
const fctTex = `Soit $f$ une fonction ${useLinear ? "linéaire" : "affine"}`;
|
|
12
12
|
// const values = usePoints ?
|
|
13
13
|
const pointA = usePoints
|
|
14
|
-
? `$A\\left(${xA}
|
|
14
|
+
? `$A\\left(${xA};${yA}\\right)$`
|
|
15
15
|
: `$f\\left(${xA}\\right) = ${yA}$`;
|
|
16
16
|
const pointB = usePoints
|
|
17
|
-
? `$B\\left(${xB}
|
|
17
|
+
? `$B\\left(${xB};${yB}\\right)$`
|
|
18
18
|
: `$f\\left(${xB}\\right) = ${yB}$`;
|
|
19
19
|
if (opts?.useLinear) {
|
|
20
20
|
return `${fctTex} telle que ${usePoints
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solveSecondDegreeEquationByFactorisation.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationByFactorisation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"solveSecondDegreeEquationByFactorisation.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/equation/solveSecondDegreeEquationByFactorisation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAarC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAiHF,eAAO,MAAM,wCAAwC,EAAE,QAAQ,CAAC,WAAW,CAiB1E,CAAC"}
|
|
@@ -57,13 +57,13 @@ export const solveSecondDegreeEquationFromCano = {
|
|
|
57
57
|
id: "solveSecondDegreeEquationFromCano",
|
|
58
58
|
connector: "\\iff",
|
|
59
59
|
label: "Résoudre une équation du type $a(x-b)^2 + c = 0$",
|
|
60
|
-
levels: [],
|
|
61
60
|
isSingleStep: true,
|
|
62
|
-
sections: [],
|
|
63
61
|
generator: (nb) => getDistinctQuestions(getSolveSecondDegreeEquationFromCanoQuestion, nb),
|
|
64
62
|
qcmTimer: 60,
|
|
65
63
|
freeTimer: 60,
|
|
66
64
|
getPropositions,
|
|
67
65
|
isAnswerValid,
|
|
68
66
|
subject: "Mathématiques",
|
|
67
|
+
getInstruction,
|
|
68
|
+
getAnswer,
|
|
69
69
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factorizedFormFromRoots.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/factoForm/factorizedFormFromRoots.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"factorizedFormFromRoots.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/factoForm/factorizedFormFromRoots.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AAcrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAoGF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAczD,CAAC"}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { randint } from "../../../../../math/utils/random/randint.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { isOppositeNode } from "../../../../../tree/nodes/functions/oppositeNode.js";
|
|
5
|
+
import { isMultiplyNode, multiply, } from "../../../../../tree/nodes/operators/multiplyNode.js";
|
|
6
|
+
import { isPowerNode, square } from "../../../../../tree/nodes/operators/powerNode.js";
|
|
7
|
+
import { substract } from "../../../../../tree/nodes/operators/substractNode.js";
|
|
8
|
+
import { parseAlgebraic } from "../../../../../tree/parsers/latexParser.js";
|
|
7
9
|
import { probaFlip } from "../../../../../utils/alea/probaFlip.js";
|
|
8
|
-
|
|
10
|
+
import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
|
|
11
|
+
const getAnswerNode = (identifiers) => {
|
|
12
|
+
const { a, roots } = identifiers;
|
|
9
13
|
const isSingleRoot = roots.length === 1;
|
|
10
14
|
return isSingleRoot
|
|
11
15
|
? multiply(a, square(substract("x", roots[0]))).simplify({
|
|
@@ -13,11 +17,16 @@ const getAnswerNode = (roots, a) => {
|
|
|
13
17
|
})
|
|
14
18
|
: multiply(multiply(a, substract("x", roots[0])), substract("x", roots[1])).simplify();
|
|
15
19
|
};
|
|
20
|
+
const getAnswer = (identifiers) => {
|
|
21
|
+
return getAnswerNode(identifiers).toTex();
|
|
22
|
+
};
|
|
16
23
|
const getInstruction = (identifiers) => {
|
|
17
24
|
const { a, roots } = identifiers;
|
|
18
25
|
return `Soit $f(x) = ax^2 + bx + c$ un polynôme du second degré avec $a = ${a}$ et qui a ${roots.length === 1
|
|
19
26
|
? `pour seule racine : $${roots[0]}$`
|
|
20
|
-
: `deux racines : $${roots[0]}$ et $${roots[1]}$`}.
|
|
27
|
+
: `deux racines : $${roots[0]}$ et $${roots[1]}$`}.
|
|
28
|
+
|
|
29
|
+
Déterminer la forme factorisée de $f$.`;
|
|
21
30
|
};
|
|
22
31
|
const getFactorizedFormFromRootsQuestion = () => {
|
|
23
32
|
const a = randint(-10, 10, [0]);
|
|
@@ -27,11 +36,9 @@ const getFactorizedFormFromRootsQuestion = () => {
|
|
|
27
36
|
const roots = isSingleRoot
|
|
28
37
|
? [firstRoot]
|
|
29
38
|
: [firstRoot, secondRoot].sort((a, b) => a - b);
|
|
30
|
-
const answer = getAnswerNode(roots, a);
|
|
31
|
-
const answerTex = answer.toTex();
|
|
32
39
|
const identifiers = { a, roots };
|
|
33
40
|
const question = {
|
|
34
|
-
answer:
|
|
41
|
+
answer: getAnswer(identifiers),
|
|
35
42
|
instruction: getInstruction(identifiers),
|
|
36
43
|
keys: ["x"],
|
|
37
44
|
answerFormat: "tex",
|
|
@@ -42,26 +49,41 @@ const getFactorizedFormFromRootsQuestion = () => {
|
|
|
42
49
|
const getPropositions = (n, { answer, a, roots }) => {
|
|
43
50
|
const propositions = [];
|
|
44
51
|
addValidProp(propositions, answer);
|
|
45
|
-
tryToAddWrongProp(propositions, getAnswerNode(roots.map((r) => -r), a).toTex());
|
|
52
|
+
tryToAddWrongProp(propositions, getAnswerNode({ roots: roots.map((r) => -r), a }).toTex());
|
|
46
53
|
while (propositions.length < n) {
|
|
47
54
|
const x1 = randint(-10, 10);
|
|
48
55
|
const x2 = randint(-10, 10, [x1]);
|
|
49
|
-
tryToAddWrongProp(propositions, getAnswerNode(
|
|
56
|
+
tryToAddWrongProp(propositions, getAnswerNode({
|
|
57
|
+
roots: [x1, x2].sort((a, b) => a - b),
|
|
58
|
+
a: randint(-10, 10, [0]),
|
|
59
|
+
}).toTex());
|
|
50
60
|
}
|
|
51
61
|
return shuffleProps(propositions, n);
|
|
52
62
|
};
|
|
53
|
-
const isAnswerValid = (ans, { answer,
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
63
|
+
const isAnswerValid = (ans, { answer, ...identifiers }) => {
|
|
64
|
+
try {
|
|
65
|
+
const parsed = parseAlgebraic(ans);
|
|
66
|
+
if (!isMultiplyNode(parsed) &&
|
|
67
|
+
!isPowerNode(parsed) &&
|
|
68
|
+
!(isOppositeNode(parsed) &&
|
|
69
|
+
(isMultiplyNode(parsed.child) || isPowerNode(parsed.child))))
|
|
70
|
+
return false;
|
|
71
|
+
return (parsed
|
|
72
|
+
.simplify({ towardsDistribute: true, forbidFactorize: true })
|
|
73
|
+
.toTex() ===
|
|
74
|
+
getAnswerNode(identifiers)
|
|
75
|
+
.simplify({ towardsDistribute: true, forbidFactorize: true })
|
|
76
|
+
.toTex());
|
|
77
|
+
}
|
|
78
|
+
catch (err) {
|
|
79
|
+
return handleVEAError(err);
|
|
80
|
+
}
|
|
57
81
|
};
|
|
58
82
|
export const factorizedFormFromRoots = {
|
|
59
83
|
id: "factorizedFormFromRoots",
|
|
60
84
|
connector: "=",
|
|
61
85
|
label: "Déterminer la forme factorisée en connaissant les racines",
|
|
62
|
-
levels: ["1rePro", "1reSpé"],
|
|
63
86
|
isSingleStep: true,
|
|
64
|
-
sections: ["Second degré"],
|
|
65
87
|
generator: (nb) => getDistinctQuestions(getFactorizedFormFromRootsQuestion, nb),
|
|
66
88
|
qcmTimer: 60,
|
|
67
89
|
freeTimer: 60,
|
|
@@ -69,4 +91,5 @@ export const factorizedFormFromRoots = {
|
|
|
69
91
|
isAnswerValid,
|
|
70
92
|
subject: "Mathématiques",
|
|
71
93
|
getInstruction,
|
|
94
|
+
getAnswer,
|
|
72
95
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"niceRootsFromDevForm.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/roots/niceRootsFromDevForm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"niceRootsFromDevForm.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/roots/niceRootsFromDevForm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA4DF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAatD,CAAC"}
|
|
@@ -2,19 +2,34 @@ import { addValidProp, tryToAddWrongProp, } from "../../../../../exercises/exerc
|
|
|
2
2
|
import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { Trinom, TrinomConstructor } from "../../../../../math/polynomials/trinom.js";
|
|
4
4
|
import { randint } from "../../../../../math/utils/random/randint.js";
|
|
5
|
-
import {
|
|
6
|
-
import { DiscreteSetNode } from "../../../../../tree/nodes/sets/discreteSetNode.js";
|
|
5
|
+
import { discreteSetParser } from "../../../../../tree/parsers/discreteSetParser.js";
|
|
7
6
|
import { shuffle } from "../../../../../utils/alea/shuffle.js";
|
|
7
|
+
import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
|
|
8
|
+
const getInstruction = (identifiers) => {
|
|
9
|
+
const { a, b, c } = identifiers;
|
|
10
|
+
const trinom = new Trinom(a, b, c);
|
|
11
|
+
return `Soit $f$ la fonction définie par :
|
|
12
|
+
|
|
13
|
+
$$
|
|
14
|
+
f(x) = ${trinom.toTree().toTex()}
|
|
15
|
+
$$
|
|
16
|
+
|
|
17
|
+
Résoudre l'équation $f(x) = 0$.`;
|
|
18
|
+
};
|
|
19
|
+
const getAnswer = (identifiers) => {
|
|
20
|
+
const { a, b, c } = identifiers;
|
|
21
|
+
const trinom = new Trinom(a, b, c);
|
|
22
|
+
const answer = trinom.getRootsEquationSolutionTex();
|
|
23
|
+
return answer;
|
|
24
|
+
};
|
|
8
25
|
const getRootsFromDevFormQuestion = () => {
|
|
9
26
|
const trinom = TrinomConstructor.randomFactorized();
|
|
10
|
-
const
|
|
27
|
+
const identifiers = { a: trinom.a, b: trinom.b, c: trinom.c };
|
|
11
28
|
const question = {
|
|
12
|
-
answer:
|
|
13
|
-
instruction:
|
|
14
|
-
.toTree()
|
|
15
|
-
.toTex()}$. Résoudre l'équation $f(x) = 0$.`,
|
|
29
|
+
answer: getAnswer(identifiers),
|
|
30
|
+
instruction: getInstruction(identifiers),
|
|
16
31
|
keys: ["S", "equal", "lbrace", "semicolon", "rbrace", "varnothing"],
|
|
17
|
-
identifiers
|
|
32
|
+
identifiers,
|
|
18
33
|
answerFormat: "tex",
|
|
19
34
|
};
|
|
20
35
|
return question;
|
|
@@ -31,12 +46,16 @@ const getPropositions = (n, { answer }) => {
|
|
|
31
46
|
}
|
|
32
47
|
return shuffle(propositions);
|
|
33
48
|
};
|
|
34
|
-
const isAnswerValid = (ans, { a, b, c }) => {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
49
|
+
const isAnswerValid = (ans, { answer, a, b, c }) => {
|
|
50
|
+
try {
|
|
51
|
+
const parsed = discreteSetParser(ans);
|
|
52
|
+
if (!parsed)
|
|
53
|
+
return false;
|
|
54
|
+
return ("S=" + parsed.simplify({ decimalToFractions: true }).toTex() === answer);
|
|
55
|
+
}
|
|
56
|
+
catch (err) {
|
|
57
|
+
return handleVEAError(err);
|
|
58
|
+
}
|
|
40
59
|
};
|
|
41
60
|
export const niceRootsFromDevForm = {
|
|
42
61
|
id: "niceRootsFromDevForm",
|
|
@@ -44,11 +63,11 @@ export const niceRootsFromDevForm = {
|
|
|
44
63
|
getPropositions,
|
|
45
64
|
isAnswerValid,
|
|
46
65
|
label: "Résoudre une équation du second degré (solutions entières)",
|
|
47
|
-
levels: ["1reSpé", "TermSpé", "MathComp"],
|
|
48
66
|
isSingleStep: true,
|
|
49
|
-
sections: ["Second degré"],
|
|
50
67
|
generator: (nb) => getDistinctQuestions(getRootsFromDevFormQuestion, nb),
|
|
51
68
|
qcmTimer: 60,
|
|
52
69
|
freeTimer: 60,
|
|
53
70
|
subject: "Mathématiques",
|
|
71
|
+
getInstruction,
|
|
72
|
+
getAnswer,
|
|
54
73
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rootsFromDevForm.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/roots/rootsFromDevForm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"rootsFromDevForm.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/roots/rootsFromDevForm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAkEF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAclD,CAAC"}
|
|
@@ -5,17 +5,31 @@ import { randint } from "../../../../../math/utils/random/randint.js";
|
|
|
5
5
|
import { EquationSolutionNode } from "../../../../../tree/nodes/equations/equationSolutionNode.js";
|
|
6
6
|
import { DiscreteSetNode } from "../../../../../tree/nodes/sets/discreteSetNode.js";
|
|
7
7
|
import { shuffle } from "../../../../../utils/alea/shuffle.js";
|
|
8
|
+
const getInstruction = (identifiers) => {
|
|
9
|
+
const { a, b, c } = identifiers;
|
|
10
|
+
const trinom = new Trinom(a, b, c);
|
|
11
|
+
return `Soit $f$ la fonction définie par :
|
|
12
|
+
|
|
13
|
+
$$
|
|
14
|
+
f(x) = ${trinom.toTree().toTex()}
|
|
15
|
+
$$
|
|
16
|
+
|
|
17
|
+
Résoudre l'équation $f(x) = 0$.`;
|
|
18
|
+
};
|
|
19
|
+
const getAnswer = (identifiers) => {
|
|
20
|
+
const { a, b, c } = identifiers;
|
|
21
|
+
const trinom = new Trinom(a, b, c);
|
|
22
|
+
return trinom.getRootsEquationSolutionTex();
|
|
23
|
+
};
|
|
8
24
|
const getRootsFromDevFormQuestion = () => {
|
|
9
25
|
const trinom = TrinomConstructor.random();
|
|
10
|
-
const
|
|
26
|
+
const identifiers = { a: trinom.a, b: trinom.b, c: trinom.c };
|
|
11
27
|
const question = {
|
|
12
|
-
answer:
|
|
13
|
-
instruction:
|
|
14
|
-
.toTree()
|
|
15
|
-
.toTex()}$. Résoudre l'équation $f(x) = 0$.`,
|
|
28
|
+
answer: getAnswer(identifiers),
|
|
29
|
+
instruction: getInstruction(identifiers),
|
|
16
30
|
keys: ["S", "equal", "lbrace", "semicolon", "rbrace", "varnothing"],
|
|
17
31
|
answerFormat: "tex",
|
|
18
|
-
identifiers
|
|
32
|
+
identifiers,
|
|
19
33
|
};
|
|
20
34
|
return question;
|
|
21
35
|
};
|
|
@@ -32,6 +46,15 @@ const getPropositions = (n, { answer }) => {
|
|
|
32
46
|
return shuffle(propositions);
|
|
33
47
|
};
|
|
34
48
|
const isAnswerValid = (ans, { a, b, c }) => {
|
|
49
|
+
// try {
|
|
50
|
+
// const parsed = discreteSetParser(ans);
|
|
51
|
+
// if (!parsed) return false;
|
|
52
|
+
// return (
|
|
53
|
+
// "S=" + parsed.simplify({ decimalToFractions: true }).toTex() === answer
|
|
54
|
+
// );
|
|
55
|
+
// } catch (err) {
|
|
56
|
+
// return handleVEAError(err);
|
|
57
|
+
// }
|
|
35
58
|
const trinom = new Trinom(a, b, c);
|
|
36
59
|
const roots = trinom.getRootsNode();
|
|
37
60
|
const answer = new EquationSolutionNode(new DiscreteSetNode(roots));
|
|
@@ -43,13 +66,13 @@ export const rootsFromDevForm = {
|
|
|
43
66
|
connector: "\\iff",
|
|
44
67
|
getPropositions,
|
|
45
68
|
label: "Résoudre une équation du second degré",
|
|
46
|
-
levels: ["1reSpé", "TermSpé", "MathComp"],
|
|
47
69
|
isSingleStep: true,
|
|
48
|
-
sections: ["Second degré"],
|
|
49
70
|
generator: (nb) => getDistinctQuestions(getRootsFromDevFormQuestion, nb),
|
|
50
71
|
qcmTimer: 60,
|
|
51
72
|
freeTimer: 60,
|
|
52
73
|
isAnswerValid,
|
|
53
74
|
subject: "Mathématiques",
|
|
54
75
|
pdfOptions: { shouldSpreadPropositions: true },
|
|
76
|
+
getInstruction,
|
|
77
|
+
getAnswer,
|
|
55
78
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rootsFromFactorizedForm.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/roots/rootsFromFactorizedForm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;
|
|
1
|
+
{"version":3,"file":"rootsFromFactorizedForm.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/roots/rootsFromFactorizedForm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAUT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAiGF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAczD,CAAC"}
|
|
@@ -10,9 +10,13 @@ import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
|
|
|
10
10
|
const getInstruction = (identifiers) => {
|
|
11
11
|
const { a, b, c } = identifiers;
|
|
12
12
|
const trinom = new Trinom(a, b, c);
|
|
13
|
-
return `Soit $f
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
return `Soit $f$ la fonction définie par :
|
|
14
|
+
|
|
15
|
+
$$
|
|
16
|
+
f(x) = ${trinom.toFactorized().toTex()}
|
|
17
|
+
$$
|
|
18
|
+
|
|
19
|
+
Résoudre l'équation $f(x) = 0$.`;
|
|
16
20
|
};
|
|
17
21
|
const getAnswer = (identifiers) => {
|
|
18
22
|
const { a, b, c } = identifiers;
|
|
@@ -70,9 +74,7 @@ export const rootsFromFactorizedForm = {
|
|
|
70
74
|
id: "rootsFromFactorizedForm",
|
|
71
75
|
connector: "=",
|
|
72
76
|
label: "Déterminer les racines d'un trinôme à partir de sa forme factorisée",
|
|
73
|
-
levels: ["1reSpé", "TermSpé", "MathComp"],
|
|
74
77
|
isSingleStep: true,
|
|
75
|
-
sections: ["Second degré"],
|
|
76
78
|
generator: (nb) => getDistinctQuestions(getRootsFromFactorizedFormQuestion, nb),
|
|
77
79
|
qcmTimer: 60,
|
|
78
80
|
freeTimer: 60,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applyPercent.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/percent/applyPercent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"applyPercent.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/percent/applyPercent.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,QAAQ,EAaT,MAAM,mBAAmB,CAAC;AAG3B,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;AAgHF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,CAgB9C,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { numberVEA } from "../../../exercises/vea/numberVEA.js";
|
|
2
|
+
import { randfloat } from "../../../math/utils/random/randfloat.js";
|
|
2
3
|
import { randint } from "../../../math/utils/random/randint.js";
|
|
3
4
|
import { round } from "../../../math/utils/round.js";
|
|
4
5
|
import { coinFlip } from "../../../utils/alea/coinFlip.js";
|
|
5
6
|
import { shuffle } from "../../../utils/alea/shuffle.js";
|
|
6
|
-
import { addValidProp, tryToAddWrongProp, } from "../../exercise.js";
|
|
7
|
+
import { addValidProp, propWhile, tryToAddWrongProp, } from "../../exercise.js";
|
|
7
8
|
import { getDistinctQuestions } from "../../utils/getDistinctQuestions.js";
|
|
8
9
|
const getInstruction = (identifiers) => {
|
|
9
10
|
const { randNbr, randPercent, isUp } = identifiers;
|
|
@@ -76,21 +77,19 @@ const getApplyPercentQuestion = () => {
|
|
|
76
77
|
};
|
|
77
78
|
return question;
|
|
78
79
|
};
|
|
79
|
-
const getPropositions = (n, { answer }) => {
|
|
80
|
+
const getPropositions = (n, { answer, isUp, randNbr, randPercent }) => {
|
|
80
81
|
const propositions = [];
|
|
81
82
|
addValidProp(propositions, answer);
|
|
82
|
-
|
|
83
|
+
tryToAddWrongProp(propositions, round(randNbr * (randPercent / 100), 2).frenchify());
|
|
84
|
+
tryToAddWrongProp(propositions, round(randNbr + ((isUp ? 1 : -1) * randPercent) / 100, 2).frenchify());
|
|
85
|
+
propWhile(propositions, n, () => {
|
|
83
86
|
const ansNb = Number(answer.replace(",", "."));
|
|
84
87
|
if (ansNb === 0)
|
|
85
88
|
tryToAddWrongProp(propositions, randint(-10, 10) + "");
|
|
86
89
|
else {
|
|
87
|
-
|
|
88
|
-
const percentDeviation = Math.random() * 20 + 1;
|
|
89
|
-
let wrongAnswer = ansNb + deviation * (percentDeviation / 100) * ansNb;
|
|
90
|
-
wrongAnswer = round(wrongAnswer, 2);
|
|
91
|
-
tryToAddWrongProp(propositions, wrongAnswer.toString().replace(".", ","));
|
|
90
|
+
tryToAddWrongProp(propositions, randfloat(1, 100, 2).frenchify());
|
|
92
91
|
}
|
|
93
|
-
}
|
|
92
|
+
});
|
|
94
93
|
return shuffle(propositions);
|
|
95
94
|
};
|
|
96
95
|
const isAnswerValid = (ans, { answer }) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"averageEvolutionRate.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/percent/averageEvolutionRate.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,QAAQ,EAYT,MAAM,mBAAmB,CAAC;AAG3B,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;
|
|
1
|
+
{"version":3,"file":"averageEvolutionRate.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/percent/averageEvolutionRate.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,QAAQ,EAYT,MAAM,mBAAmB,CAAC;AAG3B,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAkGF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAgBtD,CAAC"}
|
|
@@ -5,7 +5,9 @@ import { addValidProp, tryToAddWrongProp, } from "../../exercise.js";
|
|
|
5
5
|
import { getDistinctQuestions } from "../../utils/getDistinctQuestions.js";
|
|
6
6
|
const getInstruction = (identifiers) => {
|
|
7
7
|
const { rate, nbMois } = identifiers;
|
|
8
|
-
return `Un prix augmente de $${rate}\\%$ en $${nbMois}$ mois.
|
|
8
|
+
return `Un prix augmente de $${rate}\\%$ en $${nbMois}$ mois.
|
|
9
|
+
|
|
10
|
+
Quel est le taux d'évolution mensuel moyen ? Arrondir au centième de pourcentage.`;
|
|
9
11
|
};
|
|
10
12
|
const getAnswer = (identifiers) => {
|
|
11
13
|
const { rate, nbMois } = identifiers;
|
|
@@ -79,8 +81,6 @@ export const averageEvolutionRate = {
|
|
|
79
81
|
id: "averageEvolutionRate",
|
|
80
82
|
connector: "=",
|
|
81
83
|
label: "Calculer un taux d'évolution moyen",
|
|
82
|
-
levels: ["2nde", "1rePro", "TermPro", "1reTech", "TermTech"],
|
|
83
|
-
sections: ["Pourcentages"],
|
|
84
84
|
isSingleStep: false,
|
|
85
85
|
generator: (nb) => getDistinctQuestions(getAverageEvolutionRate, nb),
|
|
86
86
|
qcmTimer: 60,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findStartValueAfterEvolution.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/percent/findStartValueAfterEvolution.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAOrC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;
|
|
1
|
+
{"version":3,"file":"findStartValueAfterEvolution.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/percent/findStartValueAfterEvolution.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAOrC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AA4FF,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,WAAW,CAmB9D,CAAC"}
|
|
@@ -21,7 +21,9 @@ const getAnswer = (identifiers) => {
|
|
|
21
21
|
};
|
|
22
22
|
const getInstruction = (identifiers) => {
|
|
23
23
|
const evolution = identifiers.percentRate < 0 ? "baisse" : "hausse";
|
|
24
|
-
return `Après une ${evolution} de $${identifiers.percentRate.frenchify()}\\%$, le prix d'un objet est de $${identifiers.vf.frenchify()}€$.
|
|
24
|
+
return `Après une ${evolution} de $${identifiers.percentRate.frenchify()}\\%$, le prix d'un objet est de $${identifiers.vf.frenchify()}€$.
|
|
25
|
+
|
|
26
|
+
Quel était son prix initial ? Arrondir au centième.`;
|
|
25
27
|
};
|
|
26
28
|
const getHint = (identifiers) => {
|
|
27
29
|
return `Transforme le taux d'évolution en coefficient multiplicateur. Puis, divise le prix final par ce coefficient multiplicateur.`;
|
|
@@ -62,7 +64,7 @@ const isAnswerValid = (ans, { answer }) => {
|
|
|
62
64
|
};
|
|
63
65
|
const getFindStartValueAfterEvolutionQuestion = () => {
|
|
64
66
|
const vf = randfloat(1, 100, 2);
|
|
65
|
-
const percentRate = randfloat(-
|
|
67
|
+
const percentRate = randfloat(-99, 100, 2, [0]);
|
|
66
68
|
const identifiers = {
|
|
67
69
|
vf,
|
|
68
70
|
percentRate,
|
|
@@ -90,7 +90,7 @@ const isAnswerValid = (ans, { answer, percent, target }) => {
|
|
|
90
90
|
switch (target) {
|
|
91
91
|
case "decimalToPercent":
|
|
92
92
|
case "fractionToPercent":
|
|
93
|
-
return percentParser(ans) === answer;
|
|
93
|
+
return percentParser(ans, false) === answer;
|
|
94
94
|
case "percentToDecimal":
|
|
95
95
|
return numberVEA(ans, answer);
|
|
96
96
|
case "percentToFraction":
|
package/lib/index.d.ts
CHANGED
|
@@ -503,6 +503,10 @@ declare const mathExercises: (Exercise<{
|
|
|
503
503
|
}, {}> | Exercise<{
|
|
504
504
|
dec: number;
|
|
505
505
|
isDecimalToHours: boolean;
|
|
506
|
+
}, {}> | Exercise<{
|
|
507
|
+
hours: number;
|
|
508
|
+
mins: number;
|
|
509
|
+
seconds: number;
|
|
506
510
|
}, {}> | Exercise<{
|
|
507
511
|
tex: string;
|
|
508
512
|
}, {}> | Exercise<{
|
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;AAG7D,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;AAG7D,OAAO,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAA6B,CAAC;AAE/C,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC"}
|
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":"AAiBA,eAAO,MAAM,UAAU,YAGtB,CAAC"}
|
package/lib/playground.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { parseAlgebraic } from "./tree/parsers/latexParser.js";
|
|
2
2
|
export const playground = () => {
|
|
3
|
-
const tex = "
|
|
4
|
-
console.log(parseAlgebraic(tex).simplify().toTex());
|
|
3
|
+
const tex = "3\\%";
|
|
4
|
+
console.log(parseAlgebraic(tex).simplify({}).toTex());
|
|
5
5
|
};
|
|
@@ -5,12 +5,12 @@ export declare class PercentNode implements Node {
|
|
|
5
5
|
constructor(value: number);
|
|
6
6
|
toMathString(): string;
|
|
7
7
|
toTex(): string;
|
|
8
|
-
toMathjs(): string;
|
|
9
8
|
toAllValidTexs(): string[];
|
|
10
9
|
toIdentifiers(): {
|
|
11
10
|
id: NodeIds;
|
|
12
11
|
value: number;
|
|
13
12
|
};
|
|
13
|
+
toNumber(): number;
|
|
14
14
|
toEquivalentNodes(): this[];
|
|
15
15
|
simplify(): this;
|
|
16
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"percentNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/numbers/percentNode.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"percentNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/numbers/percentNode.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAErD,qBAAa,WAAY,YAAW,IAAI;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,QAAQ,CAAC;gBAEH,KAAK,EAAE,MAAM;IAKzB,YAAY,IAAI,MAAM;IAGtB,KAAK,IAAI,MAAM;IAIf,cAAc;IAGd,aAAa;;;;IAMb,QAAQ;IAGR,iBAAiB;IAGjB,QAAQ;CAGT"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { round } from "../../../math/utils/round.js";
|
|
1
2
|
import { NodeIds, NodeType } from "../node.js";
|
|
2
3
|
export class PercentNode {
|
|
3
4
|
value;
|
|
@@ -10,10 +11,7 @@ export class PercentNode {
|
|
|
10
11
|
return `${this.value}%`;
|
|
11
12
|
}
|
|
12
13
|
toTex() {
|
|
13
|
-
return `${
|
|
14
|
-
}
|
|
15
|
-
toMathjs() {
|
|
16
|
-
return this.toMathString();
|
|
14
|
+
return `${this.value.frenchify()}\\%`;
|
|
17
15
|
}
|
|
18
16
|
toAllValidTexs() {
|
|
19
17
|
return [this.toTex()];
|
|
@@ -24,6 +22,9 @@ export class PercentNode {
|
|
|
24
22
|
value: this.value,
|
|
25
23
|
};
|
|
26
24
|
}
|
|
25
|
+
toNumber() {
|
|
26
|
+
return round(this.value / 100, 10);
|
|
27
|
+
}
|
|
27
28
|
toEquivalentNodes() {
|
|
28
29
|
return [this];
|
|
29
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"latexParser.d.ts","sourceRoot":"","sources":["../../../src/tree/parsers/latexParser.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAQ5D,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;
|
|
1
|
+
{"version":3,"file":"latexParser.d.ts","sourceRoot":"","sources":["../../../src/tree/parsers/latexParser.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAQ5D,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AA0ExE,eAAO,MAAM,QAAQ,UAAW,MAAM,aAkDrC,CAAC;AAEF,KAAK,aAAa,GAAG;IACnB,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B,CAAC;AACF,eAAO,MAAM,cAAc,UAAW,MAAM,SAAS,aAAa,kBA2BjE,CAAC;AAEF,eAAO,MAAM,UAAU,UAAW,MAAM,+CA6CvC,CAAC"}
|
|
@@ -35,6 +35,11 @@ const symbols = [
|
|
|
35
35
|
{ tex: "+\\infty", node: PlusInfinityNode },
|
|
36
36
|
{ tex: "-\\infty", node: MinusInfinityNode },
|
|
37
37
|
];
|
|
38
|
+
// const specialChars = [
|
|
39
|
+
// {
|
|
40
|
+
// tex: "\\%", node: PercentNode
|
|
41
|
+
// }
|
|
42
|
+
// ]
|
|
38
43
|
//separators between trees
|
|
39
44
|
const separators = ["=", "<", ">", "\\leq", "\\geq"];
|
|
40
45
|
//le nombre de parentheses est il respecté
|
|
@@ -101,6 +106,12 @@ export const tokenize = (latex) => {
|
|
|
101
106
|
i += cmdMatch[0].length - 1;
|
|
102
107
|
continue;
|
|
103
108
|
}
|
|
109
|
+
// const specialCharMatch = substring.match(/^\\%/);
|
|
110
|
+
// if (specialCharMatch) {
|
|
111
|
+
// tokens.push(specialCharMatch[0]);
|
|
112
|
+
// i += specialCharMatch[0].length - 1;
|
|
113
|
+
// continue;
|
|
114
|
+
// }
|
|
104
115
|
}
|
|
105
116
|
return tokens;
|
|
106
117
|
};
|