math-exercises 3.0.71 → 3.0.73
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 +3 -1
- package/lib/exercises/exercise.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/getParityBetweenTwoNumbers.d.ts +9 -0
- package/lib/exercises/math/calcul/arithmetics/getParityBetweenTwoNumbers.d.ts.map +1 -0
- package/lib/exercises/math/calcul/arithmetics/getParityBetweenTwoNumbers.js +114 -0
- package/lib/exercises/math/calcul/arithmetics/imageOfSquareFunction.d.ts +8 -0
- package/lib/exercises/math/calcul/arithmetics/imageOfSquareFunction.d.ts.map +1 -0
- package/lib/exercises/math/calcul/arithmetics/imageOfSquareFunction.js +152 -0
- package/lib/exercises/math/calcul/arithmetics/index.d.ts +9 -0
- package/lib/exercises/math/calcul/arithmetics/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/index.js +9 -0
- package/lib/exercises/math/calcul/arithmetics/isInequalityTrue.d.ts +15 -0
- package/lib/exercises/math/calcul/arithmetics/isInequalityTrue.d.ts.map +1 -0
- package/lib/exercises/math/calcul/arithmetics/isInequalityTrue.js +143 -0
- package/lib/exercises/math/calcul/arithmetics/isPointOnCubicFunction.d.ts +9 -0
- package/lib/exercises/math/calcul/arithmetics/isPointOnCubicFunction.d.ts.map +1 -0
- package/lib/exercises/math/calcul/arithmetics/isPointOnCubicFunction.js +111 -0
- package/lib/exercises/math/calcul/arithmetics/isPointOnFunction.d.ts +10 -0
- package/lib/exercises/math/calcul/arithmetics/isPointOnFunction.d.ts.map +1 -0
- package/lib/exercises/math/calcul/arithmetics/isPointOnFunction.js +133 -0
- package/lib/exercises/math/calcul/arithmetics/isPointOnReciprocalFunction.d.ts +9 -0
- package/lib/exercises/math/calcul/arithmetics/isPointOnReciprocalFunction.d.ts.map +1 -0
- package/lib/exercises/math/calcul/arithmetics/isPointOnReciprocalFunction.js +117 -0
- package/lib/exercises/math/calcul/arithmetics/minNumberInequality.d.ts +13 -0
- package/lib/exercises/math/calcul/arithmetics/minNumberInequality.d.ts.map +1 -0
- package/lib/exercises/math/calcul/arithmetics/minNumberInequality.js +192 -0
- package/lib/exercises/math/calcul/arithmetics/primeNumberIdentification.d.ts +7 -0
- package/lib/exercises/math/calcul/arithmetics/primeNumberIdentification.d.ts.map +1 -0
- package/lib/exercises/math/calcul/arithmetics/primeNumberIdentification.js +84 -0
- package/lib/exercises/math/calcul/arithmetics/squareRootCalculation.d.ts +8 -0
- package/lib/exercises/math/calcul/arithmetics/squareRootCalculation.d.ts.map +1 -0
- package/lib/exercises/math/calcul/arithmetics/squareRootCalculation.js +107 -0
- package/lib/exercises/math/calcul/fractions/fractionAndIntegerSum.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionAndIntegerSum.js +37 -0
- package/lib/exercises/math/calcul/fractions/fractionToPercentToDecimal.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionToPercentToDecimal.js +57 -6
- package/lib/exercises/math/calcul/fractions/fractionsOperations.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionsOperations.js +64 -22
- package/lib/exercises/math/calcul/fractions/fractionsSubstraction.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionsSubstraction.js +143 -4
- package/lib/exercises/math/calcul/fractions/fractionsSum.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionsSum.js +141 -3
- package/lib/exercises/math/calcul/fractions/index.d.ts +1 -0
- package/lib/exercises/math/calcul/fractions/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/index.js +1 -0
- package/lib/exercises/math/calcul/fractions/periodicWritingToFraction.js +3 -3
- package/lib/exercises/math/calcul/fractions/powerNotation.d.ts +9 -0
- package/lib/exercises/math/calcul/fractions/powerNotation.d.ts.map +1 -0
- package/lib/exercises/math/calcul/fractions/powerNotation.js +125 -0
- package/lib/exercises/math/calcul/proportionality/proportionalityTable.d.ts.map +1 -1
- package/lib/exercises/math/calcul/proportionality/proportionalityTable.js +29 -5
- package/lib/exercises/math/calcul/sign/absoluteNumber.d.ts +7 -0
- package/lib/exercises/math/calcul/sign/absoluteNumber.d.ts.map +1 -0
- package/lib/exercises/math/calcul/sign/absoluteNumber.js +80 -0
- package/lib/exercises/math/calcul/sign/index.d.ts +1 -0
- package/lib/exercises/math/calcul/sign/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/sign/index.js +1 -0
- package/lib/exercises/math/calculLitteral/equation/binomialsTrinomialsProposedSolutions.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/binomialsTrinomialsProposedSolutions.js +67 -21
- package/lib/exercises/math/calculLitteral/equation/equa3.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equa3.js +0 -2
- package/lib/exercises/math/calculLitteral/equation/equationWithDistributivity.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equationWithDistributivity.js +53 -9
- package/lib/exercises/math/calculLitteral/equation/factorizeEquation.d.ts +9 -0
- package/lib/exercises/math/calculLitteral/equation/factorizeEquation.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/equation/factorizeEquation.js +145 -0
- package/lib/exercises/math/calculLitteral/equation/index.d.ts +1 -0
- package/lib/exercises/math/calculLitteral/equation/index.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/index.js +1 -0
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType2.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType2.js +32 -4
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType3.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType3.js +30 -2
- package/lib/exercises/math/calculLitteral/inequations/index.d.ts +1 -0
- package/lib/exercises/math/calculLitteral/inequations/index.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/inequations/index.js +1 -0
- package/lib/exercises/math/calculLitteral/inequations/inequationsSign.d.ts +9 -0
- package/lib/exercises/math/calculLitteral/inequations/inequationsSign.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/inequations/inequationsSign.js +75 -0
- package/lib/exercises/math/calculLitteral/inequations/inverseInequality.d.ts +9 -0
- package/lib/exercises/math/calculLitteral/inequations/inverseInequality.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/inequations/inverseInequality.js +120 -0
- package/lib/exercises/math/calculLitteral/simplifying/distributeAndSimplify.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/simplifying/distributeAndSimplify.js +43 -1
- package/lib/exercises/math/curve/index.d.ts +3 -0
- package/lib/exercises/math/curve/index.d.ts.map +1 -0
- package/lib/exercises/math/curve/index.js +2 -0
- package/lib/exercises/math/curve/sqrtCurvePoint.d.ts +8 -0
- package/lib/exercises/math/curve/sqrtCurvePoint.d.ts.map +1 -0
- package/lib/exercises/math/curve/sqrtCurvePoint.js +132 -0
- package/lib/exercises/math/curve/squareCurvePoint.d.ts +8 -0
- package/lib/exercises/math/curve/squareCurvePoint.d.ts.map +1 -0
- package/lib/exercises/math/curve/squareCurvePoint.js +133 -0
- package/lib/exercises/math/functions/absolute/index.d.ts +2 -0
- package/lib/exercises/math/functions/absolute/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/absolute/index.js +2 -0
- package/lib/exercises/math/functions/absolute/removeAbsNotation.d.ts +8 -0
- package/lib/exercises/math/functions/absolute/removeAbsNotation.d.ts.map +1 -0
- package/lib/exercises/math/functions/absolute/removeAbsNotation.js +105 -0
- package/lib/exercises/math/functions/absolute/removeAbsNotationSign.d.ts +8 -0
- package/lib/exercises/math/functions/absolute/removeAbsNotationSign.d.ts.map +1 -0
- package/lib/exercises/math/functions/absolute/removeAbsNotationSign.js +108 -0
- package/lib/exercises/math/functions/affines/affineExpressionReading.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/affineExpressionReading.js +36 -0
- package/lib/exercises/math/functions/basics/index.d.ts +1 -0
- package/lib/exercises/math/functions/basics/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/index.js +1 -0
- package/lib/exercises/math/functions/basics/valueTableCompletion.d.ts +7 -0
- package/lib/exercises/math/functions/basics/valueTableCompletion.d.ts.map +1 -0
- package/lib/exercises/math/functions/basics/valueTableCompletion.js +78 -0
- package/lib/exercises/math/functions/cube/imageOfCubeFunction.d.ts +8 -0
- package/lib/exercises/math/functions/cube/imageOfCubeFunction.d.ts.map +1 -0
- package/lib/exercises/math/functions/cube/imageOfCubeFunction.js +142 -0
- package/lib/exercises/math/functions/cube/index.d.ts +1 -0
- package/lib/exercises/math/functions/cube/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/cube/index.js +1 -0
- package/lib/exercises/math/functions/square/getImageOfSquareRootFunction.d.ts +8 -0
- package/lib/exercises/math/functions/square/getImageOfSquareRootFunction.d.ts.map +1 -0
- package/lib/exercises/math/functions/square/getImageOfSquareRootFunction.js +128 -0
- package/lib/exercises/math/functions/square/index.d.ts +1 -0
- package/lib/exercises/math/functions/square/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/square/index.js +1 -0
- package/lib/exercises/math/geometry/euclidian/pythagoreOrThales.d.ts.map +1 -1
- package/lib/exercises/math/geometry/euclidian/pythagoreOrThales.js +32 -2
- package/lib/exercises/math/index.d.ts +1 -0
- package/lib/exercises/math/index.d.ts.map +1 -1
- package/lib/exercises/math/index.js +1 -0
- package/lib/exercises/math/powers/decimalToScientific.d.ts.map +1 -1
- package/lib/exercises/math/powers/decimalToScientific.js +0 -1
- package/lib/exercises/math/powers/powersMixOperations.d.ts.map +1 -1
- package/lib/exercises/math/powers/powersMixOperations.js +0 -1
- package/lib/exercises/math/probaStat/ballsBasicProbas.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/ballsBasicProbas.js +1 -3
- package/lib/exercises/math/probaStat/stats1var/median.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/median.js +2 -11
- package/lib/exercises/math/probaStat/stats1var/medianList.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/medianList.js +2 -10
- package/lib/exercises/math/probaStat/stats1var/quartilesList.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/quartilesList.js +3 -9
- package/lib/exercises/math/python/index.d.ts +2 -0
- package/lib/exercises/math/python/index.d.ts.map +1 -1
- package/lib/exercises/math/python/index.js +2 -0
- package/lib/exercises/math/python/pyIfElseCondition.d.ts +8 -0
- package/lib/exercises/math/python/pyIfElseCondition.d.ts.map +1 -0
- package/lib/exercises/math/python/pyIfElseCondition.js +133 -0
- package/lib/exercises/math/python/variableType.d.ts +8 -0
- package/lib/exercises/math/python/variableType.d.ts.map +1 -0
- package/lib/exercises/math/python/variableType.js +118 -0
- package/lib/exercises/math/python/whileLoop.js +1 -1
- package/lib/exercises/math/sequences/arithmetic/arithmeticExplicitFormulaUsage.d.ts.map +1 -1
- package/lib/exercises/math/sequences/arithmetic/arithmeticExplicitFormulaUsage.js +1 -0
- package/lib/exercises/math/sequences/arithmetic/arithmeticFindReason.d.ts.map +1 -1
- package/lib/exercises/math/sequences/arithmetic/arithmeticFindReason.js +2 -1
- package/lib/exercises/math/sets/intervals/inequalityToInterval.d.ts.map +1 -1
- package/lib/exercises/math/sets/intervals/inequalityToInterval.js +21 -0
- package/lib/exercises/math/sets/intervals/intervalToInequality.d.ts.map +1 -1
- package/lib/exercises/math/sets/intervals/intervalToInequality.js +20 -0
- package/lib/exercises/math/sets/intervals/intervalsUnion.d.ts.map +1 -1
- package/lib/exercises/math/sets/intervals/intervalsUnion.js +19 -0
- package/lib/exercises/math/sets/setBelonging.d.ts.map +1 -1
- package/lib/exercises/math/sets/setBelonging.js +24 -0
- package/lib/exercises/pc/chemicalElements/weightPercent.d.ts.map +1 -1
- package/lib/exercises/pc/chemicalElements/weightPercent.js +0 -1
- package/lib/exercises/utils/getDistinctQuestions.d.ts.map +1 -1
- package/lib/exercises/utils/getDistinctQuestions.js +6 -0
- package/lib/index.d.ts +71 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/latexTester.d.ts.map +1 -1
- package/lib/latexTester.js +5 -2
- package/lib/math/numbers/decimals/decimal.d.ts +1 -1
- package/lib/math/numbers/decimals/decimal.d.ts.map +1 -1
- package/lib/math/numbers/decimals/decimal.js +5 -2
- package/lib/math/utils/stats/median.d.ts +2 -0
- package/lib/math/utils/stats/median.d.ts.map +1 -0
- package/lib/math/utils/stats/median.js +39 -0
- package/lib/playground.d.ts.map +1 -1
- package/lib/playground.js +5 -6
- package/lib/tests/pdfExo.test.d.ts.map +1 -1
- package/lib/tests/pdfExo.test.js +2 -2
- package/lib/tests/pdfs/mdCodeToLatex.d.ts.map +1 -1
- package/lib/tests/pdfs/mdCodeToLatex.js +10 -0
- package/lib/tests/pdfs/quizPdfPreambule.js +1 -1
- package/lib/tree/nodes/algebraicNode.d.ts +2 -0
- package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
- package/lib/tree/nodes/nodeConstructor.js +1 -1
- package/lib/tree/nodes/numbers/numberNode.js +2 -2
- package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/fractionNode.js +10 -4
- package/lib/tree/nodes/operators/powerNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/powerNode.js +4 -0
- package/package.json +1 -1
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
4
|
+
import { abs } from "../../../../tree/nodes/functions/absNode.js";
|
|
5
|
+
import { opposite } from "../../../../tree/nodes/functions/oppositeNode.js";
|
|
6
|
+
import { add } from "../../../../tree/nodes/operators/addNode.js";
|
|
7
|
+
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
8
|
+
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
9
|
+
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
10
|
+
import { coinFlip } from "../../../../utils/alea/coinFlip.js";
|
|
11
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
12
|
+
const getPropositions = (num, { answer, n }) => {
|
|
13
|
+
const propositions = [];
|
|
14
|
+
addValidProp(propositions, answer);
|
|
15
|
+
tryToAddWrongProp(propositions, add("x", n).simplify().toTex());
|
|
16
|
+
tryToAddWrongProp(propositions, substract("x", n).simplify().toTex());
|
|
17
|
+
tryToAddWrongProp(propositions, substract(multiply("x", -1), n).simplify().toTex());
|
|
18
|
+
tryToAddWrongProp(propositions, add(multiply("x", -1), n).simplify().toTex());
|
|
19
|
+
return shuffleProps(propositions, num);
|
|
20
|
+
};
|
|
21
|
+
const getAnswer = (identifiers) => {
|
|
22
|
+
const { isSup, n } = identifiers;
|
|
23
|
+
// |x+n| devient x+n si x >= -n
|
|
24
|
+
// |x+n| devient -x-n si x < -n
|
|
25
|
+
return (isSup ? add("x", n) : substract(multiply("x", -1), n))
|
|
26
|
+
.simplify()
|
|
27
|
+
.toTex();
|
|
28
|
+
};
|
|
29
|
+
const getInstruction = (identifiers) => {
|
|
30
|
+
const { isSup, n } = identifiers;
|
|
31
|
+
return `Soit $${isSup ? `x \\ge ${-n}` : `x < ${-n}`}$. Écrire $${abs(add("x", n)).toTex()}$ sans valeur absolue.`;
|
|
32
|
+
};
|
|
33
|
+
const getHint = (identifiers) => {
|
|
34
|
+
const { isSup, n } = identifiers;
|
|
35
|
+
return `On a :
|
|
36
|
+
|
|
37
|
+
$$
|
|
38
|
+
${abs("a").toTex()} =
|
|
39
|
+
\\begin{cases}
|
|
40
|
+
a \\ \\ \\text{si} \\ a \\ge 0 \\\\
|
|
41
|
+
-a \\ \\ \\text{sinon}
|
|
42
|
+
\\end{cases}
|
|
43
|
+
$$
|
|
44
|
+
|
|
45
|
+
Détermine donc le signe de $${add("x", n).toTex()}$ pour $${isSup ? `x \\ge ${-n}` : `x < ${-n}`}$.`;
|
|
46
|
+
};
|
|
47
|
+
const getCorrection = (identifiers) => {
|
|
48
|
+
const { isSup, n } = identifiers;
|
|
49
|
+
return `Si $${isSup ? `x \\ge ${-n}` : `x < ${-n}`}$, alors $${add("x", n).toTex()} ${isSup ? "\\geq 0" : "\\leq 0"}$
|
|
50
|
+
|
|
51
|
+
On a donc :
|
|
52
|
+
|
|
53
|
+
$$
|
|
54
|
+
${abs(add("x", n)).toTex()} = ${isSup
|
|
55
|
+
? add("x", n).simplify().toTex()
|
|
56
|
+
: opposite(add("x", n)).toTex() +
|
|
57
|
+
"=" +
|
|
58
|
+
substract(multiply("x", -1), n).simplify().toTex()}
|
|
59
|
+
$$`;
|
|
60
|
+
};
|
|
61
|
+
const getKeys = (identifiers) => {
|
|
62
|
+
return ["x"];
|
|
63
|
+
};
|
|
64
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
65
|
+
try {
|
|
66
|
+
return parseAlgebraic(ans).simplify().toTex() === answer;
|
|
67
|
+
}
|
|
68
|
+
catch (err) {
|
|
69
|
+
return handleVEAError(err);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
const getRemoveAbsNotationQuestion = (ops) => {
|
|
73
|
+
const isSup = coinFlip();
|
|
74
|
+
const n = randint(-10, 10, [0]);
|
|
75
|
+
const identifiers = { isSup, n };
|
|
76
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
77
|
+
};
|
|
78
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
79
|
+
return {
|
|
80
|
+
answer: getAnswer(identifiers),
|
|
81
|
+
instruction: getInstruction(identifiers),
|
|
82
|
+
keys: getKeys(identifiers),
|
|
83
|
+
answerFormat: "tex",
|
|
84
|
+
identifiers,
|
|
85
|
+
hint: getHint(identifiers),
|
|
86
|
+
correction: getCorrection(identifiers),
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
export const removeAbsNotation = {
|
|
90
|
+
id: "removeAbsNotation",
|
|
91
|
+
label: "Écrire sans valeur absolue",
|
|
92
|
+
isSingleStep: true,
|
|
93
|
+
generator: (nb, opts) => getDistinctQuestions(() => getRemoveAbsNotationQuestion(opts), nb),
|
|
94
|
+
qcmTimer: 60,
|
|
95
|
+
freeTimer: 60,
|
|
96
|
+
getPropositions,
|
|
97
|
+
isAnswerValid,
|
|
98
|
+
subject: "Mathématiques",
|
|
99
|
+
getInstruction,
|
|
100
|
+
getHint,
|
|
101
|
+
getCorrection,
|
|
102
|
+
getAnswer,
|
|
103
|
+
getQuestionFromIdentifiers,
|
|
104
|
+
hasHintAndCorrection: true,
|
|
105
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"removeAbsNotationSign.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/absolute/removeAbsNotationSign.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,OAAO,CAAC;IACf,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAsGF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,WAAW,CAkBvD,CAAC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
4
|
+
import { abs } from "../../../../tree/nodes/functions/absNode.js";
|
|
5
|
+
import { add } from "../../../../tree/nodes/operators/addNode.js";
|
|
6
|
+
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
7
|
+
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
8
|
+
import { coinFlip } from "../../../../utils/alea/coinFlip.js";
|
|
9
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
10
|
+
const getPropositions = (num, { answer, n }) => {
|
|
11
|
+
const propositions = [];
|
|
12
|
+
addValidProp(propositions, answer);
|
|
13
|
+
tryToAddWrongProp(propositions, `\\ge${-n}`);
|
|
14
|
+
tryToAddWrongProp(propositions, `\\ge${n}`);
|
|
15
|
+
tryToAddWrongProp(propositions, `\\le${-n}`);
|
|
16
|
+
tryToAddWrongProp(propositions, `\\le${n}`);
|
|
17
|
+
return shuffleProps(propositions, num);
|
|
18
|
+
};
|
|
19
|
+
const getAnswer = (identifiers) => {
|
|
20
|
+
const { isSup, n } = identifiers;
|
|
21
|
+
return isSup ? `\\ge${-n}` : `\\le${-n}`;
|
|
22
|
+
};
|
|
23
|
+
const getInstruction = (identifiers) => {
|
|
24
|
+
const { isSup, n } = identifiers;
|
|
25
|
+
const absol = (isSup ? add("x", n) : substract(multiply("x", -1), n))
|
|
26
|
+
.simplify()
|
|
27
|
+
.toTex();
|
|
28
|
+
return `Compléter par la bonne inégalité :
|
|
29
|
+
|
|
30
|
+
$${abs(add("x", n)).toTex()} = ${absol}$ si et seulement si $x \\ \\ldots \\ \\ldots$`;
|
|
31
|
+
};
|
|
32
|
+
const getHint = (identifiers) => {
|
|
33
|
+
const { n } = identifiers;
|
|
34
|
+
return `On a :
|
|
35
|
+
|
|
36
|
+
$$
|
|
37
|
+
${abs("a").toTex()} =
|
|
38
|
+
\\begin{cases}
|
|
39
|
+
a \\ \\ \\text{si} \\ a \\ge 0 \\\\
|
|
40
|
+
-a \\ \\ \\text{sinon}
|
|
41
|
+
\\end{cases}
|
|
42
|
+
$$
|
|
43
|
+
|
|
44
|
+
Cherche donc sous quelle condition $${abs(add("x", n)).toTex()}\\geq 0$.`;
|
|
45
|
+
};
|
|
46
|
+
const getCorrection = (identifiers) => {
|
|
47
|
+
const { isSup, n } = identifiers;
|
|
48
|
+
const absol = (isSup ? add("x", n) : substract(multiply("x", -1), n))
|
|
49
|
+
.simplify()
|
|
50
|
+
.toTex();
|
|
51
|
+
return `Puisque :
|
|
52
|
+
|
|
53
|
+
$$
|
|
54
|
+
${abs(add("x", n)).toTex()} =
|
|
55
|
+
\\begin{cases}
|
|
56
|
+
${add("x", n).toTex()}\\ \\text{si} \\ x \\ge ${-n} \\\\
|
|
57
|
+
${substract(multiply("x", -1), n).simplify().toTex()} \\ \\text{sinon}
|
|
58
|
+
\\end{cases}
|
|
59
|
+
$$
|
|
60
|
+
|
|
61
|
+
on a donc $${abs(add("x", n)).toTex()} = ${absol}$ si et seulement si $${isSup ? `x \\ge ${-n}` : `x < ${-n}`}$.`;
|
|
62
|
+
};
|
|
63
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
64
|
+
try {
|
|
65
|
+
return ans === answer;
|
|
66
|
+
}
|
|
67
|
+
catch (err) {
|
|
68
|
+
return handleVEAError(err);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
const getRemoveAbsNotationSignQuestion = (ops) => {
|
|
72
|
+
const isSup = coinFlip();
|
|
73
|
+
const n = randint(-10, 10, [0]);
|
|
74
|
+
const identifiers = { isSup, n };
|
|
75
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
76
|
+
};
|
|
77
|
+
const getKeys = (identifiers) => {
|
|
78
|
+
return ["leq", "geq"];
|
|
79
|
+
};
|
|
80
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
81
|
+
return {
|
|
82
|
+
answer: getAnswer(identifiers),
|
|
83
|
+
instruction: getInstruction(identifiers),
|
|
84
|
+
keys: getKeys(identifiers),
|
|
85
|
+
answerFormat: "tex",
|
|
86
|
+
identifiers,
|
|
87
|
+
hint: getHint(identifiers),
|
|
88
|
+
correction: getCorrection(identifiers),
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
export const removeAbsNotationSign = {
|
|
92
|
+
id: "removeAbsNotationSign",
|
|
93
|
+
connector: "=",
|
|
94
|
+
label: "Écrire sans valeur absolue avec une inégalité",
|
|
95
|
+
isSingleStep: true,
|
|
96
|
+
generator: (nb, opts) => getDistinctQuestions(() => getRemoveAbsNotationSignQuestion(opts), nb),
|
|
97
|
+
qcmTimer: 60,
|
|
98
|
+
freeTimer: 60,
|
|
99
|
+
getPropositions,
|
|
100
|
+
isAnswerValid,
|
|
101
|
+
subject: "Mathématiques",
|
|
102
|
+
getInstruction,
|
|
103
|
+
getHint,
|
|
104
|
+
getCorrection,
|
|
105
|
+
getAnswer,
|
|
106
|
+
getQuestionFromIdentifiers,
|
|
107
|
+
hasHintAndCorrection: true,
|
|
108
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"affineExpressionReading.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/affineExpressionReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"affineExpressionReading.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/affines/affineExpressionReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAkBrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AA4KF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,WAAW,CAezD,CAAC"}
|
|
@@ -8,7 +8,9 @@ import { randint } from "../../../../math/utils/random/randint.js";
|
|
|
8
8
|
import { EqualNode } from "../../../../tree/nodes/equations/equalNode.js";
|
|
9
9
|
import { NumberNode } from "../../../../tree/nodes/numbers/numberNode.js";
|
|
10
10
|
import { AddNode } from "../../../../tree/nodes/operators/addNode.js";
|
|
11
|
+
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
11
12
|
import { MultiplyNode } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
13
|
+
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
12
14
|
import { VariableNode } from "../../../../tree/nodes/variables/variableNode.js";
|
|
13
15
|
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
14
16
|
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
@@ -33,6 +35,37 @@ const getGGBOptions = (identifiers) => {
|
|
|
33
35
|
coords: ggb.getAdaptedCoords({ xMin, xMax, yMin, yMax }),
|
|
34
36
|
});
|
|
35
37
|
};
|
|
38
|
+
const getHint = (identifers) => {
|
|
39
|
+
return `L'expression algébrique d'une fonction affine est de la forme :
|
|
40
|
+
|
|
41
|
+
$$
|
|
42
|
+
f(x) = ax+b
|
|
43
|
+
$$
|
|
44
|
+
|
|
45
|
+
$b$ est l'ordonnée à l'origine de la droite : c'est l'ordonnée du point d'abscisse $0$.
|
|
46
|
+
|
|
47
|
+
$a$ est le coefficient directeur. Pour le déterminer, on repère deux points $A(x_A; y_A)$ et $B(x_B;y_B)$ de la droite, et on a alors :
|
|
48
|
+
|
|
49
|
+
$$
|
|
50
|
+
a = \\frac{y_B-y_A}{x_B-x_A}
|
|
51
|
+
$$`;
|
|
52
|
+
};
|
|
53
|
+
const getCorrection = (identifiers) => {
|
|
54
|
+
const { b, secondPoint } = identifiers;
|
|
55
|
+
return `On lit graphiquement que l'ordonnée à l'origine est $${b}$ : c'est l'ordonnée du point d'abscisse $0$ appartenant à la droite.
|
|
56
|
+
|
|
57
|
+
Pour trouver $a$, on repère que la droite passe par le point de coordonnées $(${secondPoint[0]};${secondPoint[1]})$. On a alors :
|
|
58
|
+
|
|
59
|
+
$$
|
|
60
|
+
a = ${frac(substract(secondPoint[1], b), secondPoint[0]).toSimplificationTex()}
|
|
61
|
+
$$
|
|
62
|
+
|
|
63
|
+
L'expression algébrique de la fonction $f$ est donc :
|
|
64
|
+
|
|
65
|
+
$$
|
|
66
|
+
${getAnswer(identifiers)}
|
|
67
|
+
$$`;
|
|
68
|
+
};
|
|
36
69
|
const getAnswer = (identifiers) => {
|
|
37
70
|
const { b, secondPoint } = identifiers;
|
|
38
71
|
const leadingCoeff = new Rational(secondPoint[1] - b, secondPoint[0])
|
|
@@ -55,6 +88,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
|
|
|
55
88
|
ggbOptions: getGGBOptions(identifiers),
|
|
56
89
|
answerFormat: "tex",
|
|
57
90
|
identifiers,
|
|
91
|
+
hint: getHint(identifiers),
|
|
92
|
+
correction: getCorrection(identifiers),
|
|
58
93
|
};
|
|
59
94
|
return question;
|
|
60
95
|
};
|
|
@@ -116,4 +151,5 @@ export const affineExpressionReading = {
|
|
|
116
151
|
hasGeogebra: true,
|
|
117
152
|
subject: "Mathématiques",
|
|
118
153
|
getQuestionFromIdentifiers,
|
|
154
|
+
hasHintAndCorrection: true,
|
|
119
155
|
};
|
|
@@ -9,4 +9,5 @@ export * from "./twoFunctionsInequation.js";
|
|
|
9
9
|
export * from "./inverseImageFunctionTable.js";
|
|
10
10
|
export * from "./imageAntecedentFromSentence.js";
|
|
11
11
|
export * from "./graphicInequationAffine.js";
|
|
12
|
+
export * from "./valueTableCompletion.js";
|
|
12
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mCAAmC,CAAC;AAClD,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kCAAkC,CAAC;AACjD,cAAc,8BAA8B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mCAAmC,CAAC;AAClD,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kCAAkC,CAAC;AACjD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"valueTableCompletion.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/valueTableCompletion.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAIrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAoEF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAmBtD,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
4
|
+
const getPropositions = (n, { answer }) => {
|
|
5
|
+
const propositions = [];
|
|
6
|
+
addValidProp(propositions, answer);
|
|
7
|
+
while (propositions.length < n) {
|
|
8
|
+
throw Error("QCM not implemented");
|
|
9
|
+
}
|
|
10
|
+
return shuffleProps(propositions, n);
|
|
11
|
+
};
|
|
12
|
+
const getAnswer = (identifiers) => {
|
|
13
|
+
return "";
|
|
14
|
+
};
|
|
15
|
+
const getInstruction = (identifiers) => {
|
|
16
|
+
return `Soit $f(x) = 3x$. Compléter le tableau suivant : `;
|
|
17
|
+
};
|
|
18
|
+
const getHint = (identifiers) => {
|
|
19
|
+
return "";
|
|
20
|
+
};
|
|
21
|
+
const getCorrection = (identifiers) => {
|
|
22
|
+
return "";
|
|
23
|
+
};
|
|
24
|
+
const getKeys = (identifiers) => {
|
|
25
|
+
return [];
|
|
26
|
+
};
|
|
27
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
28
|
+
try {
|
|
29
|
+
throw Error("VEA not implemented");
|
|
30
|
+
}
|
|
31
|
+
catch (err) {
|
|
32
|
+
return handleVEAError(err);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
const getValueTableCompletionQuestion = (ops) => {
|
|
36
|
+
const identifiers = {
|
|
37
|
+
test: Math.random(),
|
|
38
|
+
};
|
|
39
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
40
|
+
};
|
|
41
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
42
|
+
return {
|
|
43
|
+
answer: getAnswer(identifiers),
|
|
44
|
+
instruction: getInstruction(identifiers),
|
|
45
|
+
keys: getKeys(identifiers),
|
|
46
|
+
answerFormat: "tex",
|
|
47
|
+
identifiers,
|
|
48
|
+
hint: getHint(identifiers),
|
|
49
|
+
correction: getCorrection(identifiers),
|
|
50
|
+
initTable: [
|
|
51
|
+
["x", "1", "", "3", ""],
|
|
52
|
+
["f(x)", "3", "", "", "12"],
|
|
53
|
+
],
|
|
54
|
+
answerTable: [
|
|
55
|
+
["x", "1", "2", "3", "4"],
|
|
56
|
+
["f(x)", "3", "6", "9", "12"],
|
|
57
|
+
],
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
export const valueTableCompletion = {
|
|
61
|
+
id: "valueTableCompletion",
|
|
62
|
+
connector: "=",
|
|
63
|
+
label: "Tableau valeurs",
|
|
64
|
+
isSingleStep: true,
|
|
65
|
+
generator: (nb, opts) => getDistinctQuestions(() => getValueTableCompletionQuestion(opts), nb),
|
|
66
|
+
qcmTimer: 60,
|
|
67
|
+
freeTimer: 60,
|
|
68
|
+
getPropositions,
|
|
69
|
+
isAnswerValid,
|
|
70
|
+
subject: "Mathématiques",
|
|
71
|
+
getInstruction,
|
|
72
|
+
getHint,
|
|
73
|
+
getCorrection,
|
|
74
|
+
getAnswer,
|
|
75
|
+
getQuestionFromIdentifiers,
|
|
76
|
+
hasHintAndCorrection: true,
|
|
77
|
+
answerType: "valueTable",
|
|
78
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
a: NodeIdentifiers;
|
|
5
|
+
};
|
|
6
|
+
export declare const imageOfCubeFunction: Exercise<Identifiers>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=imageOfCubeFunction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imageOfCubeFunction.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/cube/imageOfCubeFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAW7C,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,eAAe,CAAC;CACpB,CAAC;AAmJF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAiBrD,CAAC"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { RationalConstructor } from "../../../../math/numbers/rationals/rational.js";
|
|
4
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
5
|
+
import { NodeIds } from "../../../../tree/nodes/node.js";
|
|
6
|
+
import { reifyAlgebraic, } from "../../../../tree/nodes/nodeConstructor.js";
|
|
7
|
+
import { NumberNode } from "../../../../tree/nodes/numbers/numberNode.js";
|
|
8
|
+
import { add } from "../../../../tree/nodes/operators/addNode.js";
|
|
9
|
+
import { divide } from "../../../../tree/nodes/operators/divideNode.js";
|
|
10
|
+
import { FractionNode } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
11
|
+
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
12
|
+
import { power } from "../../../../tree/nodes/operators/powerNode.js";
|
|
13
|
+
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
14
|
+
import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
15
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
16
|
+
const simplifyOpts = {
|
|
17
|
+
calculatePowers: true,
|
|
18
|
+
distributePowersOnFrac: true,
|
|
19
|
+
};
|
|
20
|
+
const getPropositions = (n, { answer, ...identifiers }) => {
|
|
21
|
+
const propositions = [];
|
|
22
|
+
addValidProp(propositions, answer);
|
|
23
|
+
const { a } = identifiers;
|
|
24
|
+
if (a.id === NodeIds.fraction) {
|
|
25
|
+
const frac = reifyAlgebraic(a);
|
|
26
|
+
// Erreurs potentielles pour les fractions:
|
|
27
|
+
// - l'élève ne fait le cube que sur le nominateur et dénominateur
|
|
28
|
+
// - l'élève multiplie par 3 à la place de faire un cube
|
|
29
|
+
tryToAddWrongProp(propositions, new FractionNode(frac.leftChild, power(frac.rightChild, 3))
|
|
30
|
+
.simplify(simplifyOpts)
|
|
31
|
+
.toTex());
|
|
32
|
+
tryToAddWrongProp(propositions, new FractionNode(power(frac.leftChild, 3), frac.rightChild)
|
|
33
|
+
.simplify(simplifyOpts)
|
|
34
|
+
.toTex());
|
|
35
|
+
tryToAddWrongProp(propositions, new FractionNode(frac.leftChild, multiply(frac.rightChild, 3))
|
|
36
|
+
.simplify(simplifyOpts)
|
|
37
|
+
.toTex());
|
|
38
|
+
tryToAddWrongProp(propositions, new FractionNode(multiply(frac.leftChild, 3), frac.rightChild)
|
|
39
|
+
.simplify(simplifyOpts)
|
|
40
|
+
.toTex());
|
|
41
|
+
tryToAddWrongProp(propositions, multiply(frac, 3).simplify().toTex());
|
|
42
|
+
}
|
|
43
|
+
else if (a.id === NodeIds.number) {
|
|
44
|
+
const N = reifyAlgebraic(a);
|
|
45
|
+
// Erreurs potentielles pour les nombres:
|
|
46
|
+
// - Division par 3
|
|
47
|
+
// - Multiplication par 3 (sauf pour le cas N = 3)
|
|
48
|
+
// - Cube de N+1
|
|
49
|
+
// - Cube de N-1
|
|
50
|
+
if (N.value != 3)
|
|
51
|
+
tryToAddWrongProp(propositions, multiply(N, 3).simplify().toTex());
|
|
52
|
+
tryToAddWrongProp(propositions, divide(N, 3).simplify().toTex());
|
|
53
|
+
tryToAddWrongProp(propositions, power(substract(N, 1), 3).simplify(simplifyOpts).toTex());
|
|
54
|
+
tryToAddWrongProp(propositions, power(add(N, 1), 3).simplify(simplifyOpts).toTex());
|
|
55
|
+
}
|
|
56
|
+
return shuffleProps(propositions, n);
|
|
57
|
+
};
|
|
58
|
+
const getAnswer = (identifiers) => {
|
|
59
|
+
const { a } = identifiers;
|
|
60
|
+
const correctAnswer = power(reifyAlgebraic(a), 3);
|
|
61
|
+
return correctAnswer.simplify(simplifyOpts).toTex();
|
|
62
|
+
};
|
|
63
|
+
const getInstruction = (identifiers) => {
|
|
64
|
+
const { a } = identifiers;
|
|
65
|
+
const nNode = reifyAlgebraic(a);
|
|
66
|
+
return `Calculer l'image de $${nNode.toTex()}$ par la fonction cube.`;
|
|
67
|
+
};
|
|
68
|
+
const getHint = (identifiers) => {
|
|
69
|
+
return `La fonction cube est la fonction définie par :
|
|
70
|
+
|
|
71
|
+
$$
|
|
72
|
+
f(x) = x^3
|
|
73
|
+
$$`;
|
|
74
|
+
};
|
|
75
|
+
const getCorrection = (identifiers) => {
|
|
76
|
+
const { a } = identifiers;
|
|
77
|
+
const aNode = reifyAlgebraic(a);
|
|
78
|
+
return `L'image de $${aNode.toTex()}$ par $f(x) = x^3$ est :
|
|
79
|
+
|
|
80
|
+
$$
|
|
81
|
+
f\\left(${aNode.toTex()}\\right) = ${power(aNode, 3).toTex()} = ${getAnswer(identifiers)}
|
|
82
|
+
$$`;
|
|
83
|
+
};
|
|
84
|
+
const getKeys = (identifiers) => {
|
|
85
|
+
return [];
|
|
86
|
+
};
|
|
87
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
88
|
+
try {
|
|
89
|
+
const studentAnswer = parseAlgebraic(ans);
|
|
90
|
+
const correctAnswer = parseAlgebraic(answer);
|
|
91
|
+
return studentAnswer
|
|
92
|
+
.simplify(simplifyOpts)
|
|
93
|
+
.equals(correctAnswer.simplify(simplifyOpts));
|
|
94
|
+
}
|
|
95
|
+
catch (err) {
|
|
96
|
+
return handleVEAError(err);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
const getImageOfCubeFunctionQuestion = (ops) => {
|
|
100
|
+
let a = null;
|
|
101
|
+
// Soit un nombre, soit une fraction
|
|
102
|
+
const choice = randint(1, 3);
|
|
103
|
+
switch (choice) {
|
|
104
|
+
case 1:
|
|
105
|
+
a = new NumberNode(randint(-8, 8));
|
|
106
|
+
break;
|
|
107
|
+
case 2:
|
|
108
|
+
default:
|
|
109
|
+
a = RationalConstructor.randomIrreductible(12).toTree();
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
const identifiers = { a: a.toIdentifiers() };
|
|
113
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
114
|
+
};
|
|
115
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
116
|
+
return {
|
|
117
|
+
answer: getAnswer(identifiers),
|
|
118
|
+
instruction: getInstruction(identifiers),
|
|
119
|
+
keys: getKeys(identifiers),
|
|
120
|
+
answerFormat: "tex",
|
|
121
|
+
identifiers,
|
|
122
|
+
hint: getHint(identifiers),
|
|
123
|
+
correction: getCorrection(identifiers),
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
export const imageOfCubeFunction = {
|
|
127
|
+
id: "imageOfCubeFunction",
|
|
128
|
+
label: "Calcul d'image par la fonction cube",
|
|
129
|
+
isSingleStep: true,
|
|
130
|
+
generator: (nb, opts) => getDistinctQuestions(() => getImageOfCubeFunctionQuestion(opts), nb),
|
|
131
|
+
qcmTimer: 60,
|
|
132
|
+
freeTimer: 60,
|
|
133
|
+
getPropositions,
|
|
134
|
+
isAnswerValid,
|
|
135
|
+
subject: "Mathématiques",
|
|
136
|
+
getInstruction,
|
|
137
|
+
getHint,
|
|
138
|
+
getCorrection,
|
|
139
|
+
getAnswer,
|
|
140
|
+
getQuestionFromIdentifiers,
|
|
141
|
+
hasHintAndCorrection: true,
|
|
142
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/cube/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/cube/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
a: NodeIdentifiers;
|
|
5
|
+
};
|
|
6
|
+
export declare const getImageOfSquareRootFunction: Exercise<Identifiers>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=getImageOfSquareRootFunction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getImageOfSquareRootFunction.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/square/getImageOfSquareRootFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAW7C,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,eAAe,CAAC;CACpB,CAAC;AAmIF,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,WAAW,CAoB9D,CAAC"}
|