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
|
@@ -2,56 +2,46 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Triangle = exports.TriangleConstructor = void 0;
|
|
4
4
|
const point_1 = require("./point");
|
|
5
|
-
const substractNode_1 = require("../../tree/nodes/operators/substractNode");
|
|
6
|
-
const powerNode_1 = require("../../tree/nodes/operators/powerNode");
|
|
7
|
-
const addNode_1 = require("../../tree/nodes/operators/addNode");
|
|
8
|
-
const numberNode_1 = require("../../tree/nodes/numbers/numberNode");
|
|
9
|
-
const sqrtNode_1 = require("../../tree/nodes/functions/sqrtNode");
|
|
10
|
-
const randint_1 = require("../utils/random/randint");
|
|
11
5
|
const randomLetter_1 = require("../../utils/strings/randomLetter");
|
|
12
6
|
const segment_1 = require("./segment");
|
|
13
|
-
const
|
|
7
|
+
const angle_1 = require("./angle");
|
|
8
|
+
const rotation_1 = require("../../utils/arrays/rotation");
|
|
9
|
+
const round_1 = require("../utils/round");
|
|
10
|
+
const randfloat_1 = require("../utils/random/randfloat");
|
|
11
|
+
const line_1 = require("./line");
|
|
12
|
+
const nodeConstructor_1 = require("../../tree/nodes/nodeConstructor");
|
|
14
13
|
class TriangleConstructor {
|
|
15
14
|
static fromIdentifiers(identifiers) {
|
|
16
|
-
return new Triangle(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
//xb-xa * yc-ya = xc-xa * yb-ya
|
|
47
|
-
pointA.distanceTo(pointB) === 0 ||
|
|
48
|
-
pointB.distanceTo(pointC) === 0 ||
|
|
49
|
-
pointC.distanceTo(pointA) === 0 ||
|
|
50
|
-
triangle.getAngleA() < minAngle ||
|
|
51
|
-
triangle.getAngleA() > maxAngle ||
|
|
52
|
-
triangle.getAngleB() < minAngle ||
|
|
53
|
-
triangle.getAngleB() > maxAngle);
|
|
54
|
-
return new Triangle(pointA, pointB, pointC);
|
|
15
|
+
return new Triangle(identifiers.points.map((p) => point_1.PointConstructor.fromIdentifiers(p)), {
|
|
16
|
+
anglesRadianValues: identifiers.props?.anglesRadianValues?.map((n) => (0, nodeConstructor_1.reifyAlgebraic)(n)),
|
|
17
|
+
anglesDegreeValues: identifiers.props?.anglesDegreeValues?.map((n) => (0, nodeConstructor_1.reifyAlgebraic)(n)),
|
|
18
|
+
sidesLengths: identifiers.props?.sidesLengths?.map((n) => n ? (0, nodeConstructor_1.reifyAlgebraic)(n) : undefined),
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
static randomNiceSides({ names = ["A", "B", "C"], randomName = false, }) {
|
|
22
|
+
let vertices = [];
|
|
23
|
+
if (randomName)
|
|
24
|
+
vertices = TriangleConstructor.randomName();
|
|
25
|
+
else
|
|
26
|
+
vertices = names;
|
|
27
|
+
const angle = (0, randfloat_1.randfloat)(0, 2 * Math.PI);
|
|
28
|
+
const addAngle = (0, randfloat_1.randfloat)(Math.PI / 4, (3 * Math.PI) / 4);
|
|
29
|
+
//on construit [AC] sur (Ox) de milieu O et de taille 2*xRand
|
|
30
|
+
//puis [AB] sur (Ox) qu'on rotate
|
|
31
|
+
const xRand = (0, randfloat_1.randfloat)(5, 8, 1);
|
|
32
|
+
const xRand2 = (0, randfloat_1.randfloat)(-5, 5, 1);
|
|
33
|
+
const origin = new point_1.Point("O", (0).toTree(), (0).toTree());
|
|
34
|
+
const startA = new point_1.Point(vertices[0], (-xRand).toTree(), (0).toTree());
|
|
35
|
+
const A = startA.rotate(angle, origin);
|
|
36
|
+
const C = new point_1.Point(vertices[2], xRand.toTree(), (0).toTree()).rotate(angle, origin);
|
|
37
|
+
const B = new point_1.Point(vertices[1], (-xRand + xRand2).toTree(), (0).toTree()).rotate(angle + addAngle, startA);
|
|
38
|
+
return new Triangle([A, B, C], {
|
|
39
|
+
sidesLengths: [
|
|
40
|
+
(0, round_1.round)(B.distanceTo(C), 1).toTree(),
|
|
41
|
+
(0, round_1.round)(A.distanceTo(C), 1).toTree(),
|
|
42
|
+
(0, round_1.round)(A.distanceTo(B), 1).toTree(),
|
|
43
|
+
],
|
|
44
|
+
});
|
|
55
45
|
}
|
|
56
46
|
static randomName() {
|
|
57
47
|
const startVertix = (0, randomLetter_1.randomLetter)(true, ["Y", "Z"]);
|
|
@@ -64,169 +54,152 @@ class TriangleConstructor {
|
|
|
64
54
|
}
|
|
65
55
|
exports.TriangleConstructor = TriangleConstructor;
|
|
66
56
|
class Triangle {
|
|
67
|
-
constructor(
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
this.
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
57
|
+
constructor(points, props) {
|
|
58
|
+
if (points.length !== 3)
|
|
59
|
+
throw new Error("Triangle must have 3 points");
|
|
60
|
+
this.props = props;
|
|
61
|
+
this.name = points.map((p) => p.name).join("");
|
|
62
|
+
this.points = points;
|
|
63
|
+
this.angles = [
|
|
64
|
+
new angle_1.Angle((0, rotation_1.arrayRotation)(points, 2), {
|
|
65
|
+
radianValueNode: props?.anglesRadianValues?.[0],
|
|
66
|
+
degreeValueNode: props?.anglesDegreeValues?.[0],
|
|
67
|
+
}),
|
|
68
|
+
new angle_1.Angle(points, {
|
|
69
|
+
radianValueNode: props?.anglesRadianValues?.[1],
|
|
70
|
+
degreeValueNode: props?.anglesDegreeValues?.[1],
|
|
71
|
+
}),
|
|
72
|
+
new angle_1.Angle((0, rotation_1.arrayRotation)(points, 1), {
|
|
73
|
+
radianValueNode: props?.anglesRadianValues?.[2],
|
|
74
|
+
degreeValueNode: props?.anglesDegreeValues?.[2],
|
|
75
|
+
}),
|
|
76
|
+
];
|
|
77
|
+
this.sides = [
|
|
78
|
+
new segment_1.Segment(points[1], points[2], {
|
|
79
|
+
lengthNode: props?.sidesLengths?.[0],
|
|
80
|
+
}),
|
|
81
|
+
new segment_1.Segment(points[0], points[2], {
|
|
82
|
+
lengthNode: props?.sidesLengths?.[1],
|
|
83
|
+
}),
|
|
84
|
+
new segment_1.Segment(points[0], points[1], {
|
|
85
|
+
lengthNode: props?.sidesLengths?.[2],
|
|
86
|
+
}),
|
|
87
|
+
];
|
|
88
|
+
this.commands = [
|
|
89
|
+
...points.flatMap((p) => p.toGGBCommand({
|
|
90
|
+
isFixed: true,
|
|
91
|
+
showLabel: true,
|
|
92
|
+
})),
|
|
93
|
+
...this.sides.flatMap((s) => s.toGGBCommands(false)),
|
|
77
94
|
];
|
|
78
|
-
}
|
|
79
|
-
getSideASegment() {
|
|
80
|
-
return new segment_1.Segment(this.vertexB, this.vertexC);
|
|
81
|
-
}
|
|
82
|
-
getSideBSegment() {
|
|
83
|
-
return new segment_1.Segment(this.vertexA, this.vertexC);
|
|
84
|
-
}
|
|
85
|
-
getSideCSegment() {
|
|
86
|
-
return new segment_1.Segment(this.vertexA, this.vertexB);
|
|
87
95
|
}
|
|
88
96
|
toIdentifiers() {
|
|
89
97
|
return {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
98
|
+
points: this.points.map((point) => point.toIdentifiers()),
|
|
99
|
+
props: {
|
|
100
|
+
anglesRadianValues: this.props?.anglesRadianValues?.map((n) => n.toIdentifiers()),
|
|
101
|
+
anglesDegreeValues: this.props?.anglesDegreeValues?.map((n) => n.toIdentifiers()),
|
|
102
|
+
sidesLengths: this.props?.sidesLengths?.map((n) => n?.toIdentifiers()),
|
|
103
|
+
},
|
|
93
104
|
};
|
|
94
105
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
getSideCnumber() {
|
|
102
|
-
return this.vertexA.distanceTo(this.vertexB);
|
|
103
|
-
}
|
|
104
|
-
getTriangleName() {
|
|
105
|
-
return this.vertexA.name + this.vertexB.name + this.vertexC.name;
|
|
106
|
-
}
|
|
107
|
-
getSideAnode() {
|
|
108
|
-
return new sqrtNode_1.SqrtNode(new addNode_1.AddNode(new powerNode_1.PowerNode(new substractNode_1.SubstractNode(this.vertexC.x, this.vertexB.x), new numberNode_1.NumberNode(2)), new powerNode_1.PowerNode(new substractNode_1.SubstractNode(this.vertexC.y, this.vertexB.y), new numberNode_1.NumberNode(2))));
|
|
109
|
-
}
|
|
110
|
-
getSideBnode() {
|
|
111
|
-
return new sqrtNode_1.SqrtNode(new addNode_1.AddNode(new powerNode_1.PowerNode(new substractNode_1.SubstractNode(this.vertexC.x, this.vertexA.x), new numberNode_1.NumberNode(2)), new powerNode_1.PowerNode(new substractNode_1.SubstractNode(this.vertexC.y, this.vertexA.y), new numberNode_1.NumberNode(2))));
|
|
112
|
-
}
|
|
113
|
-
getSideCnode() {
|
|
114
|
-
return new sqrtNode_1.SqrtNode(new addNode_1.AddNode(new powerNode_1.PowerNode(new substractNode_1.SubstractNode(this.vertexA.x, this.vertexB.x), new numberNode_1.NumberNode(2)), new powerNode_1.PowerNode(new substractNode_1.SubstractNode(this.vertexC.y, this.vertexB.y), new numberNode_1.NumberNode(2))));
|
|
115
|
-
}
|
|
116
|
-
getAngleA() {
|
|
117
|
-
return Math.acos((this.getSideBnumber() ** 2 +
|
|
118
|
-
this.getSideCnumber() ** 2 -
|
|
119
|
-
this.getSideAnumber() ** 2) /
|
|
120
|
-
(2 * this.getSideBnumber() * this.getSideCnumber()));
|
|
121
|
-
}
|
|
122
|
-
getAngleB() {
|
|
123
|
-
return Math.acos((this.getSideAnumber() ** 2 +
|
|
124
|
-
this.getSideCnumber() ** 2 -
|
|
125
|
-
this.getSideBnumber() ** 2) /
|
|
126
|
-
(2 * this.getSideAnumber() * this.getSideCnumber()));
|
|
127
|
-
}
|
|
128
|
-
getAngleC() {
|
|
129
|
-
return Math.acos((this.getSideAnumber() ** 2 +
|
|
130
|
-
this.getSideBnumber() ** 2 -
|
|
131
|
-
this.getSideCnumber() ** 2) /
|
|
132
|
-
(2 * this.getSideAnumber() * this.getSideBnumber()));
|
|
133
|
-
}
|
|
106
|
+
/************* ✨ Codeium Command ⭐ *************/
|
|
107
|
+
/**
|
|
108
|
+
* Returns the perimeter of the triangle.
|
|
109
|
+
* @returns {number} the perimeter of the triangle.
|
|
110
|
+
*/
|
|
111
|
+
/****** fbb7c5d7-3919-4ef2-b5ba-db0d6770666d *******/
|
|
134
112
|
getPerimeter() {
|
|
135
|
-
return
|
|
113
|
+
return this.sides.reduce((acc, curr) => acc + curr.getLength(), 0);
|
|
136
114
|
}
|
|
137
115
|
getArea() {
|
|
138
116
|
const s = this.getPerimeter() / 2;
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
(s - this.getSideBnumber()) *
|
|
142
|
-
(s - this.getSideCnumber()));
|
|
117
|
+
const lengths = this.sides.map((s) => s.getLength());
|
|
118
|
+
return (0, round_1.round)(Math.sqrt(s * (s - lengths[0]) * (s - lengths[1]) * (s - lengths[2])), 6);
|
|
143
119
|
}
|
|
144
120
|
isRight() {
|
|
145
|
-
|
|
146
|
-
return true;
|
|
147
|
-
if (Math.abs(Math.cos(this.getAngleB())) < 0.001)
|
|
148
|
-
return true;
|
|
149
|
-
if (Math.abs(Math.cos(this.getAngleC())) < 0.001)
|
|
150
|
-
return true;
|
|
151
|
-
return false;
|
|
121
|
+
return this.angles.some((a) => a.isRight());
|
|
152
122
|
}
|
|
153
123
|
isEquilateral() {
|
|
154
|
-
|
|
155
|
-
|
|
124
|
+
const lengths = this.sides.map((s) => s.getLength());
|
|
125
|
+
return lengths[0] === lengths[1] && lengths[1] === lengths[2];
|
|
156
126
|
}
|
|
157
127
|
isIsosceles() {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
128
|
+
const lengths = this.sides.map((s) => s.getLength());
|
|
129
|
+
return (lengths[0] === lengths[1] ||
|
|
130
|
+
lengths[1] === lengths[2] ||
|
|
131
|
+
lengths[0] === lengths[2]);
|
|
161
132
|
}
|
|
162
133
|
isScalene() {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
if (
|
|
171
|
-
|
|
172
|
-
if (
|
|
173
|
-
|
|
174
|
-
return "";
|
|
175
|
-
}
|
|
176
|
-
generateCommands({ highlightedAngle: highlightedAngle, colorHighlightedAngle: colorHighlightedAngle, showLabels: showLabels, setCaptions: setCaptions, highlightedSide: highlightedSide, colorHighlightedSide: colorHighlightedSide, }) {
|
|
177
|
-
let commands = [
|
|
178
|
-
`${this.vertexA.name} = Point({${this.vertexA.getXnumber()}, ${this.vertexA.getYnumber()}})`,
|
|
179
|
-
`${this.vertexB.name} = Point({${this.vertexB.getXnumber()}, ${this.vertexB.getYnumber()}})`,
|
|
180
|
-
`${this.vertexC.name} = Point({${this.vertexC.getXnumber()}, ${this.vertexC.getYnumber()}})`,
|
|
181
|
-
`ShowLabel(${this.vertexA.name}, true)`,
|
|
182
|
-
`ShowLabel(${this.vertexB.name}, true)`,
|
|
183
|
-
`ShowLabel(${this.vertexC.name}, true)`,
|
|
184
|
-
`${this.getSideCName()} = Segment(${this.vertexA.name}, ${this.vertexB.name})`,
|
|
185
|
-
`${this.getSideBName()} = Segment(${this.vertexA.name}, ${this.vertexC.name})`,
|
|
186
|
-
`${this.getSideAName()} = Segment(${this.vertexC.name}, ${this.vertexB.name})`,
|
|
187
|
-
`ShowLabel(${this.getSideCName()}, false)`,
|
|
188
|
-
`ShowLabel(${this.getSideBName()}, false)`,
|
|
189
|
-
`ShowLabel(${this.getSideBName()}, false)`,
|
|
190
|
-
];
|
|
191
|
-
if (this.isRight())
|
|
192
|
-
commands.push(`alpha = Angle(${this.vertexB.name},${this.vertexA.name},${this.vertexC.name}, Line(${this.vertexB.name},${this.vertexA.name}))`, `ShowLabel(alpha, false)`);
|
|
193
|
-
const defautColor = "Red";
|
|
194
|
-
if (highlightedAngle) {
|
|
195
|
-
let temp = [""];
|
|
196
|
-
if (highlightedAngle === this.vertexB.name)
|
|
197
|
-
temp = [this.vertexA.name, this.vertexB.name, this.vertexC.name];
|
|
198
|
-
if (highlightedAngle === this.vertexC.name)
|
|
199
|
-
temp = [this.vertexB.name, this.vertexC.name, this.vertexA.name];
|
|
200
|
-
if (highlightedAngle === this.vertexA.name)
|
|
201
|
-
temp = [this.vertexC.name, this.vertexA.name, this.vertexB.name];
|
|
202
|
-
commands.push(`be = Angle(${temp[0]}, ${temp[1]}, ${temp[2]}, Line(${temp[0]}, ${temp[1]}))`, `ShowLabel(be, false)`, `SetColor(be, "${colorHighlightedAngle ?? defautColor}")`);
|
|
134
|
+
const lengths = this.sides.map((s) => s.getLength());
|
|
135
|
+
return (lengths[0] !== lengths[1] &&
|
|
136
|
+
lengths[1] !== lengths[2] &&
|
|
137
|
+
lengths[0] !== lengths[2]);
|
|
138
|
+
}
|
|
139
|
+
highlightSide(index, opts) {
|
|
140
|
+
const side = this.sides[index];
|
|
141
|
+
if (opts.color)
|
|
142
|
+
this.commands.push(`SetColor(${side.ggbName}, "${opts.color}")`);
|
|
143
|
+
if (opts.caption) {
|
|
144
|
+
this.commands.push(...side.getFitCaptionCommands(opts.caption, opts.color));
|
|
203
145
|
}
|
|
204
|
-
if (showLabels)
|
|
205
|
-
for (let i = 0; i < showLabels.length; i++) {
|
|
206
|
-
commands.push(`ShowLabel(${showLabels[i]}, true)`);
|
|
207
|
-
if (setCaptions)
|
|
208
|
-
commands.push(`SetCaption(${showLabels[i]}, "${setCaptions[i]}")`);
|
|
209
|
-
}
|
|
210
|
-
if (highlightedSide)
|
|
211
|
-
commands.push(`SetColor(${highlightedSide}, "${colorHighlightedSide ?? defautColor}")`);
|
|
212
|
-
return commands;
|
|
213
146
|
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
Math.min(this.vertexA.getXnumber(), this.vertexB.getXnumber(), this.vertexC.getXnumber()) - 1,
|
|
217
|
-
Math.max(this.vertexA.getXnumber(), this.vertexB.getXnumber(), this.vertexC.getXnumber()) + 1,
|
|
218
|
-
Math.min(this.vertexA.getYnumber(), this.vertexB.getYnumber(), this.vertexC.getYnumber()) - 1,
|
|
219
|
-
Math.max(this.vertexA.getYnumber(), this.vertexB.getYnumber(), this.vertexC.getYnumber()) + 1,
|
|
220
|
-
];
|
|
147
|
+
highlightAngle(index, opts) {
|
|
148
|
+
this.commands.push(...this.angles[index].toCommands(opts));
|
|
221
149
|
}
|
|
222
|
-
|
|
223
|
-
|
|
150
|
+
showSidesLength(hiddenSides) {
|
|
151
|
+
this.commands.push(...this.sides
|
|
152
|
+
.filter((s, i) => !hiddenSides?.includes(i))
|
|
153
|
+
.flatMap((s) => s.getFitCaptionCommands()));
|
|
224
154
|
}
|
|
225
|
-
|
|
226
|
-
|
|
155
|
+
getHeight(summitIndex, opts) {
|
|
156
|
+
const base = line_1.LineConstructor.fromSegment(this.sides[summitIndex]);
|
|
157
|
+
const perp = base.getPerpendicular(this.points[summitIndex]);
|
|
158
|
+
const foot = perp.intersect(base, opts?.footName);
|
|
159
|
+
while (this.name.includes(foot.name)) {
|
|
160
|
+
foot.name = (0, randomLetter_1.randomLetter)(true);
|
|
161
|
+
}
|
|
162
|
+
const segmentHeight = new segment_1.Segment(this.points[summitIndex], foot);
|
|
163
|
+
return segmentHeight;
|
|
164
|
+
}
|
|
165
|
+
drawHeight(summitIndex, opts) {
|
|
166
|
+
const height = this.getHeight(summitIndex, opts);
|
|
167
|
+
const foot = height.pointB;
|
|
168
|
+
const angle = new angle_1.Angle([
|
|
169
|
+
this.points[summitIndex],
|
|
170
|
+
foot,
|
|
171
|
+
this.points[(summitIndex + 1) % 3],
|
|
172
|
+
]);
|
|
173
|
+
this.commands.push(...foot.toGGBCommand(), ...height.toGGBCommands(false, { style: 2 }), ...angle.toCommands());
|
|
174
|
+
if (!this.sides[summitIndex].includes(foot)) {
|
|
175
|
+
const distancesToSideSummits = [
|
|
176
|
+
this.sides[summitIndex].pointA,
|
|
177
|
+
this.sides[summitIndex].pointB,
|
|
178
|
+
].map((p) => p.distanceTo(foot));
|
|
179
|
+
const closestPoint = distancesToSideSummits[0] < distancesToSideSummits[1]
|
|
180
|
+
? this.sides[summitIndex].pointA
|
|
181
|
+
: this.sides[summitIndex].pointB;
|
|
182
|
+
const prolongement = new segment_1.Segment(closestPoint, foot);
|
|
183
|
+
this.commands.push(...prolongement.toGGBCommands(false, { style: 2 }));
|
|
184
|
+
}
|
|
227
185
|
}
|
|
228
|
-
|
|
229
|
-
|
|
186
|
+
generateCoords() {
|
|
187
|
+
const coords = this.points.map((p) => [p.x.evaluate(), p.y.evaluate()]);
|
|
188
|
+
const [x1, y1, x2, y2, x3, y3] = coords.flatMap((p) => p);
|
|
189
|
+
const [xMin, xMax, yMin, yMax] = [
|
|
190
|
+
Math.min(x1, x2, x3),
|
|
191
|
+
Math.max(x1, x2, x3),
|
|
192
|
+
Math.min(y1, y2, y3),
|
|
193
|
+
Math.max(y1, y2, y3),
|
|
194
|
+
];
|
|
195
|
+
const xDelta = Math.abs(xMax - xMin);
|
|
196
|
+
const yDelta = Math.abs(yMax - yMin);
|
|
197
|
+
return [
|
|
198
|
+
xMin - 0.1 * xDelta,
|
|
199
|
+
xMax + 0.1 * xDelta,
|
|
200
|
+
yMin - 0.1 * yDelta,
|
|
201
|
+
yMax + 0.1 * yDelta,
|
|
202
|
+
];
|
|
230
203
|
}
|
|
231
204
|
}
|
|
232
205
|
exports.Triangle = Triangle;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { AlgebraicNode } from "../../tree/nodes/algebraicNode";
|
|
2
|
-
import { Node } from "../../tree/nodes/node";
|
|
3
2
|
import { Point } from "./point";
|
|
4
3
|
export declare abstract class VectorConstructor {
|
|
5
4
|
static fromPoints(origin: Point, end: Point): Vector;
|
|
@@ -17,12 +16,13 @@ export declare class Vector {
|
|
|
17
16
|
isColinear(v: Vector): boolean;
|
|
18
17
|
determinant(v: Vector): AlgebraicNode;
|
|
19
18
|
times(k: AlgebraicNode, name?: string): Vector;
|
|
20
|
-
scalarProduct(v: Vector):
|
|
19
|
+
scalarProduct(v: Vector): AlgebraicNode;
|
|
21
20
|
add(v: Vector): Vector;
|
|
22
21
|
getNorm(): AlgebraicNode;
|
|
23
22
|
getEndPoint(startPoint: Point, name?: string): Point;
|
|
24
23
|
equals(v: Vector): boolean;
|
|
25
24
|
getXAsNumber(): number;
|
|
26
25
|
getYAsNumber(): number;
|
|
26
|
+
getOrthogonal(): Vector;
|
|
27
27
|
}
|
|
28
28
|
//# sourceMappingURL=vector.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vector.d.ts","sourceRoot":"","sources":["../../../src/math/geometry/vector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"vector.d.ts","sourceRoot":"","sources":["../../../src/math/geometry/vector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAgB/D,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,8BAAsB,iBAAiB;IACrC,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,GAAG,MAAM;IAOpD,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,UAAO,GAAG,MAAM;CAOtD;AAED,qBAAa,MAAM;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,CAAC,EAAE,aAAa,CAAC;IACjB,CAAC,EAAE,aAAa,CAAC;gBACL,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,aAAa,EAAE,CAAC,EAAE,aAAa;IAO5D,KAAK,IAAI,MAAM;IAIf,eAAe,IAAI,MAAM;IAMzB,iBAAiB,IAAI,MAAM;IAM3B,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO;IAK9B,WAAW,CAAC,CAAC,EAAE,MAAM,GAAG,aAAa;IAIrC,KAAK,CAAC,CAAC,EAAE,aAAa,EAAE,IAAI,CAAC,EAAE,MAAM;IAOrC,aAAa,CAAC,CAAC,EAAE,MAAM;IAgBvB,GAAG,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IAYtB,OAAO,IAAI,aAAa;IAUxB,WAAW,CAAC,UAAU,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,MAAM;IAO5C,MAAM,CAAC,CAAC,EAAE,MAAM;IAIhB,YAAY;IAMZ,YAAY;IAOZ,aAAa;CAGd"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Vector = exports.VectorConstructor = void 0;
|
|
4
|
+
const oppositeNode_1 = require("../../tree/nodes/functions/oppositeNode");
|
|
4
5
|
const sqrtNode_1 = require("../../tree/nodes/functions/sqrtNode");
|
|
5
|
-
const node_1 = require("../../tree/nodes/node");
|
|
6
6
|
const numberNode_1 = require("../../tree/nodes/numbers/numberNode");
|
|
7
7
|
const addNode_1 = require("../../tree/nodes/operators/addNode");
|
|
8
8
|
const multiplyNode_1 = require("../../tree/nodes/operators/multiplyNode");
|
|
@@ -41,7 +41,8 @@ class Vector {
|
|
|
41
41
|
}
|
|
42
42
|
isColinear(v) {
|
|
43
43
|
const det = this.determinant(v);
|
|
44
|
-
|
|
44
|
+
const ev = det.evaluate();
|
|
45
|
+
return Math.abs(ev) < 0.000001;
|
|
45
46
|
}
|
|
46
47
|
determinant(v) {
|
|
47
48
|
return (0, substractNode_1.substract)((0, multiplyNode_1.multiply)(this.x, v.y), (0, multiplyNode_1.multiply)(this.y, v.x)).simplify();
|
|
@@ -50,13 +51,18 @@ class Vector {
|
|
|
50
51
|
return new Vector(name ?? "v", new multiplyNode_1.MultiplyNode(this.x, k).simplify(), new multiplyNode_1.MultiplyNode(this.y, k).simplify());
|
|
51
52
|
}
|
|
52
53
|
scalarProduct(v) {
|
|
53
|
-
if (
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
54
|
+
// if (
|
|
55
|
+
// [this.x.type, this.y.type, v.x.type, v.y.type].some(
|
|
56
|
+
// (el) => el !== NodeType.number,
|
|
57
|
+
// )
|
|
58
|
+
// )
|
|
59
|
+
// throw Error("general determinant not implemented");
|
|
60
|
+
// const xValue = (this.x as NumberNode).value;
|
|
61
|
+
// const yValue = (this.y as NumberNode).value;
|
|
62
|
+
// const vxValue = (v.x as NumberNode).value;
|
|
63
|
+
// const vyValue = (v.y as NumberNode).value;
|
|
64
|
+
// return new NumberNode(xValue * vxValue + yValue * vyValue);
|
|
65
|
+
return (0, addNode_1.add)((0, multiplyNode_1.multiply)(this.x, v.x), (0, multiplyNode_1.multiply)(this.y, v.y)).simplify();
|
|
60
66
|
}
|
|
61
67
|
add(v) {
|
|
62
68
|
const x = v.x;
|
|
@@ -88,5 +94,8 @@ class Vector {
|
|
|
88
94
|
}
|
|
89
95
|
return this.y.value;
|
|
90
96
|
}
|
|
97
|
+
getOrthogonal() {
|
|
98
|
+
return new Vector(this.name, this.y, (0, oppositeNode_1.opposite)(this.x).simplify());
|
|
99
|
+
}
|
|
91
100
|
}
|
|
92
101
|
exports.Vector = Vector;
|
|
@@ -28,7 +28,7 @@ export declare class Rational implements Nombre {
|
|
|
28
28
|
reverse(shouldSimplify: boolean): Nombre;
|
|
29
29
|
divide(nb: Nombre): Nombre;
|
|
30
30
|
opposite(): Rational;
|
|
31
|
-
toTree(opts?: NodeOptions):
|
|
31
|
+
toTree(opts?: NodeOptions): FractionNode | OppositeNode<FractionNode>;
|
|
32
32
|
isIrreductible(): boolean;
|
|
33
33
|
simplify(): Integer | Rational;
|
|
34
34
|
}
|
|
@@ -13,6 +13,6 @@ export declare class ExtendedRingElement {
|
|
|
13
13
|
b: number;
|
|
14
14
|
algebraicElement: Nombre;
|
|
15
15
|
constructor(a: number, b: number, algebraicElement: Nombre);
|
|
16
|
-
toTree(): import("../../../tree/nodes/algebraicNode").AlgebraicNode | NumberNode | SubstractNode | AddNode |
|
|
16
|
+
toTree(): import("../../../tree/nodes/algebraicNode").AlgebraicNode | NumberNode | SubstractNode | AddNode | MultiplyNode | OppositeNode<import("../../../tree/nodes/algebraicNode").AlgebraicNode>;
|
|
17
17
|
}
|
|
18
18
|
//# sourceMappingURL=extendedRingElement.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"real.d.ts","sourceRoot":"","sources":["../../../../src/math/numbers/reals/real.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"real.d.ts","sourceRoot":"","sources":["../../../../src/math/numbers/reals/real.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAC;AAU/D,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC/C,8BAAsB,eAAe;IACnC,MAAM,CAAC,MAAM;CAUd;AACD,qBAAa,IAAK,YAAW,MAAM;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,UAAU,CAAC;gBACL,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM;IAKtC,MAAM,CAAC,CAAC,EAAE,MAAM;IAGhB,MAAM,IAAI,aAAa;CAIxB;AAED,8BAAsB,qBAAqB;IACzC;;OAEG;IACH,MAAM,CAAC,kBAAkB,CAAC,EACxB,kBAA0B,EAC1B,SAAc,GACf;;;KAAA,GAAG,UAAU;IASd,MAAM,CAAC,kBAAkB,CAAC,GAAG,GAAE,MAAW,GAAG,UAAU;CAIxD;AAED,qBAAa,UAAW,SAAQ,IAAI;IAClC,OAAO,EAAE,MAAM,CAAC;gBACJ,OAAO,EAAE,MAAM;IAK3B,cAAc;IAMd,mBAAmB,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC;IAkBvC,sDAAsD;IACtD,aAAa,IAAI,MAAM;IAMvB,QAAQ,IAAI,MAAM;IA4BlB,KAAK,IAAI,MAAM;IAIf,MAAM;CAGP"}
|
|
@@ -10,6 +10,7 @@ const piNode_1 = require("../../../tree/nodes/numbers/piNode");
|
|
|
10
10
|
const multiplyNode_1 = require("../../../tree/nodes/operators/multiplyNode");
|
|
11
11
|
const diceFlip_1 = require("../../../utils/alea/diceFlip");
|
|
12
12
|
const random_1 = require("../../../utils/alea/random");
|
|
13
|
+
const decimal_1 = require("../decimals/decimal");
|
|
13
14
|
const integer_1 = require("../integer/integer");
|
|
14
15
|
const primes_1 = require("../integer/primes");
|
|
15
16
|
const nombre_1 = require("../nombre");
|
|
@@ -101,6 +102,8 @@ class SquareRoot extends Real {
|
|
|
101
102
|
return new integer_1.Integer(0);
|
|
102
103
|
if (this.operand === 1)
|
|
103
104
|
return new integer_1.Integer(1);
|
|
105
|
+
if (Math.floor(this.operand) !== this.operand)
|
|
106
|
+
return new decimal_1.Decimal(Math.sqrt(this.operand));
|
|
104
107
|
const [outsideSqrt, insideSqrt] = this.getSimplifiedCoeffs();
|
|
105
108
|
const simplified = insideSqrt !== 1
|
|
106
109
|
? new Real(outsideSqrt * Math.sqrt(insideSqrt), `${outsideSqrt === 1 ? "" : `${outsideSqrt}`}\\sqrt{${insideSqrt}}`)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generalAffine.d.ts","sourceRoot":"","sources":["../../../src/math/polynomials/generalAffine.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAG/D,OAAO,EAEL,eAAe,EAEhB,MAAM,kCAAkC,CAAC;AAQ1C,8BAAsB,wBAAwB;IAC5C,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,wBAAwB;CAM7D;AACD,MAAM,MAAM,wBAAwB,GAAG;IACrC,EAAE,EAAE,QAAQ,CAAC;IACb,CAAC,EAAE,eAAe,CAAC;IACnB,CAAC,EAAE,eAAe,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AACF,qBAAa,aAAa;IACxB,CAAC,EAAE,aAAa,CAAC;IACjB,CAAC,EAAE,aAAa,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;gBAGf,CAAC,EAAE,MAAM,GAAG,aAAa,EACzB,CAAC,EAAE,MAAM,GAAG,aAAa,EACzB,QAAQ,GAAE,MAAY;IAUxB,aAAa,IAAI,wBAAwB;IAQzC,OAAO,IAAI,aAAa;IAIxB,MAAM;IAMN,UAAU,CAAC,GAAG,EAAE,aAAa;IAI7B,QAAQ;
|
|
1
|
+
{"version":3,"file":"generalAffine.d.ts","sourceRoot":"","sources":["../../../src/math/polynomials/generalAffine.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAG/D,OAAO,EAEL,eAAe,EAEhB,MAAM,kCAAkC,CAAC;AAQ1C,8BAAsB,wBAAwB;IAC5C,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,wBAAwB;CAM7D;AACD,MAAM,MAAM,wBAAwB,GAAG;IACrC,EAAE,EAAE,QAAQ,CAAC;IACb,CAAC,EAAE,eAAe,CAAC;IACnB,CAAC,EAAE,eAAe,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AACF,qBAAa,aAAa;IACxB,CAAC,EAAE,aAAa,CAAC;IACjB,CAAC,EAAE,aAAa,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;gBAGf,CAAC,EAAE,MAAM,GAAG,aAAa,EACzB,CAAC,EAAE,MAAM,GAAG,aAAa,EACzB,QAAQ,GAAE,MAAY;IAUxB,aAAa,IAAI,wBAAwB;IAQzC,OAAO,IAAI,aAAa;IAIxB,MAAM;IAMN,UAAU,CAAC,GAAG,EAAE,aAAa;IAI7B,QAAQ;CAMT"}
|
|
@@ -50,7 +50,7 @@ class GeneralAffine {
|
|
|
50
50
|
return (0, fractionNode_1.frac)((0, substractNode_1.substract)(aff.b, this.b), (0, substractNode_1.substract)(this.a, aff.a)).simplify();
|
|
51
51
|
}
|
|
52
52
|
opposite() {
|
|
53
|
-
return new GeneralAffine((0, oppositeNode_1.opposite)(this.a), (0, oppositeNode_1.opposite)(this.b));
|
|
53
|
+
return new GeneralAffine((0, oppositeNode_1.opposite)(this.a).simplify(), (0, oppositeNode_1.opposite)(this.b).simplify());
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
exports.GeneralAffine = GeneralAffine;
|
|
@@ -40,7 +40,7 @@ export declare class Polynomial {
|
|
|
40
40
|
integrateToNode(opts?: NodeOptions): AlgebraicNode;
|
|
41
41
|
calculate(x: number): number;
|
|
42
42
|
getLimit(to: "+\\infty" | "-\\infty"): string;
|
|
43
|
-
getLimitNode(to: "+\\infty" | "-\\infty"):
|
|
43
|
+
getLimitNode(to: "+\\infty" | "-\\infty"): import("../../tree/nodes/numbers/constantNode").ConstantNode | NumberNode;
|
|
44
44
|
toTree(opts?: NodeOptions): AlgebraicNode;
|
|
45
45
|
toTex(): string;
|
|
46
46
|
toString(): string;
|
|
@@ -65,9 +65,9 @@ export declare class Trinom extends Polynomial {
|
|
|
65
65
|
getRootsNode(): AlgebraicNode[];
|
|
66
66
|
getRootsEquationSolutionTex(): string;
|
|
67
67
|
getAlpha(): number;
|
|
68
|
-
getAlphaNode(): NumberNode |
|
|
68
|
+
getAlphaNode(): NumberNode | FractionNode | OppositeNode<FractionNode>;
|
|
69
69
|
getBeta(): number;
|
|
70
|
-
getBetaNode(): NumberNode |
|
|
70
|
+
getBetaNode(): NumberNode | FractionNode | OppositeNode<FractionNode>;
|
|
71
71
|
getFactorizedForm(): AlgebraicNode | MultiplyNode;
|
|
72
72
|
getCanonicalForm(): AddNode | MultiplyNode;
|
|
73
73
|
getSommet(): Point;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pythagoricianTriplets.d.ts","sourceRoot":"","sources":["../../../../src/math/utils/geometry/pythagoricianTriplets.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,YAiBjC,CAAC"}
|
|
1
|
+
{"version":3,"file":"pythagoricianTriplets.d.ts","sourceRoot":"","sources":["../../../../src/math/utils/geometry/pythagoricianTriplets.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,YAiBjC,CAAC;AAEF,eAAO,MAAM,+BAA+B,YAY3C,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.pythagoricianTriplets = void 0;
|
|
3
|
+
exports.pythagoricianTripletsNiceAngles = exports.pythagoricianTriplets = void 0;
|
|
4
4
|
exports.pythagoricianTriplets = [
|
|
5
5
|
[3, 4, 5],
|
|
6
6
|
[5, 12, 13],
|
|
@@ -19,3 +19,16 @@ exports.pythagoricianTriplets = [
|
|
|
19
19
|
[48, 55, 73],
|
|
20
20
|
[65, 72, 97],
|
|
21
21
|
];
|
|
22
|
+
exports.pythagoricianTripletsNiceAngles = [
|
|
23
|
+
[3, 4, 5],
|
|
24
|
+
[5, 12, 13],
|
|
25
|
+
[8, 15, 17],
|
|
26
|
+
[12, 35, 37],
|
|
27
|
+
[20, 21, 29],
|
|
28
|
+
[28, 45, 53],
|
|
29
|
+
[33, 56, 65],
|
|
30
|
+
[36, 77, 85],
|
|
31
|
+
[39, 80, 89],
|
|
32
|
+
[48, 55, 73],
|
|
33
|
+
[65, 72, 97],
|
|
34
|
+
];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @returns random [[a, b[[
|
|
3
3
|
*/
|
|
4
|
-
export declare const randfloat: (a: number, b?: number, roundTo?: number, excludes?: number[]) => number;
|
|
4
|
+
export declare const randfloat: (a: number, b?: number, roundTo?: number, excludes?: number[] | ((x: number) => boolean) | undefined) => number;
|
|
5
5
|
//# sourceMappingURL=randfloat.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"randfloat.d.ts","sourceRoot":"","sources":["../../../../src/math/utils/random/randfloat.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,eAAO,MAAM,SAAS,MACjB,MAAM,MACL,MAAM,YACA,MAAM,
|
|
1
|
+
{"version":3,"file":"randfloat.d.ts","sourceRoot":"","sources":["../../../../src/math/utils/random/randfloat.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,eAAO,MAAM,SAAS,MACjB,MAAM,MACL,MAAM,YACA,MAAM,6BACW,MAAM,KAAK,OAAO,kBAC5C,MAiBF,CAAC"}
|
|
@@ -10,13 +10,20 @@ const randfloat = (a, b, roundTo, excludes) => {
|
|
|
10
10
|
return Math.random() * a;
|
|
11
11
|
if (roundTo === undefined)
|
|
12
12
|
return a + Math.random() * (b - a);
|
|
13
|
-
if (excludes
|
|
13
|
+
if (Array.isArray(excludes)) {
|
|
14
14
|
let res = 0;
|
|
15
15
|
do {
|
|
16
16
|
res = (0, round_1.round)(a + Math.random() * (b - a), roundTo);
|
|
17
17
|
} while (excludes.includes(res));
|
|
18
18
|
return res;
|
|
19
19
|
}
|
|
20
|
+
else if (excludes) {
|
|
21
|
+
let res = 0;
|
|
22
|
+
do {
|
|
23
|
+
res = (0, round_1.round)(a + Math.random() * (b - a), roundTo);
|
|
24
|
+
} while (excludes(res));
|
|
25
|
+
return res;
|
|
26
|
+
}
|
|
20
27
|
return (0, round_1.round)(a + Math.random() * (b - a), roundTo);
|
|
21
28
|
};
|
|
22
29
|
exports.randfloat = randfloat;
|