math-exercises 3.0.149 → 3.0.151
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/primeNumbersAffirmations.js +1 -1
- package/lib/exercises/math/calculLitteral/equation/equa1.d.ts +4 -1
- package/lib/exercises/math/calculLitteral/equation/equa1.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equa1.js +27 -7
- package/lib/exercises/math/calculLitteral/equation/equa2.d.ts +1 -0
- package/lib/exercises/math/calculLitteral/equation/equa2.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equa2.js +18 -1
- package/lib/exercises/math/calculLitteral/equation/equa3.d.ts +4 -1
- package/lib/exercises/math/calculLitteral/equation/equa3.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equa3.js +26 -6
- package/lib/exercises/math/calculLitteral/equation/equa4.d.ts +4 -1
- package/lib/exercises/math/calculLitteral/equation/equa4.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equa4.js +27 -7
- package/lib/exercises/math/calculLitteral/equation/firstDegree/equa1.d.ts +14 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/equa1.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/equa1.js +129 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/equa2.d.ts +18 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/equa2.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/equa2.js +167 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/equa3.d.ts +15 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/equa3.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/equa3.js +129 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/equa4.d.ts +16 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/equa4.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/equa4.js +124 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType1.d.ts +9 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType1.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType1.js +107 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType2.d.ts +10 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType2.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType2.js +108 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType3.d.ts +11 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType3.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/firstDegreeEquationIntType3.js +104 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/index.d.ts +8 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/index.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/equation/firstDegree/index.js +7 -0
- package/lib/exercises/math/calculLitteral/equation/index.d.ts +1 -7
- package/lib/exercises/math/calculLitteral/equation/index.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/index.js +1 -7
- package/lib/exercises/math/dataRepresentations/histogram/etendueHistogram.d.ts +8 -0
- package/lib/exercises/math/dataRepresentations/histogram/etendueHistogram.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/histogram/etendueHistogram.js +175 -0
- package/lib/exercises/math/dataRepresentations/histogram/histogramCommenting.d.ts +9 -0
- package/lib/exercises/math/dataRepresentations/histogram/histogramCommenting.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/histogram/histogramCommenting.js +250 -0
- package/lib/exercises/math/dataRepresentations/histogram/histogramFillDataTableFromHistogramData.d.ts +9 -0
- package/lib/exercises/math/dataRepresentations/histogram/histogramFillDataTableFromHistogramData.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/histogram/histogramFillDataTableFromHistogramData.js +173 -0
- package/lib/exercises/math/dataRepresentations/histogram/histogramIsSameData.d.ts +14 -0
- package/lib/exercises/math/dataRepresentations/histogram/histogramIsSameData.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/histogram/histogramIsSameData.js +232 -0
- package/lib/exercises/math/dataRepresentations/histogram/histogramReading.d.ts +9 -0
- package/lib/exercises/math/dataRepresentations/histogram/histogramReading.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/histogram/histogramReading.js +163 -0
- package/lib/exercises/math/dataRepresentations/histogram/index.d.ts +6 -0
- package/lib/exercises/math/dataRepresentations/histogram/index.d.ts.map +1 -0
- package/lib/exercises/math/dataRepresentations/histogram/index.js +5 -0
- package/lib/exercises/math/dataRepresentations/index.d.ts +1 -1
- package/lib/exercises/math/dataRepresentations/index.d.ts.map +1 -1
- package/lib/exercises/math/dataRepresentations/index.js +1 -1
- package/lib/exercises/math/functions/affines/leadingCoeffAndOriginOrdinate.d.ts +4 -1
- package/lib/exercises/math/functions/affines/leadingCoeffAndOriginOrdinate.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/leadingCoeffAndOriginOrdinate.js +19 -4
- package/lib/exercises/math/functions/affines/leadingCoefficient.d.ts +1 -0
- package/lib/exercises/math/functions/affines/leadingCoefficient.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/leadingCoefficient.js +13 -1
- package/lib/exercises/math/functions/affines/recognizeAffineGraph.d.ts +4 -1
- package/lib/exercises/math/functions/affines/recognizeAffineGraph.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/recognizeAffineGraph.js +19 -4
- package/lib/exercises/math/geometry/euclidian/pythagoreOrThales.d.ts +4 -1
- package/lib/exercises/math/geometry/euclidian/pythagoreOrThales.d.ts.map +1 -1
- package/lib/exercises/math/geometry/euclidian/pythagoreOrThales.js +18 -3
- package/lib/exercises/math/geometry/triangles/index.d.ts +1 -0
- package/lib/exercises/math/geometry/triangles/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/triangles/index.js +1 -0
- package/lib/exercises/math/geometry/triangles/similar/index.d.ts +4 -0
- package/lib/exercises/math/geometry/triangles/similar/index.d.ts.map +1 -0
- package/lib/exercises/math/geometry/triangles/similar/index.js +3 -0
- package/lib/exercises/math/geometry/triangles/similar/isSimilarTrianglesWithAngles.d.ts +10 -0
- package/lib/exercises/math/geometry/triangles/similar/isSimilarTrianglesWithAngles.d.ts.map +1 -0
- package/lib/exercises/math/geometry/triangles/similar/isSimilarTrianglesWithAngles.js +122 -0
- package/lib/exercises/math/geometry/triangles/similar/isSimilarTrianglesWrtSideLengths.d.ts +15 -0
- package/lib/exercises/math/geometry/triangles/similar/isSimilarTrianglesWrtSideLengths.d.ts.map +1 -0
- package/lib/exercises/math/geometry/triangles/similar/isSimilarTrianglesWrtSideLengths.js +351 -0
- package/lib/exercises/math/geometry/triangles/similar/placeSegmentsOfSimilarTriangle.d.ts +11 -0
- package/lib/exercises/math/geometry/triangles/similar/placeSegmentsOfSimilarTriangle.d.ts.map +1 -0
- package/lib/exercises/math/geometry/triangles/similar/placeSegmentsOfSimilarTriangle.js +311 -0
- package/lib/exercises/math/probaStat/basicProbas/calculateProbaFromProbaLaw.d.ts +10 -0
- package/lib/exercises/math/probaStat/basicProbas/calculateProbaFromProbaLaw.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/basicProbas/calculateProbaFromProbaLaw.js +128 -0
- package/lib/exercises/math/probaStat/basicProbas/findEffectifFromProba.d.ts +9 -0
- package/lib/exercises/math/probaStat/basicProbas/findEffectifFromProba.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/basicProbas/findEffectifFromProba.js +109 -0
- package/lib/exercises/math/probaStat/basicProbas/index.d.ts +2 -0
- package/lib/exercises/math/probaStat/basicProbas/index.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/basicProbas/index.js +2 -0
- package/lib/exercises/math/scratch/index.d.ts +13 -0
- package/lib/exercises/math/scratch/index.d.ts.map +1 -1
- package/lib/exercises/math/scratch/index.js +14 -0
- package/lib/exercises/math/scratch/scratchCond1.d.ts +25 -0
- package/lib/exercises/math/scratch/scratchCond1.d.ts.map +1 -0
- package/lib/exercises/math/scratch/scratchCond1.js +290 -0
- package/lib/exercises/math/scratch/scratchFunction1.d.ts +9 -0
- package/lib/exercises/math/scratch/scratchFunction1.d.ts.map +1 -0
- package/lib/exercises/math/scratch/scratchFunction1.js +199 -0
- package/lib/exercises/math/scratch/scratchLoop1.d.ts +10 -0
- package/lib/exercises/math/scratch/scratchLoop1.d.ts.map +1 -0
- package/lib/exercises/math/scratch/scratchLoop1.js +207 -0
- package/lib/exercises/math/scratch/scratchLoopCond1.d.ts +12 -0
- package/lib/exercises/math/scratch/scratchLoopCond1.d.ts.map +1 -0
- package/lib/exercises/math/scratch/scratchLoopCond1.js +236 -0
- package/lib/exercises/math/scratch/scratchLoopCond2.d.ts +14 -0
- package/lib/exercises/math/scratch/scratchLoopCond2.d.ts.map +1 -0
- package/lib/exercises/math/scratch/scratchLoopCond2.js +219 -0
- package/lib/exercises/math/scratch/scratchOperations1.d.ts +8 -0
- package/lib/exercises/math/scratch/scratchOperations1.d.ts.map +1 -0
- package/lib/exercises/math/scratch/scratchOperations1.js +245 -0
- package/lib/exercises/math/scratch/scratchOperations2.d.ts +10 -0
- package/lib/exercises/math/scratch/scratchOperations2.d.ts.map +1 -0
- package/lib/exercises/math/scratch/scratchOperations2.js +324 -0
- package/lib/exercises/math/scratch/scratchPrintXY.d.ts +9 -0
- package/lib/exercises/math/scratch/scratchPrintXY.d.ts.map +1 -0
- package/lib/exercises/math/scratch/scratchPrintXY.js +194 -0
- package/lib/exercises/math/scratch/scratchStringLoop.d.ts +10 -0
- package/lib/exercises/math/scratch/scratchStringLoop.d.ts.map +1 -0
- package/lib/exercises/math/scratch/scratchStringLoop.js +192 -0
- package/lib/exercises/math/scratch/scratchStringLoopCond.d.ts +12 -0
- package/lib/exercises/math/scratch/scratchStringLoopCond.d.ts.map +1 -0
- package/lib/exercises/math/scratch/scratchStringLoopCond.js +270 -0
- package/lib/exercises/math/scratch/scratchStringLoopCond2.d.ts +12 -0
- package/lib/exercises/math/scratch/scratchStringLoopCond2.d.ts.map +1 -0
- package/lib/exercises/math/scratch/scratchStringLoopCond2.js +273 -0
- package/lib/exercises/math/scratch/scratchStringLoopCond3.d.ts +12 -0
- package/lib/exercises/math/scratch/scratchStringLoopCond3.d.ts.map +1 -0
- package/lib/exercises/math/scratch/scratchStringLoopCond3.js +275 -0
- package/lib/exercises/math/scratch/scratchSwapUsingTmp.d.ts +10 -0
- package/lib/exercises/math/scratch/scratchSwapUsingTmp.d.ts.map +1 -0
- package/lib/exercises/math/scratch/scratchSwapUsingTmp.js +199 -0
- package/lib/exercises/math/scratch/scratchVarWaterfall.d.ts +10 -0
- package/lib/exercises/math/scratch/scratchVarWaterfall.d.ts.map +1 -0
- package/lib/exercises/math/scratch/scratchVarWaterfall.js +371 -0
- package/lib/exercises/math/spaceGeometry/index.d.ts +1 -0
- package/lib/exercises/math/spaceGeometry/index.d.ts.map +1 -1
- package/lib/exercises/math/spaceGeometry/index.js +1 -0
- package/lib/exercises/math/spaceGeometry/sections/areaOfConeSection.d.ts +14 -0
- package/lib/exercises/math/spaceGeometry/sections/areaOfConeSection.d.ts.map +1 -0
- package/lib/exercises/math/spaceGeometry/sections/areaOfConeSection.js +439 -0
- package/lib/exercises/math/spaceGeometry/sections/areaOfCylinderSection.d.ts +14 -0
- package/lib/exercises/math/spaceGeometry/sections/areaOfCylinderSection.d.ts.map +1 -0
- package/lib/exercises/math/spaceGeometry/sections/areaOfCylinderSection.js +548 -0
- package/lib/exercises/math/spaceGeometry/sections/areaOfRectangularPrismSection.d.ts +11 -0
- package/lib/exercises/math/spaceGeometry/sections/areaOfRectangularPrismSection.d.ts.map +1 -0
- package/lib/exercises/math/spaceGeometry/sections/areaOfRectangularPrismSection.js +360 -0
- package/lib/exercises/math/spaceGeometry/sections/areaOfSphereSection.d.ts +9 -0
- package/lib/exercises/math/spaceGeometry/sections/areaOfSphereSection.d.ts.map +1 -0
- package/lib/exercises/math/spaceGeometry/sections/areaOfSphereSection.js +272 -0
- package/lib/exercises/math/spaceGeometry/sections/index.d.ts +9 -0
- package/lib/exercises/math/spaceGeometry/sections/index.d.ts.map +1 -0
- package/lib/exercises/math/spaceGeometry/sections/index.js +8 -0
- package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfCone.d.ts +11 -0
- package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfCone.d.ts.map +1 -0
- package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfCone.js +266 -0
- package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfCylinder.d.ts +11 -0
- package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfCylinder.d.ts.map +1 -0
- package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfCylinder.js +236 -0
- package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfRectangularPrism.d.ts +7 -0
- package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfRectangularPrism.d.ts.map +1 -0
- package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfRectangularPrism.js +92 -0
- package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfSphereOrBall.d.ts +9 -0
- package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfSphereOrBall.d.ts.map +1 -0
- package/lib/exercises/math/spaceGeometry/sections/recognizeSectionsOfSphereOrBall.js +236 -0
- package/lib/exercises/pc/mathExosInPC.d.ts +4 -4
- package/lib/exercises/pc/mathExosInPC.d.ts.map +1 -1
- package/lib/exercises/pc/mathExosInPC.js +4 -4
- package/lib/index.d.ts +239 -45
- package/lib/index.d.ts.map +1 -1
- package/lib/math/geometry/spacePoint.d.ts +10 -0
- package/lib/math/geometry/spacePoint.d.ts.map +1 -1
- package/lib/math/geometry/spacePoint.js +13 -0
- package/lib/tree/nodes/operators/substractNode.d.ts +1 -0
- package/lib/tree/nodes/operators/substractNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/substractNode.js +6 -0
- package/package.json +1 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Exercise } from "../../../../../exercises/exercise.js";
|
|
2
|
+
import { NodeIdentifiers } from "../../../../../tree/nodes/nodeConstructor.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
namePoints1: string[];
|
|
5
|
+
namePoints2: string[];
|
|
6
|
+
nodeIdsLengths1: NodeIdentifiers[];
|
|
7
|
+
nodeIdsLengths2: NodeIdentifiers[];
|
|
8
|
+
};
|
|
9
|
+
type Options = {
|
|
10
|
+
numberTypesForLengths: ("Entier" | "Décimal")[];
|
|
11
|
+
numberTypesForCoeffs: ("Entier" | "Décimal" | "Fraction")[];
|
|
12
|
+
};
|
|
13
|
+
export declare const isSimilarTrianglesWrtSideLengths: Exercise<Identifiers, Options>;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=isSimilarTrianglesWrtSideLengths.d.ts.map
|
package/lib/exercises/math/geometry/triangles/similar/isSimilarTrianglesWrtSideLengths.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isSimilarTrianglesWrtSideLengths.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/geometry/triangles/similar/isSimilarTrianglesWrtSideLengths.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAOrC,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAiC7C,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,eAAe,EAAE,eAAe,EAAE,CAAC;IACnC,eAAe,EAAE,eAAe,EAAE,CAAC;CACpC,CAAC;AA6XF,KAAK,OAAO,GAAG;IACb,qBAAqB,EAAE,CAAC,QAAQ,GAAG,SAAS,CAAC,EAAE,CAAC;IAChD,oBAAoB,EAAE,CAAC,QAAQ,GAAG,SAAS,GAAG,UAAU,CAAC,EAAE,CAAC;CAC7D,CAAC;AAwBF,eAAO,MAAM,gCAAgC,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAuBzE,CAAC"}
|
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
import { addValidProp, tryToAddWrongProp, GeneratorOptionTarget, GeneratorOptionType, } from "../../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { primes } from "../../../../../math/numbers/integer/primes.js";
|
|
4
|
+
import { gcd } from "../../../../../math/utils/arithmetic/gcd.js";
|
|
5
|
+
import { randint } from "../../../../../math/utils/random/randint.js";
|
|
6
|
+
import { round } from "../../../../../math/utils/round.js";
|
|
7
|
+
import { NodeConstructor, } from "../../../../../tree/nodes/nodeConstructor.js";
|
|
8
|
+
import { add } from "../../../../../tree/nodes/operators/addNode.js";
|
|
9
|
+
import { frac } from "../../../../../tree/nodes/operators/fractionNode.js";
|
|
10
|
+
import { multiply } from "../../../../../tree/nodes/operators/multiplyNode.js";
|
|
11
|
+
import { substract } from "../../../../../tree/nodes/operators/substractNode.js";
|
|
12
|
+
import { coinFlip } from "../../../../../utils/alea/coinFlip.js";
|
|
13
|
+
import { random, randomMany } from "../../../../../utils/alea/random.js";
|
|
14
|
+
import { shuffle } from "../../../../../utils/alea/shuffle.js";
|
|
15
|
+
import { alignTex } from "../../../../../utils/latex/alignTex.js";
|
|
16
|
+
import { joinanded } from "../../../../../utils/strings/joinanded.js";
|
|
17
|
+
const getNAllDigits = (n) => {
|
|
18
|
+
const strN = n.frenchify();
|
|
19
|
+
if (strN.includes(",")) {
|
|
20
|
+
const [leftOfSep, rightOfSep] = strN.split(",");
|
|
21
|
+
const roundTo = 1;
|
|
22
|
+
const nAllDigits = parseInt(leftOfSep + rightOfSep.slice(0, roundTo));
|
|
23
|
+
return nAllDigits;
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
return n;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const extendedGcd = (n1, n2) => {
|
|
30
|
+
try {
|
|
31
|
+
const [n1AllDigits, n2AllDigits] = [n1, n2].map(getNAllDigits);
|
|
32
|
+
const commonDivisor = gcd(n1AllDigits, n2AllDigits);
|
|
33
|
+
return commonDivisor;
|
|
34
|
+
}
|
|
35
|
+
catch (_) {
|
|
36
|
+
return 1;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const getHydratedObjs = (identifiers) => {
|
|
40
|
+
const { nodeIdsLengths1, nodeIdsLengths2, namePoints1, namePoints2 } = identifiers;
|
|
41
|
+
const [nodeLengths1, nodeLengths2] = [nodeIdsLengths1, nodeIdsLengths2].map((arrNodeIds) => arrNodeIds.map((nodeIds) => NodeConstructor.fromIdentifiers(nodeIds).simplify({
|
|
42
|
+
fractionsToDecimal: true,
|
|
43
|
+
})));
|
|
44
|
+
const [nameTriangle1, nameTriangle2] = [namePoints1, namePoints2].map((pointNames) => pointNames.join(""));
|
|
45
|
+
const [nameSegments1, nameSegments2] = [namePoints1, namePoints2].map((pointNames) => [
|
|
46
|
+
[0, 1],
|
|
47
|
+
[1, 2],
|
|
48
|
+
[2, 0],
|
|
49
|
+
].map(([i1, i2]) => `${pointNames[i1]}${pointNames[i2]}`));
|
|
50
|
+
return {
|
|
51
|
+
nodeLengths1,
|
|
52
|
+
nodeLengths2,
|
|
53
|
+
nameTriangle1,
|
|
54
|
+
nameTriangle2,
|
|
55
|
+
nameSegments1,
|
|
56
|
+
nameSegments2,
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
const isSimilar = (identifiers) => {
|
|
60
|
+
const { nodeLengths1, nodeLengths2 } = getHydratedObjs(identifiers);
|
|
61
|
+
const [nodeLengths1SortedAsc, nodeLengths2SortedAsc] = [
|
|
62
|
+
nodeLengths1,
|
|
63
|
+
nodeLengths2,
|
|
64
|
+
].map((nodeLengths) => nodeLengths.toSorted((node1, node2) => node1.evaluate() - node2.evaluate()));
|
|
65
|
+
const nodeCoeffs = nodeLengths2SortedAsc.map((nodeLength2, i) => frac(nodeLength2, nodeLengths1SortedAsc[i]));
|
|
66
|
+
const nodeCoeff0 = nodeCoeffs[0].simplify();
|
|
67
|
+
return nodeCoeffs.slice(1).every((nodeCoeff) => {
|
|
68
|
+
return (substract(nodeCoeff.simplify(), nodeCoeff0).simplify().evaluate() === 0);
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
const getPropositions = (_, { answer, ...identifiers }) => {
|
|
72
|
+
const propositions = [];
|
|
73
|
+
const answerFromIdentifiers = getAnswer(identifiers);
|
|
74
|
+
["Oui", "Non"].forEach((strProp) => {
|
|
75
|
+
if (strProp === answerFromIdentifiers) {
|
|
76
|
+
addValidProp(propositions, strProp, "raw");
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
tryToAddWrongProp(propositions, strProp, "raw");
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
return propositions;
|
|
83
|
+
};
|
|
84
|
+
const getAnswer = (identifiers) => {
|
|
85
|
+
return isSimilar(identifiers) ? "Oui" : "Non";
|
|
86
|
+
};
|
|
87
|
+
const getInstruction = (identifiers) => {
|
|
88
|
+
const { nodeLengths1, nodeLengths2, nameTriangle1, nameTriangle2, nameSegments1, nameSegments2, } = getHydratedObjs(identifiers);
|
|
89
|
+
return `Soit $${nameTriangle1}$ un triangle tel que ${joinanded(nameSegments1.map((nameSegment, i) => `$${nameSegment} = ${nodeLengths1[i].toTex()} \\ \\textrm{cm}$`), ", ", " et ")}.
|
|
90
|
+
Soit $${nameTriangle2}$ un triangle tel que ${joinanded(nameSegments2.map((nameSegment, i) => `$${nameSegment} = ${nodeLengths2[i].toTex()} \\ \\textrm{cm}$`), ", ", " et ")}.
|
|
91
|
+
|
|
92
|
+
Les triangles $${nameTriangle1}$ et $${nameTriangle2}$ sont-ils semblables ?`;
|
|
93
|
+
};
|
|
94
|
+
const getHint = (identifiers) => {
|
|
95
|
+
const { namePoints1, namePoints2 } = identifiers;
|
|
96
|
+
const [nameTriangle1, nameTriangle2] = [namePoints1, namePoints2].map((pointNames) => pointNames.join(""));
|
|
97
|
+
return `Regarde si tu peux trouver un coefficient de proportionnalité entre les longueurs de $${nameTriangle1}$ et celles de $${nameTriangle2}$ (même prises dans un autre ordre).`;
|
|
98
|
+
};
|
|
99
|
+
const getCorrection = (identifiers) => {
|
|
100
|
+
const { nodeLengths1, nodeLengths2, nameTriangle1, nameTriangle2 } = getHydratedObjs(identifiers);
|
|
101
|
+
const [nodeLengths1SortedAsc, nodeLengths2SortedAsc] = [
|
|
102
|
+
nodeLengths1,
|
|
103
|
+
nodeLengths2,
|
|
104
|
+
].map((nodeLengths) => nodeLengths.toSorted((node1, node2) => node1.evaluate() - node2.evaluate()));
|
|
105
|
+
const nodeCoeffs = nodeLengths2SortedAsc.map((nodeLength2, i) => frac(nodeLength2, nodeLengths1SortedAsc[i]));
|
|
106
|
+
const isSim = isSimilar(identifiers);
|
|
107
|
+
return `Pour ne pas avoir à tester tous les cas possibles, pour chaque triangle, on range les longueurs par ordre croissant.
|
|
108
|
+
|
|
109
|
+
Pour $${nameTriangle1}$ :
|
|
110
|
+
|
|
111
|
+
$$
|
|
112
|
+
${nodeLengths1SortedAsc.map((node) => node.toTex()).join(" < ")}
|
|
113
|
+
$$
|
|
114
|
+
|
|
115
|
+
Pour $${nameTriangle2}$ :
|
|
116
|
+
|
|
117
|
+
$$
|
|
118
|
+
${nodeLengths2SortedAsc.map((node) => node.toTex()).join(" < ")}
|
|
119
|
+
$$
|
|
120
|
+
|
|
121
|
+
On regarde ensuite si les rapports $\\frac{\\text{longueur dans ${nameTriangle2}}}{\\text{longueur dans ${nameTriangle1}}}$ sont tous égaux.
|
|
122
|
+
|
|
123
|
+
On a :
|
|
124
|
+
|
|
125
|
+
${alignTex([0, 1, 2].map((i) => [
|
|
126
|
+
`${nodeCoeffs[i].toTex()}`,
|
|
127
|
+
"=",
|
|
128
|
+
`${nodeCoeffs[i].simplify({ fractionsToDecimal: true }).toTex()}`,
|
|
129
|
+
]))}
|
|
130
|
+
|
|
131
|
+
Les triangles $${nameTriangle1}$ et $${nameTriangle2}$ ${isSim ? "sont donc semblables" : "ne sont donc pas semblables"}.`;
|
|
132
|
+
};
|
|
133
|
+
const getIsSimilarTrianglesWrtSideLengthsQuestion = (optsIn) => {
|
|
134
|
+
const opts = optsIn ?? optsDefault;
|
|
135
|
+
function createRandomNodeCoeff(numberTypeForCoeff) {
|
|
136
|
+
switch (numberTypeForCoeff) {
|
|
137
|
+
// case "Fraction":
|
|
138
|
+
// {
|
|
139
|
+
// return RationalConstructor.randomIrreductible().toTree();
|
|
140
|
+
// }
|
|
141
|
+
// break;
|
|
142
|
+
case "Décimal":
|
|
143
|
+
{
|
|
144
|
+
return round(randint(1, 20) + 0.1 * randint(1, 10), 1)
|
|
145
|
+
.toTree()
|
|
146
|
+
.simplify({ fractionsToDecimal: true });
|
|
147
|
+
}
|
|
148
|
+
break;
|
|
149
|
+
default:
|
|
150
|
+
case "Entier":
|
|
151
|
+
{
|
|
152
|
+
return randint(2, 10).toTree();
|
|
153
|
+
}
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
function createRandomNodeLength(numberTypeForLength) {
|
|
158
|
+
switch (numberTypeForLength) {
|
|
159
|
+
case "Décimal":
|
|
160
|
+
{
|
|
161
|
+
return round(randint(2, 15) + 0.1 * randint(1, 10), 1)
|
|
162
|
+
.toTree()
|
|
163
|
+
.simplify({ fractionsToDecimal: true });
|
|
164
|
+
}
|
|
165
|
+
break;
|
|
166
|
+
default:
|
|
167
|
+
case "Entier":
|
|
168
|
+
{
|
|
169
|
+
return randint(2, 16).toTree();
|
|
170
|
+
}
|
|
171
|
+
break;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
function isTriangleWrtSideLenghts(nodeLengths) {
|
|
175
|
+
return nodeLengths.every((nodeLength, i) => {
|
|
176
|
+
const nodeSumOfOther = nodeLengths
|
|
177
|
+
.filter((_, j) => j !== i)
|
|
178
|
+
.reduce((acc, x) => add(acc, x));
|
|
179
|
+
return nodeLength.evaluate() <= nodeSumOfOther.evaluate();
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
function createRandomTriangleNodes(numberTypesForLengths) {
|
|
183
|
+
let nodeLengths;
|
|
184
|
+
let isValidTriangle = false;
|
|
185
|
+
let counter = -1;
|
|
186
|
+
while (!isValidTriangle && counter < 100) {
|
|
187
|
+
counter++;
|
|
188
|
+
nodeLengths = [0, 1, 2].map(() => {
|
|
189
|
+
const numberTypeForLength = random(numberTypesForLengths);
|
|
190
|
+
return createRandomNodeLength(numberTypeForLength);
|
|
191
|
+
});
|
|
192
|
+
isValidTriangle = isTriangleWrtSideLenghts(nodeLengths);
|
|
193
|
+
}
|
|
194
|
+
if (!isValidTriangle) {
|
|
195
|
+
if (numberTypesForLengths.includes("Entier") &&
|
|
196
|
+
!numberTypesForLengths.includes("Décimal")) {
|
|
197
|
+
return [3, 4, 5].map((n) => n.toTree());
|
|
198
|
+
}
|
|
199
|
+
else if (!numberTypesForLengths.includes("Entier") &&
|
|
200
|
+
numberTypesForLengths.includes("Décimal")) {
|
|
201
|
+
return [3.3, 4.4, 5.5].map((n) => n.toTree());
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
return [3.3, 4, 5.5].map((n) => n.toTree());
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
return nodeLengths;
|
|
208
|
+
}
|
|
209
|
+
function createRandomHighGcdTriangleNodes(numberTypesForLengths) {
|
|
210
|
+
let nodeLengths;
|
|
211
|
+
let isValidTriangle = false;
|
|
212
|
+
let counter = -1;
|
|
213
|
+
while (!isValidTriangle && counter < 100) {
|
|
214
|
+
counter++;
|
|
215
|
+
const commonDivisor = random(primes.filter((n) => 7 <= n && n <= 23));
|
|
216
|
+
const numberTypeForLength = random(numberTypesForLengths);
|
|
217
|
+
if (numberTypeForLength === "Entier") {
|
|
218
|
+
nodeLengths = randomMany([2, 3, 4, 5, 6, 7, 8], 3)
|
|
219
|
+
.map((n) => n * commonDivisor)
|
|
220
|
+
.map((n) => n.toTree())
|
|
221
|
+
.map((node) => round(node.evaluate(), 1).toTree());
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
nodeLengths = randomMany([2, 3, 4, 5, 6, 7, 8], 3)
|
|
225
|
+
.map((n) => n * commonDivisor)
|
|
226
|
+
.map((n) => (n * 0.1).toTree())
|
|
227
|
+
.map((node) => round(node.evaluate(), 1).toTree());
|
|
228
|
+
}
|
|
229
|
+
isValidTriangle = isTriangleWrtSideLenghts(nodeLengths);
|
|
230
|
+
}
|
|
231
|
+
if (!isValidTriangle) {
|
|
232
|
+
if (numberTypesForLengths.includes("Entier") &&
|
|
233
|
+
!numberTypesForLengths.includes("Décimal")) {
|
|
234
|
+
return [3, 4, 5].map((n) => n.toTree());
|
|
235
|
+
}
|
|
236
|
+
else if (!numberTypesForLengths.includes("Entier") &&
|
|
237
|
+
numberTypesForLengths.includes("Décimal")) {
|
|
238
|
+
return [3.3, 4.4, 5.5].map((n) => n.toTree());
|
|
239
|
+
}
|
|
240
|
+
else {
|
|
241
|
+
return [3.3, 4, 5.5].map((n) => n.toTree());
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
return nodeLengths;
|
|
245
|
+
}
|
|
246
|
+
let isSimilar = coinFlip();
|
|
247
|
+
const numberTypeForCoeffCandidate = random(opts.numberTypesForCoeffs);
|
|
248
|
+
const nodeLengths1 = (() => {
|
|
249
|
+
if (numberTypeForCoeffCandidate === "Fraction") {
|
|
250
|
+
return createRandomHighGcdTriangleNodes(opts.numberTypesForLengths);
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
return createRandomTriangleNodes(opts.numberTypesForLengths);
|
|
254
|
+
}
|
|
255
|
+
})();
|
|
256
|
+
const nodeLengths1SortedAsc = nodeLengths1.toSorted((node1, node2) => node1.evaluate() - node2.evaluate());
|
|
257
|
+
const createNodeCoeff = () => {
|
|
258
|
+
const numberTypeForCoeff = numberTypeForCoeffCandidate === "Fraction"
|
|
259
|
+
? numberTypeForCoeffCandidate
|
|
260
|
+
: random(opts.numberTypesForCoeffs.filter((numberTypeForCoeff) => numberTypeForCoeff !== "Fraction"));
|
|
261
|
+
if (numberTypeForCoeff === "Fraction") {
|
|
262
|
+
const den = nodeLengths1
|
|
263
|
+
.reduce((acc, x) => extendedGcd(acc.evaluate(), x.evaluate()).toTree())
|
|
264
|
+
.evaluate();
|
|
265
|
+
const num = random(primes.filter((n) => n < 5 * den));
|
|
266
|
+
return frac(num, den);
|
|
267
|
+
}
|
|
268
|
+
else {
|
|
269
|
+
const nodeCoeff = createRandomNodeCoeff(numberTypeForCoeff);
|
|
270
|
+
return nodeCoeff;
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
const nodeCoeffs = isSimilar
|
|
274
|
+
? (() => {
|
|
275
|
+
const nodeCoeff = createNodeCoeff();
|
|
276
|
+
return nodeLengths1.map(() => nodeCoeff);
|
|
277
|
+
})()
|
|
278
|
+
: nodeLengths1.map(() => createNodeCoeff());
|
|
279
|
+
const nodeCoeffsSortedAsc = nodeCoeffs.toSorted((node1, node2) => node1.evaluate() - node2.evaluate());
|
|
280
|
+
isSimilar = (() => {
|
|
281
|
+
const nodeCoeff0 = nodeCoeffsSortedAsc[0].simplify();
|
|
282
|
+
return nodeCoeffsSortedAsc.slice(1).every((nodeCoeff) => {
|
|
283
|
+
return (substract(nodeCoeff.simplify(), nodeCoeff0).simplify().evaluate() === 0);
|
|
284
|
+
});
|
|
285
|
+
})();
|
|
286
|
+
const nodeLengths2SortedAsc = nodeLengths1SortedAsc.map((nodeLength, i) => multiply(nodeCoeffsSortedAsc[i], nodeLength).simplify());
|
|
287
|
+
const nodeLengths1Shuffled = shuffle(nodeLengths1SortedAsc);
|
|
288
|
+
const nodeLengths2Shuffled = shuffle(nodeLengths2SortedAsc);
|
|
289
|
+
const [A, B, C, D, E, F] = randomMany("ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""), 6);
|
|
290
|
+
const namePoints1 = [A, B, C];
|
|
291
|
+
const namePoints2 = [D, E, F];
|
|
292
|
+
const identifiers = {
|
|
293
|
+
nodeIdsLengths1: nodeLengths1Shuffled.map((node) => node.toIdentifiers()),
|
|
294
|
+
nodeIdsLengths2: nodeLengths2Shuffled.map((node) => node.toIdentifiers()),
|
|
295
|
+
namePoints1,
|
|
296
|
+
namePoints2,
|
|
297
|
+
};
|
|
298
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
299
|
+
};
|
|
300
|
+
const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
301
|
+
return {
|
|
302
|
+
answer: getAnswer(identifiers),
|
|
303
|
+
instruction: getInstruction(identifiers),
|
|
304
|
+
keys: [],
|
|
305
|
+
answerFormat: "raw",
|
|
306
|
+
identifiers,
|
|
307
|
+
hint: getHint(identifiers),
|
|
308
|
+
correction: getCorrection(identifiers),
|
|
309
|
+
options: opts,
|
|
310
|
+
};
|
|
311
|
+
};
|
|
312
|
+
const optsDefault = {
|
|
313
|
+
numberTypesForLengths: ["Décimal"],
|
|
314
|
+
numberTypesForCoeffs: ["Entier"],
|
|
315
|
+
};
|
|
316
|
+
const options = [
|
|
317
|
+
{
|
|
318
|
+
id: "numberTypesForLengths",
|
|
319
|
+
label: "Types de nombres pour les longueurs",
|
|
320
|
+
defaultValue: optsDefault.numberTypesForLengths,
|
|
321
|
+
values: ["Entier", "Décimal"],
|
|
322
|
+
target: GeneratorOptionTarget.generation,
|
|
323
|
+
type: GeneratorOptionType.multiselect,
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
id: "numberTypesForCoeffs",
|
|
327
|
+
label: "Types de nombres pour les rapports",
|
|
328
|
+
defaultValue: optsDefault.numberTypesForCoeffs,
|
|
329
|
+
values: ["Entier", "Décimal", "Fraction"],
|
|
330
|
+
target: GeneratorOptionTarget.generation,
|
|
331
|
+
type: GeneratorOptionType.multiselect,
|
|
332
|
+
},
|
|
333
|
+
];
|
|
334
|
+
export const isSimilarTrianglesWrtSideLengths = {
|
|
335
|
+
id: "isSimilarTrianglesWrtSideLengths",
|
|
336
|
+
label: "Justifier que deux triangles sont semblables par le rapport de leurs côtés",
|
|
337
|
+
isSingleStep: true,
|
|
338
|
+
generator: (nb, opts) => getDistinctQuestions(() => getIsSimilarTrianglesWrtSideLengthsQuestion(opts), nb),
|
|
339
|
+
options,
|
|
340
|
+
qcmTimer: 60,
|
|
341
|
+
freeTimer: 60,
|
|
342
|
+
getPropositions,
|
|
343
|
+
subject: "Mathématiques",
|
|
344
|
+
getInstruction,
|
|
345
|
+
getHint,
|
|
346
|
+
getCorrection,
|
|
347
|
+
getAnswer,
|
|
348
|
+
getQuestionFromIdentifiers,
|
|
349
|
+
hasHintAndCorrection: true,
|
|
350
|
+
answerType: "QCU",
|
|
351
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Exercise } from "../../../../../exercises/exercise.js";
|
|
2
|
+
import { TriangleIdentifiers } from "../../../../../math/geometry/triangles/triangle.js";
|
|
3
|
+
import { NodeIdentifiers } from "../../../../../tree/nodes/nodeConstructor.js";
|
|
4
|
+
type Identifiers = {
|
|
5
|
+
triangleIds1: TriangleIdentifiers;
|
|
6
|
+
triangleIds2: TriangleIdentifiers;
|
|
7
|
+
factor: NodeIdentifiers;
|
|
8
|
+
};
|
|
9
|
+
export declare const placeSegmentsOfSimilarTriangle: Exercise<Identifiers>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=placeSegmentsOfSimilarTriangle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"placeSegmentsOfSimilarTriangle.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/geometry/triangles/similar/placeSegmentsOfSimilarTriangle.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AAQrC,OAAO,EAGL,mBAAmB,EACpB,MAAM,2CAA2C,CAAC;AAQnD,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAwC7C,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,mBAAmB,CAAC;IAClC,YAAY,EAAE,mBAAmB,CAAC;IAClC,MAAM,EAAE,eAAe,CAAC;CACzB,CAAC;AAkXF,eAAO,MAAM,8BAA8B,EAAE,QAAQ,CAAC,WAAW,CAgBhE,CAAC"}
|