math-exercises 2.2.69 → 2.2.70
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/exercises/math/calcul/arithmetics/divisorsList.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/divisorsList.js +2 -1
- package/lib/exercises/math/calcul/arithmetics/primeNumbers.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/primeNumbers.js +2 -1
- package/lib/exercises/math/calcul/fractions/fractionsOperations.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionsOperations.js +1 -0
- package/lib/exercises/math/calculLitteral/equation/equationType1Exercise.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equationType1Exercise.js +3 -6
- package/lib/exercises/math/calculLitteral/equation/equationType2Exercise.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equationType2Exercise.js +3 -8
- package/lib/exercises/math/calculLitteral/equation/equationType3Exercise.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equationType3Exercise.js +7 -9
- package/lib/exercises/math/calculLitteral/equation/equationType4Exercise.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equationType4Exercise.js +6 -19
- package/lib/exercises/math/calculLitteral/factorisation/factoByX.d.ts +8 -0
- package/lib/exercises/math/calculLitteral/factorisation/factoByX.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/factorisation/factoByX.js +146 -0
- package/lib/exercises/math/calculLitteral/factorisation/index.d.ts +1 -0
- package/lib/exercises/math/calculLitteral/factorisation/index.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/factorisation/index.js +1 -0
- package/lib/exercises/math/functions/absolute/absolueValueAffineEquation.d.ts.map +1 -1
- package/lib/exercises/math/functions/absolute/absolueValueAffineEquation.js +2 -5
- package/lib/exercises/math/functions/trinoms/coefficientsIdentification.js +3 -3
- package/lib/exercises/math/functions/trinoms/findSecondRoot.d.ts +2 -2
- package/lib/exercises/math/functions/trinoms/findSecondRoot.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/findSecondRoot.js +5 -5
- package/lib/exercises/math/functions/trinoms/rootsProduct.d.ts +2 -2
- package/lib/exercises/math/functions/trinoms/rootsProduct.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/rootsProduct.js +6 -6
- package/lib/exercises/math/functions/trinoms/rootsSum.d.ts +2 -2
- package/lib/exercises/math/functions/trinoms/rootsSum.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/rootsSum.js +7 -7
- package/lib/exercises/math/functions/trinoms/trinomSignFromRoots.js +6 -6
- package/lib/exercises/math/geometry/areas/rightTriangleArea.d.ts +3 -1
- package/lib/exercises/math/geometry/areas/rightTriangleArea.d.ts.map +1 -1
- package/lib/exercises/math/geometry/areas/rightTriangleArea.js +10 -22
- package/lib/exercises/math/geometry/areas/triangleArea.d.ts +6 -1
- package/lib/exercises/math/geometry/areas/triangleArea.d.ts.map +1 -1
- package/lib/exercises/math/geometry/areas/triangleArea.js +34 -48
- package/lib/exercises/math/geometry/index.d.ts +1 -0
- package/lib/exercises/math/geometry/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/index.js +1 -0
- package/lib/exercises/math/geometry/pythagore/isTriangleRight.d.ts.map +1 -1
- package/lib/exercises/math/geometry/pythagore/pythagore.d.ts +0 -3
- package/lib/exercises/math/geometry/pythagore/pythagore.d.ts.map +1 -1
- package/lib/exercises/math/geometry/pythagore/pythagore.js +19 -25
- package/lib/exercises/math/geometry/pythagore/pythagoreCalcul.d.ts +1 -2
- package/lib/exercises/math/geometry/pythagore/pythagoreCalcul.d.ts.map +1 -1
- package/lib/exercises/math/geometry/pythagore/pythagoreCalcul.js +30 -65
- package/lib/exercises/math/geometry/quadrilaterals/index.d.ts +2 -0
- package/lib/exercises/math/geometry/quadrilaterals/index.d.ts.map +1 -0
- package/lib/exercises/math/geometry/quadrilaterals/index.js +17 -0
- package/lib/exercises/math/geometry/quadrilaterals/quadrilateralRecognition.d.ts +14 -0
- package/lib/exercises/math/geometry/quadrilaterals/quadrilateralRecognition.d.ts.map +1 -0
- package/lib/exercises/math/geometry/quadrilaterals/quadrilateralRecognition.js +221 -0
- package/lib/exercises/math/geometry/thales/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/thales/index.js +0 -1
- package/lib/exercises/math/geometry/thales/thales.js +2 -2
- package/lib/exercises/math/geometry/thales/thalesCalcul.d.ts +3 -4
- package/lib/exercises/math/geometry/thales/thalesCalcul.d.ts.map +1 -1
- package/lib/exercises/math/geometry/thales/thalesCalcul.js +69 -78
- package/lib/exercises/math/geometry/volumes/parallelepipedVolume.d.ts.map +1 -1
- package/lib/exercises/math/geometry/volumes/parallelepipedVolume.js +4 -3
- package/lib/exercises/math/geometry/volumes/sphereVolume.js +1 -1
- package/lib/exercises/math/trigonometry/trigonometry.d.ts +2 -3
- package/lib/exercises/math/trigonometry/trigonometry.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/trigonometry.js +32 -31
- package/lib/exercises/math/trigonometry/trigonometryAngleCalcul.d.ts +3 -2
- package/lib/exercises/math/trigonometry/trigonometryAngleCalcul.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/trigonometryAngleCalcul.js +18 -28
- package/lib/exercises/math/trigonometry/trigonometrySideCalcul.d.ts +5 -4
- package/lib/exercises/math/trigonometry/trigonometrySideCalcul.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/trigonometrySideCalcul.js +60 -56
- package/lib/exercises/pc/index.d.ts +0 -4
- package/lib/exercises/pc/index.d.ts.map +1 -1
- package/lib/exercises/pc/index.js +6 -4
- package/lib/exercises/utils/geogebra/toGGBCommandsProps.d.ts +1 -0
- package/lib/exercises/utils/geogebra/toGGBCommandsProps.d.ts.map +1 -1
- package/lib/exercises/vea/equationVEA.d.ts +2 -0
- package/lib/exercises/vea/equationVEA.d.ts.map +1 -0
- package/lib/exercises/vea/equationVEA.js +24 -0
- package/lib/exercises/vea/rationalVEA.d.ts.map +1 -1
- package/lib/exercises/vea/sqrtVEA.d.ts +6 -0
- package/lib/exercises/vea/sqrtVEA.d.ts.map +1 -0
- package/lib/exercises/vea/sqrtVEA.js +30 -0
- package/lib/geogebra/geogebraConstructor.d.ts +2 -0
- package/lib/geogebra/geogebraConstructor.d.ts.map +1 -1
- package/lib/geogebra/geogebraConstructor.js +7 -0
- package/lib/index.d.ts +28 -46
- package/lib/index.d.ts.map +1 -1
- package/lib/math/complex/complex.d.ts +1 -1
- package/lib/math/geometry/angle.d.ts +26 -0
- package/lib/math/geometry/angle.d.ts.map +1 -0
- package/lib/math/geometry/angle.js +73 -0
- package/lib/math/geometry/line.d.ts +5 -1
- package/lib/math/geometry/line.d.ts.map +1 -1
- package/lib/math/geometry/line.js +17 -0
- package/lib/math/geometry/parallelogram.d.ts +23 -0
- package/lib/math/geometry/parallelogram.d.ts.map +1 -0
- package/lib/math/geometry/parallelogram.js +70 -0
- package/lib/math/geometry/point.d.ts +3 -0
- package/lib/math/geometry/point.d.ts.map +1 -1
- package/lib/math/geometry/point.js +16 -0
- package/lib/math/geometry/quadrilateral.d.ts +15 -0
- package/lib/math/geometry/quadrilateral.d.ts.map +1 -0
- package/lib/math/geometry/quadrilateral.js +38 -0
- package/lib/math/geometry/rectangle.d.ts +24 -0
- package/lib/math/geometry/rectangle.d.ts.map +1 -0
- package/lib/math/geometry/rectangle.js +64 -0
- package/lib/math/geometry/rhombus.d.ts +19 -0
- package/lib/math/geometry/rhombus.d.ts.map +1 -0
- package/lib/math/geometry/rhombus.js +46 -0
- package/lib/math/geometry/rightTriangle.d.ts +31 -0
- package/lib/math/geometry/rightTriangle.d.ts.map +1 -0
- package/lib/math/geometry/rightTriangle.js +113 -0
- package/lib/math/geometry/segment.d.ts +24 -6
- package/lib/math/geometry/segment.d.ts.map +1 -1
- package/lib/math/geometry/segment.js +70 -4
- package/lib/math/geometry/square.d.ts +22 -0
- package/lib/math/geometry/square.d.ts.map +1 -0
- package/lib/math/geometry/square.js +43 -0
- package/lib/math/geometry/triangle.d.ts +45 -45
- package/lib/math/geometry/triangle.d.ts.map +1 -1
- package/lib/math/geometry/triangle.js +159 -186
- package/lib/math/geometry/vector.d.ts +2 -2
- package/lib/math/geometry/vector.d.ts.map +1 -1
- package/lib/math/geometry/vector.js +18 -9
- package/lib/math/numbers/rationals/rational.d.ts +1 -1
- package/lib/math/numbers/reals/extendedRingElement.d.ts +1 -1
- package/lib/math/numbers/reals/real.d.ts.map +1 -1
- package/lib/math/numbers/reals/real.js +3 -0
- package/lib/math/polynomials/generalAffine.d.ts.map +1 -1
- package/lib/math/polynomials/generalAffine.js +1 -1
- package/lib/math/polynomials/polynomial.d.ts +1 -1
- package/lib/math/polynomials/trinom.d.ts +2 -2
- package/lib/math/utils/geometry/pythagoricianTriplets.d.ts +1 -0
- package/lib/math/utils/geometry/pythagoricianTriplets.d.ts.map +1 -1
- package/lib/math/utils/geometry/pythagoricianTriplets.js +14 -1
- package/lib/math/utils/random/randfloat.d.ts +1 -1
- package/lib/math/utils/random/randfloat.d.ts.map +1 -1
- package/lib/math/utils/random/randfloat.js +8 -1
- package/lib/math/utils/random/randint.d.ts +8 -1
- package/lib/math/utils/random/randint.d.ts.map +1 -1
- package/lib/math/utils/random/randint.js +6 -1
- package/lib/playground.d.ts.map +1 -1
- package/lib/playground.js +1 -8
- package/lib/tree/nodes/functions/absNode.d.ts +1 -1
- package/lib/tree/nodes/functions/functionNode.d.ts +2 -2
- package/lib/tree/nodes/functions/functionNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/oppositeNode.d.ts +5 -5
- package/lib/tree/nodes/functions/oppositeNode.d.ts.map +1 -1
- package/lib/tree/nodes/node.d.ts +3 -1
- package/lib/tree/nodes/node.d.ts.map +1 -1
- package/lib/tree/nodes/node.js +1 -0
- package/lib/tree/nodes/nodeConstructor.d.ts.map +1 -1
- package/lib/tree/nodes/nodeConstructor.js +4 -0
- package/lib/tree/nodes/numbers/numberNode.d.ts +2 -0
- package/lib/tree/nodes/numbers/numberNode.d.ts.map +1 -1
- package/lib/tree/nodes/numbers/numberNode.js +6 -1
- package/lib/tree/nodes/operators/addNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/addNode.js +2 -1
- package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/multiplyNode.js +3 -3
- package/lib/tree/nodes/polynomials/trinomNode.d.ts +70 -0
- package/lib/tree/nodes/polynomials/trinomNode.d.ts.map +1 -0
- package/lib/tree/nodes/polynomials/trinomNode.js +156 -0
- package/lib/tree/nodes/variables/variableNode.d.ts.map +1 -1
- package/lib/tree/nodes/variables/variableNode.js +1 -1
- package/lib/tree/parsers/affineParser.d.ts.map +1 -1
- package/lib/tree/parsers/affineParser.js +1 -0
- package/lib/tree/parsers/discreteSetParser.d.ts +3 -0
- package/lib/tree/parsers/discreteSetParser.d.ts.map +1 -0
- package/lib/tree/parsers/discreteSetParser.js +23 -0
- package/lib/tree/parsers/equationSolutionParser.d.ts +1 -1
- package/lib/tree/parsers/equationSolutionParser.d.ts.map +1 -1
- package/lib/tree/parsers/equationSolutionParser.js +15 -4
- package/lib/tree/parsers/latexParser.d.ts +5 -1
- package/lib/tree/parsers/latexParser.d.ts.map +1 -1
- package/lib/tree/parsers/latexParser.js +17 -3
- package/lib/tree/parsers/monomParser.js +2 -2
- package/lib/tree/parsers/powerParser.d.ts +1 -1
- package/lib/tree/parsers/rationalParser.d.ts +1 -1
- package/lib/tree/parsers/rationalParser.d.ts.map +1 -1
- package/lib/tree/parsers/rationalParser.js +28 -24
- package/lib/tree/parsers/sqrtParser.d.ts +9 -0
- package/lib/tree/parsers/sqrtParser.d.ts.map +1 -0
- package/lib/tree/parsers/sqrtParser.js +52 -0
- package/lib/tree/parsers/trinomParser.d.ts +1 -1
- package/lib/tree/parsers/trinomParser.d.ts.map +1 -1
- package/lib/tree/parsers/trinomParser.js +14 -2
- package/lib/tree/utilities/functionComposition.d.ts +1 -1
- package/lib/tree/utilities/functionComposition.d.ts.map +1 -1
- package/lib/utils/arrays/rotation.d.ts +8 -0
- package/lib/utils/arrays/rotation.d.ts.map +1 -0
- package/lib/utils/arrays/rotation.js +17 -0
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ exports.rootsSum = void 0;
|
|
|
4
4
|
const exercise_1 = require("../../../../exercises/exercise");
|
|
5
5
|
const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
|
|
6
6
|
const rationalVEA_1 = require("../../../../exercises/vea/rationalVEA");
|
|
7
|
-
const
|
|
7
|
+
const trinomNode_1 = require("../../../../tree/nodes/polynomials/trinomNode");
|
|
8
8
|
const randint_1 = require("../../../../math/utils/random/randint");
|
|
9
9
|
const oppositeNode_1 = require("../../../../tree/nodes/functions/oppositeNode");
|
|
10
10
|
const fractionNode_1 = require("../../../../tree/nodes/operators/fractionNode");
|
|
@@ -12,7 +12,7 @@ const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
|
|
|
12
12
|
const getPropositions = (n, { answer, trinomIdentifiers }) => {
|
|
13
13
|
const propositions = [];
|
|
14
14
|
(0, exercise_1.addValidProp)(propositions, answer);
|
|
15
|
-
const trinom =
|
|
15
|
+
const trinom = trinomNode_1.TrinomNodeConstructor.fromIdentifiers(trinomIdentifiers);
|
|
16
16
|
(0, exercise_1.tryToAddWrongProp)(propositions, (0, fractionNode_1.frac)(trinom.b, trinom.a).simplify().toTex());
|
|
17
17
|
(0, exercise_1.tryToAddWrongProp)(propositions, (0, fractionNode_1.frac)(trinom.c, trinom.a).simplify().toTex());
|
|
18
18
|
(0, exercise_1.tryToAddWrongProp)(propositions, (0, fractionNode_1.frac)((0, oppositeNode_1.opposite)(trinom.b), (0, multiplyNode_1.multiply)(2, trinom.a)).simplify().toTex());
|
|
@@ -23,13 +23,13 @@ const getPropositions = (n, { answer, trinomIdentifiers }) => {
|
|
|
23
23
|
};
|
|
24
24
|
const getAnswer = (identifiers) => {
|
|
25
25
|
const { trinomIdentifiers } = identifiers;
|
|
26
|
-
const trinom =
|
|
26
|
+
const trinom = trinomNode_1.TrinomNodeConstructor.fromIdentifiers(trinomIdentifiers);
|
|
27
27
|
const ans = (0, fractionNode_1.frac)((0, oppositeNode_1.opposite)(trinom.b), trinom.a).simplify().toTex();
|
|
28
28
|
return ans;
|
|
29
29
|
};
|
|
30
30
|
const getInstruction = (identifiers) => {
|
|
31
31
|
const { trinomIdentifiers } = identifiers;
|
|
32
|
-
const trinom =
|
|
32
|
+
const trinom = trinomNode_1.TrinomNodeConstructor.fromIdentifiers(trinomIdentifiers);
|
|
33
33
|
return `Soit $f$ la fonction définie sur $\\mathbb{R}$ par :
|
|
34
34
|
|
|
35
35
|
$$
|
|
@@ -49,7 +49,7 @@ $$`;
|
|
|
49
49
|
};
|
|
50
50
|
const getCorrection = (identifiers) => {
|
|
51
51
|
const { trinomIdentifiers } = identifiers;
|
|
52
|
-
const trinom =
|
|
52
|
+
const trinom = trinomNode_1.TrinomNodeConstructor.fromIdentifiers(trinomIdentifiers);
|
|
53
53
|
const aTex = trinom.a.toTex();
|
|
54
54
|
const bTex = trinom.b.toTex();
|
|
55
55
|
const ans = (0, fractionNode_1.frac)((0, oppositeNode_1.opposite)(trinom.b), trinom.a);
|
|
@@ -77,8 +77,8 @@ const getRootsSumQuestion = (ops) => {
|
|
|
77
77
|
const a = (0, randint_1.randint)(-10, 10, [0]);
|
|
78
78
|
const b = (0, randint_1.randint)(-10, 10);
|
|
79
79
|
const c = (a / Math.abs(a)) * (0, randint_1.randint)(-10, 0, !b ? [0] : []);
|
|
80
|
-
// const trinom =
|
|
81
|
-
const trinom = new
|
|
80
|
+
// const trinom = TrinomNodeConstructor.randomNiceRoots(2);
|
|
81
|
+
const trinom = new trinomNode_1.TrinomNode(a, b, c);
|
|
82
82
|
const identifiers = {
|
|
83
83
|
trinomIdentifiers: trinom.toIdentifiers(),
|
|
84
84
|
};
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.trinomSignFromRoots = void 0;
|
|
4
4
|
const exercise_1 = require("../../../../exercises/exercise");
|
|
5
5
|
const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
|
|
6
|
-
const
|
|
6
|
+
const trinomNode_1 = require("../../../../tree/nodes/polynomials/trinomNode");
|
|
7
7
|
const intervals_1 = require("../../../../math/sets/intervals/intervals");
|
|
8
8
|
const infiniteNode_1 = require("../../../../tree/nodes/numbers/infiniteNode");
|
|
9
9
|
const closure_1 = require("../../../../tree/nodes/sets/closure");
|
|
@@ -13,7 +13,7 @@ const coinFlip_1 = require("../../../../utils/alea/coinFlip");
|
|
|
13
13
|
const getPropositions = (n, { answer, trinomCoeffs, isAskingPositive }) => {
|
|
14
14
|
const propositions = [];
|
|
15
15
|
(0, exercise_1.addValidProp)(propositions, answer);
|
|
16
|
-
const trinom =
|
|
16
|
+
const trinom = trinomNode_1.TrinomNodeConstructor.fromCoeffs(trinomCoeffs);
|
|
17
17
|
const roots = trinom.getRoots();
|
|
18
18
|
const a = trinomCoeffs[2];
|
|
19
19
|
const b = trinomCoeffs[1];
|
|
@@ -26,7 +26,7 @@ const getPropositions = (n, { answer, trinomCoeffs, isAskingPositive }) => {
|
|
|
26
26
|
return (0, exercise_1.shuffleProps)(propositions, n);
|
|
27
27
|
};
|
|
28
28
|
const getAnswerNode = (identifiers) => {
|
|
29
|
-
const trinom =
|
|
29
|
+
const trinom = trinomNode_1.TrinomNodeConstructor.fromCoeffs(identifiers.trinomCoeffs);
|
|
30
30
|
const roots = trinom.getRoots();
|
|
31
31
|
const a = identifiers.trinomCoeffs[2];
|
|
32
32
|
return a > 0 === identifiers.isAskingPositive
|
|
@@ -40,7 +40,7 @@ const getAnswer = (identifiers) => {
|
|
|
40
40
|
return getAnswerNode(identifiers).toTex();
|
|
41
41
|
};
|
|
42
42
|
const getInstruction = (identifiers) => {
|
|
43
|
-
const trinom =
|
|
43
|
+
const trinom = trinomNode_1.TrinomNodeConstructor.fromCoeffs(identifiers.trinomCoeffs);
|
|
44
44
|
const roots = trinom.getRoots();
|
|
45
45
|
return `Soit $f$ une fonction polynôme de degré $2$ définie sur $\\mathbb{R}$ par $f(x) = ${trinom.toTex()}$.
|
|
46
46
|
|
|
@@ -52,7 +52,7 @@ const getHint = (identifiers) => {
|
|
|
52
52
|
return `Une fonction polynôme de degré $2$ est du signe de son coefficient $a$, sauf entre ses racines.`;
|
|
53
53
|
};
|
|
54
54
|
const getCorrection = (identifiers) => {
|
|
55
|
-
const trinom =
|
|
55
|
+
const trinom = trinomNode_1.TrinomNodeConstructor.fromCoeffs(identifiers.trinomCoeffs);
|
|
56
56
|
const roots = trinom.getRoots();
|
|
57
57
|
const a = identifiers.trinomCoeffs[2];
|
|
58
58
|
const answer = getAnswer(identifiers);
|
|
@@ -79,7 +79,7 @@ const isAnswerValid = (ans, { answer, isAskingPositive, trinomCoeffs }) => {
|
|
|
79
79
|
return texs.includes(ans);
|
|
80
80
|
};
|
|
81
81
|
const getTrinomSignFromRootsQuestion = () => {
|
|
82
|
-
const trinom =
|
|
82
|
+
const trinom = trinomNode_1.TrinomNodeConstructor.randomNiceRoots(2);
|
|
83
83
|
const isAskingPositive = (0, coinFlip_1.coinFlip)();
|
|
84
84
|
const identifiers = {
|
|
85
85
|
isAskingPositive,
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Exercise } from "../../../../exercises/exercise";
|
|
2
|
+
import { TriangleIdentifiers } from "../../../../math/geometry/triangle";
|
|
2
3
|
type Identifiers = {
|
|
3
|
-
|
|
4
|
+
/**!! old */
|
|
5
|
+
triangleIdentifiers: TriangleIdentifiers;
|
|
4
6
|
};
|
|
5
7
|
export declare const rightTriangleArea: Exercise<Identifiers>;
|
|
6
8
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rightTriangleArea.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/areas/rightTriangleArea.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"rightTriangleArea.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/areas/rightTriangleArea.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AAIlC,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAKnE,KAAK,WAAW,GAAG;IACjB,YAAY;IAEZ,mBAAmB,EAAE,mBAAmB,CAAC;CAC1C,CAAC;AAgEF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAcnD,CAAC"}
|
|
@@ -4,31 +4,17 @@ exports.rightTriangleArea = void 0;
|
|
|
4
4
|
const exercise_1 = require("../../../../exercises/exercise");
|
|
5
5
|
const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
|
|
6
6
|
const geogebraConstructor_1 = require("../../../../geogebra/geogebraConstructor");
|
|
7
|
-
const
|
|
7
|
+
const rightTriangle_1 = require("../../../../math/geometry/rightTriangle");
|
|
8
8
|
const rational_1 = require("../../../../math/numbers/rationals/rational");
|
|
9
9
|
const randint_1 = require("../../../../math/utils/random/randint");
|
|
10
10
|
const shuffle_1 = require("../../../../utils/alea/shuffle");
|
|
11
11
|
const getRightTriangleArea = () => {
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
for (let i = 0; i < 3; i++)
|
|
15
|
-
vertices.push(String.fromCharCode(code + i));
|
|
16
|
-
const triangle = triangle_1.TriangleConstructor.createRandomRightTriangle({
|
|
17
|
-
minRapport: 0.4,
|
|
18
|
-
maxRapport: 1.6,
|
|
19
|
-
names: vertices,
|
|
12
|
+
const triangle = rightTriangle_1.RightTriangleConstructor.randomNiceSides({
|
|
13
|
+
randomName: true,
|
|
20
14
|
});
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
];
|
|
25
|
-
const commands = [
|
|
26
|
-
...triangle.generateCommands({
|
|
27
|
-
showLabels: [triangle.getSideBName(), triangle.getSideCName()],
|
|
28
|
-
setCaptions: [sidesLengths[0] + "", sidesLengths[1] + ""],
|
|
29
|
-
}),
|
|
30
|
-
];
|
|
31
|
-
const answer = ((sidesLengths[0] * sidesLengths[1]) / 2 + "").replace(".", ",");
|
|
15
|
+
triangle.showSidesLength([0]);
|
|
16
|
+
const commands = [...triangle.commands];
|
|
17
|
+
const answer = triangle.getArea().frenchify();
|
|
32
18
|
const answerTex = answer + "\\text{cm}^2";
|
|
33
19
|
const ggb = new geogebraConstructor_1.GeogebraConstructor({
|
|
34
20
|
commands,
|
|
@@ -36,14 +22,16 @@ const getRightTriangleArea = () => {
|
|
|
36
22
|
hideGrid: true,
|
|
37
23
|
});
|
|
38
24
|
const question = {
|
|
39
|
-
instruction: `
|
|
25
|
+
instruction: `Le triangle $${triangle.name}$ ci-dessous est rectangle en $${triangle.points[0].name}$, et tel que $${triangle.sides[1].toLengthTex()}$ cm et $${triangle.sides[2].toLengthTex()}$ cm.
|
|
26
|
+
|
|
27
|
+
Calculer l'aire de $${triangle.name}$.`,
|
|
40
28
|
answer: answerTex,
|
|
41
29
|
keys: ["cm", "cm2"],
|
|
42
30
|
ggbOptions: ggb.getOptions({
|
|
43
31
|
coords: triangle.generateCoords(),
|
|
44
32
|
}),
|
|
45
33
|
answerFormat: "tex",
|
|
46
|
-
identifiers: {
|
|
34
|
+
identifiers: { triangleIdentifiers: triangle.toIdentifiers() },
|
|
47
35
|
};
|
|
48
36
|
return question;
|
|
49
37
|
};
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { Exercise } from "../../../../exercises/exercise";
|
|
2
|
-
|
|
2
|
+
import { TriangleIdentifiers } from "../../../../math/geometry/triangle";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
triangleIdentifiers: TriangleIdentifiers;
|
|
5
|
+
height: number;
|
|
6
|
+
base: number;
|
|
7
|
+
};
|
|
3
8
|
export declare const triangleArea: Exercise<Identifiers>;
|
|
4
9
|
export {};
|
|
5
10
|
//# sourceMappingURL=triangleArea.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"triangleArea.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/areas/triangleArea.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"triangleArea.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/areas/triangleArea.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAGL,mBAAmB,EACpB,MAAM,8BAA8B,CAAC;AAYtC,KAAK,WAAW,GAAG;IACjB,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAwFF,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,WAAW,CAc9C,CAAC"}
|
|
@@ -9,65 +9,51 @@ const rational_1 = require("../../../../math/numbers/rationals/rational");
|
|
|
9
9
|
const randint_1 = require("../../../../math/utils/random/randint");
|
|
10
10
|
const randomLetter_1 = require("../../../../utils/strings/randomLetter");
|
|
11
11
|
const shuffle_1 = require("../../../../utils/alea/shuffle");
|
|
12
|
+
const randfloat_1 = require("../../../../math/utils/random/randfloat");
|
|
13
|
+
const point_1 = require("../../../../math/geometry/point");
|
|
14
|
+
const doWhile_1 = require("../../../../utils/doWhile");
|
|
15
|
+
const segment_1 = require("../../../../math/geometry/segment");
|
|
16
|
+
const round_1 = require("../../../../math/utils/round");
|
|
12
17
|
const getTriangleArea = () => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
//segment de taille fixé
|
|
19
|
+
//puis hauteur de taille fixée placée sur segment (élargi)
|
|
20
|
+
//puis rotation
|
|
21
|
+
const base = (0, randfloat_1.randfloat)(1, 7, 1);
|
|
22
|
+
const height = (0, randfloat_1.randfloat)(1, 5, 1);
|
|
23
|
+
const angle = (0, randfloat_1.randfloat)(0, 2 * Math.PI);
|
|
24
|
+
const names = triangle_1.TriangleConstructor.randomName();
|
|
25
|
+
const A = point_1.PointConstructor.origin(names[0]);
|
|
26
|
+
const C = new point_1.Point(names[2], base.toTree(), (0).toTree()).rotate(angle, A);
|
|
27
|
+
const xH = (0, randfloat_1.randfloat)(-0.5 * base, 1.5 * base, 1, (x) => Math.abs(x) < 0.2 * base || Math.abs(x - base) < 0.2 * base);
|
|
28
|
+
const footName = (0, doWhile_1.doWhile)(() => (0, randomLetter_1.randomLetter)(true), (p) => names.includes(p));
|
|
29
|
+
const H = new point_1.Point(footName, xH.toTree(), (0).toTree()).rotate(angle, A);
|
|
30
|
+
const B = new point_1.Point(names[1], xH.toTree(), height.toTree()).rotate(angle, A);
|
|
31
|
+
const triangle = new triangle_1.Triangle([A, B, C], {
|
|
32
|
+
sidesLengths: [undefined, base.toTree(), undefined],
|
|
21
33
|
});
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
triangle.getSideBName(),
|
|
25
|
-
triangle.getSideCName(),
|
|
26
|
-
];
|
|
27
|
-
const sidesLengths = [
|
|
28
|
-
triangle.getSideAnumber(),
|
|
29
|
-
triangle.getSideBnumber(),
|
|
30
|
-
triangle.getSideCnumber(),
|
|
31
|
-
].map((el) => Math.round(el / 2));
|
|
32
|
-
const angles = [
|
|
33
|
-
triangle.getAngleA(),
|
|
34
|
-
triangle.getAngleB(),
|
|
35
|
-
triangle.getAngleC(),
|
|
36
|
-
];
|
|
37
|
-
const randoms = (0, shuffle_1.shuffle)([0, 1, 2]);
|
|
38
|
-
const height = Math.round(sidesLengths[randoms[1]] * Math.sin(angles[randoms[2]]));
|
|
39
|
-
const interceptName = (0, randomLetter_1.randomLetter)(true, vertices);
|
|
40
|
-
const commands = [
|
|
41
|
-
...triangle.generateCommands({
|
|
42
|
-
showLabels: [sides[randoms[0]]],
|
|
43
|
-
setCaptions: [sidesLengths[randoms[0]] + ""],
|
|
44
|
-
}),
|
|
45
|
-
`poi = Intersect(PerpendicularLine(${vertices[randoms[0]]},${sides[randoms[0]]}),${sides[randoms[0]]})`,
|
|
46
|
-
`SetCaption(poi, "${interceptName}")`,
|
|
47
|
-
`ShowLabel(poi, true)`,
|
|
48
|
-
`seg = Segment(${vertices[randoms[0]]}, poi)`,
|
|
49
|
-
`ShowLabel(seg, true)`,
|
|
50
|
-
`SetCaption(seg, "${height}")`,
|
|
51
|
-
`SetLineStyle(seg, 1)`,
|
|
52
|
-
`alpha = Angle(${vertices[randoms[0]]},poi ,${vertices[randoms[1]]}, Line(${vertices[randoms[0]]},poi))`,
|
|
53
|
-
`ShowLabel(alpha, false)`,
|
|
54
|
-
];
|
|
34
|
+
const heightSegment = new segment_1.Segment(B, H, { lengthNode: height.toTree() });
|
|
35
|
+
triangle.drawHeight(1, { footName });
|
|
55
36
|
const ggb = new geogebraConstructor_1.GeogebraConstructor({
|
|
56
|
-
commands,
|
|
37
|
+
commands: triangle.commands,
|
|
57
38
|
hideAxes: true,
|
|
58
39
|
hideGrid: true,
|
|
59
40
|
});
|
|
60
|
-
const answer = (
|
|
61
|
-
const answerTex = answer + "\\text{cm}^2";
|
|
41
|
+
const answer = (0, round_1.round)((height * base) / 2, 1);
|
|
62
42
|
const question = {
|
|
63
|
-
instruction: `Calculer l'aire du triangle $${triangle.
|
|
64
|
-
|
|
43
|
+
instruction: `Calculer l'aire du triangle $${triangle.name}$ sachant que $${triangle.sides[1].toLengthTex()}$ cm et $${heightSegment.toLengthTex()}$ cm.
|
|
44
|
+
|
|
45
|
+
Arrondir à $0,1$ cm près.`,
|
|
46
|
+
answer: answer.frenchify() + "\\text{cm}^2",
|
|
65
47
|
keys: ["cm", "cm2"],
|
|
66
48
|
ggbOptions: ggb.getOptions({
|
|
67
|
-
coords:
|
|
49
|
+
coords: ggb.getCoordsForPoints([A, B, C, H]),
|
|
68
50
|
}),
|
|
69
51
|
answerFormat: "tex",
|
|
70
|
-
identifiers: {
|
|
52
|
+
identifiers: {
|
|
53
|
+
triangleIdentifiers: triangle.toIdentifiers(),
|
|
54
|
+
height,
|
|
55
|
+
base,
|
|
56
|
+
},
|
|
71
57
|
};
|
|
72
58
|
return question;
|
|
73
59
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/geometry/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAE1B,cAAc,0BAA0B,CAAC;AACzC,cAAc,UAAU,CAAC;AAEzB,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/geometry/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAE1B,cAAc,0BAA0B,CAAC;AACzC,cAAc,UAAU,CAAC;AAEzB,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isTriangleRight.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/pythagore/isTriangleRight.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"isTriangleRight.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/pythagore/isTriangleRight.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAclC,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AAyGF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAiBjD,CAAC"}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { Exercise } from "../../../../exercises/exercise";
|
|
2
2
|
import { TriangleIdentifiers } from "../../../../math/geometry/triangle";
|
|
3
3
|
type Identifiers = {
|
|
4
|
-
sideA: string;
|
|
5
|
-
sideB: string;
|
|
6
|
-
sideC: string;
|
|
7
4
|
triangleIdentifiers: TriangleIdentifiers;
|
|
8
5
|
};
|
|
9
6
|
export declare const pythagore: Exercise<Identifiers>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pythagore.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/pythagore/pythagore.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAEL,mBAAmB,EACpB,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"pythagore.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/pythagore/pythagore.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAST,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAEL,mBAAmB,EACpB,MAAM,8BAA8B,CAAC;AAUtC,KAAK,WAAW,GAAG;IACjB,mBAAmB,EAAE,mBAAmB,CAAC;CAC1C,CAAC;AA8DF,eAAO,MAAM,SAAS,EAAE,QAAQ,CAAC,WAAW,CAc3C,CAAC"}
|
|
@@ -3,57 +3,51 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.pythagore = void 0;
|
|
4
4
|
const exercise_1 = require("../../../../exercises/exercise");
|
|
5
5
|
const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
|
|
6
|
-
const triangle_1 = require("../../../../math/geometry/triangle");
|
|
7
|
-
const randint_1 = require("../../../../math/utils/random/randint");
|
|
8
6
|
const lengthNode_1 = require("../../../../tree/nodes/geometry/lengthNode");
|
|
9
7
|
const addNode_1 = require("../../../../tree/nodes/operators/addNode");
|
|
10
8
|
const equalNode_1 = require("../../../../tree/nodes/equations/equalNode");
|
|
11
9
|
const powerNode_1 = require("../../../../tree/nodes/operators/powerNode");
|
|
12
10
|
const geogebraConstructor_1 = require("../../../../geogebra/geogebraConstructor");
|
|
11
|
+
const rightTriangle_1 = require("../../../../math/geometry/rightTriangle");
|
|
13
12
|
const getPythagore = () => {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
for (let i = 0; i < 3; i++)
|
|
17
|
-
vertices.push(String.fromCharCode(code + i));
|
|
18
|
-
const triangle = triangle_1.TriangleConstructor.createRandomRightTriangle({
|
|
19
|
-
minRapport: 0.7,
|
|
20
|
-
maxRapport: 1.3,
|
|
21
|
-
names: vertices,
|
|
13
|
+
const triangle = rightTriangle_1.RightTriangleConstructor.randomNiceSides({
|
|
14
|
+
randomName: true,
|
|
22
15
|
});
|
|
23
|
-
const sideA = triangle.getSideAName();
|
|
24
|
-
const sideB = triangle.getSideBName();
|
|
25
|
-
const sideC = triangle.getSideCName();
|
|
26
16
|
const triangleIdentifiers = triangle.toIdentifiers();
|
|
27
17
|
const ggb = new geogebraConstructor_1.GeogebraConstructor({
|
|
28
|
-
commands: triangle.
|
|
18
|
+
commands: triangle.commands,
|
|
29
19
|
hideAxes: true,
|
|
30
20
|
hideGrid: true,
|
|
31
21
|
});
|
|
32
|
-
const answer =
|
|
22
|
+
const answer = triangle.getPythagorianTex();
|
|
33
23
|
const question = {
|
|
34
24
|
instruction: "Écrire l'égalité de Pythagore pour le triangle rectangle suivant : ",
|
|
35
25
|
answer,
|
|
36
|
-
keys: [...
|
|
26
|
+
keys: [...triangle.points.map((p) => p.name), "equal"],
|
|
37
27
|
ggbOptions: ggb.getOptions({
|
|
38
28
|
coords: triangle.generateCoords(),
|
|
39
29
|
}),
|
|
40
30
|
answerFormat: "tex",
|
|
41
|
-
identifiers: {
|
|
31
|
+
identifiers: { triangleIdentifiers },
|
|
42
32
|
};
|
|
43
33
|
return question;
|
|
44
34
|
};
|
|
45
|
-
const getPropositions = (n, { answer,
|
|
35
|
+
const getPropositions = (n, { answer, triangleIdentifiers }) => {
|
|
46
36
|
const propositions = [];
|
|
47
37
|
(0, exercise_1.addValidProp)(propositions, answer);
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
(0, exercise_1.tryToAddWrongProp)(propositions, `${
|
|
51
|
-
(0, exercise_1.tryToAddWrongProp)(propositions, `${
|
|
52
|
-
(0, exercise_1.tryToAddWrongProp)(propositions, `${
|
|
53
|
-
(0, exercise_1.tryToAddWrongProp)(propositions, `${
|
|
38
|
+
const triangle = rightTriangle_1.RightTriangleConstructor.fromIdentifiers(triangleIdentifiers);
|
|
39
|
+
const [sideA, sideB, sideC] = triangle.sides.map((s) => s.toInsideName());
|
|
40
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, `${sideA}=${sideB}+${sideC}`);
|
|
41
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, `${sideA}^2=${sideB}^2-${sideC}^2`);
|
|
42
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, `${sideB}^2=${sideA}^2+${sideC}^2`);
|
|
43
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, `${sideC}^2= ${sideA}^2+${sideB}^2`);
|
|
44
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, `${sideA}^2=${sideB}+${sideC}^2`);
|
|
45
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, `${sideA}^2=${sideB}^2+${sideC}`);
|
|
54
46
|
return (0, exercise_1.shuffleProps)(propositions, n);
|
|
55
47
|
};
|
|
56
|
-
const isAnswerValid = (ans, {
|
|
48
|
+
const isAnswerValid = (ans, { triangleIdentifiers }) => {
|
|
49
|
+
const triangle = rightTriangle_1.RightTriangleConstructor.fromIdentifiers(triangleIdentifiers);
|
|
50
|
+
const [sideA, sideB, sideC] = triangle.sides.map((s) => s.toInsideName());
|
|
57
51
|
const answer = new equalNode_1.EqualNode(new powerNode_1.SquareNode(new lengthNode_1.LengthNode(sideA)), new addNode_1.AddNode(new powerNode_1.SquareNode(new lengthNode_1.LengthNode(sideB)), new powerNode_1.SquareNode(new lengthNode_1.LengthNode(sideC))));
|
|
58
52
|
const texs = answer.toAllValidTexs();
|
|
59
53
|
return texs.includes(ans);
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Exercise } from "../../../../exercises/exercise";
|
|
2
2
|
import { TriangleIdentifiers } from "../../../../math/geometry/triangle";
|
|
3
3
|
type Identifiers = {
|
|
4
|
-
|
|
5
|
-
sideLengths: number[];
|
|
4
|
+
sideAsked: number;
|
|
6
5
|
triangleIdentifiers: TriangleIdentifiers;
|
|
7
6
|
};
|
|
8
7
|
export declare const pythagoreCalcul: Exercise<Identifiers>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pythagoreCalcul.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/pythagore/pythagoreCalcul.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAEL,mBAAmB,EACpB,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"pythagoreCalcul.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/pythagore/pythagoreCalcul.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAEL,mBAAmB,EACpB,MAAM,8BAA8B,CAAC;AAiBtC,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,mBAAmB,EAAE,mBAAmB,CAAC;CAC1C,CAAC;AA+EF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,WAAW,CAcjD,CAAC"}
|
|
@@ -4,95 +4,60 @@ exports.pythagoreCalcul = void 0;
|
|
|
4
4
|
const exercise_1 = require("../../../../exercises/exercise");
|
|
5
5
|
const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
|
|
6
6
|
const geogebraConstructor_1 = require("../../../../geogebra/geogebraConstructor");
|
|
7
|
-
const triangle_1 = require("../../../../math/geometry/triangle");
|
|
8
|
-
const real_1 = require("../../../../math/numbers/reals/real");
|
|
9
|
-
const randint_1 = require("../../../../math/utils/random/randint");
|
|
10
|
-
const sqrtNode_1 = require("../../../../tree/nodes/functions/sqrtNode");
|
|
11
|
-
const numberNode_1 = require("../../../../tree/nodes/numbers/numberNode");
|
|
12
|
-
const coinFlip_1 = require("../../../../utils/alea/coinFlip");
|
|
13
|
-
const isInt_1 = require("../../../../utils/isInt");
|
|
14
7
|
const shuffle_1 = require("../../../../utils/alea/shuffle");
|
|
8
|
+
const random_1 = require("../../../../utils/alea/random");
|
|
9
|
+
const rightTriangle_1 = require("../../../../math/geometry/rightTriangle");
|
|
10
|
+
const sqrtVEA_1 = require("../../../../exercises/vea/sqrtVEA");
|
|
11
|
+
const powerNode_1 = require("../../../../tree/nodes/operators/powerNode");
|
|
12
|
+
const randfloat_1 = require("../../../../math/utils/random/randfloat");
|
|
13
|
+
const round_1 = require("../../../../math/utils/round");
|
|
15
14
|
const getPythagoreCalcul = () => {
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
for (let i = 0; i < 3; i++)
|
|
19
|
-
vertices.push(String.fromCharCode(code + i));
|
|
20
|
-
const triangle = triangle_1.TriangleConstructor.createRandomRightTriangle({
|
|
21
|
-
minRapport: 0.7,
|
|
22
|
-
maxRapport: 1.3,
|
|
23
|
-
names: vertices,
|
|
15
|
+
const triangle = rightTriangle_1.RightTriangleConstructor.randomNiceSides({
|
|
16
|
+
randomName: true,
|
|
24
17
|
});
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
];
|
|
30
|
-
const sideLengths = [
|
|
31
|
-
triangle.getSideCnumber(),
|
|
32
|
-
triangle.getSideBnumber(),
|
|
33
|
-
triangle.getSideAnumber(),
|
|
34
|
-
].map((el) => Math.round(el / 2));
|
|
35
|
-
const zeroOrOne = (0, shuffle_1.shuffle)([0, 1]);
|
|
36
|
-
const randoms = (0, coinFlip_1.coinFlip)() ? [...zeroOrOne, 2] : [2, ...zeroOrOne];
|
|
37
|
-
// le but est d'avoir une chance sur 2 d'avoir un hépoténus et une 1 chance sur 2 d'avoir un a des 2 autres cote
|
|
38
|
-
let answer;
|
|
39
|
-
let square;
|
|
40
|
-
if (randoms[2] === 2) {
|
|
41
|
-
// cas de l'hypoténus
|
|
42
|
-
square = sideLengths[0] ** 2 + sideLengths[1] ** 2;
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
// les deux autres cotés
|
|
46
|
-
square = sideLengths[randoms[0]] ** 2 - sideLengths[randoms[1]] ** 2;
|
|
47
|
-
}
|
|
48
|
-
const sqrt = Math.sqrt(square);
|
|
49
|
-
answer = (0, isInt_1.isInt)(sqrt) ? sqrt + "" : `\\sqrt{${square}}`;
|
|
50
|
-
const commands = [
|
|
51
|
-
...triangle.generateCommands({
|
|
52
|
-
showLabels: [...sides, sides[randoms[2]]],
|
|
53
|
-
setCaptions: [...sideLengths.map((el) => el + ""), "?"],
|
|
54
|
-
highlightedSide: sides[randoms[2]],
|
|
55
|
-
}),
|
|
56
|
-
];
|
|
18
|
+
//une chance sur deux d'avoir hypoténuse
|
|
19
|
+
const sideIndexAsked = (0, random_1.random)([0, (0, random_1.random)([1, 2])]);
|
|
20
|
+
const answer = triangle.sides[sideIndexAsked].getLengthNode().toTex();
|
|
21
|
+
triangle.showSidesLength([sideIndexAsked]);
|
|
22
|
+
const commands = [...triangle.commands];
|
|
57
23
|
const ggb = new geogebraConstructor_1.GeogebraConstructor({
|
|
58
24
|
commands,
|
|
59
25
|
hideAxes: true,
|
|
60
26
|
hideGrid: true,
|
|
61
27
|
});
|
|
62
28
|
const triangleIdentifiers = triangle.toIdentifiers();
|
|
63
|
-
answer = answer + "";
|
|
64
29
|
const question = {
|
|
65
|
-
instruction: `Dans le triangle $${triangle.
|
|
30
|
+
instruction: `Dans le triangle $${triangle.name}$ rectangle en $${triangle.points[0].name}$, on sait que $${triangle.sides[(sideIndexAsked + 1) % 3].toLengthTex()}$ et que $${triangle.sides[(sideIndexAsked + 2) % 3].toLengthTex()}$.
|
|
31
|
+
|
|
32
|
+
Calculer la longueur exacte $${triangle.sides[sideIndexAsked].toInsideName()}$.`,
|
|
66
33
|
answer,
|
|
67
|
-
keys: [
|
|
34
|
+
keys: [],
|
|
68
35
|
ggbOptions: ggb.getOptions({
|
|
69
36
|
coords: triangle.generateCoords(),
|
|
70
37
|
}),
|
|
71
38
|
answerFormat: "tex",
|
|
72
|
-
identifiers: {
|
|
39
|
+
identifiers: { sideAsked: sideIndexAsked, triangleIdentifiers },
|
|
73
40
|
};
|
|
74
41
|
return question;
|
|
75
42
|
};
|
|
76
|
-
const getPropositions = (n, { answer }) => {
|
|
43
|
+
const getPropositions = (n, { answer, triangleIdentifiers, sideAsked }) => {
|
|
77
44
|
const propositions = [];
|
|
78
45
|
(0, exercise_1.addValidProp)(propositions, answer);
|
|
46
|
+
const triangle = rightTriangle_1.RightTriangleConstructor.fromIdentifiers(triangleIdentifiers);
|
|
47
|
+
const lengths = triangle.sides.map((s) => s.getLength());
|
|
48
|
+
//erreur d'oubli de la racine
|
|
49
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, (0, powerNode_1.square)(answer.unfrenchify()).simplify().toTex());
|
|
50
|
+
if (sideAsked !== 0) {
|
|
51
|
+
//erreur d'application a^2+b^2 = c^2 alors qu'on cherche pas l'hypo
|
|
52
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, (0, round_1.round)(Math.sqrt(lengths[0] ** 2 + lengths[3 - sideAsked] ** 2), 1).frenchify());
|
|
53
|
+
}
|
|
79
54
|
while (propositions.length < n) {
|
|
80
|
-
|
|
81
|
-
const squareRoot = new real_1.SquareRoot(temp);
|
|
82
|
-
const wrongAnswer = Math.sqrt(temp) === Math.floor(Math.sqrt(temp))
|
|
83
|
-
? Math.sqrt(temp).toString()
|
|
84
|
-
: squareRoot.toTree().toTex();
|
|
85
|
-
(0, exercise_1.tryToAddWrongProp)(propositions, wrongAnswer);
|
|
55
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, (0, randfloat_1.randfloat)(1, 100, 1).frenchify());
|
|
86
56
|
}
|
|
87
57
|
return (0, shuffle_1.shuffle)(propositions);
|
|
88
58
|
};
|
|
89
|
-
const isAnswerValid = (ans, {
|
|
90
|
-
|
|
91
|
-
const answer = (0, isInt_1.isInt)(sqrt)
|
|
92
|
-
? new numberNode_1.NumberNode(sqrt)
|
|
93
|
-
: new sqrtNode_1.SqrtNode(new numberNode_1.NumberNode(square), { allowSimplifySqrt: true });
|
|
94
|
-
const texs = answer.toAllValidTexs();
|
|
95
|
-
return texs.includes(ans);
|
|
59
|
+
const isAnswerValid = (ans, { answer, sideAsked, triangleIdentifiers }) => {
|
|
60
|
+
return (0, sqrtVEA_1.sqrtVEA)(ans, answer);
|
|
96
61
|
};
|
|
97
62
|
exports.pythagoreCalcul = {
|
|
98
63
|
id: "pythagoreCalcul",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/quadrilaterals/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./quadrilateralRecognition"), exports);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise";
|
|
2
|
+
import { ParallelogramIdentifiers } from "../../../../math/geometry/parallelogram";
|
|
3
|
+
import { RectangleIdentifiers } from "../../../../math/geometry/rectangle";
|
|
4
|
+
import { RhombusIdentifiers } from "../../../../math/geometry/rhombus";
|
|
5
|
+
import { SquareIdentifiers } from "../../../../math/geometry/square";
|
|
6
|
+
type Identifiers = {
|
|
7
|
+
shape: string;
|
|
8
|
+
showDiagonals: boolean;
|
|
9
|
+
drawAngles: boolean;
|
|
10
|
+
shapeIdentifiers: RectangleIdentifiers | SquareIdentifiers | RhombusIdentifiers | ParallelogramIdentifiers;
|
|
11
|
+
};
|
|
12
|
+
export declare const quadrilateralRecognition: Exercise<Identifiers>;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=quadrilateralRecognition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quadrilateralRecognition.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/geometry/quadrilaterals/quadrilateralRecognition.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAEL,wBAAwB,EACzB,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAEL,oBAAoB,EACrB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAGL,kBAAkB,EACnB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,iBAAiB,EAClB,MAAM,4BAA4B,CAAC;AAIpC,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,OAAO,CAAC;IACvB,UAAU,EAAE,OAAO,CAAC;IACpB,gBAAgB,EACZ,oBAAoB,GACpB,iBAAiB,GACjB,kBAAkB,GAClB,wBAAwB,CAAC;CAC9B,CAAC;AA0MF,eAAO,MAAM,wBAAwB,EAAE,QAAQ,CAAC,WAAW,CAoB1D,CAAC"}
|