math-exercises 1.3.37 → 1.3.39
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/package.json +1 -1
- package/lib/exercises/geometry/cartesian/derivativeNumberReading.d.ts +0 -4
- package/lib/exercises/geometry/cartesian/derivativeNumberReading.d.ts.map +0 -1
- package/lib/exercises/geometry/cartesian/derivativeNumberReading.js +0 -51
- package/lib/exercises/geometry/cartesian/derivativeNumberReading2.d.ts +0 -1
- package/lib/exercises/geometry/cartesian/derivativeNumberReading2.d.ts.map +0 -1
- package/lib/exercises/geometry/cartesian/derivativeNumberReading2.js +0 -91
- /package/lib/exercises/geometry/euclidean/{TriangleArea.d.ts → triangleArea.d.ts} +0 -0
- /package/lib/exercises/geometry/euclidean/{TriangleArea.d.ts.map → triangleArea.d.ts.map} +0 -0
- /package/lib/exercises/geometry/euclidean/{TriangleArea.js → triangleArea.js} +0 -0
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"derivativeNumberReading.d.ts","sourceRoot":"","sources":["../../../../src/exercises/geometry/cartesian/derivativeNumberReading.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAS9D,eAAO,MAAM,uBAAuB,EAAE,QASrC,CAAC;AAEF,wBAAgB,0BAA0B,IAAI,QAAQ,CAoCrD"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getDerivativeNumberReading = exports.derivativeNumberReading = void 0;
|
|
4
|
-
const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
|
|
5
|
-
const droite_1 = require("../../../math/geometry/droite");
|
|
6
|
-
const point_1 = require("../../../math/geometry/point");
|
|
7
|
-
const polynomial_1 = require("../../../math/polynomials/polynomial");
|
|
8
|
-
const randint_1 = require("../../../math/utils/random/randint");
|
|
9
|
-
const numberNode_1 = require("../../../tree/nodes/numbers/numberNode");
|
|
10
|
-
const mathjs_1 = require("mathjs");
|
|
11
|
-
exports.derivativeNumberReading = {
|
|
12
|
-
id: 'derivativeNumberReading',
|
|
13
|
-
connector: '=',
|
|
14
|
-
instruction: '',
|
|
15
|
-
label: 'Lecture de nombre dérivé',
|
|
16
|
-
levels: ['3', '2', '1'],
|
|
17
|
-
isSingleStep: false,
|
|
18
|
-
section: 'Géométrie cartésienne',
|
|
19
|
-
generator: (nb) => (0, getDistinctQuestions_1.getDistinctQuestions)(getDerivativeNumberReading, nb),
|
|
20
|
-
};
|
|
21
|
-
function getDerivativeNumberReading() {
|
|
22
|
-
let xA, yA, xB, yB;
|
|
23
|
-
let pointA, pointB;
|
|
24
|
-
do {
|
|
25
|
-
[xA, yA] = [1, 2].map((el) => (0, randint_1.randint)(-5, 6));
|
|
26
|
-
xB = xA > 0 ? (0, randint_1.randint)(xA - 4, 6) : (0, randint_1.randint)(-4, xA + 5); // l'écart entre les deux points ne soit pas grand
|
|
27
|
-
yB = yA > 0 ? (0, randint_1.randint)(yA - 4, 6) : (0, randint_1.randint)(-4, yA + 5);
|
|
28
|
-
pointA = new point_1.Point('A', new numberNode_1.NumberNode(xA), new numberNode_1.NumberNode(yA));
|
|
29
|
-
pointB = new point_1.Point('B', new numberNode_1.NumberNode(xB), new numberNode_1.NumberNode(yB));
|
|
30
|
-
} while (xB - xA === 0);
|
|
31
|
-
const droite = droite_1.DroiteConstructor.fromTwoPoints(pointA, pointB, 'D');
|
|
32
|
-
const [a, b] = [(3 * (0, randint_1.randint)(-100, 100, [0])) / 100, (2 * (0, randint_1.randint)(-4, 5)) / 100];
|
|
33
|
-
const c = (0, mathjs_1.evaluate)(droite.a.toMathString()) - a * Math.pow(xA, 2) - b * xA;
|
|
34
|
-
const d = yA - (a / 3) * Math.pow(xA, 3) - (b / 2) * Math.pow(xA, 2) - xA * c;
|
|
35
|
-
const polynome = new polynomial_1.Polynomial([d, c, b / 2, a / 3]);
|
|
36
|
-
const instruction = `Ci-dessous sont tracées la courbe de la fonction $f$ et la tangente à cette courbe au point d'abscisse $${xA}$.$\\\\$ Déterminer le coefficient directeur de la tangente qui passe par ce point.`;
|
|
37
|
-
const commands = [
|
|
38
|
-
polynome.toString(),
|
|
39
|
-
`g(x) = (${droite.a.toMathString()}) * x + (${droite.b.toMathString()})`,
|
|
40
|
-
`(${xA},${yA})`,
|
|
41
|
-
];
|
|
42
|
-
const question = {
|
|
43
|
-
instruction,
|
|
44
|
-
startStatement: 'a',
|
|
45
|
-
answer: droite.getLeadingCoefficient(),
|
|
46
|
-
commands,
|
|
47
|
-
coords: [xA - 5, xA + 5, yA - 5, yA + 5],
|
|
48
|
-
};
|
|
49
|
-
return question;
|
|
50
|
-
}
|
|
51
|
-
exports.getDerivativeNumberReading = getDerivativeNumberReading;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=derivativeNumberReading2.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"derivativeNumberReading2.d.ts","sourceRoot":"","sources":["../../../../src/exercises/geometry/cartesian/derivativeNumberReading2.ts"],"names":[],"mappings":""}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*import { Exercise, Question } from '../../../exercises/exercise';
|
|
3
|
-
import { getDistinctQuestions } from '../../../exercises/utils/getDistinctQuestions';
|
|
4
|
-
import { DroiteConstructor } from '../../../math/geometry/droite';
|
|
5
|
-
import { Point } from '../../../math/geometry/point';
|
|
6
|
-
import { Polynomial } from '../../../math/polynomials/polynomial';
|
|
7
|
-
import { randint } from '../../../math/utils/random/randint';
|
|
8
|
-
import { NumberNode } from '../../../tree/nodes/numbers/numberNode';
|
|
9
|
-
import { evaluate } from 'mathjs';
|
|
10
|
-
|
|
11
|
-
export const derivativeNumberReading2: Exercise = {
|
|
12
|
-
id: 'derivativeNumberReading2',
|
|
13
|
-
connector: '=',
|
|
14
|
-
instruction: '',
|
|
15
|
-
label: 'Lecture de nombre dérivé 2',
|
|
16
|
-
levels: ['3', '2', '1'],
|
|
17
|
-
isSingleStep: false,
|
|
18
|
-
section: 'Géométrie cartésienne',
|
|
19
|
-
generator: (nb: number) => getDistinctQuestions(getDerivativeNumberReading, nb),
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export function getDerivativeNumberReading(): Question {
|
|
23
|
-
function computePolynomial(
|
|
24
|
-
x0: number,
|
|
25
|
-
y0: number,
|
|
26
|
-
m: number,
|
|
27
|
-
x1: number,
|
|
28
|
-
y1: number,
|
|
29
|
-
x2: number,
|
|
30
|
-
y2: number,
|
|
31
|
-
x3: number,
|
|
32
|
-
y3: number,
|
|
33
|
-
): [number, number, number, number] {
|
|
34
|
-
const a = (-2 * x0 * x1 * x2 + x0 * x1 * x3 + x0 * x2 * x3 + x1 * x2 * x3) / ((x0 - x1) * (x0 - x2) * (x0 - x3));
|
|
35
|
-
const b =
|
|
36
|
-
((y0 - y1) / ((x0 - x1) * (x0 - x1)) -
|
|
37
|
-
(y0 - y2) / ((x0 - x2) * (x0 - x2)) +
|
|
38
|
-
(y0 - y3) / ((x0 - x3) * (x0 - x3))) /
|
|
39
|
-
(x0 - x1);
|
|
40
|
-
const c =
|
|
41
|
-
((m - 2 * a * x0 - b) * (x0 - x1) * (x0 - x2) * (x0 - x3) -
|
|
42
|
-
(y0 - y1) / ((x0 - x1) * (x0 - x1)) +
|
|
43
|
-
a * (x1 * x1 * (x0 - x2) + x2 * x2 * (x0 - x1) - 2 * x1 * x2 * x0) +
|
|
44
|
-
b * (x1 + x2 - 2 * x0)) /
|
|
45
|
-
((x0 - x2) * (x0 - x3));
|
|
46
|
-
const d = y0 - a * x0 * x0 * x0 - b * x0 * x0 - c * x0;
|
|
47
|
-
return [a, b, c, d];
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function generatePolynomial(
|
|
51
|
-
x0: number,
|
|
52
|
-
y0: number,
|
|
53
|
-
m: number,
|
|
54
|
-
x1: number,
|
|
55
|
-
y1: number,
|
|
56
|
-
x2: number,
|
|
57
|
-
y2: number,
|
|
58
|
-
x3: number,
|
|
59
|
-
y3: number,
|
|
60
|
-
): Polynomial {
|
|
61
|
-
const [a, b, c, d] = computePolynomial(x0, y0, m, x1, y1, x2, y2, x3, y3);
|
|
62
|
-
return new Polynomial([d, c, b, a]);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const [x1, y1, x2, y2, x3, y3] = [1, 2, 3, 4, 5, 6].map((el) => randint(-5, 6));
|
|
66
|
-
|
|
67
|
-
let xA: number, yA, xB, yB: number;
|
|
68
|
-
let pointA, pointB: Point;
|
|
69
|
-
do {
|
|
70
|
-
[xA, yA] = [1, 2].map((el) => randint(-5, 6));
|
|
71
|
-
xB = xA > 0 ? randint(xA - 4, 6) : randint(-4, xA + 5); // l'écart entre les deux points ne soit pas grand
|
|
72
|
-
yB = yA > 0 ? randint(yA - 4, 6) : randint(-4, yA + 5);
|
|
73
|
-
pointA = new Point('A', new NumberNode(xA), new NumberNode(yA));
|
|
74
|
-
pointB = new Point('B', new NumberNode(xB), new NumberNode(yB));
|
|
75
|
-
} while (xB - xA === 0);
|
|
76
|
-
|
|
77
|
-
const droite = DroiteConstructor.fromTwoPoints(pointA, pointB, 'D');
|
|
78
|
-
|
|
79
|
-
const polynome = generatePolynomial(xA, yA, evaluate(droite.a.toMathString()), x1, y1, x2, y2, x3, y3);
|
|
80
|
-
|
|
81
|
-
let instruction = `$f(x) = ${polynome.toTex()}$, $${pointA.toTexWithCoords()}$, $${pointB.toTexWithCoords()}$, $f'(${xA}) = ${droite.getLeadingCoefficient()}$`;
|
|
82
|
-
|
|
83
|
-
const question: Question = {
|
|
84
|
-
instruction,
|
|
85
|
-
//startStatement: pointA.toTexWithCoords() + ' ' + pointB.toTexWithCoords(),
|
|
86
|
-
answer: droite.a.toTex(),
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
return question;
|
|
90
|
-
}
|
|
91
|
-
*/
|
|
File without changes
|
|
File without changes
|
|
File without changes
|