math-exercises 2.2.79 → 2.2.81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/exercises/math/calcul/arithmetics/divisibiltyCriteria.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/divisibiltyCriteria.js +1 -0
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType0.d.ts +5 -1
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType0.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType0.js +95 -20
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType1.d.ts +4 -1
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType1.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType1.js +104 -26
- package/lib/exercises/math/derivation/derivative/lnDerivativeOne.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/lnDerivativeOne.js +17 -7
- package/lib/exercises/math/derivation/derivative/lnDerivativeThree.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/lnDerivativeThree.js +49 -27
- package/lib/exercises/math/derivation/derivative/lnDerivativeTwo.js +1 -1
- package/lib/exercises/math/derivation/derivative/secondDerivativeOfExpoFunction.js +1 -1
- package/lib/exercises/math/functions/affines/signFunction.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/signFunction.js +66 -27
- package/lib/exercises/math/functions/basics/graphicInequation.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/graphicInequation.js +57 -36
- package/lib/exercises/math/functions/exponential/expEquation.js +1 -1
- package/lib/exercises/math/functions/exponentials/exponentialsVariations.d.ts.map +1 -1
- package/lib/exercises/math/functions/exponentials/exponentialsVariations.js +1 -0
- package/lib/exercises/math/functions/integral/integralFractions.js +1 -1
- package/lib/exercises/math/functions/logarithm/log10Simplifying.d.ts +5 -2
- package/lib/exercises/math/functions/logarithm/log10Simplifying.d.ts.map +1 -1
- package/lib/exercises/math/functions/logarithm/log10Simplifying.js +7 -2
- package/lib/exercises/math/functions/logarithm/logEquation.d.ts.map +1 -1
- package/lib/exercises/math/functions/logarithm/logEquation.js +23 -14
- package/lib/exercises/math/functions/logarithm/logPowerEquation.d.ts +5 -2
- package/lib/exercises/math/functions/logarithm/logPowerEquation.d.ts.map +1 -1
- package/lib/exercises/math/functions/logarithm/logPowerEquation.js +16 -12
- package/lib/exercises/math/functions/logarithm/logSimplifiying.d.ts.map +1 -1
- package/lib/exercises/math/functions/logarithm/logSimplifiying.js +37 -16
- package/lib/exercises/math/geometry/vectors/vectorLinearCombination.js +4 -4
- package/lib/exercises/math/matrices/matrixInversibilityDomain.js +1 -0
- package/lib/exercises/math/primitive/logarithmePrimitive.d.ts.map +1 -1
- package/lib/exercises/math/primitive/logarithmePrimitive.js +11 -3
- package/lib/exercises/math/sets/intervals/inequalityToInterval.d.ts.map +1 -1
- package/lib/exercises/math/sets/intervals/inequalityToInterval.js +11 -11
- package/lib/exercises/options/inequationSolutionFormat.d.ts +3 -0
- package/lib/exercises/options/inequationSolutionFormat.d.ts.map +1 -0
- package/lib/exercises/options/inequationSolutionFormat.js +12 -0
- package/lib/exercises/pc/pH.js +1 -1
- package/lib/index.d.ts +18 -6
- package/lib/index.d.ts.map +1 -1
- package/lib/math/numbers/integer/integer.d.ts +1 -1
- package/lib/math/numbers/reals/real.d.ts +1 -1
- package/lib/tree/nodes/algebraicNode.d.ts +1 -0
- package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
- package/lib/tree/nodes/inequations/inequationNode.d.ts +5 -2
- package/lib/tree/nodes/inequations/inequationNode.d.ts.map +1 -1
- package/lib/tree/nodes/inequations/inequationNode.js +40 -3
- package/lib/tree/nodes/numbers/numberNode.d.ts +2 -2
- package/lib/tree/nodes/numbers/numberNode.d.ts.map +1 -1
- package/lib/tree/nodes/numbers/numberNode.js +7 -1
- package/lib/tree/nodes/sets/intervalNode.d.ts +2 -2
- package/lib/tree/nodes/sets/intervalNode.d.ts.map +1 -1
- package/lib/tree/nodes/sets/intervalNode.js +2 -2
- package/lib/tree/nodes/sets/setNode.d.ts +1 -0
- package/lib/tree/nodes/sets/setNode.d.ts.map +1 -1
- package/lib/tree/nodes/sets/unionIntervalNode.d.ts +1 -1
- package/lib/tree/nodes/sets/unionIntervalNode.d.ts.map +1 -1
- package/lib/tree/nodes/sets/unionIntervalNode.js +1 -1
- package/lib/tree/parsers/inequationParser.d.ts +7 -0
- package/lib/tree/parsers/inequationParser.d.ts.map +1 -0
- package/lib/tree/parsers/inequationParser.js +30 -0
- package/lib/tree/parsers/intervalParser.d.ts.map +1 -1
- package/lib/tree/parsers/intervalParser.js +32 -26
- package/lib/tree/parsers/latexParser.d.ts.map +1 -1
- package/lib/tree/parsers/latexParser.js +29 -6
- package/lib/tree/parsers/powerParser.d.ts +1 -1
- package/lib/tree/parsers/rationalParser.d.ts +1 -1
- package/lib/tree/parsers/unionIntervalParser.d.ts +9 -0
- package/lib/tree/parsers/unionIntervalParser.d.ts.map +1 -0
- package/lib/tree/parsers/unionIntervalParser.js +26 -0
- package/lib/types/keyIds.d.ts +1 -1
- package/lib/types/keyIds.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"divisibiltyCriteria.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/arithmetics/divisibiltyCriteria.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,0BAA0B,CAAC;AAOlC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AA0FF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,
|
|
1
|
+
{"version":3,"file":"divisibiltyCriteria.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/arithmetics/divisibiltyCriteria.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,0BAA0B,CAAC;AAOlC,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AA0FF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAmBrD,CAAC"}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { Exercise } from "../../../../exercises/exercise";
|
|
2
2
|
import { InegalitySymbols } from "../../../../math/inequations/inequation";
|
|
3
|
+
/**x +b < c */
|
|
3
4
|
type Identifiers = {
|
|
4
5
|
b: number;
|
|
5
6
|
c: number;
|
|
6
7
|
ineqType: InegalitySymbols;
|
|
7
8
|
};
|
|
8
|
-
|
|
9
|
+
type Options = {
|
|
10
|
+
inequationSolutionFormat: string;
|
|
11
|
+
};
|
|
12
|
+
export declare const firstDegreeInequationsType0: Exercise<Identifiers, Options>;
|
|
9
13
|
export {};
|
|
10
14
|
//# sourceMappingURL=firstDegreeInequationsType0.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firstDegreeInequationsType0.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/inequations/firstDegreeInequationsType0.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"firstDegreeInequationsType0.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/inequations/firstDegreeInequationsType0.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,0BAA0B,CAAC;AAIlC,OAAO,EACL,gBAAgB,EAGjB,MAAM,mCAAmC,CAAC;AAe3C,cAAc;AAEd,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,QAAQ,EAAE,gBAAgB,CAAC;CAC5B,CAAC;AA2JF,KAAK,OAAO,GAAG;IACb,wBAAwB,EAAE,MAAM,CAAC;CAClC,CAAC;AAGF,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAqBtE,CAAC"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.firstDegreeInequationsType0 = void 0;
|
|
4
4
|
const exercise_1 = require("../../../../exercises/exercise");
|
|
5
|
+
const inequationSolutionFormat_1 = require("../../../../exercises/options/inequationSolutionFormat");
|
|
5
6
|
const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
|
|
6
|
-
const inequationKeys_1 = require("../../../../exercises/utils/keys/inequationKeys");
|
|
7
7
|
const inequation_1 = require("../../../../math/inequations/inequation");
|
|
8
8
|
const affine_1 = require("../../../../math/polynomials/affine");
|
|
9
9
|
const randint_1 = require("../../../../math/utils/random/randint");
|
|
@@ -11,44 +11,112 @@ const inequationNode_1 = require("../../../../tree/nodes/inequations/inequationN
|
|
|
11
11
|
const inequationSolutionNode_1 = require("../../../../tree/nodes/inequations/inequationSolutionNode");
|
|
12
12
|
const numberNode_1 = require("../../../../tree/nodes/numbers/numberNode");
|
|
13
13
|
const variableNode_1 = require("../../../../tree/nodes/variables/variableNode");
|
|
14
|
+
const inequationParser_1 = require("../../../../tree/parsers/inequationParser");
|
|
15
|
+
const intervalParser_1 = require("../../../../tree/parsers/intervalParser");
|
|
14
16
|
const coinFlip_1 = require("../../../../utils/alea/coinFlip");
|
|
15
17
|
const shuffle_1 = require("../../../../utils/alea/shuffle");
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
const getHint = (identifiers) => {
|
|
19
|
+
return `Pour résoudre cette inéquation, il faut isoler $x$ à gauche. Pour cela, il faut effectuer des deux côtés de l'inéquation la bonne opération qui permet de supprimer le terme $${identifiers.b < 0 ? "" : "+"}${identifiers.b}$.`;
|
|
20
|
+
};
|
|
21
|
+
const getCorrection = (identifiers, opts) => {
|
|
22
|
+
const isInterval = opts?.inequationSolutionFormat === "Intervalle (S = [a;b])";
|
|
23
|
+
const answer = getAnswer(identifiers, opts);
|
|
24
|
+
return `On isole $x$ à gauche en ${identifiers.b > 0 ? "soustrayant" : "additionnant"} les deux côtés de l'inéquation par $${Math.abs(identifiers.b)}$:
|
|
25
|
+
|
|
26
|
+
${(0, inequationNode_1.firstDegreeInequationResolutionTex)(new affine_1.Affine(1, identifiers.b), identifiers.ineqType, identifiers.c.toTree())}
|
|
27
|
+
|
|
28
|
+
${isInterval
|
|
29
|
+
? `On traduit ensuite cette inéquation en intervalle :
|
|
30
|
+
|
|
31
|
+
$$
|
|
32
|
+
${answer}
|
|
33
|
+
$$
|
|
34
|
+
`
|
|
35
|
+
: ""}
|
|
36
|
+
`;
|
|
37
|
+
};
|
|
38
|
+
const getInstruction = (identifiers) => {
|
|
39
|
+
const affine = new affine_1.Affine(1, identifiers.b);
|
|
40
|
+
return `Résoudre l'inéquation :
|
|
41
|
+
|
|
42
|
+
$$
|
|
43
|
+
${affine.toTex()} ${identifiers.ineqType} ${identifiers.c}
|
|
44
|
+
$$`;
|
|
45
|
+
};
|
|
46
|
+
const getAnswer = (identifiers, opts) => {
|
|
47
|
+
const result = identifiers.c - identifiers.b;
|
|
48
|
+
const ineq = new inequationNode_1.InequationNode([new variableNode_1.VariableNode("x"), new numberNode_1.NumberNode(result)], identifiers.ineqType);
|
|
49
|
+
const isInterval = opts?.inequationSolutionFormat === "Intervalle (S = [a;b])";
|
|
50
|
+
if (isInterval) {
|
|
51
|
+
return new inequationSolutionNode_1.InequationSolutionNode(ineq.toInterval()).toTex();
|
|
52
|
+
}
|
|
53
|
+
else
|
|
54
|
+
return ineq.toTex();
|
|
55
|
+
};
|
|
56
|
+
const getKeys = (identifiers, opts) => {
|
|
57
|
+
const isInterval = opts?.inequationSolutionFormat === "Intervalle (S = [a;b])";
|
|
58
|
+
if (isInterval)
|
|
59
|
+
return ["S", "equal", "lbracket", "semicolon", "rbracket", "infty"];
|
|
60
|
+
return ["x", "inf", "sup", "leq", "geq"];
|
|
61
|
+
};
|
|
62
|
+
const getFirstDegreeInequationsQuestion = (opts) => {
|
|
18
63
|
const affine = new affine_1.Affine(1, (0, randint_1.randint)(-10, 11, [0]));
|
|
19
64
|
const c = (0, randint_1.randint)(-10, 11);
|
|
20
|
-
const result = c - affine.b;
|
|
21
65
|
const ineqType = inequation_1.InequationSymbolConstructor.random();
|
|
22
|
-
const
|
|
66
|
+
const identifiers = { ineqType: ineqType.symbol, b: affine.b, c };
|
|
23
67
|
const question = {
|
|
24
|
-
answer:
|
|
25
|
-
instruction:
|
|
26
|
-
keys:
|
|
68
|
+
answer: getAnswer(identifiers, opts),
|
|
69
|
+
instruction: getInstruction(identifiers, opts),
|
|
70
|
+
keys: getKeys(identifiers, opts),
|
|
27
71
|
answerFormat: "tex",
|
|
28
|
-
identifiers
|
|
72
|
+
identifiers,
|
|
73
|
+
hint: getHint(identifiers, opts),
|
|
74
|
+
correction: getCorrection(identifiers, opts),
|
|
29
75
|
};
|
|
30
76
|
return question;
|
|
31
77
|
};
|
|
32
|
-
const getPropositions = (n, { answer, ineqType, b, c }) => {
|
|
78
|
+
const getPropositions = (n, { answer, ineqType, b, c }, opts) => {
|
|
79
|
+
const isInterval = opts?.inequationSolutionFormat === "Intervalle (S = [a;b])";
|
|
33
80
|
const result = c - b;
|
|
34
81
|
const propositions = [];
|
|
35
82
|
(0, exercise_1.addValidProp)(propositions, answer);
|
|
36
83
|
const ineqSymbol = new inequation_1.InequationSymbol(ineqType);
|
|
37
84
|
const invIneqType = ineqSymbol.reversed();
|
|
38
|
-
(
|
|
85
|
+
const ineq = new inequationNode_1.InequationNode([new variableNode_1.VariableNode("x"), new numberNode_1.NumberNode(result)], invIneqType);
|
|
86
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, isInterval
|
|
87
|
+
? new inequationSolutionNode_1.InequationSolutionNode(ineq.toInterval()).toTex()
|
|
88
|
+
: ineq.toTex());
|
|
39
89
|
while (propositions.length < n) {
|
|
40
|
-
const
|
|
41
|
-
(0,
|
|
90
|
+
const fakeRes = (0, randint_1.randint)(-10, 11);
|
|
91
|
+
const fakeIneqType = (0, coinFlip_1.coinFlip)() ? ineqType : invIneqType;
|
|
92
|
+
const fakeIneq = new inequationNode_1.InequationNode([new variableNode_1.VariableNode("x"), new numberNode_1.NumberNode(fakeRes)], fakeIneqType);
|
|
93
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, isInterval
|
|
94
|
+
? new inequationSolutionNode_1.InequationSolutionNode(fakeIneq.toInterval()).toTex()
|
|
95
|
+
: fakeIneq.toTex());
|
|
42
96
|
}
|
|
43
97
|
return (0, shuffle_1.shuffle)(propositions);
|
|
44
98
|
};
|
|
45
|
-
const isAnswerValid = (ans, { answer, ineqType, b, c }) => {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
99
|
+
const isAnswerValid = (ans, { answer, ineqType, b, c }, opts) => {
|
|
100
|
+
try {
|
|
101
|
+
const isInterval = opts?.inequationSolutionFormat === "Intervalle (S = [a;b])";
|
|
102
|
+
if (isInterval) {
|
|
103
|
+
const parsed = (0, intervalParser_1.intervalParser)(ans.replaceAll("S", "").replaceAll("=", ""));
|
|
104
|
+
if (!parsed)
|
|
105
|
+
return false;
|
|
106
|
+
return "S=\\ " + parsed.simplify().toTex() === answer;
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
const parsed = (0, inequationParser_1.inequationParser)(ans);
|
|
110
|
+
if (!parsed)
|
|
111
|
+
return false;
|
|
112
|
+
return parsed.simplify().toTex() === answer;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
catch (err) {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
51
118
|
};
|
|
119
|
+
const options = [inequationSolutionFormat_1.inequationSolutionFormat];
|
|
52
120
|
exports.firstDegreeInequationsType0 = {
|
|
53
121
|
id: "firstDegreeInequationsType0",
|
|
54
122
|
connector: "\\iff",
|
|
@@ -56,10 +124,17 @@ exports.firstDegreeInequationsType0 = {
|
|
|
56
124
|
levels: ["3ème", "2ndPro", "2nde", "1reESM", "1rePro", "1reTech"],
|
|
57
125
|
isSingleStep: true,
|
|
58
126
|
sections: ["Inéquations"],
|
|
59
|
-
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getFirstDegreeInequationsQuestion, nb),
|
|
127
|
+
generator: (nb, opts) => (0, getDistinctQuestions_1.getDistinctQuestions)(() => getFirstDegreeInequationsQuestion(opts), nb),
|
|
60
128
|
qcmTimer: 60,
|
|
61
129
|
freeTimer: 60,
|
|
62
130
|
getPropositions,
|
|
63
131
|
isAnswerValid,
|
|
64
132
|
subject: "Mathématiques",
|
|
133
|
+
options,
|
|
134
|
+
hasHintAndCorrection: true,
|
|
135
|
+
getAnswer,
|
|
136
|
+
getCorrection,
|
|
137
|
+
getHint,
|
|
138
|
+
getInstruction,
|
|
139
|
+
getKeys,
|
|
65
140
|
};
|
|
@@ -5,6 +5,9 @@ type Identifiers = {
|
|
|
5
5
|
b: number;
|
|
6
6
|
ineqType: InegalitySymbols;
|
|
7
7
|
};
|
|
8
|
-
|
|
8
|
+
type Options = {
|
|
9
|
+
inequationSolutionFormat: string;
|
|
10
|
+
};
|
|
11
|
+
export declare const firstDegreeInequationsType1: Exercise<Identifiers, Options>;
|
|
9
12
|
export {};
|
|
10
13
|
//# sourceMappingURL=firstDegreeInequationsType1.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firstDegreeInequationsType1.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/inequations/firstDegreeInequationsType1.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"firstDegreeInequationsType1.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/inequations/firstDegreeInequationsType1.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,0BAA0B,CAAC;AAIlC,OAAO,EACL,gBAAgB,EAGjB,MAAM,mCAAmC,CAAC;AAc3C,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,QAAQ,EAAE,gBAAgB,CAAC;CAC5B,CAAC;AA8KF,KAAK,OAAO,GAAG;IACb,wBAAwB,EAAE,MAAM,CAAC;CAClC,CAAC;AAGF,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAsBtE,CAAC"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.firstDegreeInequationsType1 = void 0;
|
|
4
4
|
const exercise_1 = require("../../../../exercises/exercise");
|
|
5
|
+
const inequationSolutionFormat_1 = require("../../../../exercises/options/inequationSolutionFormat");
|
|
5
6
|
const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
|
|
6
|
-
const inequationKeys_1 = require("../../../../exercises/utils/keys/inequationKeys");
|
|
7
7
|
const inequation_1 = require("../../../../math/inequations/inequation");
|
|
8
8
|
const rational_1 = require("../../../../math/numbers/rationals/rational");
|
|
9
9
|
const affine_1 = require("../../../../math/polynomials/affine");
|
|
@@ -11,50 +11,121 @@ const randint_1 = require("../../../../math/utils/random/randint");
|
|
|
11
11
|
const inequationNode_1 = require("../../../../tree/nodes/inequations/inequationNode");
|
|
12
12
|
const inequationSolutionNode_1 = require("../../../../tree/nodes/inequations/inequationSolutionNode");
|
|
13
13
|
const variableNode_1 = require("../../../../tree/nodes/variables/variableNode");
|
|
14
|
+
const inequationParser_1 = require("../../../../tree/parsers/inequationParser");
|
|
15
|
+
const intervalParser_1 = require("../../../../tree/parsers/intervalParser");
|
|
14
16
|
const coinFlip_1 = require("../../../../utils/alea/coinFlip");
|
|
15
17
|
const shuffle_1 = require("../../../../utils/alea/shuffle");
|
|
16
18
|
/**ax<b */
|
|
17
|
-
const
|
|
19
|
+
const getHint = (identifiers) => {
|
|
20
|
+
return `Pour résoudre cette inéquation, il faut isoler $x$ à gauche. Pour cela, il faut effectuer des deux côtés de l'inéquation la bonne opération qui permet de supprimer le facteur $${identifiers.a}$.`;
|
|
21
|
+
};
|
|
22
|
+
const getCorrection = (identifiers, opts) => {
|
|
23
|
+
const { a, b, ineqType } = identifiers;
|
|
24
|
+
const isInterval = opts?.inequationSolutionFormat === "Intervalle (S = [a;b])";
|
|
25
|
+
const answer = getAnswer(identifiers, opts);
|
|
26
|
+
return `On isole $x$ à gauche en divisant les deux côtés de l'inéquation par $${identifiers.a}$:
|
|
27
|
+
|
|
28
|
+
${(0, inequationNode_1.firstDegreeInequationResolutionTex)(new affine_1.Affine(a, 0), ineqType, b.toTree())}
|
|
29
|
+
|
|
30
|
+
${identifiers.a < 0
|
|
31
|
+
? `On a changé le sens de l'inéquation, car $${a}$ est négatif.`
|
|
32
|
+
: ""}
|
|
33
|
+
|
|
34
|
+
${isInterval
|
|
35
|
+
? `On traduit ensuite cette inéquation en intervalle :
|
|
36
|
+
|
|
37
|
+
$$
|
|
38
|
+
${answer}
|
|
39
|
+
$$
|
|
40
|
+
`
|
|
41
|
+
: ""}
|
|
42
|
+
`;
|
|
43
|
+
};
|
|
44
|
+
const getInstruction = (identifiers) => {
|
|
45
|
+
const affine = new affine_1.Affine(identifiers.a, 0);
|
|
46
|
+
return `Résoudre l'inéquation :
|
|
47
|
+
|
|
48
|
+
$$
|
|
49
|
+
${affine.toTex()} ${identifiers.ineqType} ${identifiers.b}
|
|
50
|
+
$$`;
|
|
51
|
+
};
|
|
52
|
+
const getAnswer = (identifiers, opts) => {
|
|
53
|
+
const { a, b, ineqType } = identifiers;
|
|
54
|
+
const result = new rational_1.Rational(b, a).simplify().toTree();
|
|
55
|
+
const ineq = new inequationNode_1.InequationNode([new variableNode_1.VariableNode("x"), result], identifiers.ineqType);
|
|
56
|
+
const answerIneq = identifiers.a < 0 ? ineq.toSwitched() : ineq;
|
|
57
|
+
const isInterval = opts?.inequationSolutionFormat === "Intervalle (S = [a;b])";
|
|
58
|
+
if (isInterval) {
|
|
59
|
+
return new inequationSolutionNode_1.InequationSolutionNode(answerIneq.toInterval()).toTex();
|
|
60
|
+
}
|
|
61
|
+
else
|
|
62
|
+
return answerIneq.toTex();
|
|
63
|
+
};
|
|
64
|
+
const getKeys = (identifiers, opts) => {
|
|
65
|
+
const isInterval = opts?.inequationSolutionFormat === "Intervalle (S = [a;b])";
|
|
66
|
+
if (isInterval)
|
|
67
|
+
return ["S", "equal", "lbracket", "semicolon", "rbracket", "infty"];
|
|
68
|
+
return ["x", "inf", "sup", "leq", "geq"];
|
|
69
|
+
};
|
|
70
|
+
const getFirstDegreeInequationsQuestion = (opts) => {
|
|
18
71
|
const affine = new affine_1.Affine((0, randint_1.randint)(-10, 10, [0, 1]), 0);
|
|
19
72
|
const b = (0, randint_1.randint)(-10, 11);
|
|
20
|
-
const result = new rational_1.Rational(b, affine.a).simplify().toTree().toTex();
|
|
21
73
|
const ineqType = inequation_1.InequationSymbolConstructor.random();
|
|
22
|
-
const
|
|
23
|
-
const answer = `x${affine.a > 0 ? ineqType.symbol : invIneqType}${result}`;
|
|
74
|
+
const identifiers = { a: affine.a, b, ineqType: ineqType.symbol };
|
|
24
75
|
const question = {
|
|
25
|
-
answer:
|
|
26
|
-
instruction:
|
|
27
|
-
keys:
|
|
76
|
+
answer: getAnswer(identifiers, opts),
|
|
77
|
+
instruction: getInstruction(identifiers, opts),
|
|
78
|
+
keys: getKeys(identifiers, opts),
|
|
28
79
|
answerFormat: "tex",
|
|
29
|
-
identifiers
|
|
80
|
+
identifiers,
|
|
81
|
+
hint: getHint(identifiers, opts),
|
|
82
|
+
correction: getCorrection(identifiers, opts),
|
|
30
83
|
};
|
|
31
84
|
return question;
|
|
32
85
|
};
|
|
33
|
-
const getPropositions = (n, { answer, a, ineqType, b }) => {
|
|
86
|
+
const getPropositions = (n, { answer, a, ineqType, b }, opts) => {
|
|
34
87
|
const propositions = [];
|
|
35
88
|
(0, exercise_1.addValidProp)(propositions, answer);
|
|
89
|
+
const isInterval = opts?.inequationSolutionFormat === "Intervalle (S = [a;b])";
|
|
36
90
|
const ineq = new inequation_1.InequationSymbol(ineqType);
|
|
37
91
|
const invIneqType = ineq.reversed();
|
|
38
|
-
const result = new rational_1.Rational(b, a).simplify().toTree()
|
|
39
|
-
(
|
|
92
|
+
const result = new rational_1.Rational(b, a).simplify().toTree();
|
|
93
|
+
const inequation = new inequationNode_1.InequationNode([new variableNode_1.VariableNode("x"), result], a < 0 ? ineqType : invIneqType);
|
|
94
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, isInterval
|
|
95
|
+
? new inequationSolutionNode_1.InequationSolutionNode(inequation.toInterval()).toTex()
|
|
96
|
+
: inequation.toTex());
|
|
40
97
|
while (propositions.length < n) {
|
|
41
|
-
const
|
|
42
|
-
(0,
|
|
98
|
+
const fakeRes = (0, randint_1.randint)(-10, 11);
|
|
99
|
+
const fakeType = (0, coinFlip_1.coinFlip)() ? ineqType : invIneqType;
|
|
100
|
+
const fakeIneq = new inequationNode_1.InequationNode(["x".toTree(), fakeRes.toTree()], fakeType);
|
|
101
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, isInterval
|
|
102
|
+
? new inequationSolutionNode_1.InequationSolutionNode(fakeIneq.toInterval()).toTex()
|
|
103
|
+
: fakeIneq.toTex());
|
|
43
104
|
}
|
|
44
105
|
return (0, shuffle_1.shuffle)(propositions);
|
|
45
106
|
};
|
|
46
|
-
const isAnswerValid = (ans, { a, b, ineqType }) => {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
107
|
+
const isAnswerValid = (ans, { answer, a, b, ineqType }, opts) => {
|
|
108
|
+
try {
|
|
109
|
+
const isInterval = opts?.inequationSolutionFormat === "Intervalle (S = [a;b])";
|
|
110
|
+
if (isInterval) {
|
|
111
|
+
const parsed = (0, intervalParser_1.intervalParser)(ans.replaceAll("S", "").replaceAll("=", ""));
|
|
112
|
+
if (!parsed)
|
|
113
|
+
return false;
|
|
114
|
+
return ("S=\\ " + parsed.simplify({ decimalToFractions: true }).toTex() ===
|
|
115
|
+
answer);
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
const parsed = (0, inequationParser_1.inequationParser)(ans);
|
|
119
|
+
if (!parsed)
|
|
120
|
+
return false;
|
|
121
|
+
return parsed.simplify({ decimalToFractions: true }).toTex() === answer;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
catch (err) {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
57
127
|
};
|
|
128
|
+
const options = [inequationSolutionFormat_1.inequationSolutionFormat];
|
|
58
129
|
exports.firstDegreeInequationsType1 = {
|
|
59
130
|
id: "firstDegreeInequationsType1",
|
|
60
131
|
connector: "\\iff",
|
|
@@ -63,9 +134,16 @@ exports.firstDegreeInequationsType1 = {
|
|
|
63
134
|
levels: ["3ème", "2ndPro", "2nde", "1reESM", "1rePro", "1reTech"],
|
|
64
135
|
isSingleStep: true,
|
|
65
136
|
sections: ["Inéquations"],
|
|
66
|
-
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getFirstDegreeInequationsQuestion, nb),
|
|
137
|
+
generator: (nb, opts) => (0, getDistinctQuestions_1.getDistinctQuestions)(() => getFirstDegreeInequationsQuestion(opts), nb),
|
|
67
138
|
qcmTimer: 60,
|
|
68
139
|
freeTimer: 60,
|
|
69
140
|
isAnswerValid,
|
|
70
141
|
subject: "Mathématiques",
|
|
142
|
+
options,
|
|
143
|
+
hasHintAndCorrection: true,
|
|
144
|
+
getAnswer,
|
|
145
|
+
getCorrection,
|
|
146
|
+
getHint,
|
|
147
|
+
getInstruction,
|
|
148
|
+
getKeys,
|
|
71
149
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lnDerivativeOne.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/lnDerivativeOne.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"lnDerivativeOne.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/lnDerivativeOne.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,0BAA0B,CAAC;AAUlC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAiEF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAajD,CAAC"}
|
|
@@ -10,22 +10,32 @@ const expNode_1 = require("../../../../tree/nodes/functions/expNode");
|
|
|
10
10
|
const logNode_1 = require("../../../../tree/nodes/functions/logNode");
|
|
11
11
|
const numberNode_1 = require("../../../../tree/nodes/numbers/numberNode");
|
|
12
12
|
const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
|
|
13
|
-
const
|
|
14
|
-
const a
|
|
15
|
-
const b = (0, randint_1.randint)(-9, 10);
|
|
13
|
+
const getInstruction = (identifiers) => {
|
|
14
|
+
const { a, b } = identifiers;
|
|
16
15
|
const polynom = new polynomial_1.Polynomial([b, a]);
|
|
17
16
|
const logTree = new logNode_1.LogNode(polynom.toTree());
|
|
17
|
+
return `Déterminer la dérivée de la fonction : $f(x) = ${logTree.toTex()}$.`;
|
|
18
|
+
};
|
|
19
|
+
const getAnswer = (identifiers) => {
|
|
20
|
+
const { a, b } = identifiers;
|
|
21
|
+
const polynom = new polynomial_1.Polynomial([b, a]);
|
|
18
22
|
const answer = new rationalFrac_1.RationalFrac(new polynomial_1.Polynomial([a]), polynom)
|
|
19
23
|
.simplify()
|
|
20
24
|
.toTree()
|
|
21
25
|
.toTex();
|
|
26
|
+
return answer;
|
|
27
|
+
};
|
|
28
|
+
const getLnDerivative = () => {
|
|
29
|
+
const a = (0, randint_1.randint)(-9, 10, [0]);
|
|
30
|
+
const b = (0, randint_1.randint)(-9, 10);
|
|
31
|
+
const identifiers = { a, b };
|
|
22
32
|
const question = {
|
|
23
|
-
instruction:
|
|
33
|
+
instruction: getInstruction(identifiers),
|
|
24
34
|
startStatement: "f'(x)",
|
|
25
|
-
answer,
|
|
26
|
-
keys: ["x", "
|
|
35
|
+
answer: getAnswer(identifiers),
|
|
36
|
+
keys: ["x", "lnBrackets", "epower"],
|
|
27
37
|
answerFormat: "tex",
|
|
28
|
-
identifiers
|
|
38
|
+
identifiers,
|
|
29
39
|
};
|
|
30
40
|
return question;
|
|
31
41
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lnDerivativeThree.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/lnDerivativeThree.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"lnDerivativeThree.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/derivation/derivative/lnDerivativeThree.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,0BAA0B,CAAC;AAelC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA8GF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAgBnD,CAAC"}
|
|
@@ -12,20 +12,43 @@ const addNode_1 = require("../../../../tree/nodes/operators/addNode");
|
|
|
12
12
|
const fractionNode_1 = require("../../../../tree/nodes/operators/fractionNode");
|
|
13
13
|
const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
|
|
14
14
|
const variableNode_1 = require("../../../../tree/nodes/variables/variableNode");
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
const b =
|
|
15
|
+
const latexParser_1 = require("../../../../tree/parsers/latexParser");
|
|
16
|
+
const getInstruction = (identifiers) => {
|
|
17
|
+
const { a, b } = identifiers;
|
|
18
18
|
const affine = new polynomial_1.Polynomial([b, a]).toTree();
|
|
19
19
|
const myfunction = new multiplyNode_1.MultiplyNode(affine, new logNode_1.LogNode(new variableNode_1.VariableNode("x")));
|
|
20
|
+
return `Déterminer la dérivée de la fonction :
|
|
21
|
+
|
|
22
|
+
$$
|
|
23
|
+
f(x) = ${myfunction.toTex()}
|
|
24
|
+
$$`;
|
|
25
|
+
};
|
|
26
|
+
const getAnswer = (identifiers) => {
|
|
27
|
+
const { a, b } = identifiers;
|
|
28
|
+
const affine = new polynomial_1.Polynomial([b, a]).toTree();
|
|
20
29
|
const derivative = new addNode_1.AddNode(new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode(a), new logNode_1.LogNode(new variableNode_1.VariableNode("x"))), new fractionNode_1.FractionNode(affine, new variableNode_1.VariableNode("x")));
|
|
21
|
-
|
|
30
|
+
return derivative
|
|
31
|
+
.simplify({
|
|
32
|
+
forbidFactorize: true,
|
|
33
|
+
forceDistributeFractions: true,
|
|
34
|
+
towardsDistribute: true,
|
|
35
|
+
})
|
|
36
|
+
.toTex();
|
|
37
|
+
};
|
|
38
|
+
const getKeys = (identifiers) => {
|
|
39
|
+
return ["x", "lnBrackets", "epower"];
|
|
40
|
+
};
|
|
41
|
+
const getLnDerivative = () => {
|
|
42
|
+
const a = (0, randint_1.randint)(-9, 10, [0]);
|
|
43
|
+
const b = (0, randint_1.randint)(-9, 10);
|
|
44
|
+
const identifiers = { a, b };
|
|
22
45
|
const question = {
|
|
23
|
-
instruction:
|
|
46
|
+
instruction: getInstruction(identifiers),
|
|
24
47
|
startStatement: "f'(x)",
|
|
25
|
-
answer,
|
|
26
|
-
keys:
|
|
48
|
+
answer: getAnswer(identifiers),
|
|
49
|
+
keys: getKeys(identifiers),
|
|
27
50
|
answerFormat: "tex",
|
|
28
|
-
identifiers
|
|
51
|
+
identifiers,
|
|
29
52
|
};
|
|
30
53
|
return question;
|
|
31
54
|
};
|
|
@@ -46,26 +69,22 @@ const getPropositions = (n, { answer, a, b }) => {
|
|
|
46
69
|
}
|
|
47
70
|
return (0, exercise_1.shuffleProps)(propositions, n);
|
|
48
71
|
};
|
|
49
|
-
const isAnswerValid = (ans, { a, b }) => {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
72
|
+
const isAnswerValid = (ans, { a, b, answer }) => {
|
|
73
|
+
try {
|
|
74
|
+
const parsed = (0, latexParser_1.parseAlgebraic)(ans);
|
|
75
|
+
if (!parsed)
|
|
76
|
+
return false;
|
|
77
|
+
return (parsed
|
|
78
|
+
.simplify({
|
|
79
|
+
forbidFactorize: true,
|
|
80
|
+
forceDistributeFractions: true,
|
|
81
|
+
towardsDistribute: true,
|
|
82
|
+
})
|
|
83
|
+
.toTex() === answer);
|
|
84
|
+
}
|
|
85
|
+
catch (err) {
|
|
86
|
+
return false;
|
|
62
87
|
}
|
|
63
|
-
const texs = [
|
|
64
|
-
...raw.toAllValidTexs(),
|
|
65
|
-
...developped.toAllValidTexs(),
|
|
66
|
-
...simplified.toAllValidTexs(),
|
|
67
|
-
];
|
|
68
|
-
return texs.includes(ans);
|
|
69
88
|
};
|
|
70
89
|
exports.lnDerivativeThree = {
|
|
71
90
|
id: "lnDerivativeThree",
|
|
@@ -80,4 +99,7 @@ exports.lnDerivativeThree = {
|
|
|
80
99
|
getPropositions,
|
|
81
100
|
isAnswerValid,
|
|
82
101
|
subject: "Mathématiques",
|
|
102
|
+
getKeys,
|
|
103
|
+
getAnswer,
|
|
104
|
+
getInstruction,
|
|
83
105
|
};
|
|
@@ -22,7 +22,7 @@ const getLnDerivative = () => {
|
|
|
22
22
|
instruction: `Déterminer la dérivée de la fonction $f(x) = ${myfunction.toTex()}$.`,
|
|
23
23
|
startStatement: "f'(x)",
|
|
24
24
|
answer,
|
|
25
|
-
keys: ["x", "
|
|
25
|
+
keys: ["x", "lnBrackets", "epower"],
|
|
26
26
|
answerFormat: "tex",
|
|
27
27
|
identifiers: { a, b },
|
|
28
28
|
};
|
|
@@ -15,7 +15,7 @@ const getSecondDerivativeOfExpoFunctionQuestion = () => {
|
|
|
15
15
|
const question = {
|
|
16
16
|
answer: correctAnswer.toTex(),
|
|
17
17
|
instruction: `Déterminer la fonction dérivée seconde $f''$ de la fonction $f$ définie par $f(x)=${funct.toTex()}$`,
|
|
18
|
-
keys: ["epower", "x", "
|
|
18
|
+
keys: ["epower", "x", "lnBrackets"],
|
|
19
19
|
answerFormat: "tex",
|
|
20
20
|
identifiers: { coeffs: polynom.coefficients },
|
|
21
21
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signFunction.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/signFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"signFunction.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/signFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,0BAA0B,CAAC;AAmBlC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,cAAc,EAAE,OAAO,CAAC;CACzB,CAAC;AA8HF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,CAe9C,CAAC"}
|