math-exercises 2.2.34 → 2.2.35
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/README.md +6 -62
- package/lib/exercises/math/geometry/vectors/vectorNormCalculation.js +2 -2
- package/lib/exercises/math/spaceGeometry/vectors/spaceVectorNormCalculation.d.ts.map +1 -1
- package/lib/exercises/math/spaceGeometry/vectors/spaceVectorNormCalculation.js +42 -29
- package/lib/utils/markdown/mdCode.d.ts +2 -0
- package/lib/utils/markdown/mdCode.d.ts.map +1 -0
- package/lib/utils/markdown/mdCode.js +9 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,73 +1,17 @@
|
|
|
1
1
|
# math-exercises
|
|
2
2
|
|
|
3
|
-
This is
|
|
4
|
-
|
|
5
|
-
So far, exercises are written in French, but any translation is welcome !
|
|
6
|
-
|
|
7
|
-
This library is used by [Mathlive.fr](https://www.mathlive.fr) for collaborative quizzes.
|
|
3
|
+
This library is used by [Mathlive.fr](https://www.mathlive.fr) and [XPLive.fr](https://www.xplive.fr).
|
|
8
4
|
|
|
9
5
|
## 🚧 Work in progress !
|
|
10
6
|
|
|
11
7
|
This library is still in beta and the architecture may very well completely change in the future.
|
|
12
8
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
- Random images generation using tikZ
|
|
16
|
-
|
|
17
|
-
- Steps within answers
|
|
18
|
-
|
|
19
|
-
- Coverage of all topics up to 12th grade
|
|
20
|
-
|
|
21
|
-
- Better classification of exercises
|
|
22
|
-
|
|
23
|
-
## Exercises format
|
|
24
|
-
|
|
25
|
-
Each Exercise has a `generator` that will return distinct questions for this exercise.
|
|
26
|
-
|
|
27
|
-
The Question in itself has an `instruction`, a `startStatement` and an `answer` (which are all tex strings).
|
|
28
|
-
|
|
29
|
-
You can see all the exercises implemented so far [by playing with the select input here](https://www.mathlive.fr/teacher/createActivity/quizCollab/623366c277e90f70691aee70/).
|
|
30
|
-
|
|
31
|
-
## How to use
|
|
32
|
-
|
|
33
|
-
Example with (ax+b)^2 questions :
|
|
34
|
-
|
|
35
|
-
```js
|
|
36
|
-
import { firstIdentity } from "exercises/calculLitteral/distributivity/firstIdentity";
|
|
37
|
-
|
|
38
|
-
console.log(firstIdentity.instruction);
|
|
39
|
-
const question = firstIdentity.generator(1);
|
|
40
|
-
console.log(question.startStatement);
|
|
41
|
-
console.log(question.answer);
|
|
42
|
-
|
|
43
|
-
//output :
|
|
44
|
-
// Développer et réduire :
|
|
45
|
-
// (2x+3)^2
|
|
46
|
-
// 4x^2 + 12x + 9
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
Some exercises do not have instructions, because the instruction is directly in the question itself.
|
|
50
|
-
|
|
51
|
-
A list of all exercises is exported from root.
|
|
52
|
-
|
|
53
|
-
## Expression tree and latex parser
|
|
54
|
-
|
|
55
|
-
Math expressions are implemented via a tree of Nodes that you'll find inside `tree/nodes`.
|
|
56
|
-
|
|
57
|
-
Any expression can be turned into a valid latex output via the `.toTex()` method.
|
|
58
|
-
|
|
59
|
-
They also can be simplified via the `simplifyNode` method.
|
|
60
|
-
|
|
61
|
-
## Math objects
|
|
62
|
-
|
|
63
|
-
This library also aims to implement pretty much all mathematical objects and notions up to 12th grade : all types of numbers and operations on them, but also points, vectors, polynomials, sets... Thus it can also be used for basic mathematics work.
|
|
64
|
-
|
|
65
|
-
## Minimal dependencies
|
|
9
|
+
## CAS & ASTs
|
|
66
10
|
|
|
67
|
-
|
|
11
|
+
Math expressions are implemented through ASTs.
|
|
68
12
|
|
|
69
|
-
|
|
13
|
+
This library implements its own CAS.
|
|
70
14
|
|
|
71
|
-
|
|
15
|
+
## Copyright
|
|
72
16
|
|
|
73
|
-
|
|
17
|
+
All rights reserved. MathLive and XpLive are registered trademarks. MathLive and XpLive are edited by Heureux Hasard.
|
|
@@ -16,7 +16,7 @@ const getAnswer = (identifiers) => {
|
|
|
16
16
|
return correctAnswer.simplify().toTex();
|
|
17
17
|
};
|
|
18
18
|
const getHint = (identifiers) => {
|
|
19
|
-
return `La norme d'un vecteur est la racine carrée de la somme des
|
|
19
|
+
return `La norme d'un vecteur est la racine carrée de la somme des carrés de ses coordonnées. En d'autres termes, la norme du vecteur $$\\overrightarrow{u}\\begin{pmatrix}x\\\\y\\end{pmatrix}$$ est :
|
|
20
20
|
|
|
21
21
|
$$
|
|
22
22
|
\\lVert \\overrightarrow u \\rVert = \\sqrt{x^2+y^2}
|
|
@@ -27,7 +27,7 @@ const getCorrection = (identifiers) => {
|
|
|
27
27
|
const x = identifiers.x.toTree();
|
|
28
28
|
const y = identifiers.y.toTree();
|
|
29
29
|
const answer = getAnswer(identifiers);
|
|
30
|
-
return `La norme d'un vecteur est la racine carrée de la somme des
|
|
30
|
+
return `La norme d'un vecteur est la racine carrée de la somme des carrés de ses coordonnées. Ici, on a donc :
|
|
31
31
|
|
|
32
32
|
${(0, alignTex_1.alignTex)([
|
|
33
33
|
[
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spaceVectorNormCalculation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/spaceGeometry/vectors/spaceVectorNormCalculation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"spaceVectorNormCalculation.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/spaceGeometry/vectors/spaceVectorNormCalculation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,0BAA0B,CAAC;AAelC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AA2FF,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,WAAW,CAkB5D,CAAC"}
|
|
@@ -9,40 +9,49 @@ const sqrtNode_1 = require("../../../../tree/nodes/functions/sqrtNode");
|
|
|
9
9
|
const addNode_1 = require("../../../../tree/nodes/operators/addNode");
|
|
10
10
|
const powerNode_1 = require("../../../../tree/nodes/operators/powerNode");
|
|
11
11
|
const alignTex_1 = require("../../../../utils/latex/alignTex");
|
|
12
|
+
const getHint = (identifiers) => {
|
|
13
|
+
return "La norme d'un vecteur de l'espace est la racine carrée de la somme des carrés de ses coordonnées.";
|
|
14
|
+
};
|
|
15
|
+
const getCorrection = ({ x, y, z }) => {
|
|
16
|
+
const answer = getAnswer({ x, y, z });
|
|
17
|
+
return `La norme d'un vecteur de l'espace est la racine carrée de la somme des carrés de ses coordonnées. Ici, on a donc :
|
|
18
|
+
|
|
19
|
+
${(0, alignTex_1.alignTex)([
|
|
20
|
+
[
|
|
21
|
+
"\\lVert \\overrightarrow u \\rVert",
|
|
22
|
+
"=",
|
|
23
|
+
new sqrtNode_1.SqrtNode(new addNode_1.AddNode(new powerNode_1.SquareNode(x.toTree()), new addNode_1.AddNode(new powerNode_1.SquareNode(y.toTree()), new powerNode_1.SquareNode(z.toTree())))).toTex(),
|
|
24
|
+
],
|
|
25
|
+
["", "=", new sqrtNode_1.SqrtNode((x ** 2 + y ** 2 + z ** 2).toTree()).toTex()],
|
|
26
|
+
])}
|
|
27
|
+
|
|
28
|
+
Donc $\\lVert \\overrightarrow u \\rVert = ${answer}$.
|
|
29
|
+
`;
|
|
30
|
+
};
|
|
31
|
+
const getAnswer = (identifiers) => {
|
|
32
|
+
const u = new spaceVector_1.SpaceVector("u", identifiers.x.toTree(), identifiers.y.toTree(), identifiers.z.toTree());
|
|
33
|
+
const correctAnswer = u.getNorm();
|
|
34
|
+
return correctAnswer.simplify().toTex();
|
|
35
|
+
};
|
|
36
|
+
const getInstruction = (identifiers) => {
|
|
37
|
+
const u = new spaceVector_1.SpaceVector("u", identifiers.x.toTree(), identifiers.y.toTree(), identifiers.z.toTree());
|
|
38
|
+
return `Cacluler la norme du vecteur $${u.toTexWithCoords()}$`;
|
|
39
|
+
};
|
|
12
40
|
const getSpaceVectorNormCalculationQuestion = () => {
|
|
13
41
|
const u = spaceVector_1.SpaceVectorConstructor.random("u", false);
|
|
14
|
-
const
|
|
15
|
-
|
|
42
|
+
const identifiers = {
|
|
43
|
+
x: u.x.evaluate({}),
|
|
44
|
+
y: u.y.evaluate({}),
|
|
45
|
+
z: u.z.evaluate({}),
|
|
46
|
+
};
|
|
16
47
|
const question = {
|
|
17
|
-
answer,
|
|
18
|
-
instruction:
|
|
48
|
+
answer: getAnswer(identifiers),
|
|
49
|
+
instruction: getInstruction(identifiers),
|
|
19
50
|
keys: [],
|
|
20
51
|
answerFormat: "tex",
|
|
21
|
-
identifiers
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
z: u.z.evaluate({}),
|
|
25
|
-
},
|
|
26
|
-
hint: "La norme d'un vecteur de l'espace est la racine carrée de la somme des carrés de ses coordonnées.",
|
|
27
|
-
correction: `La norme d'un vecteur de l'espace est la racine carrée de la somme des carrés de ses coordonnées. Ici, on a donc :
|
|
28
|
-
|
|
29
|
-
${(0, alignTex_1.alignTex)([
|
|
30
|
-
[
|
|
31
|
-
"\\lVert \\overrightarrow u \\rVert",
|
|
32
|
-
"=",
|
|
33
|
-
new sqrtNode_1.SqrtNode(new addNode_1.AddNode(new powerNode_1.SquareNode(u.x), new addNode_1.AddNode(new powerNode_1.SquareNode(u.y), new powerNode_1.SquareNode(u.z)))).toTex(),
|
|
34
|
-
],
|
|
35
|
-
[
|
|
36
|
-
"",
|
|
37
|
-
"=",
|
|
38
|
-
new sqrtNode_1.SqrtNode((u.x.evaluate({}) ** 2 +
|
|
39
|
-
u.y.evaluate({}) ** 2 +
|
|
40
|
-
u.z.evaluate({}) ** 2).toTree()).toTex(),
|
|
41
|
-
],
|
|
42
|
-
])}
|
|
43
|
-
|
|
44
|
-
Donc $\\lVert \\overrightarrow u \\rVert = ${answer}$.
|
|
45
|
-
`,
|
|
52
|
+
identifiers,
|
|
53
|
+
hint: getHint(identifiers),
|
|
54
|
+
correction: getCorrection(identifiers),
|
|
46
55
|
};
|
|
47
56
|
return question;
|
|
48
57
|
};
|
|
@@ -76,4 +85,8 @@ exports.spaceVectorNormCalculation = {
|
|
|
76
85
|
isAnswerValid,
|
|
77
86
|
subject: "Mathématiques",
|
|
78
87
|
hasHintAndCorrection: true,
|
|
88
|
+
getHint,
|
|
89
|
+
getCorrection,
|
|
90
|
+
getAnswer,
|
|
91
|
+
getInstruction,
|
|
79
92
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mdCode.d.ts","sourceRoot":"","sources":["../../../src/utils/markdown/mdCode.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM,QAAS,MAAM,WAIjC,CAAC"}
|