math-exercises 3.0.177 → 3.0.178
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/derivation/variations/readExtremaAbscissFromDerivativeCurve.js +1 -1
- package/lib/exercises/math/functions/trinoms/sign/index.d.ts +1 -0
- package/lib/exercises/math/functions/trinoms/sign/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/sign/index.js +1 -0
- package/lib/exercises/math/functions/trinoms/sign/signOfProductOfAffineAndTrinom.d.ts +8 -0
- package/lib/exercises/math/functions/trinoms/sign/signOfProductOfAffineAndTrinom.d.ts.map +1 -0
- package/lib/exercises/math/functions/trinoms/sign/signOfProductOfAffineAndTrinom.js +233 -0
- package/lib/exercises/math/geometry/angles/parallelogramFourthAngle.d.ts.map +1 -1
- package/lib/exercises/math/geometry/angles/parallelogramFourthAngle.js +10 -10
- package/lib/exercises/math/geometry/quadrilaterals/parallelogramAngles.js +8 -8
- package/lib/exercises/math/geometry/triangles/similar/isSimilarTrianglesWithAngles.js +6 -6
- package/lib/exercises/math/geometry/triangles/triangleThirdAngleValue.js +8 -8
- package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiAngle.js +1 -1
- package/lib/exercises/math/geometry/vectors/scalarProduct/alKashi/scalarProductAlKashiSideLength.js +2 -2
- package/lib/exercises/math/geometry/vectors/scalarProduct/angleFromScalarProduct.js +2 -2
- package/lib/exercises/math/probaStat/randomVariable/index.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/randomVariable/index.js +1 -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/sequences/pySequenceThresholdInstructionCompletion.d.ts.map +1 -1
- package/lib/exercises/math/python/sequences/pySequenceThresholdInstructionCompletion.js +11 -8
- package/lib/exercises/math/sequences/arithmetic/arithmeticFindExplicitFormulaFromTwoTerms.d.ts.map +1 -1
- package/lib/exercises/math/sequences/arithmetic/arithmeticFindExplicitFormulaFromTwoTerms.js +4 -3
- package/lib/exercises/math/sequences/arithmetic/index.d.ts +4 -3
- package/lib/exercises/math/sequences/arithmetic/index.d.ts.map +1 -1
- package/lib/exercises/math/sequences/arithmetic/index.js +4 -3
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindExplicitFormulaFromSituation.d.ts.map +1 -1
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindExplicitFormulaFromSituation.js +3 -2
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRankFromSituation.d.ts.map +1 -1
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRankFromSituation.js +8 -6
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindThresholdFromSituation.d.ts.map +1 -1
- package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindThresholdFromSituation.js +6 -5
- package/lib/exercises/math/sequences/arithmetic/situations/index.d.ts +0 -2
- package/lib/exercises/math/sequences/arithmetic/situations/index.d.ts.map +1 -1
- package/lib/exercises/math/sequences/arithmetic/situations/index.js +2 -2
- package/lib/exercises/math/sequences/arithmetic/sum/arithmeticComputeSumWithDots.d.ts +1 -0
- package/lib/exercises/math/sequences/arithmetic/sum/arithmeticComputeSumWithDots.d.ts.map +1 -1
- package/lib/exercises/math/sequences/arithmetic/sum/arithmeticComputeSumWithDots.js +65 -14
- package/lib/exercises/math/sequences/arithmetic/sum/index.d.ts +0 -1
- package/lib/exercises/math/sequences/arithmetic/sum/index.d.ts.map +1 -1
- package/lib/exercises/math/sequences/arithmetic/sum/index.js +1 -1
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoConsecutiveTerms.d.ts +14 -0
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoConsecutiveTerms.d.ts.map +1 -0
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoConsecutiveTerms.js +291 -0
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoTerms.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoTerms.js +4 -3
- package/lib/exercises/math/sequences/geometric/geometricFindRandomTermFromTwoConsecutiveTerms.d.ts +15 -0
- package/lib/exercises/math/sequences/geometric/geometricFindRandomTermFromTwoConsecutiveTerms.d.ts.map +1 -0
- package/lib/exercises/math/sequences/geometric/geometricFindRandomTermFromTwoConsecutiveTerms.js +249 -0
- package/lib/exercises/math/sequences/geometric/geometricFindRandomTermFromTwoTerms.js +1 -1
- package/lib/exercises/math/sequences/geometric/index.d.ts +6 -2
- package/lib/exercises/math/sequences/geometric/index.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/index.js +6 -2
- package/lib/exercises/math/sequences/geometric/situations/geometricFindExplicitFormulaFromSituation.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/situations/geometricFindExplicitFormulaFromSituation.js +3 -2
- package/lib/exercises/math/sequences/geometric/situations/geometricFindTermFromSituation.js +1 -1
- package/lib/exercises/math/sequences/geometric/sum/geometricComputeSumWithDots.js +2 -2
- package/lib/exercises/math/sequences/graph/placeFirstSequencePoints.js +2 -2
- package/lib/exercises/math/sequences/index.d.ts +1 -0
- package/lib/exercises/math/sequences/index.d.ts.map +1 -1
- package/lib/exercises/math/sequences/index.js +1 -0
- package/lib/exercises/math/sequences/seqArithmGeom/seqArithmGeomRecurrenceFormulaUsage.d.ts.map +1 -1
- package/lib/exercises/math/sequences/seqArithmGeom/seqArithmGeomRecurrenceFormulaUsage.js +5 -9
- package/lib/exercises/math/spaceGeometry/sphere/sphereLatLonReading.2d.js +1 -1
- package/lib/exercises/math/trigonometry/triangle/trigonometryAngleCalcul.js +2 -2
- package/lib/exercises/pc/snellDescartes.js +2 -2
- package/lib/index.d.ts +152 -21
- package/lib/index.d.ts.map +1 -1
- package/lib/latexTester.d.ts.map +1 -1
- package/lib/latexTester.js +8 -5
- package/lib/math/polynomials/affine.d.ts +1 -0
- package/lib/math/polynomials/affine.d.ts.map +1 -1
- package/lib/math/polynomials/affine.js +5 -0
- package/lib/math/utils/arithmetic/primeFactors.js +1 -1
- package/lib/math/utils/functions/functionComposition.d.ts.map +1 -1
- package/lib/math/utils/functions/functionComposition.js +18 -1
- package/lib/math/utils/sequences/situations/seqArithmeticSituations.d.ts +18 -4
- package/lib/math/utils/sequences/situations/seqArithmeticSituations.d.ts.map +1 -1
- package/lib/math/utils/sequences/situations/seqArithmeticSituations.js +437 -336
- package/lib/math/utils/sequences/situations/seqArithmeticUtils.d.ts.map +1 -1
- package/lib/math/utils/sequences/situations/seqArithmeticUtils.js +3 -1
- package/lib/math/utils/sequences/situations/seqGeometricSituations.d.ts +5 -0
- package/lib/math/utils/sequences/situations/seqGeometricSituations.d.ts.map +1 -1
- package/lib/math/utils/sequences/situations/seqGeometricSituations.js +58 -25
- package/lib/prototypesEnhancement.d.ts +1 -0
- package/lib/prototypesEnhancement.d.ts.map +1 -1
- package/lib/prototypesEnhancement.js +3 -0
- package/lib/tests/pdfs/mdCodeToLatex.d.ts.map +1 -1
- package/lib/tests/pdfs/mdCodeToLatex.js +8 -15
- package/lib/tests/questionTest.d.ts.map +1 -1
- package/lib/tests/questionTest.js +6 -3
- package/lib/tree/nodes/geometry/degree.js +1 -1
- package/lib/tree/parsers/degreeParser.js +2 -2
- package/package.json +1 -1
|
@@ -5,17 +5,18 @@ export * from "./arithmeticFindReason.js";
|
|
|
5
5
|
export * from "./arithmeticReasonUsage.js";
|
|
6
6
|
export * from "./arithmeticRecurrenceFormulaUsage.js";
|
|
7
7
|
export * from "./arithmeticThresholdFind.js";
|
|
8
|
-
export * from "./firstIntegersSum.js";
|
|
9
8
|
export * from "./recognizeArithmeticFromFirstTerms.js";
|
|
10
9
|
export * from "./recognizeReasonFromFirstTerms.js";
|
|
11
10
|
export * from "./recognizeReasonFromGraph.js";
|
|
12
11
|
export * from "./recognizeArithmeticFromGraph.js";
|
|
13
|
-
export * from "./arithmeticFirstTermsSum.js";
|
|
14
12
|
export * from "./arithmeticFindExplicitFormulaFirstTermRandom.js";
|
|
15
13
|
export * from "./arithmeticFindReasonRandomRange.js";
|
|
16
|
-
export * from "./arithmeticFindRandomTermFromTwoTerms.js";
|
|
17
14
|
export * from "./arithmeticFindTerm.js";
|
|
18
15
|
export * from "./arithmeticFindTermFirstRankOne.js";
|
|
19
16
|
export * from "./arithmeticFindAntecedent.js";
|
|
17
|
+
export * from "./arithmeticFindRandomTermFromTwoTerms.js";
|
|
18
|
+
export * from "./arithmeticFindExplicitFormulaFromTwoTerms.js";
|
|
19
|
+
export * from "./situations/index.js";
|
|
20
|
+
export * from "./sum/index.js";
|
|
20
21
|
export * from "./arithmeticVariations.js";
|
|
21
22
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/arithmetic/index.ts"],"names":[],"mappings":"AAAA,cAAc,qCAAqC,CAAC;AAEpD,cAAc,oCAAoC,CAAC;AACnD,cAAc,gDAAgD,CAAC;AAE/D,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uCAAuC,CAAC;AACtD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/arithmetic/index.ts"],"names":[],"mappings":"AAAA,cAAc,qCAAqC,CAAC;AAEpD,cAAc,oCAAoC,CAAC;AACnD,cAAc,gDAAgD,CAAC;AAE/D,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uCAAuC,CAAC;AACtD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wCAAwC,CAAC;AACvD,cAAc,oCAAoC,CAAC;AACnD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,mCAAmC,CAAC;AAClD,cAAc,mDAAmD,CAAC;AAClE,cAAc,sCAAsC,CAAC;AACrD,cAAc,yBAAyB,CAAC;AACxC,cAAc,qCAAqC,CAAC;AACpD,cAAc,+BAA+B,CAAC;AAE9C,cAAc,2CAA2C,CAAC;AAC1D,cAAc,gDAAgD,CAAC;AAE/D,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,2BAA2B,CAAC"}
|
|
@@ -5,16 +5,17 @@ export * from "./arithmeticFindReason.js";
|
|
|
5
5
|
export * from "./arithmeticReasonUsage.js";
|
|
6
6
|
export * from "./arithmeticRecurrenceFormulaUsage.js";
|
|
7
7
|
export * from "./arithmeticThresholdFind.js";
|
|
8
|
-
export * from "./firstIntegersSum.js";
|
|
9
8
|
export * from "./recognizeArithmeticFromFirstTerms.js";
|
|
10
9
|
export * from "./recognizeReasonFromFirstTerms.js";
|
|
11
10
|
export * from "./recognizeReasonFromGraph.js";
|
|
12
11
|
export * from "./recognizeArithmeticFromGraph.js";
|
|
13
|
-
export * from "./arithmeticFirstTermsSum.js";
|
|
14
12
|
export * from "./arithmeticFindExplicitFormulaFirstTermRandom.js";
|
|
15
13
|
export * from "./arithmeticFindReasonRandomRange.js";
|
|
16
|
-
export * from "./arithmeticFindRandomTermFromTwoTerms.js";
|
|
17
14
|
export * from "./arithmeticFindTerm.js";
|
|
18
15
|
export * from "./arithmeticFindTermFirstRankOne.js";
|
|
19
16
|
export * from "./arithmeticFindAntecedent.js";
|
|
17
|
+
export * from "./arithmeticFindRandomTermFromTwoTerms.js";
|
|
18
|
+
export * from "./arithmeticFindExplicitFormulaFromTwoTerms.js";
|
|
19
|
+
export * from "./situations/index.js";
|
|
20
|
+
export * from "./sum/index.js";
|
|
20
21
|
export * from "./arithmeticVariations.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arithmeticFindExplicitFormulaFromSituation.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/sequences/arithmetic/situations/arithmeticFindExplicitFormulaFromSituation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,sBAAsB,EACvB,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAEL,2BAA2B,EAC5B,MAAM,wDAAwD,CAAC;AAGhE,OAAO,EAEL,kCAAkC,EAEnC,MAAM,kEAAkE,CAAC;AAgB1E,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,kCAAkC,CAAC;CACtD,CAAC;
|
|
1
|
+
{"version":3,"file":"arithmeticFindExplicitFormulaFromSituation.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/sequences/arithmetic/situations/arithmeticFindExplicitFormulaFromSituation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,sBAAsB,EACvB,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAEL,2BAA2B,EAC5B,MAAM,wDAAwD,CAAC;AAGhE,OAAO,EAEL,kCAAkC,EAEnC,MAAM,kEAAkE,CAAC;AAgB1E,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,kCAAkC,CAAC;CACtD,CAAC;AAkNF,KAAK,OAAO,GAAG,sBAAsB,GAAG,2BAA2B,CAAC;AAcpE,eAAO,MAAM,0CAA0C,EAAE,QAAQ,CAC/D,WAAW,EACX,OAAO,CAoBR,CAAC"}
|
|
@@ -68,8 +68,10 @@ const getPropositions = (n, { answer, ...identifiers }, optsIn) => {
|
|
|
68
68
|
const isAnswerValid = (ans, { answer, ...identifiers }, optsIn) => {
|
|
69
69
|
const opts = optsIn ?? optsDefault;
|
|
70
70
|
try {
|
|
71
|
+
const nodeAnswer = getAnswerNode(identifiers, opts);
|
|
71
72
|
if (!ans.includes("=")) {
|
|
72
|
-
return false;
|
|
73
|
+
// return false;
|
|
74
|
+
ans = nodeAnswer.leftChild.toTex() + "=" + ans;
|
|
73
75
|
}
|
|
74
76
|
//TODO faire fonctionner parseAlgebraic("u_n=3+2n") (token _ not implemented)
|
|
75
77
|
// const nodeAns = parseAlgebraic(ans);
|
|
@@ -82,7 +84,6 @@ const isAnswerValid = (ans, { answer, ...identifiers }, optsIn) => {
|
|
|
82
84
|
if (!isEqualNode(nodeAns)) {
|
|
83
85
|
return false;
|
|
84
86
|
}
|
|
85
|
-
const nodeAnswer = getAnswerNode(identifiers, opts);
|
|
86
87
|
const isValidLhs = () => nodeAns.leftChild.toTex() === nodeAnswer.leftChild.toTex();
|
|
87
88
|
const isValidRhs = () => {
|
|
88
89
|
const nodeAnsRhs = nodeAns.rightChild;
|
package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRankFromSituation.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arithmeticFindRankFromSituation.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/sequences/arithmetic/situations/arithmeticFindRankFromSituation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,sBAAsB,EACvB,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAEL,2BAA2B,EAC5B,MAAM,wDAAwD,CAAC;AAKhE,OAAO,EAEL,kCAAkC,EAEnC,MAAM,kEAAkE,CAAC;
|
|
1
|
+
{"version":3,"file":"arithmeticFindRankFromSituation.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/sequences/arithmetic/situations/arithmeticFindRankFromSituation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,sBAAsB,EACvB,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAEL,2BAA2B,EAC5B,MAAM,wDAAwD,CAAC;AAKhE,OAAO,EAEL,kCAAkC,EAEnC,MAAM,kEAAkE,CAAC;AAM1E,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,kCAAkC,CAAC;IACrD,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAsOF,KAAK,OAAO,GAAG,sBAAsB,GAAG,2BAA2B,CAAC;AAcpE,eAAO,MAAM,+BAA+B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAmB1E,CAAC"}
|
package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindRankFromSituation.js
CHANGED
|
@@ -17,13 +17,14 @@ const getInstruction = (identifiers, optsIn) => {
|
|
|
17
17
|
const situation = situations[situationIndex];
|
|
18
18
|
return `${situation.getStrSituation(initial, reason, firstRank, superfluousData)}
|
|
19
19
|
|
|
20
|
-
${situation.variationFindRank.getStrQuestion(initial, reason, firstRank, valueAsked)}`;
|
|
20
|
+
${situation.variationFindRank.getStrQuestion(initial, reason, firstRank, valueAsked, situation.rankDecoder)}`;
|
|
21
21
|
};
|
|
22
22
|
const getAnswerNode = (identifiers, opts) => {
|
|
23
23
|
const firstRank = opts?.firstTermRankOne ? 1 : 0;
|
|
24
24
|
const { situationIndex, initial, reason, valueAsked } = identifiers;
|
|
25
25
|
const situation = situations[situationIndex];
|
|
26
|
-
|
|
26
|
+
const rankDecoder = situation.rankDecoder;
|
|
27
|
+
return situation.variationFindRank.getAnswerStuff(initial, reason, firstRank, valueAsked, rankDecoder).answerNode;
|
|
27
28
|
};
|
|
28
29
|
const getAnswer = (identifiers, optsIn) => {
|
|
29
30
|
const opts = optsIn ?? optsDefault;
|
|
@@ -41,7 +42,7 @@ const getCorrection = (identifiers, optsIn) => {
|
|
|
41
42
|
const firstRank = opts?.firstTermRankOne ? 1 : 0;
|
|
42
43
|
const { situationIndex, initial, reason, valueAsked } = identifiers;
|
|
43
44
|
const situation = situations[situationIndex];
|
|
44
|
-
return situation.variationFindRank.getCorrectionStuff(initial, reason, firstRank, valueAsked).str;
|
|
45
|
+
return situation.variationFindRank.getCorrectionStuff(initial, reason, firstRank, valueAsked, situation.rankDecoder).str;
|
|
45
46
|
};
|
|
46
47
|
const getPropositions = (n, { answer, ...identifiers }, optsIn) => {
|
|
47
48
|
const opts = optsIn ?? optsDefault;
|
|
@@ -57,9 +58,10 @@ const getPropositions = (n, { answer, ...identifiers }, optsIn) => {
|
|
|
57
58
|
tryToAddWrongProp(propositions, nodeWrong.simplify().toTex());
|
|
58
59
|
arrNodeWrong.push(nodeWrong);
|
|
59
60
|
}
|
|
60
|
-
const rankValid =
|
|
61
|
-
.
|
|
62
|
-
.evaluate(), 0);
|
|
61
|
+
const rankValid = (() => {
|
|
62
|
+
const { rankNode } = situation.variationFindRank.getAnswerStuff(initial, reason, firstRank, valueAsked);
|
|
63
|
+
return round(rankNode.evaluate(), 0);
|
|
64
|
+
})();
|
|
63
65
|
//pseudo terror
|
|
64
66
|
if (coinFlip()) {
|
|
65
67
|
if (coinFlip()) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arithmeticFindThresholdFromSituation.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/sequences/arithmetic/situations/arithmeticFindThresholdFromSituation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,sBAAsB,EACvB,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAEL,2BAA2B,EAC5B,MAAM,wDAAwD,CAAC;AAGhE,OAAO,EACL,gBAAgB,EAGjB,MAAM,sCAAsC,CAAC;AAG9C,OAAO,EAEL,kCAAkC,EAEnC,MAAM,kEAAkE,CAAC;
|
|
1
|
+
{"version":3,"file":"arithmeticFindThresholdFromSituation.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/sequences/arithmetic/situations/arithmeticFindThresholdFromSituation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,sBAAsB,EACvB,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAEL,2BAA2B,EAC5B,MAAM,wDAAwD,CAAC;AAGhE,OAAO,EACL,gBAAgB,EAGjB,MAAM,sCAAsC,CAAC;AAG9C,OAAO,EAEL,kCAAkC,EAEnC,MAAM,kEAAkE,CAAC;AAM1E,KAAK,WAAW,GAAG;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,kCAAkC,CAAC;IACrD,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,gBAAgB,CAAC;CAC9B,CAAC;AA0PF,KAAK,OAAO,GAAG,sBAAsB,GAAG,2BAA2B,CAAC;AAcpE,eAAO,MAAM,oCAAoC,EAAE,QAAQ,CACzD,WAAW,EACX,OAAO,CAoBR,CAAC"}
|
package/lib/exercises/math/sequences/arithmetic/situations/arithmeticFindThresholdFromSituation.js
CHANGED
|
@@ -26,7 +26,7 @@ const getAnswerNode = (identifiers, opts) => {
|
|
|
26
26
|
const { situationIndex, initial, reason, valueThreshold, inegSymbol } = identifiers;
|
|
27
27
|
const situation = situations[situationIndex];
|
|
28
28
|
const inequationSymbol = new InequationSymbol(inegSymbol);
|
|
29
|
-
return situation.variationFindThreshold.
|
|
29
|
+
return situation.variationFindThreshold.getAnswerStuff(initial, reason, firstRank, valueThreshold, inequationSymbol, situation.rankDecoder).answerNode;
|
|
30
30
|
};
|
|
31
31
|
const getAnswer = (identifiers, optsIn) => {
|
|
32
32
|
const opts = optsIn ?? optsDefault;
|
|
@@ -46,7 +46,7 @@ const getCorrection = (identifiers, optsIn) => {
|
|
|
46
46
|
const { situationIndex, initial, reason, valueThreshold, inegSymbol } = identifiers;
|
|
47
47
|
const situation = situations[situationIndex];
|
|
48
48
|
const inequationSymbol = new InequationSymbol(inegSymbol);
|
|
49
|
-
return situation.variationFindThreshold.getCorrectionStuff(initial, reason, firstRank, valueThreshold, inequationSymbol).str;
|
|
49
|
+
return situation.variationFindThreshold.getCorrectionStuff(initial, reason, firstRank, valueThreshold, inequationSymbol, situation.rankDecoder).str;
|
|
50
50
|
};
|
|
51
51
|
const getPropositions = (n, { answer, ...identifiers }, optsIn) => {
|
|
52
52
|
const opts = optsIn ?? optsDefault;
|
|
@@ -57,9 +57,10 @@ const getPropositions = (n, { answer, ...identifiers }, optsIn) => {
|
|
|
57
57
|
const propositions = [];
|
|
58
58
|
addValidProp(propositions, answer);
|
|
59
59
|
const arrNodeWrong = [];
|
|
60
|
-
const rankValid =
|
|
61
|
-
.
|
|
62
|
-
.evaluate(), 0);
|
|
60
|
+
const rankValid = (() => {
|
|
61
|
+
const { rankNode } = situation.variationFindRank.getAnswerStuff(initial, reason, firstRank, valueThreshold, inequationSymbol);
|
|
62
|
+
return round(rankNode.evaluate(), 0);
|
|
63
|
+
})();
|
|
63
64
|
//student: gives u[threshold] instead of threshold
|
|
64
65
|
{
|
|
65
66
|
const nodeWrong = situation.variationFindRandomTerm.getAnswerNode(initial, reason, firstRank, rankValid);
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
export * from "./arithmeticFindExplicitFormulaFromSituation.js";
|
|
2
2
|
export * from "./arithmeticFindRecurrenceFormulaFromSituation.js";
|
|
3
3
|
export * from "./arithmeticFindTermFromSituation.js";
|
|
4
|
-
export * from "./arithmeticFindRankFromSituation.js";
|
|
5
|
-
export * from "./arithmeticFindThresholdFromSituation.js";
|
|
6
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/sequences/arithmetic/situations/index.ts"],"names":[],"mappings":"AAAA,cAAc,iDAAiD,CAAC;AAChE,cAAc,mDAAmD,CAAC;AAClE,cAAc,sCAAsC,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/sequences/arithmetic/situations/index.ts"],"names":[],"mappings":"AAAA,cAAc,iDAAiD,CAAC;AAChE,cAAc,mDAAmD,CAAC;AAClE,cAAc,sCAAsC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from "./arithmeticFindExplicitFormulaFromSituation.js";
|
|
2
2
|
export * from "./arithmeticFindRecurrenceFormulaFromSituation.js";
|
|
3
3
|
export * from "./arithmeticFindTermFromSituation.js";
|
|
4
|
-
export * from "./arithmeticFindRankFromSituation.js";
|
|
5
|
-
export * from "./arithmeticFindThresholdFromSituation.js";
|
|
4
|
+
// export * from "./arithmeticFindRankFromSituation.js";
|
|
5
|
+
// export * from "./arithmeticFindThresholdFromSituation.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arithmeticComputeSumWithDots.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/sequences/arithmetic/sum/arithmeticComputeSumWithDots.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,sBAAsB,EACvB,MAAM,mDAAmD,CAAC;
|
|
1
|
+
{"version":3,"file":"arithmeticComputeSumWithDots.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/sequences/arithmetic/sum/arithmeticComputeSumWithDots.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,sBAAsB,EACvB,MAAM,mDAAmD,CAAC;AA0H3D,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAiOF,KAAK,OAAO,GAAG,sBAAsB,GAAG;IACtC,WAAW,EAAE,OAAO,CAAC;IACrB,6BAA6B,EAAE,OAAO,CAAC;CACxC,CAAC;AAyBF,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAkBvE,CAAC"}
|
|
@@ -8,30 +8,69 @@ import { frac } from "../../../../../tree/nodes/operators/fractionNode.js";
|
|
|
8
8
|
import { multiply } from "../../../../../tree/nodes/operators/multiplyNode.js";
|
|
9
9
|
import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
|
|
10
10
|
import { alignTex } from "../../../../../utils/latex/alignTex.js";
|
|
11
|
-
const strForValue = (v) => {
|
|
12
|
-
return v < 0 ? `(${v.frenchify()})` : `${v.frenchify()}`;
|
|
13
|
-
};
|
|
14
11
|
const valueForRank = (initial, reason, rank) => {
|
|
15
12
|
return initial + reason * rank;
|
|
16
13
|
};
|
|
17
|
-
const strSumWithDots = (initial, reason, firstRank, lowRankDots, highRankDots, lastRank) => {
|
|
14
|
+
const strSumWithDots = (initial, reason, firstRank, lowRankDots, highRankDots, lastRank, isForcePlusSymbol) => {
|
|
18
15
|
const arrRankStart = [...Array(lowRankDots - firstRank).keys()].map((i) => i + firstRank);
|
|
19
16
|
const arrRankEnd = [...Array(lastRank - highRankDots).keys()].map((i) => i + highRankDots + 1);
|
|
20
|
-
const [arrValueStart, arrValueEnd] = [arrRankStart, arrRankEnd].map((arrRank) => arrRank.map((rank) => strForValue(valueForRank(initial, reason, rank))));
|
|
21
|
-
const [strStart, strEnd] = [arrValueStart, arrValueEnd].map((arrValue) => arrValue.join(" + "));
|
|
22
|
-
const strFlat = [strStart, strEnd].join(` + \\ldots + `);
|
|
23
17
|
const maxStrLength = 40;
|
|
24
|
-
if (
|
|
25
|
-
|
|
18
|
+
if (isForcePlusSymbol) {
|
|
19
|
+
const strForValue = (v) => {
|
|
20
|
+
return v < 0 ? `(${v.frenchify()})` : `${v.frenchify()}`;
|
|
21
|
+
};
|
|
22
|
+
const [arrStrValueStart, arrStrValueEnd] = [arrRankStart, arrRankEnd].map((arrRank) => arrRank.map((rank) => strForValue(valueForRank(initial, reason, rank))));
|
|
23
|
+
const [strStart, strEnd] = [arrStrValueStart, arrStrValueEnd].map((arrValue) => arrValue.join(" + "));
|
|
24
|
+
const strFlat = [strStart, strEnd].join(` + \\ldots + `);
|
|
25
|
+
if (strFlat.length < maxStrLength) {
|
|
26
|
+
return `
|
|
26
27
|
|
|
27
28
|
$$
|
|
28
29
|
${strFlat}
|
|
29
30
|
$$
|
|
30
31
|
|
|
31
32
|
`;
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
return `
|
|
36
|
+
|
|
37
|
+
$$
|
|
38
|
+
${strStart}
|
|
39
|
+
$$
|
|
40
|
+
|
|
41
|
+
$$
|
|
42
|
+
+ \\ldots
|
|
43
|
+
$$
|
|
44
|
+
|
|
45
|
+
$$
|
|
46
|
+
+ \\ ${strEnd}
|
|
47
|
+
$$
|
|
48
|
+
|
|
49
|
+
`;
|
|
50
|
+
}
|
|
32
51
|
}
|
|
33
52
|
else {
|
|
34
|
-
|
|
53
|
+
const strForValue = (v, isForceShowSymbol) => {
|
|
54
|
+
return isForceShowSymbol
|
|
55
|
+
? v >= 0
|
|
56
|
+
? `+ ${v.frenchify()}`
|
|
57
|
+
: `${v.frenchify()}`
|
|
58
|
+
: v;
|
|
59
|
+
};
|
|
60
|
+
const [arrStrValueStart, arrStrValueEnd] = [arrRankStart, arrRankEnd].map((arrRank, j) => arrRank.map((rank, i) => strForValue(valueForRank(initial, reason, rank), i !== 0 || j === 1)));
|
|
61
|
+
const [strStart, strEnd] = [arrStrValueStart, arrStrValueEnd].map((arrValue) => arrValue.join(" "));
|
|
62
|
+
const strFlat = [strStart, strEnd].join(` + \\ldots `);
|
|
63
|
+
if (strFlat.length < maxStrLength) {
|
|
64
|
+
return `
|
|
65
|
+
|
|
66
|
+
$$
|
|
67
|
+
${strFlat}
|
|
68
|
+
$$
|
|
69
|
+
|
|
70
|
+
`;
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
return `
|
|
35
74
|
|
|
36
75
|
$$
|
|
37
76
|
${strStart}
|
|
@@ -42,15 +81,16 @@ $$
|
|
|
42
81
|
$$
|
|
43
82
|
|
|
44
83
|
$$
|
|
45
|
-
|
|
84
|
+
${strEnd}
|
|
46
85
|
$$
|
|
47
86
|
|
|
48
87
|
`;
|
|
88
|
+
}
|
|
49
89
|
}
|
|
50
90
|
};
|
|
51
91
|
const getInstruction = (identifiers, optsIn) => {
|
|
52
92
|
const opts = optsIn ?? optsDefault;
|
|
53
|
-
const { isGiveCount } = opts;
|
|
93
|
+
const { isGiveCount, isForceWriteSumWithPlusSymbol } = opts;
|
|
54
94
|
const firstRank = opts.firstTermRankOne ? 1 : 0;
|
|
55
95
|
const { initial, reason, nbTerms, lowRankDots, highRankDots } = identifiers;
|
|
56
96
|
const lastRank = firstRank + nbTerms - 1;
|
|
@@ -60,7 +100,7 @@ Calculer la somme des premiers termes de $u$ ${isGiveCount
|
|
|
60
100
|
? `(la somme contient en tout $${nbTerms.frenchify()}$ termes)`
|
|
61
101
|
: ""}:
|
|
62
102
|
|
|
63
|
-
${strSumWithDots(initial, reason, firstRank, lowRankDots, highRankDots, lastRank)}
|
|
103
|
+
${strSumWithDots(initial, reason, firstRank, lowRankDots, highRankDots, lastRank, isForceWriteSumWithPlusSymbol)}
|
|
64
104
|
|
|
65
105
|
`;
|
|
66
106
|
};
|
|
@@ -97,6 +137,9 @@ const getCorrection = (identifiers, optsIn) => {
|
|
|
97
137
|
const lastRank = firstRank + nbTerms - 1;
|
|
98
138
|
const lastValue = valueForRank(initial, reason, lastRank);
|
|
99
139
|
const answerNode = getAnswerNode(identifiers, opts);
|
|
140
|
+
const strForValue = (v) => {
|
|
141
|
+
return v < 0 ? `(${v.frenchify()})` : `${v.frenchify()}`;
|
|
142
|
+
};
|
|
100
143
|
return `La somme $S$ des $n$ premiers termes d'une suite arithmétique s'obtient par la formule :
|
|
101
144
|
|
|
102
145
|
$$
|
|
@@ -205,16 +248,24 @@ const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
|
205
248
|
const { optsDefaultFirstTermRankOne, generatorOptionFirstTermRankOne } = getOptionFirstTermRankOneStuff(false);
|
|
206
249
|
const optsDefault = Object.assign({}, optsDefaultFirstTermRankOne, {
|
|
207
250
|
isGiveCount: true,
|
|
251
|
+
isForceWriteSumWithPlusSymbol: false,
|
|
208
252
|
});
|
|
209
253
|
const options = [
|
|
210
254
|
generatorOptionFirstTermRankOne,
|
|
211
255
|
{
|
|
212
256
|
id: "isGiveCount",
|
|
213
|
-
label: "Donner
|
|
257
|
+
label: "Donner le nombre de termes de la somme dans la consigne",
|
|
214
258
|
target: GeneratorOptionTarget.generation,
|
|
215
259
|
type: GeneratorOptionType.checkbox,
|
|
216
260
|
defaultValue: optsDefault.isGiveCount,
|
|
217
261
|
},
|
|
262
|
+
{
|
|
263
|
+
id: "isForceWriteSumWithPlusSymbol",
|
|
264
|
+
label: "Forcer l'écriture de la somme avec des symboles $+$",
|
|
265
|
+
target: GeneratorOptionTarget.generation,
|
|
266
|
+
type: GeneratorOptionType.checkbox,
|
|
267
|
+
defaultValue: optsDefault.isForceWriteSumWithPlusSymbol,
|
|
268
|
+
},
|
|
218
269
|
];
|
|
219
270
|
export const arithmeticComputeSumWithDots = {
|
|
220
271
|
id: "arithmeticComputeSumWithDots",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/sequences/arithmetic/sum/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mCAAmC,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/sequences/arithmetic/sum/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mCAAmC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { OptionFirstTermRankOne } from "../../../../exercises/options/optionFirstTermRankOne.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
rank1: number;
|
|
5
|
+
value1: number;
|
|
6
|
+
rank2: number;
|
|
7
|
+
value2: number;
|
|
8
|
+
precisionInitial: number;
|
|
9
|
+
precisionReason: number;
|
|
10
|
+
};
|
|
11
|
+
type Options = OptionFirstTermRankOne;
|
|
12
|
+
export declare const geometricFindExplicitFormulaFromTwoConsecutiveTerms: Exercise<Identifiers, Options>;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=geometricFindExplicitFormulaFromTwoConsecutiveTerms.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometricFindExplicitFormulaFromTwoConsecutiveTerms.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/geometricFindExplicitFormulaFromTwoConsecutiveTerms.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,sBAAsB,EACvB,MAAM,mDAAmD,CAAC;AAoB3D,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAyVF,KAAK,OAAO,GAAG,sBAAsB,CAAC;AAMtC,eAAO,MAAM,mDAAmD,EAAE,QAAQ,CACxE,WAAW,EACX,OAAO,CAqBR,CAAC"}
|