math-exercises 3.0.133 → 3.0.135
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/coprime.d.ts +8 -0
- package/lib/exercises/math/calcul/arithmetics/coprime.d.ts.map +1 -0
- package/lib/exercises/math/calcul/arithmetics/coprime.js +113 -0
- package/lib/exercises/math/calcul/arithmetics/index.d.ts +1 -0
- package/lib/exercises/math/calcul/arithmetics/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/index.js +1 -0
- package/lib/exercises/math/calcul/decimals/decimalFractionToDecimal.d.ts +11 -0
- package/lib/exercises/math/calcul/decimals/decimalFractionToDecimal.d.ts.map +1 -0
- package/lib/exercises/math/calcul/decimals/decimalFractionToDecimal.js +243 -0
- package/lib/exercises/math/calcul/decimals/index.d.ts +1 -0
- package/lib/exercises/math/calcul/decimals/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/decimals/index.js +1 -0
- package/lib/exercises/math/calculLitteral/distributivity/doubleDistri.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/distributivity/doubleDistri.js +4 -0
- package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivityAdd.d.ts +12 -0
- package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivityAdd.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/distributivity/doubleDistributivityAdd.js +173 -0
- package/lib/exercises/math/calculLitteral/distributivity/index.d.ts +1 -0
- package/lib/exercises/math/calculLitteral/distributivity/index.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/distributivity/index.js +1 -0
- package/lib/exercises/math/calculLitteral/equation/equationSecondDegreeWithNoB.d.ts +7 -0
- package/lib/exercises/math/calculLitteral/equation/equationSecondDegreeWithNoB.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/equation/equationSecondDegreeWithNoB.js +160 -0
- package/lib/exercises/math/calculLitteral/simplifying/compareMinusA.js +1 -1
- package/lib/exercises/math/dataRepresentations/barChartInterpreting.d.ts.map +1 -1
- package/lib/exercises/math/dataRepresentations/barChartInterpreting.js +0 -1
- package/lib/exercises/math/derivation/derivative/composition/functionCompositionDerivative.d.ts +11 -0
- package/lib/exercises/math/derivation/derivative/composition/functionCompositionDerivative.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivative/composition/functionCompositionDerivative.js +372 -0
- package/lib/exercises/math/derivation/derivative/composition/index.d.ts +2 -0
- package/lib/exercises/math/derivation/derivative/composition/index.d.ts.map +1 -0
- package/lib/exercises/math/derivation/derivative/composition/index.js +1 -0
- package/lib/exercises/math/derivation/derivative/index.d.ts +1 -0
- package/lib/exercises/math/derivation/derivative/index.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/index.js +1 -0
- package/lib/exercises/math/functions/affines/recognizeAffineGraph.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/recognizeAffineGraph.js +3 -3
- package/lib/exercises/math/functions/affines/recognizeExprAffine.js +2 -2
- package/lib/exercises/math/functions/composition/functionComposition.js +1 -1
- package/lib/exercises/math/functions/composition/functionDecompositionFindPossibleUVs.d.ts +13 -0
- package/lib/exercises/math/functions/composition/functionDecompositionFindPossibleUVs.d.ts.map +1 -0
- package/lib/exercises/math/functions/composition/functionDecompositionFindPossibleUVs.js +223 -0
- package/lib/exercises/math/functions/composition/functionDecompositionFindUOrV.d.ts +9 -0
- package/lib/exercises/math/functions/composition/functionDecompositionFindUOrV.d.ts.map +1 -0
- package/lib/exercises/math/functions/composition/functionDecompositionFindUOrV.js +252 -0
- package/lib/exercises/math/functions/composition/index.d.ts +2 -0
- package/lib/exercises/math/functions/composition/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/composition/index.js +2 -0
- package/lib/exercises/math/functions/trinoms/roots/rootsReading.d.ts +4 -1
- package/lib/exercises/math/functions/trinoms/roots/rootsReading.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/roots/rootsReading.js +29 -9
- package/lib/exercises/math/geometry/cartesian/midpoint.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/midpoint.js +8 -1
- package/lib/exercises/math/geometry/vectors/constructions/index.d.ts +1 -0
- package/lib/exercises/math/geometry/vectors/constructions/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/vectors/constructions/index.js +1 -0
- package/lib/exercises/math/geometry/vectors/constructions/traceVectorCL.d.ts +13 -0
- package/lib/exercises/math/geometry/vectors/constructions/traceVectorCL.d.ts.map +1 -0
- package/lib/exercises/math/geometry/vectors/constructions/traceVectorCL.js +178 -0
- package/lib/exercises/math/percent/evolutions/findEndValueAfterEvolution.d.ts.map +1 -1
- package/lib/exercises/math/percent/evolutions/findEndValueAfterEvolution.js +1 -1
- package/lib/exercises/math/powers/powersMixOperations.d.ts +4 -1
- package/lib/exercises/math/powers/powersMixOperations.d.ts.map +1 -1
- package/lib/exercises/math/powers/powersMixOperations.js +17 -7
- package/lib/exercises/math/probaStat/stats1var/plausibilityOfAverage.js +1 -1
- package/lib/exercises/math/sequences/arithmetic/arithmeticFindExplicitFormulaFirstRankOne.d.ts +8 -0
- package/lib/exercises/math/sequences/arithmetic/arithmeticFindExplicitFormulaFirstRankOne.d.ts.map +1 -0
- package/lib/exercises/math/sequences/arithmetic/arithmeticFindExplicitFormulaFirstRankOne.js +105 -0
- package/lib/exercises/math/sequences/arithmetic/arithmeticFindTermFirstRankOne.d.ts +9 -0
- package/lib/exercises/math/sequences/arithmetic/arithmeticFindTermFirstRankOne.d.ts.map +1 -0
- package/lib/exercises/math/sequences/arithmetic/arithmeticFindTermFirstRankOne.js +99 -0
- package/lib/exercises/math/sequences/arithmetic/arithmeticRecurrenceFormulaUsage.d.ts.map +1 -1
- package/lib/exercises/math/sequences/arithmetic/arithmeticRecurrenceFormulaUsage.js +9 -1
- package/lib/exercises/math/sequences/arithmetic/index.d.ts +2 -0
- package/lib/exercises/math/sequences/arithmetic/index.d.ts.map +1 -1
- package/lib/exercises/math/sequences/arithmetic/index.js +2 -0
- package/lib/exercises/math/sequences/genericSequenceVariations.d.ts.map +1 -1
- package/lib/exercises/math/sequences/genericSequenceVariations.js +5 -1
- package/lib/exercises/math/sequences/geometric/geometricExplicitFormulaUsage.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/geometricExplicitFormulaUsage.js +7 -1
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormula.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormula.js +3 -2
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFirstRankOne.d.ts +8 -0
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFirstRankOne.d.ts.map +1 -0
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFirstRankOne.js +112 -0
- package/lib/exercises/math/sequences/geometric/geometricFindTermFirstRankOne.d.ts +9 -0
- package/lib/exercises/math/sequences/geometric/geometricFindTermFirstRankOne.d.ts.map +1 -0
- package/lib/exercises/math/sequences/geometric/geometricFindTermFirstRankOne.js +97 -0
- package/lib/exercises/math/sequences/geometric/geometricFirstTermsGeneralSum.d.ts +5 -1
- package/lib/exercises/math/sequences/geometric/geometricFirstTermsGeneralSum.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/geometricFirstTermsGeneralSum.js +23 -6
- package/lib/exercises/math/sequences/geometric/geometricReasonUsage.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/geometricReasonUsage.js +3 -1
- package/lib/exercises/math/sequences/geometric/geometricRecurrenceFormulaUsage.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/geometricRecurrenceFormulaUsage.js +9 -1
- package/lib/exercises/math/sequences/geometric/index.d.ts +2 -0
- package/lib/exercises/math/sequences/geometric/index.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/index.js +2 -0
- package/lib/exercises/math/sequences/recurrenceFormulaUsage.d.ts.map +1 -1
- package/lib/exercises/math/sequences/recurrenceFormulaUsage.js +10 -3
- package/lib/index.d.ts +59 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/math/utils/arithmetic/isCoprime.d.ts +2 -0
- package/lib/math/utils/arithmetic/isCoprime.d.ts.map +1 -0
- package/lib/math/utils/arithmetic/isCoprime.js +10 -0
- package/lib/math/utils/arithmetic/primeDecompNode.d.ts +3 -0
- package/lib/math/utils/arithmetic/primeDecompNode.d.ts.map +1 -0
- package/lib/math/utils/arithmetic/primeDecompNode.js +24 -0
- package/lib/math/utils/functions/functionComparison.d.ts +3 -0
- package/lib/math/utils/functions/functionComparison.d.ts.map +1 -0
- package/lib/math/utils/functions/functionComparison.js +58 -0
- package/lib/math/utils/functions/functionComposition.d.ts +13 -0
- package/lib/math/utils/functions/functionComposition.d.ts.map +1 -0
- package/lib/math/utils/functions/functionComposition.js +117 -0
- package/lib/math/utils/functions/functionDecomposition.d.ts +10 -0
- package/lib/math/utils/functions/functionDecomposition.d.ts.map +1 -0
- package/lib/math/utils/functions/functionDecomposition.js +256 -0
- package/lib/server.js +24 -23
- package/lib/tree/nodes/operators/powerNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/powerNode.js +4 -0
- package/lib/utils/strings/joinanded.d.ts +2 -0
- package/lib/utils/strings/joinanded.d.ts.map +1 -0
- package/lib/utils/strings/joinanded.js +11 -0
- package/package.json +1 -1
|
@@ -85,7 +85,8 @@ const isAnswerValid = (ans, { reason, firstValue }) => {
|
|
|
85
85
|
const texs = equal.toAllValidTexs();
|
|
86
86
|
return (texs.includes(ans) ||
|
|
87
87
|
(() => {
|
|
88
|
-
|
|
88
|
+
const refinedAns = ans.replace("u_n", "").replace("=", "");
|
|
89
|
+
let nodeAns = parseLatex(refinedAns);
|
|
89
90
|
if (isEqualNode(nodeAns)) {
|
|
90
91
|
nodeAns = nodeAns.rightChild;
|
|
91
92
|
}
|
|
@@ -98,7 +99,7 @@ const isAnswerValid = (ans, { reason, firstValue }) => {
|
|
|
98
99
|
export const geometricFindExplicitFormula = {
|
|
99
100
|
id: "geometricFindExplicitFormula",
|
|
100
101
|
connector: "=",
|
|
101
|
-
label: "Déterminer la formule générale d'une suite géométrique",
|
|
102
|
+
label: "Déterminer la formule générale d'une suite géométrique (premier rang $u_0$)",
|
|
102
103
|
isSingleStep: false,
|
|
103
104
|
generator: (nb) => getDistinctQuestions(getGeometricFindExplicitFormula, nb),
|
|
104
105
|
qcmTimer: 60,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
reason: number;
|
|
4
|
+
firstValue: number;
|
|
5
|
+
};
|
|
6
|
+
export declare const geometricFindExplicitFormulaFirstRankOne: Exercise<Identifiers>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=geometricFindExplicitFormulaFirstRankOne.d.ts.map
|
package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFirstRankOne.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometricFindExplicitFormulaFirstRankOne.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/geometricFindExplicitFormulaFirstRankOne.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAWrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAoIF,eAAO,MAAM,wCAAwC,EAAE,QAAQ,CAAC,WAAW,CAe1E,CAAC"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { addValidProp, propWhile, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
4
|
+
import { NumberNode } from "../../../../tree/nodes/numbers/numberNode.js";
|
|
5
|
+
import { EqualNode } from "../../../../tree/nodes/equations/equalNode.js";
|
|
6
|
+
import { MultiplyNode } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
7
|
+
import { PowerNode } from "../../../../tree/nodes/operators/powerNode.js";
|
|
8
|
+
import { VariableNode } from "../../../../tree/nodes/variables/variableNode.js";
|
|
9
|
+
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
10
|
+
import { parseLatex } from "../../../../tree/parsers/latexParser.js";
|
|
11
|
+
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
12
|
+
const getInstruction = (identifiers) => {
|
|
13
|
+
const { firstValue, reason } = identifiers;
|
|
14
|
+
const firstRank = 1;
|
|
15
|
+
return `$(u_n)$ est une suite géométrique de premier terme $u_{${firstRank}} = ${firstValue}$ et de raison $q = ${reason}$.
|
|
16
|
+
|
|
17
|
+
Donner l'expression de $u_n$ en fonction de $n$.`;
|
|
18
|
+
};
|
|
19
|
+
const getAnswer = (identifiers) => {
|
|
20
|
+
const { firstValue, reason } = identifiers;
|
|
21
|
+
const formula = new MultiplyNode(new NumberNode(firstValue), new PowerNode(new NumberNode(reason), substract("n", 1)));
|
|
22
|
+
const answer = "u_n=" + formula.toTex();
|
|
23
|
+
return answer;
|
|
24
|
+
};
|
|
25
|
+
const getHint = () => {
|
|
26
|
+
return `Utilise la formule générale d'une suite géométrique :
|
|
27
|
+
|
|
28
|
+
$$
|
|
29
|
+
u_n = u_1 \\times r^{n-1}
|
|
30
|
+
$$
|
|
31
|
+
|
|
32
|
+
où $u_1$ est le premier terme et $r$ la raison.`;
|
|
33
|
+
};
|
|
34
|
+
const getCorrection = (identifiers) => {
|
|
35
|
+
const { firstValue, reason } = identifiers;
|
|
36
|
+
const answer = getAnswer(identifiers);
|
|
37
|
+
return `La formule générale d'une suite géométrique est :
|
|
38
|
+
|
|
39
|
+
$$
|
|
40
|
+
u_n = u_1 \\times r^{n-1}
|
|
41
|
+
$$
|
|
42
|
+
|
|
43
|
+
où $u_1$ est le premier terme et $r$ la raison.
|
|
44
|
+
|
|
45
|
+
Ici, puisque $u_1 = ${firstValue}$ et $r = ${reason}$, on a :
|
|
46
|
+
|
|
47
|
+
$$
|
|
48
|
+
${answer}
|
|
49
|
+
$$`;
|
|
50
|
+
};
|
|
51
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
52
|
+
const question = {
|
|
53
|
+
instruction: getInstruction(identifiers),
|
|
54
|
+
answer: getAnswer(identifiers),
|
|
55
|
+
keys: ["un", "equal", "n"],
|
|
56
|
+
answerFormat: "tex",
|
|
57
|
+
identifiers,
|
|
58
|
+
hint: getHint(identifiers),
|
|
59
|
+
correction: getCorrection(identifiers),
|
|
60
|
+
};
|
|
61
|
+
return question;
|
|
62
|
+
};
|
|
63
|
+
const getGeometricFindExplicitFormula = () => {
|
|
64
|
+
const firstValue = randint(1, 10);
|
|
65
|
+
const reason = randint(2, 10);
|
|
66
|
+
const identifiers = { reason, firstValue };
|
|
67
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
68
|
+
};
|
|
69
|
+
const getPropositions = (n, { answer, reason, firstValue }) => {
|
|
70
|
+
const propositions = [];
|
|
71
|
+
addValidProp(propositions, answer);
|
|
72
|
+
tryToAddWrongProp(propositions, "u_n=" +
|
|
73
|
+
new MultiplyNode(new NumberNode(firstValue), new PowerNode(new NumberNode(reason), new VariableNode("n"))).toTex());
|
|
74
|
+
tryToAddWrongProp(propositions, "u_n=" +
|
|
75
|
+
new MultiplyNode(new NumberNode(reason), new PowerNode(new NumberNode(firstValue), substract("n", 1))).toTex());
|
|
76
|
+
propWhile(propositions, n, () => {
|
|
77
|
+
const wrongAnswer = new MultiplyNode(new NumberNode(firstValue + randint(-firstValue, 2 * firstValue + 1)), new PowerNode(new NumberNode(reason + +randint(-reason + 1, 2 * reason + 1)), substract("n", 1)));
|
|
78
|
+
tryToAddWrongProp(propositions, "u_n=" + wrongAnswer.toTex());
|
|
79
|
+
});
|
|
80
|
+
return shuffle(propositions);
|
|
81
|
+
};
|
|
82
|
+
const isAnswerValid = (ans, { reason, firstValue }) => {
|
|
83
|
+
const formula = new MultiplyNode(new NumberNode(firstValue), new PowerNode(new NumberNode(reason), substract("n", 1)));
|
|
84
|
+
const equal = new EqualNode(new VariableNode("u_n"), formula, {
|
|
85
|
+
allowRawRightChildAsSolution: true,
|
|
86
|
+
});
|
|
87
|
+
const texs = equal.toAllValidTexs();
|
|
88
|
+
return (texs.includes(ans) ||
|
|
89
|
+
(() => {
|
|
90
|
+
const splitted = ans.split("=");
|
|
91
|
+
const rightTerm = splitted[1] ?? splitted[0];
|
|
92
|
+
const nodeAns = parseLatex(rightTerm);
|
|
93
|
+
const differenceNode = substract(nodeAns, formula);
|
|
94
|
+
return (differenceNode.evaluate({ n: 0 }) === 0 &&
|
|
95
|
+
differenceNode.evaluate({ n: 1 }) === 0 &&
|
|
96
|
+
differenceNode.evaluate({ n: 5 }) === 0);
|
|
97
|
+
})());
|
|
98
|
+
};
|
|
99
|
+
export const geometricFindExplicitFormulaFirstRankOne = {
|
|
100
|
+
id: "geometricFindExplicitFormulaFirstRankOne",
|
|
101
|
+
connector: "=",
|
|
102
|
+
label: "Déterminer la formule générale d'une suite géométrique (premier rang $u_1$)",
|
|
103
|
+
isSingleStep: false,
|
|
104
|
+
generator: (nb) => getDistinctQuestions(getGeometricFindExplicitFormula, nb),
|
|
105
|
+
qcmTimer: 60,
|
|
106
|
+
freeTimer: 60,
|
|
107
|
+
getPropositions,
|
|
108
|
+
isAnswerValid,
|
|
109
|
+
subject: "Mathématiques",
|
|
110
|
+
hasHintAndCorrection: true,
|
|
111
|
+
getQuestionFromIdentifiers,
|
|
112
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
firstTerm: number;
|
|
4
|
+
reason: number;
|
|
5
|
+
askedRank: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const geometricFindTermFirstRankOne: Exercise<Identifiers>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=geometricFindTermFirstRankOne.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometricFindTermFirstRankOne.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/geometricFindTermFirstRankOne.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAiGF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,CAe/D,CAAC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, propWhile, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
4
|
+
import { MultiplyNode } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
5
|
+
import { PowerNode } from "../../../../tree/nodes/operators/powerNode.js";
|
|
6
|
+
import { SubstractNode } from "../../../../tree/nodes/operators/substractNode.js";
|
|
7
|
+
import { VariableNode } from "../../../../tree/nodes/variables/variableNode.js";
|
|
8
|
+
import { alignTex } from "../../../../utils/latex/alignTex.js";
|
|
9
|
+
const getInstruction = (identifiers) => {
|
|
10
|
+
const { firstTerm, reason, askedRank } = identifiers;
|
|
11
|
+
return `Soit $u$ la suite géométrique de premier terme $u_1 = ${firstTerm}$ et de raison $q = ${reason}$. Calculer $u_{${askedRank}}$.`;
|
|
12
|
+
};
|
|
13
|
+
const getAnswer = (identifiers) => {
|
|
14
|
+
const { firstTerm, reason, askedRank } = identifiers;
|
|
15
|
+
const answer = firstTerm * Math.pow(reason, askedRank - 1);
|
|
16
|
+
return answer.frenchify();
|
|
17
|
+
};
|
|
18
|
+
const getHint = () => {
|
|
19
|
+
return `Le terme général d'une suite geométrique est :
|
|
20
|
+
|
|
21
|
+
$$
|
|
22
|
+
u_n = u_1 \\times q^{n-1}
|
|
23
|
+
$$
|
|
24
|
+
|
|
25
|
+
où $u_1$ est le premier terme et $q$ la raison.`;
|
|
26
|
+
};
|
|
27
|
+
const getCorrection = (identifiers) => {
|
|
28
|
+
const { firstTerm, reason, askedRank } = identifiers;
|
|
29
|
+
return `Le terme général de la suite $u$ est :
|
|
30
|
+
|
|
31
|
+
${alignTex([
|
|
32
|
+
[`u_n`, "=", `u_1 \\times q^{n-1}`],
|
|
33
|
+
[
|
|
34
|
+
"",
|
|
35
|
+
"=",
|
|
36
|
+
new MultiplyNode(firstTerm.toTree(), new PowerNode(reason.toTree(), new SubstractNode(new VariableNode("n"), (1).toTree()))).toTex(),
|
|
37
|
+
],
|
|
38
|
+
])}
|
|
39
|
+
|
|
40
|
+
Il suffit alors de remplacer $n$ par $${askedRank}$ dans la formule :
|
|
41
|
+
|
|
42
|
+
${alignTex([
|
|
43
|
+
[
|
|
44
|
+
`u_{${askedRank}}`,
|
|
45
|
+
"=",
|
|
46
|
+
`${new MultiplyNode(firstTerm.toTree(), new PowerNode(reason.toTree(), (askedRank - 1).toTree())).toTex()}`,
|
|
47
|
+
],
|
|
48
|
+
["", "=", getAnswer(identifiers)],
|
|
49
|
+
])}
|
|
50
|
+
`;
|
|
51
|
+
};
|
|
52
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
53
|
+
const question = {
|
|
54
|
+
answer: getAnswer(identifiers),
|
|
55
|
+
instruction: getInstruction(identifiers),
|
|
56
|
+
keys: [],
|
|
57
|
+
answerFormat: "tex",
|
|
58
|
+
hint: getHint(identifiers),
|
|
59
|
+
correction: getCorrection(identifiers),
|
|
60
|
+
identifiers,
|
|
61
|
+
};
|
|
62
|
+
return question;
|
|
63
|
+
};
|
|
64
|
+
const getGeometricFindTermQuestion = () => {
|
|
65
|
+
const firstRank = 1;
|
|
66
|
+
const firstTerm = randint(-10, 10, [0]);
|
|
67
|
+
const reason = randint(2, 6);
|
|
68
|
+
const askedRank = randint(5, 12);
|
|
69
|
+
const identifiers = { firstRank, askedRank, firstTerm, reason };
|
|
70
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
71
|
+
};
|
|
72
|
+
const getPropositions = (n, { answer, askedRank, firstTerm, reason }) => {
|
|
73
|
+
const propositions = [];
|
|
74
|
+
addValidProp(propositions, answer);
|
|
75
|
+
propWhile(propositions, n, () => {
|
|
76
|
+
const fake = firstTerm * Math.pow(reason, askedRank - randint(-5, 3, [1]));
|
|
77
|
+
tryToAddWrongProp(propositions, fake + "");
|
|
78
|
+
});
|
|
79
|
+
return shuffleProps(propositions, n);
|
|
80
|
+
};
|
|
81
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
82
|
+
return ans === answer;
|
|
83
|
+
};
|
|
84
|
+
export const geometricFindTermFirstRankOne = {
|
|
85
|
+
id: "geometricFindTermFirstRankOne",
|
|
86
|
+
connector: "=",
|
|
87
|
+
label: "Calculer un terme d'une suite géométrique à partir de son premier terme ($u_1$) et sa raison",
|
|
88
|
+
isSingleStep: true,
|
|
89
|
+
generator: (nb) => getDistinctQuestions(getGeometricFindTermQuestion, nb),
|
|
90
|
+
qcmTimer: 60,
|
|
91
|
+
freeTimer: 60,
|
|
92
|
+
getPropositions,
|
|
93
|
+
isAnswerValid,
|
|
94
|
+
subject: "Mathématiques",
|
|
95
|
+
hasHintAndCorrection: true,
|
|
96
|
+
getQuestionFromIdentifiers,
|
|
97
|
+
};
|
|
@@ -5,6 +5,10 @@ type Identifiers = {
|
|
|
5
5
|
reason: number;
|
|
6
6
|
nbTerms: number;
|
|
7
7
|
};
|
|
8
|
-
|
|
8
|
+
type Options = {
|
|
9
|
+
positiveReason: boolean;
|
|
10
|
+
firstRankOne: boolean;
|
|
11
|
+
};
|
|
12
|
+
export declare const geometricFirstTermsGeneralSum: Exercise<Identifiers, Options>;
|
|
9
13
|
export {};
|
|
10
14
|
//# sourceMappingURL=geometricFirstTermsGeneralSum.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometricFirstTermsGeneralSum.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/geometricFirstTermsGeneralSum.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"geometricFirstTermsGeneralSum.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/geometricFirstTermsGeneralSum.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAkHF,KAAK,OAAO,GAAG;IACb,cAAc,EAAE,OAAO,CAAC;IACxB,YAAY,EAAE,OAAO,CAAC;CACvB,CAAC;AAkBF,eAAO,MAAM,6BAA6B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAkBxE,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { addValidProp, shuffleProps, tryToAddWrongProp, propWhile, } from "../../../../exercises/exercise.js";
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, propWhile, GeneratorOptionTarget, GeneratorOptionType, } from "../../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { randint } from "../../../../math/utils/random/randint.js";
|
|
4
4
|
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
@@ -53,10 +53,10 @@ const getAnswer = (identifiers) => {
|
|
|
53
53
|
const answer = (firstValue * (1 - Math.pow(reason, nbTerms))) / (1 - reason);
|
|
54
54
|
return answer.frenchify();
|
|
55
55
|
};
|
|
56
|
-
const getGeometricFirstTermsGeneralSumQuestion = () => {
|
|
57
|
-
const firstRank = random([0, 1]);
|
|
56
|
+
const getGeometricFirstTermsGeneralSumQuestion = (opts) => {
|
|
57
|
+
const firstRank = opts?.firstRankOne ? 1 : random([0, 1]);
|
|
58
58
|
const firstValue = randint(-9, 10, [0]);
|
|
59
|
-
const reason = randint(-5, 5, [0, 1]);
|
|
59
|
+
const reason = opts?.positiveReason ? randint(2, 5) : randint(-5, 5, [0, 1]);
|
|
60
60
|
const nbTerms = randint(4, 9);
|
|
61
61
|
const identifiers = {
|
|
62
62
|
firstRank,
|
|
@@ -64,7 +64,7 @@ const getGeometricFirstTermsGeneralSumQuestion = () => {
|
|
|
64
64
|
reason,
|
|
65
65
|
nbTerms,
|
|
66
66
|
};
|
|
67
|
-
return getQuestionFromIdentifiers(identifiers);
|
|
67
|
+
return getQuestionFromIdentifiers(identifiers, opts);
|
|
68
68
|
};
|
|
69
69
|
const getQuestionFromIdentifiers = (identifiers) => {
|
|
70
70
|
const question = {
|
|
@@ -93,14 +93,31 @@ const getPropositions = (n, { answer, firstValue, reason }) => {
|
|
|
93
93
|
const isAnswerValid = (ans, { answer }) => {
|
|
94
94
|
return ans === answer;
|
|
95
95
|
};
|
|
96
|
+
const options = [
|
|
97
|
+
{
|
|
98
|
+
id: "positiveReason",
|
|
99
|
+
label: "Utiliser des raisons positives",
|
|
100
|
+
target: GeneratorOptionTarget.generation,
|
|
101
|
+
type: GeneratorOptionType.checkbox,
|
|
102
|
+
defaultValue: false,
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
id: "firstRankOne",
|
|
106
|
+
label: "Toujours utiliser $u_1$ comme premier terme",
|
|
107
|
+
target: GeneratorOptionTarget.generation,
|
|
108
|
+
type: GeneratorOptionType.checkbox,
|
|
109
|
+
defaultValue: false,
|
|
110
|
+
},
|
|
111
|
+
];
|
|
96
112
|
export const geometricFirstTermsGeneralSum = {
|
|
97
113
|
id: "geometricFirstTermsGeneralSum",
|
|
98
114
|
connector: "=",
|
|
99
115
|
label: "Somme des termes d'une suite géométrique (cas général)",
|
|
100
116
|
isSingleStep: true,
|
|
101
|
-
generator: (nb) => getDistinctQuestions(getGeometricFirstTermsGeneralSumQuestion, nb),
|
|
117
|
+
generator: (nb, opts) => getDistinctQuestions(() => getGeometricFirstTermsGeneralSumQuestion(opts), nb),
|
|
102
118
|
qcmTimer: 60,
|
|
103
119
|
freeTimer: 60,
|
|
120
|
+
options,
|
|
104
121
|
getPropositions,
|
|
105
122
|
isAnswerValid,
|
|
106
123
|
subject: "Mathématiques",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometricReasonUsage.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/geometricReasonUsage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;
|
|
1
|
+
{"version":3,"file":"geometricReasonUsage.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/geometricReasonUsage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAUrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AA0GF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAYtD,CAAC"}
|
|
@@ -9,7 +9,9 @@ import { parseAlgebraic } from "../../../../tree/parsers/latexParser.js";
|
|
|
9
9
|
import { probaLawFlip } from "../../../../utils/alea/probaLawFlip.js";
|
|
10
10
|
const getInstruction = (identifiers) => {
|
|
11
11
|
const { reason, startRank, startValue, askedRank } = identifiers;
|
|
12
|
-
return `$(u_n)$ est une suite géométrique de raison $q = ${reason}$ et on sait que $u_{${startRank}} = ${startValue}$.
|
|
12
|
+
return `$(u_n)$ est une suite géométrique de raison $q = ${reason}$ et on sait que $u_{${startRank}} = ${startValue}$.
|
|
13
|
+
|
|
14
|
+
Calculer le terme $u_{${askedRank}}$.`;
|
|
13
15
|
};
|
|
14
16
|
const getAnswer = (identifiers) => {
|
|
15
17
|
const answer = getAnswerNode(identifiers).evaluate().frenchify();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometricRecurrenceFormulaUsage.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/geometricRecurrenceFormulaUsage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAKrC,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;
|
|
1
|
+
{"version":3,"file":"geometricRecurrenceFormulaUsage.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/geometricRecurrenceFormulaUsage.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAKrC,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAgFF,eAAO,MAAM,+BAA+B,EAAE,QAAQ,CAAC,WAAW,CAajE,CAAC"}
|
|
@@ -5,7 +5,15 @@ import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
|
5
5
|
const getInstruction = (identifiers) => {
|
|
6
6
|
const { firstRank, firstValue, reason } = identifiers;
|
|
7
7
|
const askedRank = firstRank + 1;
|
|
8
|
-
return `$(u_n)$ est une suite définie par
|
|
8
|
+
return `$(u_n)$ est une suite définie par :
|
|
9
|
+
|
|
10
|
+
$$
|
|
11
|
+
u_{n+1} = ${reason}\\times u_n
|
|
12
|
+
$$
|
|
13
|
+
|
|
14
|
+
et $u_{${firstRank}} = ${firstValue}$.
|
|
15
|
+
|
|
16
|
+
Calculer le terme $u_{${askedRank}}$.`;
|
|
9
17
|
};
|
|
10
18
|
const getAnswer = (identifiers) => {
|
|
11
19
|
const { firstValue, reason } = identifiers;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
export * from "./geometricExplicitFormulaUsage.js";
|
|
2
2
|
export * from "./geometricFindExplicitFormula.js";
|
|
3
|
+
export * from "./geometricFindExplicitFormulaFirstRankOne.js";
|
|
3
4
|
export * from "./geometricFindReason.js";
|
|
4
5
|
export * from "./geometricFirstTermsSum.js";
|
|
5
6
|
export * from "./geometricReasonUsage.js";
|
|
6
7
|
export * from "./geometricRecurrenceFormulaUsage.js";
|
|
7
8
|
export * from "./geometricFindExplicitFormulaFirstTermRandom.js";
|
|
8
9
|
export * from "./geometricFindTerm.js";
|
|
10
|
+
export * from "./geometricFindTermFirstRankOne.js";
|
|
9
11
|
export * from "./geometricRecognizeReasonFromFirstTerms.js";
|
|
10
12
|
export * from "./geometricFirstTermsGeneralSum.js";
|
|
11
13
|
export * from "./geometricVariations.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/index.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAC;AACnD,cAAc,mCAAmC,CAAC;AAClD,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sCAAsC,CAAC;AACrD,cAAc,kDAAkD,CAAC;AACjE,cAAc,wBAAwB,CAAC;AACvC,cAAc,6CAA6C,CAAC;AAC5D,cAAc,oCAAoC,CAAC;AACnD,cAAc,0BAA0B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/index.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAC;AACnD,cAAc,mCAAmC,CAAC;AAClD,cAAc,+CAA+C,CAAC;AAE9D,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sCAAsC,CAAC;AACrD,cAAc,kDAAkD,CAAC;AACjE,cAAc,wBAAwB,CAAC;AACvC,cAAc,oCAAoC,CAAC;AAEnD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,oCAAoC,CAAC;AACnD,cAAc,0BAA0B,CAAC"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
export * from "./geometricExplicitFormulaUsage.js";
|
|
2
2
|
export * from "./geometricFindExplicitFormula.js";
|
|
3
|
+
export * from "./geometricFindExplicitFormulaFirstRankOne.js";
|
|
3
4
|
export * from "./geometricFindReason.js";
|
|
4
5
|
export * from "./geometricFirstTermsSum.js";
|
|
5
6
|
export * from "./geometricReasonUsage.js";
|
|
6
7
|
export * from "./geometricRecurrenceFormulaUsage.js";
|
|
7
8
|
export * from "./geometricFindExplicitFormulaFirstTermRandom.js";
|
|
8
9
|
export * from "./geometricFindTerm.js";
|
|
10
|
+
export * from "./geometricFindTermFirstRankOne.js";
|
|
9
11
|
export * from "./geometricRecognizeReasonFromFirstTerms.js";
|
|
10
12
|
export * from "./geometricFirstTermsGeneralSum.js";
|
|
11
13
|
export * from "./geometricVariations.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recurrenceFormulaUsage.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/sequences/recurrenceFormulaUsage.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAKrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;
|
|
1
|
+
{"version":3,"file":"recurrenceFormulaUsage.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/sequences/recurrenceFormulaUsage.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAKrC,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAwEF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,WAAW,CAaxD,CAAC"}
|
|
@@ -5,9 +5,16 @@ import { randint } from "../../../math/utils/random/randint.js";
|
|
|
5
5
|
const getInstruction = (identifiers) => {
|
|
6
6
|
const { rank, u0, coeffs } = identifiers;
|
|
7
7
|
const u = new Polynomial(coeffs, "u_n");
|
|
8
|
-
return `Soit $u$ la suite définie par
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
return `Soit $u$ la suite définie par :
|
|
9
|
+
|
|
10
|
+
- $u_0 = ${u0}$,
|
|
11
|
+
|
|
12
|
+
- pour tout $n\\geq 0$ :
|
|
13
|
+
$$
|
|
14
|
+
u_{n+1} = ${u.toTree().toTex()}
|
|
15
|
+
$$
|
|
16
|
+
|
|
17
|
+
Calculer $u_${rank}$.`;
|
|
11
18
|
};
|
|
12
19
|
const getAnswer = (identifiers) => {
|
|
13
20
|
const { rank, u0, coeffs } = identifiers;
|
package/lib/index.d.ts
CHANGED
|
@@ -46,6 +46,9 @@ declare const mathExercises: (Exercise<{
|
|
|
46
46
|
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
47
47
|
a: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
48
48
|
b: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
49
|
+
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
50
|
+
a: number;
|
|
51
|
+
b: number;
|
|
49
52
|
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
50
53
|
integerFirst: boolean;
|
|
51
54
|
integer: number;
|
|
@@ -330,6 +333,11 @@ declare const mathExercises: (Exercise<{
|
|
|
330
333
|
point: import("./math/geometry/point.js").PointIdentifiers;
|
|
331
334
|
bounding: number;
|
|
332
335
|
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
336
|
+
isFractionToDigital: boolean;
|
|
337
|
+
nb: number;
|
|
338
|
+
}, {
|
|
339
|
+
conversionType: string;
|
|
340
|
+
}> | Exercise<{
|
|
333
341
|
choices: {
|
|
334
342
|
node: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
335
343
|
irrationalUsed: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers | null;
|
|
@@ -388,6 +396,12 @@ declare const mathExercises: (Exercise<{
|
|
|
388
396
|
a: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
389
397
|
b: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
390
398
|
isAdd: boolean;
|
|
399
|
+
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
400
|
+
type: number;
|
|
401
|
+
affine1: import("./math/polynomials/generalAffine.js").GeneralAffineIdentifiers;
|
|
402
|
+
affine2: import("./math/polynomials/generalAffine.js").GeneralAffineIdentifiers;
|
|
403
|
+
affine3: import("./math/polynomials/generalAffine.js").GeneralAffineIdentifiers;
|
|
404
|
+
affine4?: import("./math/polynomials/generalAffine.js").GeneralAffineIdentifiers;
|
|
391
405
|
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
392
406
|
randNbr: number;
|
|
393
407
|
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
@@ -825,6 +839,11 @@ declare const mathExercises: (Exercise<{
|
|
|
825
839
|
affineB: number;
|
|
826
840
|
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
827
841
|
a: number;
|
|
842
|
+
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
843
|
+
nodeUIds: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
844
|
+
nodeVIds: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
845
|
+
nodeUPrimeIds: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
846
|
+
nodeVPrimeIds: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
828
847
|
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
829
848
|
coeffs: number[];
|
|
830
849
|
x: number;
|
|
@@ -1197,7 +1216,9 @@ declare const mathExercises: (Exercise<{
|
|
|
1197
1216
|
a: number;
|
|
1198
1217
|
b: number;
|
|
1199
1218
|
c: number;
|
|
1200
|
-
},
|
|
1219
|
+
}, {
|
|
1220
|
+
withNoCoeffB: boolean;
|
|
1221
|
+
}> | Exercise<{
|
|
1201
1222
|
trinomIdentifiers: import("./tree/nodes/polynomials/trinomNode.js").TrinomNodeIdentifiers;
|
|
1202
1223
|
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
1203
1224
|
trinomCoeffs: number[];
|
|
@@ -1469,6 +1490,15 @@ declare const mathExercises: (Exercise<{
|
|
|
1469
1490
|
k: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
1470
1491
|
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
1471
1492
|
nodeIds: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers[];
|
|
1493
|
+
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
1494
|
+
isFindU: boolean;
|
|
1495
|
+
nodeIds: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers[];
|
|
1496
|
+
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
1497
|
+
uov: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
1498
|
+
items: {
|
|
1499
|
+
tex: string;
|
|
1500
|
+
isValid: boolean;
|
|
1501
|
+
}[];
|
|
1472
1502
|
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
1473
1503
|
coin: boolean;
|
|
1474
1504
|
radius: number;
|
|
@@ -1782,6 +1812,13 @@ declare const mathExercises: (Exercise<{
|
|
|
1782
1812
|
vCoords: number[];
|
|
1783
1813
|
wCoords: number[];
|
|
1784
1814
|
uCoords: number[];
|
|
1815
|
+
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
1816
|
+
points: import("./math/geometry/point.js").PointIdentifiers[];
|
|
1817
|
+
startPointIndex: number;
|
|
1818
|
+
firstVectorPointsIndexes: number[];
|
|
1819
|
+
secondVectorPointsIndexes: number[];
|
|
1820
|
+
a: number;
|
|
1821
|
+
b: number;
|
|
1785
1822
|
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
1786
1823
|
points: string[][];
|
|
1787
1824
|
pointAskedIndex: number[];
|
|
@@ -2170,7 +2207,9 @@ declare const mathExercises: (Exercise<{
|
|
|
2170
2207
|
l: number;
|
|
2171
2208
|
m: number;
|
|
2172
2209
|
n: number | undefined;
|
|
2173
|
-
},
|
|
2210
|
+
}, {
|
|
2211
|
+
useSameInteger: boolean;
|
|
2212
|
+
}> | Exercise<{
|
|
2174
2213
|
a: number;
|
|
2175
2214
|
b: number;
|
|
2176
2215
|
c: number;
|
|
@@ -2492,6 +2531,9 @@ declare const mathExercises: (Exercise<{
|
|
|
2492
2531
|
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
2493
2532
|
firstValue: number;
|
|
2494
2533
|
reason: number;
|
|
2534
|
+
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
2535
|
+
firstValue: number;
|
|
2536
|
+
reason: number;
|
|
2495
2537
|
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
2496
2538
|
rank1: number;
|
|
2497
2539
|
reason: number;
|
|
@@ -2547,6 +2589,10 @@ declare const mathExercises: (Exercise<{
|
|
|
2547
2589
|
firstTerm: number;
|
|
2548
2590
|
reason: number;
|
|
2549
2591
|
askedRank: number;
|
|
2592
|
+
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
2593
|
+
firstTerm: number;
|
|
2594
|
+
reason: number;
|
|
2595
|
+
askedRank: number;
|
|
2550
2596
|
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
2551
2597
|
a: number;
|
|
2552
2598
|
b: number;
|
|
@@ -2558,6 +2604,9 @@ declare const mathExercises: (Exercise<{
|
|
|
2558
2604
|
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
2559
2605
|
reason: number;
|
|
2560
2606
|
firstValue: number;
|
|
2607
|
+
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
2608
|
+
reason: number;
|
|
2609
|
+
firstValue: number;
|
|
2561
2610
|
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
2562
2611
|
value1: number;
|
|
2563
2612
|
reason: number;
|
|
@@ -2583,6 +2632,10 @@ declare const mathExercises: (Exercise<{
|
|
|
2583
2632
|
firstTerm: number;
|
|
2584
2633
|
reason: number;
|
|
2585
2634
|
askedRank: number;
|
|
2635
|
+
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
2636
|
+
firstTerm: number;
|
|
2637
|
+
reason: number;
|
|
2638
|
+
askedRank: number;
|
|
2586
2639
|
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
2587
2640
|
sequence: number[];
|
|
2588
2641
|
reason: number;
|
|
@@ -2591,7 +2644,10 @@ declare const mathExercises: (Exercise<{
|
|
|
2591
2644
|
firstValue: number;
|
|
2592
2645
|
reason: number;
|
|
2593
2646
|
nbTerms: number;
|
|
2594
|
-
},
|
|
2647
|
+
}, {
|
|
2648
|
+
positiveReason: boolean;
|
|
2649
|
+
firstRankOne: boolean;
|
|
2650
|
+
}> | Exercise<{
|
|
2595
2651
|
q: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
2596
2652
|
a: number;
|
|
2597
2653
|
}, Record<string, string | boolean | string[]>> | Exercise<{
|
package/lib/index.d.ts.map
CHANGED
|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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kDAA6B,CAAC;AAE/C,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isCoprime.d.ts","sourceRoot":"","sources":["../../../../src/math/utils/arithmetic/isCoprime.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS,GAAI,GAAG,MAAM,EAAE,GAAG,MAAM,YAY7C,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { primeDecomposition } from "./primeDecomposition.js";
|
|
2
|
+
export const isCoprime = (a, b) => {
|
|
3
|
+
const [dictDecompA, dictDecompB] = [a, b].map((n) => {
|
|
4
|
+
const arrDecomp = primeDecomposition(n);
|
|
5
|
+
const dictDecomp = Object.fromEntries(arrDecomp.map(({ value, power }) => [value, power]));
|
|
6
|
+
return dictDecomp;
|
|
7
|
+
});
|
|
8
|
+
const isCoprime = Object.keys(dictDecompA).every((value) => dictDecompB[value] === undefined);
|
|
9
|
+
return isCoprime;
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"primeDecompNode.d.ts","sourceRoot":"","sources":["../../../../src/math/utils/arithmetic/primeDecompNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAMlE,eAAO,MAAM,eAAe,GAAI,IAAI,MAAM,EAAE,WAAU,OAAc,KAef,aACpD,CAAC"}
|