math-exercises 3.0.144 → 3.0.146
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/exercises/exercise.d.ts +1 -0
- package/lib/exercises/exercise.d.ts.map +1 -1
- package/lib/exercises/math/calcul/addAndSub.d.ts.map +1 -1
- package/lib/exercises/math/calcul/addAndSub.js +20 -1
- package/lib/exercises/math/calcul/arithmetics/euclideanDivision.js +1 -1
- package/lib/exercises/math/calcul/index.d.ts +1 -0
- package/lib/exercises/math/calcul/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/index.js +1 -0
- package/lib/exercises/math/calcul/mentalCaluls/index.d.ts +2 -0
- package/lib/exercises/math/calcul/mentalCaluls/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/mentalCaluls/index.js +2 -0
- package/lib/exercises/math/calcul/mentalCaluls/mentalAddAndSub.d.ts.map +1 -1
- package/lib/exercises/math/calcul/mentalCaluls/mentalAddAndSub.js +22 -0
- package/lib/exercises/math/calcul/mentalCaluls/mentalFractionageOfInteger.d.ts +9 -0
- package/lib/exercises/math/calcul/mentalCaluls/mentalFractionageOfInteger.d.ts.map +1 -0
- package/lib/exercises/math/calcul/mentalCaluls/mentalFractionageOfInteger.js +152 -0
- package/lib/exercises/math/calcul/mentalCaluls/mentalFractionageOfQuantity.d.ts +15 -0
- package/lib/exercises/math/calcul/mentalCaluls/mentalFractionageOfQuantity.d.ts.map +1 -0
- package/lib/exercises/math/calcul/mentalCaluls/mentalFractionageOfQuantity.js +412 -0
- package/lib/exercises/math/calcul/mentalCaluls/mentalProgramSolve.d.ts.map +1 -1
- package/lib/exercises/math/calcul/mentalCaluls/mentalProgramSolve.js +6 -8
- package/lib/exercises/math/calcul/proportionality/isTableProportionalNonInteger.d.ts.map +1 -1
- package/lib/exercises/math/calcul/proportionality/isTableProportionalNonInteger.js +37 -7
- package/lib/exercises/math/calcul/ratio/index.d.ts +2 -0
- package/lib/exercises/math/calcul/ratio/index.d.ts.map +1 -0
- package/lib/exercises/math/calcul/ratio/index.js +2 -0
- package/lib/exercises/math/calcul/ratio/partUsingRatio.d.ts +14 -0
- package/lib/exercises/math/calcul/ratio/partUsingRatio.d.ts.map +1 -0
- package/lib/exercises/math/calcul/ratio/partUsingRatio.js +388 -0
- package/lib/exercises/math/calcul/ratio/ratioFromParts.d.ts +10 -0
- package/lib/exercises/math/calcul/ratio/ratioFromParts.d.ts.map +1 -0
- package/lib/exercises/math/calcul/ratio/ratioFromParts.js +198 -0
- package/lib/exercises/math/calculLitteral/equation/equationFromSentenceExercise.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equationFromSentenceExercise.js +50 -0
- package/lib/exercises/math/calculLitteral/simplifying/compareMinusA.js +1 -1
- package/lib/exercises/math/index.d.ts +1 -0
- package/lib/exercises/math/index.d.ts.map +1 -1
- package/lib/exercises/math/index.js +1 -0
- package/lib/exercises/math/probaStat/basicProbas/index.d.ts +1 -0
- package/lib/exercises/math/probaStat/basicProbas/index.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/basicProbas/index.js +1 -0
- package/lib/exercises/math/probaStat/basicProbas/rangeBasicProbas.d.ts +10 -0
- package/lib/exercises/math/probaStat/basicProbas/rangeBasicProbas.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/basicProbas/rangeBasicProbas.js +113 -0
- package/lib/exercises/math/probaStat/index.d.ts +1 -0
- package/lib/exercises/math/probaStat/index.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/index.js +1 -0
- package/lib/exercises/math/probaStat/stats1var/etendueTable.d.ts +8 -0
- package/lib/exercises/math/probaStat/stats1var/etendueTable.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/stats1var/etendueTable.js +89 -0
- package/lib/exercises/math/probaStat/stats1var/index.d.ts +1 -0
- package/lib/exercises/math/probaStat/stats1var/index.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats1var/index.js +1 -0
- package/lib/exercises/math/probaStat/twoStepExperiments/countIssuesTwoStepExperiment.d.ts +8 -0
- package/lib/exercises/math/probaStat/twoStepExperiments/countIssuesTwoStepExperiment.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/twoStepExperiments/countIssuesTwoStepExperiment.js +244 -0
- package/lib/exercises/math/probaStat/twoStepExperiments/index.d.ts +3 -0
- package/lib/exercises/math/probaStat/twoStepExperiments/index.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/twoStepExperiments/index.js +2 -0
- package/lib/exercises/math/probaStat/twoStepExperiments/twoStepExperimentProbas.d.ts +8 -0
- package/lib/exercises/math/probaStat/twoStepExperiments/twoStepExperimentProbas.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/twoStepExperiments/twoStepExperimentProbas.js +452 -0
- package/lib/exercises/math/python/pythonWhileStatementOperationCompletion.d.ts.map +1 -1
- package/lib/exercises/math/python/pythonWhileStatementOperationCompletion.js +3 -0
- package/lib/exercises/math/scratch/index.d.ts +2 -0
- package/lib/exercises/math/scratch/index.d.ts.map +1 -0
- package/lib/exercises/math/scratch/index.js +1 -0
- package/lib/exercises/math/scratch/scratchLoopStepsCount.d.ts +8 -0
- package/lib/exercises/math/scratch/scratchLoopStepsCount.d.ts.map +1 -0
- package/lib/exercises/math/scratch/scratchLoopStepsCount.js +85 -0
- package/lib/exercises/math/scratch/testScratch.d.ts +8 -0
- package/lib/exercises/math/scratch/testScratch.d.ts.map +1 -0
- package/lib/exercises/math/scratch/testScratch.js +79 -0
- package/lib/exercises/math/trigonometry/index.d.ts +3 -0
- package/lib/exercises/math/trigonometry/index.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/index.js +3 -0
- package/lib/exercises/math/trigonometry/trigonometrySideName.d.ts +13 -0
- package/lib/exercises/math/trigonometry/trigonometrySideName.d.ts.map +1 -0
- package/lib/exercises/math/trigonometry/trigonometrySideName.js +189 -0
- package/lib/exercises/math/trigonometry/trigonometrySohcahtoaCalcul.d.ts +13 -0
- package/lib/exercises/math/trigonometry/trigonometrySohcahtoaCalcul.d.ts.map +1 -0
- package/lib/exercises/math/trigonometry/trigonometrySohcahtoaCalcul.js +290 -0
- package/lib/exercises/math/trigonometry/trigonometrySohcahtoaUse.d.ts +18 -0
- package/lib/exercises/math/trigonometry/trigonometrySohcahtoaUse.d.ts.map +1 -0
- package/lib/exercises/math/trigonometry/trigonometrySohcahtoaUse.js +386 -0
- package/lib/index.d.ts +58 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/latexTester.d.ts.map +1 -1
- package/lib/latexTester.js +5 -0
- package/lib/math/geometry/triangles/triangle.d.ts +1 -0
- package/lib/math/geometry/triangles/triangle.d.ts.map +1 -1
- package/lib/math/geometry/triangles/triangle.js +1 -0
- package/lib/math/numbers/fractions/isDecimalFraction.d.ts +3 -0
- package/lib/math/numbers/fractions/isDecimalFraction.d.ts.map +1 -0
- package/lib/math/numbers/fractions/isDecimalFraction.js +14 -0
- package/lib/math/polynomials/polynomial.js +1 -1
- package/lib/types/keyIds.d.ts +1 -1
- package/lib/types/keyIds.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -14,4 +14,7 @@ export * from "./degreeToRadians.js";
|
|
|
14
14
|
export * from "./arcLength.js";
|
|
15
15
|
export * from "./equationCosOnRandomInterval.js";
|
|
16
16
|
export * from "./trigoFundamentalEquation.js";
|
|
17
|
+
export * from "./trigonometrySohcahtoaCalcul.js";
|
|
18
|
+
export * from "./trigonometrySideName.js";
|
|
19
|
+
export * from "./trigonometrySohcahtoaUse.js";
|
|
17
20
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/trigonometry/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kCAAkC,CAAC;AACjD,cAAc,+BAA+B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/trigonometry/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kCAAkC,CAAC;AACjD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC"}
|
|
@@ -14,3 +14,6 @@ export * from "./degreeToRadians.js";
|
|
|
14
14
|
export * from "./arcLength.js";
|
|
15
15
|
export * from "./equationCosOnRandomInterval.js";
|
|
16
16
|
export * from "./trigoFundamentalEquation.js";
|
|
17
|
+
export * from "./trigonometrySohcahtoaCalcul.js";
|
|
18
|
+
export * from "./trigonometrySideName.js";
|
|
19
|
+
export * from "./trigonometrySohcahtoaUse.js";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Exercise } from "../../../exercises/exercise.js";
|
|
2
|
+
import { TriangleIdentifiers } from "../../../math/geometry/triangles/triangle.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
sideType: string;
|
|
5
|
+
indexPoint: number;
|
|
6
|
+
triangleIdentifiers: TriangleIdentifiers;
|
|
7
|
+
};
|
|
8
|
+
type Options = {
|
|
9
|
+
sideTypes: string[];
|
|
10
|
+
};
|
|
11
|
+
export declare const trigonometrySideName: Exercise<Identifiers, Options>;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=trigonometrySideName.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trigonometrySideName.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/trigonometry/trigonometrySideName.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAeT,MAAM,6BAA6B,CAAC;AAKrC,OAAO,EAGL,mBAAmB,EACpB,MAAM,2CAA2C,CAAC;AAsCnD,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,mBAAmB,EAAE,mBAAmB,CAAC;CAC1C,CAAC;AAmKF,KAAK,OAAO,GAAG;IACb,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAeF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAgB/D,CAAC"}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { GeneratorOptionTarget, GeneratorOptionType, addValidProp, tryToAddWrongProp, } from "../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { greenDark } from "../../../geogebra/colors.js";
|
|
4
|
+
import { GeogebraConstructor } from "../../../geogebra/geogebraConstructor.js";
|
|
5
|
+
import { RightTriangleConstructor } from "../../../math/geometry/triangles/rightTriangle.js";
|
|
6
|
+
import { TriangleConstructor, } from "../../../math/geometry/triangles/triangle.js";
|
|
7
|
+
import { randint } from "../../../math/utils/random/randint.js";
|
|
8
|
+
import { random } from "../../../utils/alea/random.js";
|
|
9
|
+
import { shuffle } from "../../../utils/alea/shuffle.js";
|
|
10
|
+
const getSidePropstWithSideType = (triangle, indexPoint, sideType) => {
|
|
11
|
+
const indexSideAdjacent = 3 - indexPoint;
|
|
12
|
+
const indexSideOpposite = indexPoint;
|
|
13
|
+
const indexSideHypo = 0;
|
|
14
|
+
const sidePropsDict = {
|
|
15
|
+
adjacent: {
|
|
16
|
+
strFrench: "adjacent",
|
|
17
|
+
name: triangle.sides[indexSideAdjacent].toTex(),
|
|
18
|
+
indexSide: 3 - indexPoint,
|
|
19
|
+
},
|
|
20
|
+
opposé: {
|
|
21
|
+
strFrench: "opposé",
|
|
22
|
+
name: triangle.sides[indexSideOpposite].toTex(),
|
|
23
|
+
indexSide: indexPoint,
|
|
24
|
+
},
|
|
25
|
+
hypoténuse: {
|
|
26
|
+
strFrench: "hypoténuse",
|
|
27
|
+
name: triangle.sides[indexSideHypo].toTex(),
|
|
28
|
+
indexSide: 0,
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
const sideProps = sidePropsDict[sideType];
|
|
32
|
+
return sideProps;
|
|
33
|
+
};
|
|
34
|
+
const getInstruction = (identifiers) => {
|
|
35
|
+
const { indexPoint, sideType, triangleIdentifiers } = identifiers;
|
|
36
|
+
const triangle = TriangleConstructor.fromIdentifiers(triangleIdentifiers);
|
|
37
|
+
return `Le triangle $${triangle.name}$ est rectangle en $${triangle.points[0].name}$.
|
|
38
|
+
|
|
39
|
+
${(() => {
|
|
40
|
+
switch (sideType) {
|
|
41
|
+
case "hypoténuse": {
|
|
42
|
+
return `Nommer l'${sideType} du triangle.`;
|
|
43
|
+
}
|
|
44
|
+
default: {
|
|
45
|
+
const angleTex = `\\widehat{${triangle.points[indexPoint].name}}`;
|
|
46
|
+
return `Nommer le côté ${sideType} à l'angle $${angleTex}$.`;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
})()}`;
|
|
50
|
+
};
|
|
51
|
+
const getAnswer = (identifiers) => {
|
|
52
|
+
const { indexPoint, sideType, triangleIdentifiers } = identifiers;
|
|
53
|
+
const triangle = TriangleConstructor.fromIdentifiers(triangleIdentifiers);
|
|
54
|
+
const sideProps = getSidePropstWithSideType(triangle, indexPoint, sideType);
|
|
55
|
+
return sideProps.name;
|
|
56
|
+
};
|
|
57
|
+
const getGGBOptions = (identifiers) => {
|
|
58
|
+
const { indexPoint, triangleIdentifiers } = identifiers;
|
|
59
|
+
const triangle = RightTriangleConstructor.fromIdentifiers(triangleIdentifiers);
|
|
60
|
+
triangle.highlightAngle(indexPoint, { color: greenDark, showValue: false });
|
|
61
|
+
const ggb = new GeogebraConstructor({
|
|
62
|
+
commands: triangle.commands,
|
|
63
|
+
hideAxes: true,
|
|
64
|
+
hideGrid: true,
|
|
65
|
+
});
|
|
66
|
+
return ggb.getOptions({
|
|
67
|
+
coords: triangle.generateCoords(),
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
const getCorrectionGGBOptions = (identifiers) => {
|
|
71
|
+
const { indexPoint, sideType, triangleIdentifiers } = identifiers;
|
|
72
|
+
const triangle = RightTriangleConstructor.fromIdentifiers(triangleIdentifiers);
|
|
73
|
+
triangle.highlightAngle(indexPoint, { color: greenDark, showValue: false });
|
|
74
|
+
["adjacent", "opposé", "hypoténuse"].forEach((key) => {
|
|
75
|
+
const sideProps = getSidePropstWithSideType(triangle, indexPoint, key);
|
|
76
|
+
if (sideType === key) {
|
|
77
|
+
triangle.highlightSide(sideProps.indexSide, {
|
|
78
|
+
color: greenDark,
|
|
79
|
+
caption: sideProps.strFrench,
|
|
80
|
+
size: "small",
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
triangle.highlightSide(sideProps.indexSide, {
|
|
85
|
+
caption: sideProps.strFrench,
|
|
86
|
+
size: "tiny",
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
const ggb = new GeogebraConstructor({
|
|
91
|
+
commands: triangle.commands,
|
|
92
|
+
hideAxes: true,
|
|
93
|
+
hideGrid: true,
|
|
94
|
+
});
|
|
95
|
+
return ggb.getOptions({
|
|
96
|
+
coords: triangle.generateCoords(),
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
const getPropositions = (_, { answer, ...identifiers }) => {
|
|
100
|
+
const { indexPoint, sideType, triangleIdentifiers } = identifiers;
|
|
101
|
+
const triangle = RightTriangleConstructor.fromIdentifiers(triangleIdentifiers);
|
|
102
|
+
const propositions = [];
|
|
103
|
+
["adjacent", "opposé", "hypoténuse"].forEach((key) => {
|
|
104
|
+
const sideProps = getSidePropstWithSideType(triangle, indexPoint, key);
|
|
105
|
+
if (sideType === key) {
|
|
106
|
+
addValidProp(propositions, sideProps.name);
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
tryToAddWrongProp(propositions, sideProps.name);
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
return shuffle(propositions);
|
|
113
|
+
};
|
|
114
|
+
const getHint = () => {
|
|
115
|
+
return `- Le côté opposé à un angle est celui qui est en face de cet angle.
|
|
116
|
+
- L'hypoténuse est le côté opposé à l'angle droit.
|
|
117
|
+
- Le côté adjacent à un angle est le côté qui touche cette angle et qui n'est pas l'hypoténuse.
|
|
118
|
+
|
|
119
|
+
Si tu pivotes le triangle pour qu'il ait l'angle droit vers le haut, l'hypoténuse se retrouve en dessous ("hypo" veut dire en dessous en grec).`;
|
|
120
|
+
};
|
|
121
|
+
const getCorrection = (identifiers) => {
|
|
122
|
+
const { indexPoint, sideType, triangleIdentifiers } = identifiers;
|
|
123
|
+
const triangle = RightTriangleConstructor.fromIdentifiers(triangleIdentifiers);
|
|
124
|
+
const sideProps = getSidePropstWithSideType(triangle, indexPoint, sideType);
|
|
125
|
+
if (sideType === "hypoténuse") {
|
|
126
|
+
return `L'hypoténuse du triangle $${triangle.name}$ est $${sideProps.name}$.`;
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
const angleTex = `\\widehat{${triangle.points[indexPoint].name}}`;
|
|
130
|
+
return `Le côté ${sideType} à l'angle $${angleTex}$ est $${sideProps.name}$.`;
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
const getTrigonometrySideNameQuestion = (optsIn) => {
|
|
134
|
+
const opts = optsIn ?? optsDefault;
|
|
135
|
+
const indexPoint = randint(1, 3);
|
|
136
|
+
const sideType = random(opts.sideTypes);
|
|
137
|
+
const triangle = RightTriangleConstructor.randomNiceAngles({
|
|
138
|
+
randomName: true,
|
|
139
|
+
});
|
|
140
|
+
const identifiers = {
|
|
141
|
+
indexPoint,
|
|
142
|
+
sideType,
|
|
143
|
+
triangleIdentifiers: triangle.toIdentifiers(),
|
|
144
|
+
};
|
|
145
|
+
return getQuestionFromIdentifiers(identifiers, opts);
|
|
146
|
+
};
|
|
147
|
+
const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
148
|
+
return {
|
|
149
|
+
instruction: getInstruction(identifiers),
|
|
150
|
+
answer: getAnswer(identifiers),
|
|
151
|
+
hint: getHint(identifiers),
|
|
152
|
+
correction: getCorrection(identifiers),
|
|
153
|
+
keys: [],
|
|
154
|
+
ggbOptions: getGGBOptions(identifiers),
|
|
155
|
+
correctionGgbOptions: getCorrectionGGBOptions(identifiers),
|
|
156
|
+
answerFormat: "tex",
|
|
157
|
+
identifiers,
|
|
158
|
+
options: opts,
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
const optsDefault = {
|
|
162
|
+
sideTypes: ["adjacent", "opposé", "hypoténuse"],
|
|
163
|
+
};
|
|
164
|
+
const options = [
|
|
165
|
+
{
|
|
166
|
+
id: "sideTypes",
|
|
167
|
+
label: "Type de côté",
|
|
168
|
+
type: GeneratorOptionType.multiselect,
|
|
169
|
+
target: GeneratorOptionTarget.generation,
|
|
170
|
+
values: ["adjacent", "opposé", "hypoténuse"],
|
|
171
|
+
defaultValue: optsDefault.sideTypes,
|
|
172
|
+
},
|
|
173
|
+
];
|
|
174
|
+
export const trigonometrySideName = {
|
|
175
|
+
id: "trigonometrySideName",
|
|
176
|
+
connector: "=",
|
|
177
|
+
label: "Nommer le côté opposé/adjacent/hypoténuse dans un triangle",
|
|
178
|
+
isSingleStep: false,
|
|
179
|
+
generator: (nb, opts) => getDistinctQuestions(() => getTrigonometrySideNameQuestion(opts), nb),
|
|
180
|
+
options,
|
|
181
|
+
qcmTimer: 60,
|
|
182
|
+
freeTimer: 60,
|
|
183
|
+
getPropositions,
|
|
184
|
+
hasGeogebra: true,
|
|
185
|
+
subject: "Mathématiques",
|
|
186
|
+
hasHintAndCorrection: true,
|
|
187
|
+
getQuestionFromIdentifiers,
|
|
188
|
+
answerType: "QCU",
|
|
189
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Exercise } from "../../../exercises/exercise.js";
|
|
2
|
+
import { TriangleIdentifiers } from "../../../math/geometry/triangles/triangle.js";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
nameTrigoFunc: string;
|
|
5
|
+
indexPoint: number;
|
|
6
|
+
triangleIdentifiers: TriangleIdentifiers;
|
|
7
|
+
};
|
|
8
|
+
type Options = {
|
|
9
|
+
acceptedInputType: string;
|
|
10
|
+
};
|
|
11
|
+
export declare const trigonometrySohcahtoaCalcul: Exercise<Identifiers, Options>;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=trigonometrySohcahtoaCalcul.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trigonometrySohcahtoaCalcul.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/trigonometry/trigonometrySohcahtoaCalcul.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAKrC,OAAO,EAEL,mBAAmB,EACpB,MAAM,2CAA2C,CAAC;AA0FnD,KAAK,WAAW,GAAG;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,mBAAmB,EAAE,mBAAmB,CAAC;CAC1C,CAAC;AAqQF,KAAK,OAAO,GAAG;IACb,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC;AAiBF,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAoBtE,CAAC"}
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
import { GeneratorOptionTarget, GeneratorOptionType, addValidProp, propWhile, shuffleProps, tryToAddWrongProp, } from "../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { greenDark } from "../../../geogebra/colors.js";
|
|
4
|
+
import { GeogebraConstructor } from "../../../geogebra/geogebraConstructor.js";
|
|
5
|
+
import { RightTriangleConstructor } from "../../../math/geometry/triangles/rightTriangle.js";
|
|
6
|
+
import { TriangleConstructor, } from "../../../math/geometry/triangles/triangle.js";
|
|
7
|
+
import { randint } from "../../../math/utils/random/randint.js";
|
|
8
|
+
import { round } from "../../../math/utils/round.js";
|
|
9
|
+
import { frac } from "../../../tree/nodes/operators/fractionNode.js";
|
|
10
|
+
import { substract } from "../../../tree/nodes/operators/substractNode.js";
|
|
11
|
+
import { parseAlgebraic } from "../../../tree/parsers/latexParser.js";
|
|
12
|
+
import { random } from "../../../utils/alea/random.js";
|
|
13
|
+
const getAcceptedInputTypesSentence = (acceptedInputType) => {
|
|
14
|
+
return `Donner le résultat
|
|
15
|
+
${(() => {
|
|
16
|
+
switch (acceptedInputType) {
|
|
17
|
+
case "exact":
|
|
18
|
+
return "sous forme exacte";
|
|
19
|
+
default:
|
|
20
|
+
case "arrondi au centième":
|
|
21
|
+
return "arrondi au centième";
|
|
22
|
+
}
|
|
23
|
+
})()}`;
|
|
24
|
+
};
|
|
25
|
+
const getFormattedNode = (node, acceptedInputType) => {
|
|
26
|
+
switch (acceptedInputType) {
|
|
27
|
+
case "exact":
|
|
28
|
+
return node;
|
|
29
|
+
default:
|
|
30
|
+
case "arrondi au centième":
|
|
31
|
+
return round(node.evaluate(), 2).toTree();
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const trigoFuncsDict = {
|
|
35
|
+
sin: {
|
|
36
|
+
strFrenchThe: "le sinus",
|
|
37
|
+
funcTex: (content) => `\\sin(${content})`,
|
|
38
|
+
funcIndexesSegment: (indexPoint) => {
|
|
39
|
+
switch (indexPoint) {
|
|
40
|
+
case 1:
|
|
41
|
+
return [1, 0];
|
|
42
|
+
case 2:
|
|
43
|
+
return [2, 0];
|
|
44
|
+
default:
|
|
45
|
+
throw new Error("Unsupported indexPoint: " + indexPoint);
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
texEqFrac: "\\sin(\\text{angle}) = \\frac{\\text{opposé}}{\\text{hypoténuse}}",
|
|
49
|
+
},
|
|
50
|
+
cos: {
|
|
51
|
+
strFrenchThe: "le cosinus",
|
|
52
|
+
funcTex: (content) => `\\cos(${content})`,
|
|
53
|
+
funcIndexesSegment: (indexPoint) => {
|
|
54
|
+
switch (indexPoint) {
|
|
55
|
+
case 1:
|
|
56
|
+
return [2, 0];
|
|
57
|
+
case 2:
|
|
58
|
+
return [1, 0];
|
|
59
|
+
default:
|
|
60
|
+
throw new Error("Unsupported indexPoint: " + indexPoint);
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
texEqFrac: "\\cos(\\text{angle}) = \\frac{\\text{adjacent}}{\\text{hypoténuse}}",
|
|
64
|
+
},
|
|
65
|
+
tan: {
|
|
66
|
+
strFrenchThe: "la tangente",
|
|
67
|
+
funcTex: (content) => `\\tan(${content})`,
|
|
68
|
+
funcIndexesSegment: (indexPoint) => {
|
|
69
|
+
switch (indexPoint) {
|
|
70
|
+
case 1:
|
|
71
|
+
return [1, 2];
|
|
72
|
+
case 2:
|
|
73
|
+
return [2, 1];
|
|
74
|
+
default:
|
|
75
|
+
throw new Error("Unsupported indexPoint: " + indexPoint);
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
texEqFrac: "\\tan(\\text{angle}) = \\frac{\\text{opposé}}{\\text{adjacent}}",
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
const getInstruction = (identifiers, optsIn) => {
|
|
82
|
+
const opts = optsIn ?? optsDefault;
|
|
83
|
+
const { nameTrigoFunc, indexPoint, triangleIdentifiers } = identifiers;
|
|
84
|
+
const triangle = TriangleConstructor.fromIdentifiers(triangleIdentifiers);
|
|
85
|
+
const texAngle = `\\widehat{${triangle.points[indexPoint].toTex()}}`;
|
|
86
|
+
const trigoFunc = trigoFuncsDict[nameTrigoFunc];
|
|
87
|
+
return `Le triangle $${triangle.name}$ rectangle en $${triangle.points[0].name}$ est tel que :
|
|
88
|
+
|
|
89
|
+
${triangle.sides.map((side) => `- $${side.toLengthTex()}\\ \\textrm{cm}$`)
|
|
90
|
+
.join(`
|
|
91
|
+
|
|
92
|
+
`)}
|
|
93
|
+
|
|
94
|
+
Calculer ${trigoFunc.strFrenchThe} de l'angle $${texAngle}$.
|
|
95
|
+
${getAcceptedInputTypesSentence(opts.acceptedInputType)}.`;
|
|
96
|
+
};
|
|
97
|
+
const getAnswerNode = (identifiers) => {
|
|
98
|
+
const { nameTrigoFunc, indexPoint, triangleIdentifiers } = identifiers;
|
|
99
|
+
const triangle = TriangleConstructor.fromIdentifiers(triangleIdentifiers);
|
|
100
|
+
const trigoFunc = trigoFuncsDict[nameTrigoFunc];
|
|
101
|
+
const indexesSegment = trigoFunc.funcIndexesSegment(indexPoint);
|
|
102
|
+
const [nodeNum, nodeDen] = indexesSegment.map((i) => triangle.sides[i].getLengthNode());
|
|
103
|
+
const fractionNode = frac(nodeNum, nodeDen);
|
|
104
|
+
return fractionNode;
|
|
105
|
+
};
|
|
106
|
+
const getFormattedAnswerNode = (identifiers, opts) => {
|
|
107
|
+
return getFormattedNode(getAnswerNode(identifiers), opts.acceptedInputType);
|
|
108
|
+
};
|
|
109
|
+
const getAnswer = (identifiers, optsIn) => {
|
|
110
|
+
const opts = optsIn ?? optsDefault;
|
|
111
|
+
return getFormattedAnswerNode(identifiers, opts).toTex();
|
|
112
|
+
};
|
|
113
|
+
const getHint = () => {
|
|
114
|
+
return `Identifie le côté opposé, le côté adjacent et l'hypoténuse du triangle. Puis utilise la bonne formule de trigonométrie, en te rappelant de :
|
|
115
|
+
|
|
116
|
+
$$
|
|
117
|
+
\\text{SOHCAHTOA}
|
|
118
|
+
$$`;
|
|
119
|
+
};
|
|
120
|
+
const getCorrection = (identifiers, optsIn) => {
|
|
121
|
+
const opts = optsIn ?? optsDefault;
|
|
122
|
+
const { nameTrigoFunc, indexPoint, triangleIdentifiers } = identifiers;
|
|
123
|
+
//sohcahtoa
|
|
124
|
+
//
|
|
125
|
+
const triangle = RightTriangleConstructor.fromIdentifiers(triangleIdentifiers);
|
|
126
|
+
const trigoFunc = trigoFuncsDict[nameTrigoFunc];
|
|
127
|
+
const indexesSegment = trigoFunc.funcIndexesSegment(indexPoint);
|
|
128
|
+
const [segmentNum, segmentDen] = indexesSegment.map((i) => triangle.sides[i]);
|
|
129
|
+
const [nameNum, nameDen] = [segmentNum, segmentDen].map((segment) => `${segment.pointA.name}${segment.pointB.name}`);
|
|
130
|
+
const [nodeNum, nodeDen] = [segmentNum, segmentDen].map((segment) => segment.getLengthNode());
|
|
131
|
+
const fractionNode = frac(nodeNum, nodeDen);
|
|
132
|
+
const texAngle = `\\widehat{${triangle.points[indexPoint].toTex()}}`;
|
|
133
|
+
return `Le triangle $${triangle.name}$ est un triangle rectangle.
|
|
134
|
+
On peut donc utiliser la formule qui donne ${trigoFunc.strFrenchThe} d'un des angles non-droits comme un rapport des longueurs de côtés du triangle :
|
|
135
|
+
|
|
136
|
+
$$
|
|
137
|
+
${trigoFunc.texEqFrac}
|
|
138
|
+
$$
|
|
139
|
+
|
|
140
|
+
On a donc :
|
|
141
|
+
|
|
142
|
+
$$
|
|
143
|
+
${trigoFunc.funcTex(texAngle)} = \\frac{${nameNum}}{${nameDen}}
|
|
144
|
+
$$
|
|
145
|
+
|
|
146
|
+
$$
|
|
147
|
+
${trigoFunc.funcTex(texAngle)} = ${fractionNode.toTex()}
|
|
148
|
+
$$
|
|
149
|
+
|
|
150
|
+
${(() => {
|
|
151
|
+
if (opts.acceptedInputType === "arrondi au centième") {
|
|
152
|
+
return `Arrondi au centième, cela donne :
|
|
153
|
+
|
|
154
|
+
$$
|
|
155
|
+
${trigoFunc.funcTex(texAngle)} \\approx ${getFormattedAnswerNode(identifiers, opts).toTex()}
|
|
156
|
+
$$
|
|
157
|
+
|
|
158
|
+
`;
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
return ``;
|
|
162
|
+
}
|
|
163
|
+
})()}
|
|
164
|
+
|
|
165
|
+
`;
|
|
166
|
+
};
|
|
167
|
+
const getGGBOptions = (identifiers) => {
|
|
168
|
+
const { indexPoint, triangleIdentifiers } = identifiers;
|
|
169
|
+
const triangle = RightTriangleConstructor.fromIdentifiers(triangleIdentifiers);
|
|
170
|
+
triangle.highlightAngle(indexPoint, { color: greenDark, showValue: false });
|
|
171
|
+
const ggb = new GeogebraConstructor({
|
|
172
|
+
commands: triangle.commands,
|
|
173
|
+
hideAxes: true,
|
|
174
|
+
hideGrid: true,
|
|
175
|
+
});
|
|
176
|
+
return ggb.getOptions({
|
|
177
|
+
coords: triangle.generateCoords(),
|
|
178
|
+
});
|
|
179
|
+
};
|
|
180
|
+
// const getCorrectionGGBOptions: GetGGBOptions<Identifiers, Options> = (
|
|
181
|
+
// identifiers,
|
|
182
|
+
// ) => {
|
|
183
|
+
// const { nameTrigoFunc, indexPoint, triangleIdentifiers } = identifiers;
|
|
184
|
+
// const triangle =
|
|
185
|
+
// RightTriangleConstructor.fromIdentifiers(triangleIdentifiers);
|
|
186
|
+
// const trigoFunc = trigoFuncsDict[nameTrigoFunc];
|
|
187
|
+
// const indexesSegment = trigoFunc.funcIndexesSegment(indexPoint);
|
|
188
|
+
// triangle.highlightAngle(indexPoint, { color: greenDark, showValue: false });
|
|
189
|
+
// indexesSegment.forEach((i) => {
|
|
190
|
+
// triangle.highlightSide(i, { color: greenDark });
|
|
191
|
+
// });
|
|
192
|
+
// const ggb = new GeogebraConstructor({
|
|
193
|
+
// commands: triangle.commands,
|
|
194
|
+
// hideAxes: true,
|
|
195
|
+
// hideGrid: true,
|
|
196
|
+
// });
|
|
197
|
+
// return ggb.getOptions({
|
|
198
|
+
// coords: triangle.generateCoords(),
|
|
199
|
+
// });
|
|
200
|
+
// };
|
|
201
|
+
const getPropositions = (n, { answer, ...identifiers }, optsIn) => {
|
|
202
|
+
const opts = optsIn ?? optsDefault;
|
|
203
|
+
const format = (node) => getFormattedNode(node, opts.acceptedInputType);
|
|
204
|
+
const { triangleIdentifiers } = identifiers;
|
|
205
|
+
const triangle = RightTriangleConstructor.fromIdentifiers(triangleIdentifiers);
|
|
206
|
+
const propositions = [];
|
|
207
|
+
const answerNode = getAnswerNode(identifiers);
|
|
208
|
+
addValidProp(propositions, format(answerNode).toTex());
|
|
209
|
+
["sin", "cos", "tan"].forEach((nameTrigoFunc) => {
|
|
210
|
+
const trigoFunc = trigoFuncsDict[nameTrigoFunc];
|
|
211
|
+
[1, 2].forEach((indexPoint) => {
|
|
212
|
+
const indexesSegment = trigoFunc.funcIndexesSegment(indexPoint);
|
|
213
|
+
const [nodeNum, nodeDen] = indexesSegment.map((i) => triangle.sides[i].getLengthNode());
|
|
214
|
+
tryToAddWrongProp(propositions, format(frac(nodeNum, nodeDen)).toTex());
|
|
215
|
+
});
|
|
216
|
+
});
|
|
217
|
+
propWhile(propositions, n, () => {
|
|
218
|
+
tryToAddWrongProp(propositions, `${(round(randint(11, 100) / 100, 2) + "").replace(".", ",")}`);
|
|
219
|
+
});
|
|
220
|
+
return shuffleProps(propositions, n);
|
|
221
|
+
};
|
|
222
|
+
const isAnswerValid = (ans, { answer, ...identifiers }, optsIn) => {
|
|
223
|
+
const opts = optsIn ?? optsDefault;
|
|
224
|
+
try {
|
|
225
|
+
const nodeAns = parseAlgebraic(ans);
|
|
226
|
+
const nodeAnswer = getFormattedAnswerNode(identifiers, opts);
|
|
227
|
+
return (substract(nodeAns.simplify(), nodeAnswer.simplify())
|
|
228
|
+
.simplify()
|
|
229
|
+
.evaluate() === 0);
|
|
230
|
+
}
|
|
231
|
+
catch (_) {
|
|
232
|
+
return false;
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
const getTrigonometrySohcahtoaCalculQuestion = () => {
|
|
236
|
+
const indexPoint = randint(1, 3);
|
|
237
|
+
const nameTrigoFunc = random(Object.keys(trigoFuncsDict));
|
|
238
|
+
const triangle = RightTriangleConstructor.randomNiceSides({
|
|
239
|
+
randomName: true,
|
|
240
|
+
});
|
|
241
|
+
const identifiers = {
|
|
242
|
+
indexPoint,
|
|
243
|
+
nameTrigoFunc,
|
|
244
|
+
triangleIdentifiers: triangle.toIdentifiers(),
|
|
245
|
+
};
|
|
246
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
247
|
+
};
|
|
248
|
+
const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
249
|
+
return {
|
|
250
|
+
instruction: getInstruction(identifiers, opts),
|
|
251
|
+
answer: getAnswer(identifiers, opts),
|
|
252
|
+
hint: getHint(identifiers, opts),
|
|
253
|
+
correction: getCorrection(identifiers, opts),
|
|
254
|
+
keys: [],
|
|
255
|
+
ggbOptions: getGGBOptions(identifiers, opts),
|
|
256
|
+
// correctionGgbOptions: getCorrectionGGBOptions(identifiers, opts),
|
|
257
|
+
answerFormat: "tex",
|
|
258
|
+
identifiers,
|
|
259
|
+
options: opts,
|
|
260
|
+
};
|
|
261
|
+
};
|
|
262
|
+
const optsDefault = {
|
|
263
|
+
acceptedInputType: "arrondi au centième",
|
|
264
|
+
};
|
|
265
|
+
const options = [
|
|
266
|
+
{
|
|
267
|
+
id: "acceptedInputType",
|
|
268
|
+
label: "Format du résultat",
|
|
269
|
+
target: GeneratorOptionTarget.generation,
|
|
270
|
+
type: GeneratorOptionType.select,
|
|
271
|
+
values: ["exact", "arrondi au centième"],
|
|
272
|
+
defaultValue: optsDefault.acceptedInputType,
|
|
273
|
+
},
|
|
274
|
+
];
|
|
275
|
+
export const trigonometrySohcahtoaCalcul = {
|
|
276
|
+
id: "trigonometrySohcahtoaCalcul",
|
|
277
|
+
connector: "=",
|
|
278
|
+
label: "Calculer le cosinus/sinus/tangente d'un angle dans un triangle rectangle",
|
|
279
|
+
isSingleStep: false,
|
|
280
|
+
generator: (nb, opts) => getDistinctQuestions(() => getTrigonometrySohcahtoaCalculQuestion(opts), nb),
|
|
281
|
+
options,
|
|
282
|
+
qcmTimer: 60,
|
|
283
|
+
freeTimer: 60,
|
|
284
|
+
getPropositions,
|
|
285
|
+
isAnswerValid,
|
|
286
|
+
hasGeogebra: true,
|
|
287
|
+
subject: "Mathématiques",
|
|
288
|
+
hasHintAndCorrection: true,
|
|
289
|
+
getQuestionFromIdentifiers,
|
|
290
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Exercise } from "../../../exercises/exercise.js";
|
|
2
|
+
import { TriangleIdentifiers } from "../../../math/geometry/triangles/triangle.js";
|
|
3
|
+
type Options = {
|
|
4
|
+
questionType: "frac" | "func";
|
|
5
|
+
targetTypes: string[];
|
|
6
|
+
};
|
|
7
|
+
type Identifiers = {
|
|
8
|
+
questionType: "frac" | "func";
|
|
9
|
+
targetType: string;
|
|
10
|
+
indexTarget: number;
|
|
11
|
+
indexesGivenSegments: number[];
|
|
12
|
+
indexGivenAngle: number | undefined;
|
|
13
|
+
triangleIdentifiers: TriangleIdentifiers;
|
|
14
|
+
};
|
|
15
|
+
export declare const trigonometrySohcahtoaUseFrac: Exercise<Identifiers, Options>;
|
|
16
|
+
export declare const trigonometrySohcahtoaUseFunc: Exercise<Identifiers, Options>;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=trigonometrySohcahtoaUse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trigonometrySohcahtoaUse.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/trigonometry/trigonometrySohcahtoaUse.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAKrC,OAAO,EAEL,mBAAmB,EACpB,MAAM,2CAA2C,CAAC;AAiInD,KAAK,OAAO,GAAG;IACb,YAAY,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9B,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,oBAAoB,EAAE,MAAM,EAAE,CAAC;IAC/B,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,mBAAmB,EAAE,mBAAmB,CAAC;CAC1C,CAAC;AAiZF,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAsBvE,CAAC;AAEF,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAsBvE,CAAC"}
|