math-exercises 3.0.73 → 3.0.75
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/divisorsList.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/divisorsList.js +37 -2
- package/lib/exercises/math/calcul/arithmetics/index.d.ts +2 -0
- package/lib/exercises/math/calcul/arithmetics/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/index.js +2 -0
- package/lib/exercises/math/calcul/arithmetics/isInequalityTrue.js +2 -2
- package/lib/exercises/math/calcul/arithmetics/isMultipleOrDivisor.d.ts +9 -0
- package/lib/exercises/math/calcul/arithmetics/isMultipleOrDivisor.d.ts.map +1 -0
- package/lib/exercises/math/calcul/arithmetics/isMultipleOrDivisor.js +123 -0
- package/lib/exercises/math/calcul/arithmetics/paritySumsAndProducts.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/paritySumsAndProducts.js +114 -0
- package/lib/exercises/math/calcul/arithmetics/pgcdCalcul.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/pgcdCalcul.js +28 -1
- package/lib/exercises/math/calcul/arithmetics/ppcmCalcul.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/ppcmCalcul.js +1 -0
- package/lib/exercises/math/calcul/arithmetics/primeNumbers.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/primeNumbers.js +37 -2
- package/lib/exercises/math/calcul/arithmetics/whichMultipleAmI.d.ts +9 -0
- package/lib/exercises/math/calcul/arithmetics/whichMultipleAmI.d.ts.map +1 -0
- package/lib/exercises/math/calcul/arithmetics/whichMultipleAmI.js +131 -0
- package/lib/exercises/math/calcul/operations/operationsPrioritiesParenthesis.js +1 -1
- package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivitySubstract.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivitySubstract.js +52 -4
- package/lib/exercises/math/calculLitteral/distributivity/identitiesWithNonIntegers.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/distributivity/identitiesWithNonIntegers.js +109 -4
- package/lib/exercises/math/calculLitteral/inequations/squareFunctionInequation.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/inequations/squareFunctionInequation.js +15 -0
- package/lib/exercises/math/functions/affines/leadingCoefficientCalculV1.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/leadingCoefficientCalculV1.js +52 -0
- package/lib/exercises/math/functions/basics/index.d.ts +0 -1
- package/lib/exercises/math/functions/basics/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/index.js +1 -1
- package/lib/exercises/math/functions/basics/inverseImageFunctionGeogebra.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/inverseImageFunctionGeogebra.js +24 -0
- package/lib/exercises/math/functions/basics/inverseImageFunctionTable.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/inverseImageFunctionTable.js +19 -0
- package/lib/exercises/math/functions/cube/cubicEquation.d.ts.map +1 -1
- package/lib/exercises/math/functions/cube/cubicEquation.js +16 -8
- package/lib/exercises/math/functions/parity/parityFromAlgebra.d.ts.map +1 -1
- package/lib/exercises/math/functions/parity/parityFromAlgebra.js +57 -2
- package/lib/exercises/math/geometry/euclidian/pythagoreOrThales.js +34 -31
- package/lib/exercises/math/geometry/thales/thalesCalcul.d.ts.map +1 -1
- package/lib/exercises/math/geometry/thales/thalesCalcul.js +79 -8
- package/lib/exercises/math/geometry/vectors/paralellismViaColinearity.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/paralellismViaColinearity.js +39 -1
- package/lib/exercises/math/geometry/vectors/parallelogramViaEqualVectors.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/parallelogramViaEqualVectors.js +32 -1
- package/lib/exercises/math/geometry/vectors/vectorLinearCombination.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/vectorLinearCombination.js +40 -2
- package/lib/exercises/math/percent/evolutions/findRightCalculForPriceEvolution.d.ts.map +1 -1
- package/lib/exercises/math/percent/evolutions/findRightCalculForPriceEvolution.js +39 -8
- package/lib/exercises/math/probaStat/cardBasicProbas.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/cardBasicProbas.js +37 -0
- package/lib/exercises/math/probaStat/issuesCountingForCards.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/issuesCountingForCards.js +27 -0
- package/lib/exercises/math/probaStat/probaFromTableNoContext.d.ts +3 -1
- package/lib/exercises/math/probaStat/probaFromTableNoContext.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/probaFromTableNoContext.js +126 -7
- package/lib/exercises/math/probaStat/probaFromTableWithContext.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/probaFromTableWithContext.js +131 -3
- package/lib/exercises/math/probaStat/stats1var/choseReasoningForIndicator.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/choseReasoningForIndicator.js +17 -10
- package/lib/exercises/math/probaStat/stats1var/median.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/median.js +35 -0
- package/lib/exercises/math/probaStat/stats1var/medianList.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/medianList.js +18 -0
- package/lib/exercises/math/probaStat/stats1var/quartiles.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/quartiles.js +37 -0
- package/lib/exercises/math/probaStat/stats1var/quartilesList.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/quartilesList.js +23 -0
- package/lib/exercises/math/python/index.d.ts +1 -0
- package/lib/exercises/math/python/index.d.ts.map +1 -1
- package/lib/exercises/math/python/index.js +1 -0
- package/lib/exercises/math/python/whileLoopCount.d.ts +8 -0
- package/lib/exercises/math/python/whileLoopCount.d.ts.map +1 -0
- package/lib/exercises/math/python/whileLoopCount.js +94 -0
- package/lib/exercises/math/squareRoots/simpifySquareRoot.d.ts.map +1 -1
- package/lib/exercises/math/squareRoots/simpifySquareRoot.js +41 -0
- package/lib/exercises/math/squareRoots/squareRootEquation.d.ts.map +1 -1
- package/lib/exercises/math/squareRoots/squareRootEquation.js +25 -0
- package/lib/exercises/math/squareRoots/squareRootIdentities.d.ts.map +1 -1
- package/lib/exercises/math/squareRoots/squareRootIdentities.js +106 -5
- package/lib/exercises/math/squareRoots/squareRootsDistributivity.d.ts.map +1 -1
- package/lib/exercises/math/squareRoots/squareRootsDistributivity.js +29 -2
- package/lib/exercises/math/squareRoots/squareRootsFractions.d.ts.map +1 -1
- package/lib/exercises/math/squareRoots/squareRootsFractions.js +33 -4
- package/lib/exercises/math/squareRoots/squareRootsProducts.d.ts.map +1 -1
- package/lib/exercises/math/squareRoots/squareRootsProducts.js +27 -4
- package/lib/exercises/math/squareRoots/squareRootsSum.d.ts.map +1 -1
- package/lib/exercises/math/squareRoots/squareRootsSum.js +33 -1
- package/lib/exercises/math/squareRoots/squareRootsToSquare.d.ts.map +1 -1
- package/lib/exercises/math/squareRoots/squareRootsToSquare.js +46 -4
- package/lib/index.d.ts +13 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/playground.d.ts.map +1 -1
- package/lib/playground.js +9 -5
- package/lib/tree/nodes/functions/absNode.d.ts +2 -2
- package/lib/tree/nodes/functions/absNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/absNode.js +5 -2
- package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/multiplyNode.js +15 -6
- package/package.json +1 -1
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
2
2
|
import { firstQuartile, thirdQuartile, } from "../../../../math/utils/stats/quartiles.js";
|
|
3
|
+
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
4
|
+
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
3
5
|
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../exercise.js";
|
|
4
6
|
import { getDistinctQuestions } from "../../../utils/getDistinctQuestions.js";
|
|
5
7
|
const getInstruction = ({ randomQuartile, randomValues, }) => {
|
|
@@ -34,6 +36,24 @@ const getQuartiles = () => {
|
|
|
34
36
|
};
|
|
35
37
|
return getQuestionFromIdentifiers(identifiers);
|
|
36
38
|
};
|
|
39
|
+
const getHint = (identifiers) => {
|
|
40
|
+
const { randomValues, randomQuartile } = identifiers;
|
|
41
|
+
if (randomQuartile === 0)
|
|
42
|
+
return `Le premier quartile est la valeur de la série telle qu'au moins un quart des valeurs lui sont inférieures. `;
|
|
43
|
+
return `Le troisième quartile est la valeur de la série telle qu'au moins un trois quarts des valeurs lui sont inférieures.`;
|
|
44
|
+
};
|
|
45
|
+
const getCorrection = (identifiers) => {
|
|
46
|
+
const { randomValues, randomQuartile } = identifiers;
|
|
47
|
+
const total = randomValues.length;
|
|
48
|
+
const rank = randomQuartile === 0 ? frac(total, 4) : frac(multiply(3, total), 4);
|
|
49
|
+
const rankEv = rank.evaluate();
|
|
50
|
+
const numeral = randomQuartile === 0 ? "premier" : "troisième";
|
|
51
|
+
return `Il y a $${total}$ valeurs dans la série.
|
|
52
|
+
|
|
53
|
+
Puisque $${rank.toTex()} = ${rankEv.frenchify()}$, le ${numeral} quartile est la $${Math.ceil(rankEv)}$-ème valeur.
|
|
54
|
+
|
|
55
|
+
Le ${numeral} quartile est donc $${getAnswer(identifiers)}$.`;
|
|
56
|
+
};
|
|
37
57
|
const getQuestionFromIdentifiers = (identifiers) => {
|
|
38
58
|
const question = {
|
|
39
59
|
instruction: getInstruction(identifiers),
|
|
@@ -41,6 +61,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
|
|
|
41
61
|
keys: [],
|
|
42
62
|
answerFormat: "tex",
|
|
43
63
|
identifiers,
|
|
64
|
+
hint: getHint(identifiers),
|
|
65
|
+
correction: getCorrection(identifiers),
|
|
44
66
|
};
|
|
45
67
|
return question;
|
|
46
68
|
};
|
|
@@ -71,4 +93,5 @@ export const quartilesList = {
|
|
|
71
93
|
isAnswerValid,
|
|
72
94
|
subject: "Mathématiques",
|
|
73
95
|
getQuestionFromIdentifiers,
|
|
96
|
+
hasHintAndCorrection: true,
|
|
74
97
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/python/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/python/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"whileLoopCount.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/python/whileLoopCount.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAIrC,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAqGF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,CAgBlD,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
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
|
+
const getInstruction = ({ inputValue, threshold, }) => {
|
|
5
|
+
return `On définit la fonction en Python boucle.
|
|
6
|
+
|
|
7
|
+
\`\`\`python
|
|
8
|
+
def boucle(x):
|
|
9
|
+
while x > ${threshold}:
|
|
10
|
+
x = x / 2
|
|
11
|
+
return x
|
|
12
|
+
\`\`\`
|
|
13
|
+
|
|
14
|
+
Si l'on saisit la commande boucle($${inputValue}$), combien de fois la boucle s'exécute-t-elle ?`;
|
|
15
|
+
};
|
|
16
|
+
const getAnswer = ({ inputValue, threshold }) => {
|
|
17
|
+
let x = inputValue;
|
|
18
|
+
let count = 0;
|
|
19
|
+
while (x > threshold) {
|
|
20
|
+
x = x / 2;
|
|
21
|
+
count++;
|
|
22
|
+
}
|
|
23
|
+
return count.frenchify();
|
|
24
|
+
};
|
|
25
|
+
const getHint = ({ inputValue, threshold }) => {
|
|
26
|
+
return `La boucle s'exécute tant que la condition $x > ${threshold}$ est vraie. À chaque tour, $x$ est divisé par $2$. Compte combien de fois on peut diviser $${inputValue}$ par $2$ avant d'obtenir un résultat inférieur ou égal à $${threshold}$.`;
|
|
27
|
+
};
|
|
28
|
+
const getCorrection = ({ inputValue, threshold, }) => {
|
|
29
|
+
let x = inputValue;
|
|
30
|
+
let count = 0;
|
|
31
|
+
let allValues = [];
|
|
32
|
+
while (x > threshold) {
|
|
33
|
+
allValues.push(x.frenchify());
|
|
34
|
+
x = x / 2;
|
|
35
|
+
count++;
|
|
36
|
+
}
|
|
37
|
+
allValues.push(x.frenchify());
|
|
38
|
+
return `On commence avec $x = ${inputValue}$ et à chaque itération on divise $x$ par $2$. La boucle while $x > ${threshold}$ s'exécute tant que $x$ est strictement supérieur à $${threshold}$.
|
|
39
|
+
|
|
40
|
+
$x$ prend donc les valeurs successives suivantes :
|
|
41
|
+
|
|
42
|
+
$$
|
|
43
|
+
${allValues.join("\\rightarrow ")}
|
|
44
|
+
$$
|
|
45
|
+
|
|
46
|
+
La boucle s'arrêtte alors car $${allValues[allValues.length - 1]} < ${threshold}$.
|
|
47
|
+
|
|
48
|
+
La boucle s'exécute donc $${count}$ fois.`;
|
|
49
|
+
};
|
|
50
|
+
const getQuestionFromIdentifiers = (identifiers) => ({
|
|
51
|
+
instruction: getInstruction(identifiers),
|
|
52
|
+
answer: getAnswer(identifiers),
|
|
53
|
+
hint: getHint(identifiers),
|
|
54
|
+
correction: getCorrection(identifiers),
|
|
55
|
+
keys: [],
|
|
56
|
+
answerFormat: "raw",
|
|
57
|
+
identifiers,
|
|
58
|
+
});
|
|
59
|
+
const getPyWhileLoopCountQuestion = () => {
|
|
60
|
+
const threshold = randint(2, 20);
|
|
61
|
+
const inputValue = randint(threshold + 1, 100);
|
|
62
|
+
return getQuestionFromIdentifiers({ inputValue, threshold });
|
|
63
|
+
};
|
|
64
|
+
const getPropositions = (n, { answer, inputValue, threshold }) => {
|
|
65
|
+
const propositions = [];
|
|
66
|
+
const correctAnswer = parseInt(answer);
|
|
67
|
+
addValidProp(propositions, correctAnswer.frenchify());
|
|
68
|
+
tryToAddWrongProp(propositions, (correctAnswer - 1).frenchify());
|
|
69
|
+
tryToAddWrongProp(propositions, (correctAnswer + 1).frenchify());
|
|
70
|
+
tryToAddWrongProp(propositions, Math.floor(inputValue / 2).frenchify());
|
|
71
|
+
tryToAddWrongProp(propositions, "0");
|
|
72
|
+
while (propositions.length < n) {
|
|
73
|
+
const rand = randint(0, 6);
|
|
74
|
+
tryToAddWrongProp(propositions, rand.frenchify());
|
|
75
|
+
}
|
|
76
|
+
return shuffleProps(propositions, n);
|
|
77
|
+
};
|
|
78
|
+
const isAnswerValid = (ans, { answer }) => ans === answer;
|
|
79
|
+
export const pyWhileLoopCount = {
|
|
80
|
+
id: "whileLoopCount",
|
|
81
|
+
label: "Nombre d’itérations d’une boucle while",
|
|
82
|
+
isSingleStep: true,
|
|
83
|
+
generator: (nb) => getDistinctQuestions(getPyWhileLoopCountQuestion, nb),
|
|
84
|
+
qcmTimer: 60,
|
|
85
|
+
freeTimer: 60,
|
|
86
|
+
getPropositions,
|
|
87
|
+
isAnswerValid,
|
|
88
|
+
getInstruction,
|
|
89
|
+
getHint,
|
|
90
|
+
getCorrection,
|
|
91
|
+
subject: "Mathématiques",
|
|
92
|
+
getQuestionFromIdentifiers,
|
|
93
|
+
hasHintAndCorrection: true,
|
|
94
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simpifySquareRoot.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/squareRoots/simpifySquareRoot.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"simpifySquareRoot.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/squareRoots/simpifySquareRoot.ts"],"names":[],"mappings":"AAcA,OAAO,EACL,QAAQ,EAcT,MAAM,mBAAmB,CAAC;AAE3B,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAwGF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAapD,CAAC"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { SquareRoot, SquareRootConstructor, } from "../../../math/numbers/reals/real.js";
|
|
2
|
+
import { sqrt } from "../../../tree/nodes/functions/sqrtNode.js";
|
|
3
|
+
import { multiply, } from "../../../tree/nodes/operators/multiplyNode.js";
|
|
2
4
|
import { shuffle } from "../../../utils/alea/shuffle.js";
|
|
5
|
+
import { alignTex } from "../../../utils/latex/alignTex.js";
|
|
3
6
|
import { addValidProp, tryToAddWrongProp, } from "../../exercise.js";
|
|
4
7
|
import { getDistinctQuestions } from "../../utils/getDistinctQuestions.js";
|
|
5
8
|
const getStatementNode = (identifiers) => {
|
|
@@ -16,6 +19,41 @@ $$
|
|
|
16
19
|
${getStartStatement(identifiers)}
|
|
17
20
|
$$`;
|
|
18
21
|
};
|
|
22
|
+
const getHint = (identifiers) => {
|
|
23
|
+
const { sqrtOperand } = identifiers;
|
|
24
|
+
return `Cherche à écrire $${sqrtOperand}$ sous la forme $a^2\\times b$, puis utilise la propriété :
|
|
25
|
+
|
|
26
|
+
$$
|
|
27
|
+
\\sqrt{ab} = \\sqrt{a} \\times \\sqrt{b}
|
|
28
|
+
$$`;
|
|
29
|
+
};
|
|
30
|
+
const getCorrection = (identifiers) => {
|
|
31
|
+
const { sqrtOperand } = identifiers;
|
|
32
|
+
let biggestSquare = 0;
|
|
33
|
+
const ints = Array.from({ length: 16 }, (_, i) => i + 1).reverse();
|
|
34
|
+
for (const k of ints) {
|
|
35
|
+
const square = k ** 2;
|
|
36
|
+
if (sqrtOperand % square === 0) {
|
|
37
|
+
biggestSquare = square;
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return `
|
|
42
|
+
|
|
43
|
+
${alignTex([
|
|
44
|
+
[
|
|
45
|
+
sqrt(sqrtOperand).toTex(),
|
|
46
|
+
"=",
|
|
47
|
+
sqrt(multiply(biggestSquare, sqrtOperand / biggestSquare)).toTex(),
|
|
48
|
+
],
|
|
49
|
+
[
|
|
50
|
+
"",
|
|
51
|
+
"=",
|
|
52
|
+
multiply(sqrt(biggestSquare), sqrt(sqrtOperand / biggestSquare)).toTex(),
|
|
53
|
+
],
|
|
54
|
+
["", "=", getAnswer(identifiers)],
|
|
55
|
+
])}`;
|
|
56
|
+
};
|
|
19
57
|
const getAnswer = (identifiers) => {
|
|
20
58
|
const squareRoot = new SquareRoot(identifiers.sqrtOperand);
|
|
21
59
|
const answer = squareRoot.simplify().toTree().toTex();
|
|
@@ -37,6 +75,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
|
|
|
37
75
|
keys: [],
|
|
38
76
|
answerFormat: "tex",
|
|
39
77
|
identifiers,
|
|
78
|
+
hint: getHint(identifiers),
|
|
79
|
+
correction: getCorrection(identifiers),
|
|
40
80
|
};
|
|
41
81
|
return question;
|
|
42
82
|
};
|
|
@@ -69,4 +109,5 @@ export const simplifySquareRoot = {
|
|
|
69
109
|
isAnswerValid,
|
|
70
110
|
subject: "Mathématiques",
|
|
71
111
|
getQuestionFromIdentifiers,
|
|
112
|
+
hasHintAndCorrection: true,
|
|
72
113
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"squareRootEquation.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/squareRoots/squareRootEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"squareRootEquation.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/squareRoots/squareRootEquation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAwFF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,WAAW,CAcpD,CAAC"}
|
|
@@ -3,6 +3,7 @@ import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuesti
|
|
|
3
3
|
import { randint } from "../../../math/utils/random/randint.js";
|
|
4
4
|
import { EquationSolutionNode } from "../../../tree/nodes/equations/equationSolutionNode.js";
|
|
5
5
|
import { NumberNode } from "../../../tree/nodes/numbers/numberNode.js";
|
|
6
|
+
import { square } from "../../../tree/nodes/operators/powerNode.js";
|
|
6
7
|
import { DiscreteSetNode, EmptySet, } from "../../../tree/nodes/sets/discreteSetNode.js";
|
|
7
8
|
import { shuffle } from "../../../utils/alea/shuffle.js";
|
|
8
9
|
const getInstruction = (identifiers) => {
|
|
@@ -23,6 +24,27 @@ const getSquareRootEquationQuestion = () => {
|
|
|
23
24
|
const identifiers = { k };
|
|
24
25
|
return getQuestionFromIdentifiers(identifiers);
|
|
25
26
|
};
|
|
27
|
+
const getHint = (identifiers) => {
|
|
28
|
+
const { k } = identifiers;
|
|
29
|
+
return `Si $k>=0$, alors $\\sqrt{x} = k$ si et seulement si $x = k^2$.`;
|
|
30
|
+
};
|
|
31
|
+
const getCorrection = (identifiers) => {
|
|
32
|
+
const { k } = identifiers;
|
|
33
|
+
if (k < 0) {
|
|
34
|
+
return `La racine carrée d'un nombre est un nombre positif. Il n'y a donc pas de solution à cette équation :
|
|
35
|
+
|
|
36
|
+
$$
|
|
37
|
+
${getAnswer(identifiers)}
|
|
38
|
+
$$`;
|
|
39
|
+
}
|
|
40
|
+
return `Puisque $${k}>0$, alors $\\sqrt{x} = ${k}$ si et seulement si $x = ${square(k).toTex()}$.
|
|
41
|
+
|
|
42
|
+
La solution de cette équation est donc :
|
|
43
|
+
|
|
44
|
+
$$
|
|
45
|
+
${getAnswer(identifiers)}
|
|
46
|
+
$$`;
|
|
47
|
+
};
|
|
26
48
|
const getQuestionFromIdentifiers = (identifiers) => {
|
|
27
49
|
const question = {
|
|
28
50
|
answer: getAnswer(identifiers),
|
|
@@ -30,6 +52,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
|
|
|
30
52
|
keys: ["S", "equal", "lbrace", "semicolon", "rbrace", "varnothing"],
|
|
31
53
|
answerFormat: "tex",
|
|
32
54
|
identifiers,
|
|
55
|
+
hint: getHint(identifiers),
|
|
56
|
+
correction: getCorrection(identifiers),
|
|
33
57
|
};
|
|
34
58
|
return question;
|
|
35
59
|
};
|
|
@@ -64,4 +88,5 @@ export const squareRootEquation = {
|
|
|
64
88
|
isAnswerValid,
|
|
65
89
|
subject: "Mathématiques",
|
|
66
90
|
getQuestionFromIdentifiers,
|
|
91
|
+
hasHintAndCorrection: true,
|
|
67
92
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"squareRootIdentities.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/squareRoots/squareRootIdentities.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"squareRootIdentities.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/squareRoots/squareRootIdentities.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAyBrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtB,CAAC,EAAE,MAAM,CAAC;IACV,eAAe,EAAE,OAAO,CAAC;CAC1B,CAAC;AAsUF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CActD,CAAC"}
|
|
@@ -4,12 +4,13 @@ import { SquareRootConstructor, } from "../../../math/numbers/reals/real.js";
|
|
|
4
4
|
import { randint } from "../../../math/utils/random/randint.js";
|
|
5
5
|
import { sqrt, SqrtNode } from "../../../tree/nodes/functions/sqrtNode.js";
|
|
6
6
|
import { NumberNode } from "../../../tree/nodes/numbers/numberNode.js";
|
|
7
|
-
import { AddNode } from "../../../tree/nodes/operators/addNode.js";
|
|
7
|
+
import { add, AddNode } from "../../../tree/nodes/operators/addNode.js";
|
|
8
8
|
import { multiply, MultiplyNode, } from "../../../tree/nodes/operators/multiplyNode.js";
|
|
9
|
-
import { SquareNode } from "../../../tree/nodes/operators/powerNode.js";
|
|
10
|
-
import { SubstractNode } from "../../../tree/nodes/operators/substractNode.js";
|
|
9
|
+
import { square, SquareNode } from "../../../tree/nodes/operators/powerNode.js";
|
|
10
|
+
import { substract, SubstractNode, } from "../../../tree/nodes/operators/substractNode.js";
|
|
11
11
|
import { probaFlip } from "../../../utils/alea/probaFlip.js";
|
|
12
12
|
import { shuffle } from "../../../utils/alea/shuffle.js";
|
|
13
|
+
import { alignTex } from "../../../utils/latex/alignTex.js";
|
|
13
14
|
const getInstruction = (identifiers) => {
|
|
14
15
|
const { type, a, x, b, y, otherTermIsSqrt } = identifiers;
|
|
15
16
|
let statement;
|
|
@@ -39,10 +40,107 @@ const getAnswer = (identifiers) => {
|
|
|
39
40
|
return answer;
|
|
40
41
|
};
|
|
41
42
|
const getHint = (identifiers) => {
|
|
42
|
-
|
|
43
|
+
const { type } = identifiers;
|
|
44
|
+
switch (type) {
|
|
45
|
+
case 1:
|
|
46
|
+
return `Utilise l'identité remarquable :
|
|
47
|
+
|
|
48
|
+
$$
|
|
49
|
+
(a+b)^2 = a^2 + 2ab+b^2
|
|
50
|
+
$$`;
|
|
51
|
+
case 2:
|
|
52
|
+
return `Utilise l'identité remarquable :
|
|
53
|
+
|
|
54
|
+
$$
|
|
55
|
+
(a-b)^2 = a^2 - 2ab+b^2
|
|
56
|
+
$$`;
|
|
57
|
+
case 3:
|
|
58
|
+
default:
|
|
59
|
+
return `Utilise l'identité remarquable :
|
|
60
|
+
|
|
61
|
+
$$
|
|
62
|
+
(a-b)(a+b) = a^2 - b^2
|
|
63
|
+
$$
|
|
64
|
+
`;
|
|
65
|
+
}
|
|
43
66
|
};
|
|
44
67
|
const getCorrection = (identifiers) => {
|
|
45
|
-
|
|
68
|
+
const { type, a, x, b, y, otherTermIsSqrt } = identifiers;
|
|
69
|
+
const firstTerm = multiply(x, sqrt(a));
|
|
70
|
+
const secondTerm = otherTermIsSqrt
|
|
71
|
+
? multiply(y, sqrt(b))
|
|
72
|
+
: new NumberNode(y);
|
|
73
|
+
switch (type) {
|
|
74
|
+
case 1:
|
|
75
|
+
return `On utilise l'identité remarquable :
|
|
76
|
+
|
|
77
|
+
$$
|
|
78
|
+
(a+b)^2 = a^2 + 2ab+b^2
|
|
79
|
+
$$
|
|
80
|
+
|
|
81
|
+
On a donc :
|
|
82
|
+
|
|
83
|
+
${alignTex([
|
|
84
|
+
["", square(add(firstTerm, secondTerm)).toTex()],
|
|
85
|
+
[
|
|
86
|
+
"=",
|
|
87
|
+
add(square(firstTerm), add(multiply(2, multiply(firstTerm, secondTerm)), square(secondTerm))).toTex(),
|
|
88
|
+
],
|
|
89
|
+
[
|
|
90
|
+
"=",
|
|
91
|
+
add(square(firstTerm).simplify(), add(multiply(2, multiply(firstTerm, secondTerm)).simplify(), square(secondTerm)).simplify()).toTex(),
|
|
92
|
+
],
|
|
93
|
+
["=", getAnswer(identifiers)],
|
|
94
|
+
])}
|
|
95
|
+
`;
|
|
96
|
+
case 2:
|
|
97
|
+
return `On utilise l'identité remarquable :
|
|
98
|
+
|
|
99
|
+
$$
|
|
100
|
+
(a-b)^2 = a^2 - 2ab+b^2
|
|
101
|
+
$$
|
|
102
|
+
|
|
103
|
+
On a donc :
|
|
104
|
+
|
|
105
|
+
${alignTex([
|
|
106
|
+
["", square(substract(firstTerm, secondTerm)).toTex()],
|
|
107
|
+
[
|
|
108
|
+
"=",
|
|
109
|
+
add(square(firstTerm), add(multiply(-2, multiply(firstTerm, secondTerm)), square(secondTerm))).toTex(),
|
|
110
|
+
],
|
|
111
|
+
[
|
|
112
|
+
"=",
|
|
113
|
+
add(square(firstTerm).simplify(), add(multiply(-2, multiply(firstTerm, secondTerm)).simplify(), square(secondTerm)).simplify()).toTex(),
|
|
114
|
+
],
|
|
115
|
+
["=", getAnswer(identifiers)],
|
|
116
|
+
])}
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
`;
|
|
120
|
+
case 3:
|
|
121
|
+
default:
|
|
122
|
+
return `On utilise l'identité remarquable :
|
|
123
|
+
|
|
124
|
+
$$
|
|
125
|
+
(a+b)(a-b) = a^2 - b^2
|
|
126
|
+
$$
|
|
127
|
+
|
|
128
|
+
On a donc :
|
|
129
|
+
|
|
130
|
+
${alignTex([
|
|
131
|
+
[
|
|
132
|
+
"",
|
|
133
|
+
multiply(add(firstTerm, secondTerm), substract(firstTerm, secondTerm)).toTex(),
|
|
134
|
+
],
|
|
135
|
+
["=", substract(square(firstTerm), square(secondTerm)).toTex()],
|
|
136
|
+
[
|
|
137
|
+
"=",
|
|
138
|
+
substract(square(firstTerm).simplify(), square(secondTerm).simplify()).toTex(),
|
|
139
|
+
],
|
|
140
|
+
["=", getAnswer(identifiers)],
|
|
141
|
+
])}
|
|
142
|
+
`;
|
|
143
|
+
}
|
|
46
144
|
};
|
|
47
145
|
const getQuestionFromIdentifiers = (identifiers) => {
|
|
48
146
|
const question = {
|
|
@@ -51,6 +149,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
|
|
|
51
149
|
keys: [],
|
|
52
150
|
answerFormat: "tex",
|
|
53
151
|
identifiers,
|
|
152
|
+
hint: getHint(identifiers),
|
|
153
|
+
correction: getCorrection(identifiers),
|
|
54
154
|
};
|
|
55
155
|
return question;
|
|
56
156
|
};
|
|
@@ -147,4 +247,5 @@ export const squareRootIdentities = {
|
|
|
147
247
|
isAnswerValid,
|
|
148
248
|
subject: "Mathématiques",
|
|
149
249
|
getQuestionFromIdentifiers,
|
|
250
|
+
hasHintAndCorrection: true,
|
|
150
251
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"squareRootsDistributivity.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/squareRoots/squareRootsDistributivity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"squareRootsDistributivity.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/squareRoots/squareRootsDistributivity.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAgBrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAkHF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,WAAW,CAc3D,CAAC"}
|
|
@@ -6,6 +6,7 @@ import { sqrt, SqrtNode } from "../../../tree/nodes/functions/sqrtNode.js";
|
|
|
6
6
|
import { NumberNode } from "../../../tree/nodes/numbers/numberNode.js";
|
|
7
7
|
import { add, AddNode } from "../../../tree/nodes/operators/addNode.js";
|
|
8
8
|
import { multiply, MultiplyNode, } from "../../../tree/nodes/operators/multiplyNode.js";
|
|
9
|
+
import { alignTex } from "../../../utils/latex/alignTex.js";
|
|
9
10
|
/**
|
|
10
11
|
* a sqrt(b) (c + d sqrt(b))
|
|
11
12
|
*/
|
|
@@ -26,10 +27,33 @@ const getAnswer = (identifiers) => {
|
|
|
26
27
|
return answer;
|
|
27
28
|
};
|
|
28
29
|
const getHint = (identifiers) => {
|
|
29
|
-
return
|
|
30
|
+
return `Distribue le premier terme en utilisant :
|
|
31
|
+
|
|
32
|
+
$$
|
|
33
|
+
k(a+b) = ka + kb
|
|
34
|
+
$$
|
|
35
|
+
|
|
36
|
+
Puis simplifie les racines carrés en utilisant :
|
|
37
|
+
|
|
38
|
+
$$
|
|
39
|
+
\\sqrt{ab} = \\sqrt{a} \\times \\sqrt{b}
|
|
40
|
+
$$`;
|
|
30
41
|
};
|
|
31
42
|
const getCorrection = (identifiers) => {
|
|
32
|
-
|
|
43
|
+
const { a, b, c, d } = identifiers;
|
|
44
|
+
const first = multiply(a, sqrt(b));
|
|
45
|
+
const second = c.toTree();
|
|
46
|
+
const third = multiply(d, sqrt(b));
|
|
47
|
+
const statement = multiply(first, add(second, third));
|
|
48
|
+
return `
|
|
49
|
+
${alignTex([
|
|
50
|
+
["", statement.toTex()],
|
|
51
|
+
["=", add(multiply(first, second), multiply(first, third)).toTex()],
|
|
52
|
+
[
|
|
53
|
+
"=",
|
|
54
|
+
add(multiply(first, second), multiply(first, third)).simplify().toTex(),
|
|
55
|
+
],
|
|
56
|
+
])}`;
|
|
33
57
|
};
|
|
34
58
|
const getQuestionFromIdentifiers = (identifiers) => {
|
|
35
59
|
const question = {
|
|
@@ -38,6 +62,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
|
|
|
38
62
|
keys: [],
|
|
39
63
|
answerFormat: "tex",
|
|
40
64
|
identifiers,
|
|
65
|
+
hint: getHint(identifiers),
|
|
66
|
+
correction: getCorrection(identifiers),
|
|
41
67
|
};
|
|
42
68
|
return question;
|
|
43
69
|
};
|
|
@@ -79,4 +105,5 @@ export const squareRootsDistributivity = {
|
|
|
79
105
|
isAnswerValid,
|
|
80
106
|
subject: "Mathématiques",
|
|
81
107
|
getQuestionFromIdentifiers,
|
|
108
|
+
hasHintAndCorrection: true,
|
|
82
109
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"squareRootsFractions.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/squareRoots/squareRootsFractions.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"squareRootsFractions.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/squareRoots/squareRootsFractions.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA+GF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAgBtD,CAAC"}
|
|
@@ -7,6 +7,7 @@ import { frac } from "../../../tree/nodes/operators/fractionNode.js";
|
|
|
7
7
|
import { multiply } from "../../../tree/nodes/operators/multiplyNode.js";
|
|
8
8
|
import { rationalParser } from "../../../tree/parsers/rationalParser.js";
|
|
9
9
|
import { coinFlip } from "../../../utils/alea/coinFlip.js";
|
|
10
|
+
import { alignTex } from "../../../utils/latex/alignTex.js";
|
|
10
11
|
const getPropositions = (n, { answer }) => {
|
|
11
12
|
const propositions = [];
|
|
12
13
|
addValidProp(propositions, answer);
|
|
@@ -29,8 +30,35 @@ $$
|
|
|
29
30
|
${frac(multiply(a, sqrt(b)), multiply(c, sqrt(d))).toTex()}
|
|
30
31
|
$$`;
|
|
31
32
|
};
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
const getHint = (identifiers) => {
|
|
34
|
+
return `Utilise la propriété :
|
|
35
|
+
|
|
36
|
+
$$
|
|
37
|
+
\\frac{\\sqrt{a}}{\\sqrt{b}} = \\sqrt{\\frac{a}{b}}
|
|
38
|
+
$$`;
|
|
39
|
+
};
|
|
40
|
+
const getCorrection = (identifiers) => {
|
|
41
|
+
const { a, b, c, d } = identifiers;
|
|
42
|
+
return `
|
|
43
|
+
${alignTex([
|
|
44
|
+
[
|
|
45
|
+
frac(multiply(a, sqrt(b)), multiply(c, sqrt(d))).toTex(),
|
|
46
|
+
"=",
|
|
47
|
+
multiply(frac(a, c), sqrt(frac(b, d))).toTex(),
|
|
48
|
+
],
|
|
49
|
+
[
|
|
50
|
+
"",
|
|
51
|
+
"=",
|
|
52
|
+
multiply(frac(a, c).simplify(), sqrt(frac(b, d).simplify())).toTex(),
|
|
53
|
+
],
|
|
54
|
+
[
|
|
55
|
+
"",
|
|
56
|
+
"=",
|
|
57
|
+
multiply(frac(a, c).simplify(), sqrt(frac(b, d)).simplify()).toTex(),
|
|
58
|
+
],
|
|
59
|
+
["", "=", getAnswer(identifiers)],
|
|
60
|
+
])}`;
|
|
61
|
+
};
|
|
34
62
|
const getKeys = (identifiers) => {
|
|
35
63
|
return [];
|
|
36
64
|
};
|
|
@@ -71,8 +99,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
|
|
|
71
99
|
keys: getKeys(identifiers),
|
|
72
100
|
answerFormat: "tex",
|
|
73
101
|
identifiers,
|
|
74
|
-
|
|
75
|
-
|
|
102
|
+
hint: getHint(identifiers),
|
|
103
|
+
correction: getCorrection(identifiers),
|
|
76
104
|
};
|
|
77
105
|
return question;
|
|
78
106
|
};
|
|
@@ -90,4 +118,5 @@ export const squareRootsFractions = {
|
|
|
90
118
|
// getHint,
|
|
91
119
|
// getCorrection,
|
|
92
120
|
getQuestionFromIdentifiers,
|
|
121
|
+
hasHintAndCorrection: true,
|
|
93
122
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"squareRootsProducts.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/squareRoots/squareRootsProducts.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"squareRootsProducts.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/squareRoots/squareRootsProducts.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA6FF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAgBrD,CAAC"}
|
|
@@ -5,6 +5,7 @@ import { randint } from "../../../math/utils/random/randint.js";
|
|
|
5
5
|
import { sqrt } from "../../../tree/nodes/functions/sqrtNode.js";
|
|
6
6
|
import { multiply } from "../../../tree/nodes/operators/multiplyNode.js";
|
|
7
7
|
import { coinFlip } from "../../../utils/alea/coinFlip.js";
|
|
8
|
+
import { alignTex } from "../../../utils/latex/alignTex.js";
|
|
8
9
|
const getPropositions = (n, { answer }) => {
|
|
9
10
|
const propositions = [];
|
|
10
11
|
addValidProp(propositions, answer);
|
|
@@ -32,8 +33,29 @@ ${multiply(multiply(a, sqrt(b)), multiply(c, sqrt(d)), {
|
|
|
32
33
|
$$
|
|
33
34
|
`;
|
|
34
35
|
};
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
const getHint = (identifiers) => {
|
|
37
|
+
return `Utilise la propriété suivante :
|
|
38
|
+
|
|
39
|
+
$$
|
|
40
|
+
\\sqrt{a}\\times \\sqrt{b} = \\sqrt{ab}
|
|
41
|
+
$$`;
|
|
42
|
+
};
|
|
43
|
+
const getCorrection = (identifiers) => {
|
|
44
|
+
const { a, b, c, d } = identifiers;
|
|
45
|
+
return `
|
|
46
|
+
${alignTex([
|
|
47
|
+
[
|
|
48
|
+
multiply(multiply(a, sqrt(b)), multiply(c, sqrt(d)), {
|
|
49
|
+
forceTimesSign: true,
|
|
50
|
+
}).toTex(),
|
|
51
|
+
"=",
|
|
52
|
+
multiply(multiply(a, c), multiply(sqrt(b), sqrt(d))).toTex(),
|
|
53
|
+
],
|
|
54
|
+
["", "=", multiply(a * c, sqrt(multiply(b, d))).toTex()],
|
|
55
|
+
["", "=", multiply(a * c, sqrt(b * d)).toTex()],
|
|
56
|
+
["", "=", getAnswer(identifiers)],
|
|
57
|
+
])}`;
|
|
58
|
+
};
|
|
37
59
|
const getKeys = (identifiers) => {
|
|
38
60
|
return [];
|
|
39
61
|
};
|
|
@@ -61,8 +83,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
|
|
|
61
83
|
keys: getKeys(identifiers),
|
|
62
84
|
answerFormat: "tex",
|
|
63
85
|
identifiers,
|
|
64
|
-
|
|
65
|
-
|
|
86
|
+
hint: getHint(identifiers),
|
|
87
|
+
correction: getCorrection(identifiers),
|
|
66
88
|
};
|
|
67
89
|
return question;
|
|
68
90
|
};
|
|
@@ -80,4 +102,5 @@ export const squareRootsProducts = {
|
|
|
80
102
|
// getHint,
|
|
81
103
|
// getCorrection,
|
|
82
104
|
getQuestionFromIdentifiers,
|
|
105
|
+
hasHintAndCorrection: true,
|
|
83
106
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"squareRootsSum.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/squareRoots/squareRootsSum.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"squareRootsSum.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/squareRoots/squareRootsSum.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAiBrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACvB,CAAC;AA4IF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAahD,CAAC"}
|