math-exercises 3.0.197 → 3.0.199
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/calculLitteral/equation/exp/expOfTrinomEquals1Equation.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/exp/expOfTrinomEquals1Equation.js +3 -0
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType3.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType3.js +58 -30
- package/lib/exercises/math/complex/addComplex.d.ts.map +1 -1
- package/lib/exercises/math/complex/addComplex.js +53 -7
- package/lib/exercises/math/complex/conjugateComplex.d.ts.map +1 -1
- package/lib/exercises/math/complex/conjugateComplex.js +48 -7
- package/lib/exercises/math/complex/mutiplyComplex.d.ts.map +1 -1
- package/lib/exercises/math/complex/mutiplyComplex.js +51 -18
- package/lib/exercises/math/complex/reAndIm.d.ts.map +1 -1
- package/lib/exercises/math/complex/reAndIm.js +35 -4
- package/lib/exercises/math/derivation/convexity/convexityQuadrinomials.d.ts.map +1 -1
- package/lib/exercises/math/derivation/convexity/convexityQuadrinomials.js +46 -4
- package/lib/exercises/math/derivation/convexity/convexityQuadrinomialsGeo.d.ts +9 -0
- package/lib/exercises/math/derivation/convexity/convexityQuadrinomialsGeo.d.ts.map +1 -0
- package/lib/exercises/math/derivation/convexity/convexityQuadrinomialsGeo.js +160 -0
- package/lib/exercises/math/derivation/convexity/convexityTrinomials.d.ts.map +1 -1
- package/lib/exercises/math/derivation/convexity/convexityTrinomials.js +33 -2
- package/lib/exercises/math/derivation/convexity/convexityTrinomialsGeo.d.ts +7 -0
- package/lib/exercises/math/derivation/convexity/convexityTrinomialsGeo.d.ts.map +1 -0
- package/lib/exercises/math/derivation/convexity/convexityTrinomialsGeo.js +80 -0
- package/lib/exercises/math/derivation/convexity/index.d.ts +2 -0
- package/lib/exercises/math/derivation/convexity/index.d.ts.map +1 -1
- package/lib/exercises/math/derivation/convexity/index.js +2 -0
- package/lib/exercises/math/derivation/convexity/inflexionPointQuadrinomials.js +2 -2
- package/lib/exercises/math/derivation/derivative/exp/expDerivativeFour.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/exp/expDerivativeFour.js +39 -33
- package/lib/exercises/math/derivation/derivative/exp/secondDerivativeOfExpoFunction.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/exp/secondDerivativeOfExpoFunction.js +45 -3
- package/lib/exercises/math/derivation/derivative/ln/lnDerivativeOne.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/ln/lnDerivativeOne.js +53 -11
- package/lib/exercises/math/derivation/derivative/ln/lnDerivativeThree.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/ln/lnDerivativeThree.js +54 -3
- package/lib/exercises/math/derivation/derivative/ln/lnDerivativeTwo.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/ln/lnDerivativeTwo.js +23 -0
- package/lib/exercises/math/derivation/derivative/polynomial/secondDerivativeOfThirdDegreeFunction.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/polynomial/secondDerivativeOfThirdDegreeFunction.js +30 -0
- package/lib/exercises/math/derivation/derivative/polynomial/secondDerivativeOfTrinom.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/polynomial/secondDerivativeOfTrinom.js +25 -1
- package/lib/exercises/math/derivation/derivative/trigo/cosCompositionDerivation.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/trigo/cosCompositionDerivation.js +27 -0
- package/lib/exercises/math/derivation/derivative/trigo/cosSecondDegreeDerivative.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/trigo/cosSecondDegreeDerivative.js +47 -3
- package/lib/exercises/math/derivation/derivative/trigo/sinCompositionDerivation.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/trigo/sinCompositionDerivation.js +44 -5
- package/lib/exercises/math/derivation/derivative/trigo/sinSecondDegreeDerivative.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/trigo/sinSecondDegreeDerivative.js +65 -9
- package/lib/exercises/math/functions/exponential/sign/expFunctionBasicSign.d.ts.map +1 -1
- package/lib/exercises/math/functions/exponential/sign/expFunctionBasicSign.js +3 -0
- package/lib/exercises/math/functions/exponential/variations/varSignTableOfAffineTimesExp.js +1 -1
- package/lib/exercises/math/functions/exponential/variations/varSignTableOfExpMinusX.js +1 -1
- package/lib/exercises/math/functions/sign/affineProductSign.d.ts.map +1 -1
- package/lib/exercises/math/functions/sign/affineProductSign.js +0 -4
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitReading.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/summitAndCanonical/summitReading.js +1 -0
- package/lib/exercises/math/geometry/index.d.ts +0 -1
- package/lib/exercises/math/geometry/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/index.js +0 -1
- package/lib/exercises/math/spaceGeometry/vectors/spaceVectorLinearCombinationCoords.d.ts.map +1 -1
- package/lib/index.d.ts +6 -6
- package/lib/math/utils/arithmetic/gcd.d.ts +5 -0
- package/lib/math/utils/arithmetic/gcd.d.ts.map +1 -1
- package/lib/math/utils/arithmetic/gcd.js +5 -0
- package/lib/playground.d.ts.map +1 -1
- package/lib/playground.js +6 -1
- package/lib/server.js +3 -2
- package/lib/tests/pdfExo.test.js +2 -2
- package/lib/tests/pdfs/buildPDFForExercise.d.ts.map +1 -1
- package/lib/tests/pdfs/buildPDFForExercise.js +6 -0
- package/lib/tests/pdfs/quizPdfPreambule.d.ts.map +1 -1
- package/lib/tests/pdfs/quizPdfPreambule.js +1 -0
- package/lib/tests/pdfs/treeDiagramToLatex.d.ts +15 -0
- package/lib/tests/pdfs/treeDiagramToLatex.d.ts.map +1 -0
- package/lib/tests/pdfs/treeDiagramToLatex.js +49 -0
- package/lib/tests/questionTest.d.ts.map +1 -1
- package/lib/tests/questionTest.js +19 -0
- package/package.json +1 -1
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import { addValidProp, propWhile, shuffleProps, tryToAddWrongProp, } from "../../../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
3
|
import { AffineConstructor } from "../../../../../math/polynomials/affine.js";
|
|
4
|
-
import { CosNode } from "../../../../../tree/nodes/functions/cosNode.js";
|
|
5
|
-
import { SinNode } from "../../../../../tree/nodes/functions/sinNode.js";
|
|
4
|
+
import { cos, CosNode } from "../../../../../tree/nodes/functions/cosNode.js";
|
|
5
|
+
import { sin, SinNode } from "../../../../../tree/nodes/functions/sinNode.js";
|
|
6
6
|
import { NumberNode } from "../../../../../tree/nodes/numbers/numberNode.js";
|
|
7
7
|
import { AddNode } from "../../../../../tree/nodes/operators/addNode.js";
|
|
8
|
-
import { MultiplyNode } from "../../../../../tree/nodes/operators/multiplyNode.js";
|
|
8
|
+
import { multiply, MultiplyNode, } from "../../../../../tree/nodes/operators/multiplyNode.js";
|
|
9
9
|
import { PowerNode } from "../../../../../tree/nodes/operators/powerNode.js";
|
|
10
10
|
import { VariableNode } from "../../../../../tree/nodes/variables/variableNode.js";
|
|
11
|
+
import { parseAlgebraic } from "../../../../../tree/parsers/latexParser.js";
|
|
12
|
+
import { handleVEAError } from "../../../../../utils/errors/handleVEAError.js";
|
|
11
13
|
const getAnswer = (identifiers) => {
|
|
12
14
|
const { affinecoeffs } = identifiers;
|
|
13
15
|
const affine = AffineConstructor.fromCoeffs(affinecoeffs);
|
|
14
16
|
const ans = new MultiplyNode(new MultiplyNode(new PowerNode(affinecoeffs[1].toTree(), new NumberNode(2)), new NumberNode(-1)), new SinNode(affine.toTree().simplify({ forbidFactorize: true })))
|
|
15
|
-
.simplify()
|
|
17
|
+
.simplify({ forbidFactorize: true })
|
|
16
18
|
.toTex();
|
|
17
19
|
return ans;
|
|
18
20
|
};
|
|
@@ -32,6 +34,47 @@ const getSinSecondDegreeDerivativeQuestion = () => {
|
|
|
32
34
|
const identifiers = { affinecoeffs };
|
|
33
35
|
return getQuestionFromIdentifiers(identifiers);
|
|
34
36
|
};
|
|
37
|
+
const getHint = () => {
|
|
38
|
+
return `Pour toute fonction dérivable $u$, on a :
|
|
39
|
+
|
|
40
|
+
$$
|
|
41
|
+
\\left(\\sin(u)\\right)' = u'\\times \\cos(u)
|
|
42
|
+
$$
|
|
43
|
+
|
|
44
|
+
et
|
|
45
|
+
|
|
46
|
+
$$
|
|
47
|
+
\\left(\\cos(u)\\right)' = -u'\\times \\sin(u)
|
|
48
|
+
$$`;
|
|
49
|
+
};
|
|
50
|
+
const getCorrection = (identifiers) => {
|
|
51
|
+
const { affinecoeffs } = identifiers;
|
|
52
|
+
const affTree = AffineConstructor.fromCoeffs(affinecoeffs).toTree();
|
|
53
|
+
const a = affinecoeffs[1];
|
|
54
|
+
return `On utilise la propriété suivante : pour toute fonction dérivable $u$,
|
|
55
|
+
|
|
56
|
+
$$
|
|
57
|
+
\\left(\\sin(u)\\right)' = u'\\times \\cos(u)
|
|
58
|
+
$$
|
|
59
|
+
|
|
60
|
+
et
|
|
61
|
+
|
|
62
|
+
$$
|
|
63
|
+
\\left(\\cos(u)\\right)' = -u'\\times \\sin(u)
|
|
64
|
+
$$
|
|
65
|
+
|
|
66
|
+
Ici, on dérive la fonction $f$ deux fois. On a, pour tout $x\\in \\mathbb{R}$ :
|
|
67
|
+
|
|
68
|
+
$$
|
|
69
|
+
f'(x) = ${multiply(a, cos(affTree)).toTex()}
|
|
70
|
+
$$
|
|
71
|
+
|
|
72
|
+
Donc
|
|
73
|
+
|
|
74
|
+
$$
|
|
75
|
+
f''(x)= ${multiply(multiply(-a, a).simplify(), sin(affTree)).toTex()}
|
|
76
|
+
$$`;
|
|
77
|
+
};
|
|
35
78
|
const getQuestionFromIdentifiers = (identifiers) => {
|
|
36
79
|
const question = {
|
|
37
80
|
answer: getAnswer(identifiers),
|
|
@@ -39,6 +82,8 @@ const getQuestionFromIdentifiers = (identifiers) => {
|
|
|
39
82
|
keys: ["x", "sin", "cos", "tan"],
|
|
40
83
|
answerFormat: "tex",
|
|
41
84
|
identifiers,
|
|
85
|
+
hint: getHint(identifiers),
|
|
86
|
+
correction: getCorrection(identifiers),
|
|
42
87
|
};
|
|
43
88
|
return question;
|
|
44
89
|
};
|
|
@@ -73,11 +118,21 @@ const getPropositions = (n, { answer, affinecoeffs }) => {
|
|
|
73
118
|
});
|
|
74
119
|
return shuffleProps(propositions, n);
|
|
75
120
|
};
|
|
76
|
-
const isAnswerValid = (ans, {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
121
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
122
|
+
try {
|
|
123
|
+
const parsed = parseAlgebraic(ans);
|
|
124
|
+
if (!parsed)
|
|
125
|
+
return false;
|
|
126
|
+
return (parsed
|
|
127
|
+
.simplify({
|
|
128
|
+
forbidFactorize: true,
|
|
129
|
+
towardsDistribute: true,
|
|
130
|
+
})
|
|
131
|
+
.toTex() === answer);
|
|
132
|
+
}
|
|
133
|
+
catch (err) {
|
|
134
|
+
return handleVEAError(err);
|
|
135
|
+
}
|
|
81
136
|
};
|
|
82
137
|
export const sinSecondDegreeDerivative = {
|
|
83
138
|
id: "sinSecondDegreeDerivative",
|
|
@@ -92,4 +147,5 @@ export const sinSecondDegreeDerivative = {
|
|
|
92
147
|
getAnswer,
|
|
93
148
|
getInstruction,
|
|
94
149
|
getQuestionFromIdentifiers,
|
|
150
|
+
hasHintAndCorrection: true,
|
|
95
151
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expFunctionBasicSign.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/exponential/sign/expFunctionBasicSign.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAOrC,KAAK,WAAW,GAAG;IAGjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAwFF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,
|
|
1
|
+
{"version":3,"file":"expFunctionBasicSign.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/exponential/sign/expFunctionBasicSign.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAYT,MAAM,6BAA6B,CAAC;AAOrC,KAAK,WAAW,GAAG;IAGjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAwFF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAqBtD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"affineProductSign.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/sign/affineProductSign.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAGL,wBAAwB,EACzB,MAAM,yCAAyC,CAAC;AAejD,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,wBAAwB,CAAC;IACrC,UAAU,EAAE,wBAAwB,CAAC;IACrC,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAAC;
|
|
1
|
+
{"version":3,"file":"affineProductSign.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/sign/affineProductSign.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAGL,wBAAwB,EACzB,MAAM,yCAAyC,CAAC;AAejD,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,wBAAwB,CAAC;IACrC,UAAU,EAAE,wBAAwB,CAAC;IACrC,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAAC;AA6IF,KAAK,OAAO,GAAG;IACb,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAaF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAiB5D,CAAC"}
|
|
@@ -75,8 +75,6 @@ $$
|
|
|
75
75
|
|
|
76
76
|
Sur quel(s) intervalle(s) $f$ est-elle ${isAskingPositive ? "positive" : "négative"} ?`;
|
|
77
77
|
};
|
|
78
|
-
// const getHint: GetHint<Identifiers, Options> = (identifiers, opts) => {};
|
|
79
|
-
// const getCorrection: GetCorrection<Identifiers, Options> = (identifiers) => {};
|
|
80
78
|
const getKeys = () => {
|
|
81
79
|
return ["lbracket", "semicolon", "rbracket", "cup", "infty"];
|
|
82
80
|
};
|
|
@@ -114,8 +112,6 @@ const getQuestionFromIdentifiers = (identifiers, opts) => {
|
|
|
114
112
|
keys: getKeys(identifiers, opts),
|
|
115
113
|
answerFormat: "tex",
|
|
116
114
|
identifiers,
|
|
117
|
-
// hint: getHint(identifiers, opts),
|
|
118
|
-
// correction: getCorrection(identifiers, opts),
|
|
119
115
|
};
|
|
120
116
|
return question;
|
|
121
117
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summitReading.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/summitAndCanonical/summitReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;
|
|
1
|
+
{"version":3,"file":"summitReading.d.ts","sourceRoot":"","sources":["../../../../../../src/exercises/math/functions/trinoms/summitAndCanonical/summitReading.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAgBT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAkGF,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,WAAW,CAgB/C,CAAC"}
|
|
@@ -4,7 +4,6 @@ export * from "./perimeters/index.js";
|
|
|
4
4
|
export * from "./pythagore/index.js";
|
|
5
5
|
export * from "./thales/index.js";
|
|
6
6
|
export * from "./vectors/index.js";
|
|
7
|
-
export * from "./convexity/index.js";
|
|
8
7
|
export * from "./volumes/index.js";
|
|
9
8
|
export * from "./euclidianConstructions/index.js";
|
|
10
9
|
export * from "./shapes/index.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/geometry/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/geometry/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mCAAmC,CAAC;AAClD,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC"}
|
|
@@ -4,7 +4,6 @@ export * from "./perimeters/index.js";
|
|
|
4
4
|
export * from "./pythagore/index.js";
|
|
5
5
|
export * from "./thales/index.js";
|
|
6
6
|
export * from "./vectors/index.js";
|
|
7
|
-
export * from "./convexity/index.js";
|
|
8
7
|
export * from "./volumes/index.js";
|
|
9
8
|
export * from "./euclidianConstructions/index.js";
|
|
10
9
|
export * from "./shapes/index.js";
|
package/lib/exercises/math/spaceGeometry/vectors/spaceVectorLinearCombinationCoords.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spaceVectorLinearCombinationCoords.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/spaceGeometry/vectors/spaceVectorLinearCombinationCoords.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAQrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;
|
|
1
|
+
{"version":3,"file":"spaceVectorLinearCombinationCoords.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/spaceGeometry/vectors/spaceVectorLinearCombinationCoords.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAQrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAkFF,eAAO,MAAM,kCAAkC,EAAE,QAAQ,CAAC,WAAW,CAcpE,CAAC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1228,6 +1228,12 @@ declare const mathExercises: (Exercise<{
|
|
|
1228
1228
|
quadcoeffs: number[];
|
|
1229
1229
|
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
1230
1230
|
quadcoeffs: number[];
|
|
1231
|
+
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
1232
|
+
trinom: number[];
|
|
1233
|
+
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
1234
|
+
askConvex: boolean;
|
|
1235
|
+
quadcoeffs: number[];
|
|
1236
|
+
inflexionPoint: number;
|
|
1231
1237
|
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
1232
1238
|
a: number;
|
|
1233
1239
|
b: number;
|
|
@@ -2553,12 +2559,6 @@ declare const mathExercises: (Exercise<{
|
|
|
2553
2559
|
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
2554
2560
|
vec: string;
|
|
2555
2561
|
vecsProposed: string[];
|
|
2556
|
-
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
2557
|
-
trinom: number[];
|
|
2558
|
-
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
2559
|
-
askConvex: boolean;
|
|
2560
|
-
quadcoeffs: number[];
|
|
2561
|
-
inflexionPoint: number;
|
|
2562
2562
|
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
2563
2563
|
cubeSide: number;
|
|
2564
2564
|
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gcd.d.ts","sourceRoot":"","sources":["../../../../src/math/utils/arithmetic/gcd.ts"],"names":[],"mappings":"AAIA,wBAAgB,GAAG,CAAC,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAG7C"}
|
|
1
|
+
{"version":3,"file":"gcd.d.ts","sourceRoot":"","sources":["../../../../src/math/utils/arithmetic/gcd.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,wBAAgB,GAAG,CAAC,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAG7C"}
|
package/lib/playground.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playground.d.ts","sourceRoot":"","sources":["../src/playground.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"playground.d.ts","sourceRoot":"","sources":["../src/playground.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU,YAItB,CAAC;AAEF;;;;GAIG"}
|
package/lib/playground.js
CHANGED
package/lib/server.js
CHANGED
|
@@ -27,8 +27,9 @@ const runServer = () => {
|
|
|
27
27
|
dotenv.config();
|
|
28
28
|
const app = express();
|
|
29
29
|
app.use(cors());
|
|
30
|
-
console.log("math exos", mathExercises.length);
|
|
31
|
-
console.log("math hints", mathExercises.filter((exo) => exo.hasHintAndCorrection
|
|
30
|
+
console.log("math exos", mathExercises.filter((exo) => !exo.subject || exo.subject === "Mathématiques").length);
|
|
31
|
+
console.log("math hints", mathExercises.filter((exo) => exo.hasHintAndCorrection &&
|
|
32
|
+
(!exo.subject || exo.subject === "Mathématiques")).length);
|
|
32
33
|
console.log("pc exos", `${pcExercises.length}`);
|
|
33
34
|
console.log("pc hints", pcExercises.filter((exo) => exo.hasHintAndCorrection).length);
|
|
34
35
|
playground();
|
package/lib/tests/pdfExo.test.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { buildPdfForExercise } from "./pdfs/buildPDFForExercise.js";
|
|
2
2
|
import "../prototypesEnhancement.js";
|
|
3
|
-
import {
|
|
3
|
+
import { independancyFromProbaTree, } from "../exercises/math/index.js";
|
|
4
4
|
try {
|
|
5
|
-
buildPdfForExercise(
|
|
5
|
+
buildPdfForExercise(independancyFromProbaTree);
|
|
6
6
|
}
|
|
7
7
|
catch (err) {
|
|
8
8
|
console.log(err);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildPDFForExercise.d.ts","sourceRoot":"","sources":["../../../src/tests/pdfs/buildPDFForExercise.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,QAAQ,EAAe,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"buildPDFForExercise.d.ts","sourceRoot":"","sources":["../../../src/tests/pdfs/buildPDFForExercise.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,QAAQ,EAAe,MAAM,6BAA6B,CAAC;AASpE,eAAO,MAAM,mBAAmB,GAAI,KAAK,QAAQ,CAAC,MAAM,CAAC,SAwMxD,CAAC"}
|
|
@@ -11,6 +11,7 @@ import { signTableToLatex } from "./signTableToLatex.js";
|
|
|
11
11
|
import { varTableToLatex } from "./varTableToLatex.js";
|
|
12
12
|
import { valueTableToLatex } from "./valueTableToLatex.js";
|
|
13
13
|
import { signVarTableToLatex } from "./signVarTableToLatex.js";
|
|
14
|
+
import { treeDiagramToLatex } from "./treeDiagramToLatex.js";
|
|
14
15
|
export const buildPdfForExercise = (exo) => {
|
|
15
16
|
const __filename = fileURLToPath(import.meta.url);
|
|
16
17
|
const __dirname = path.dirname(__filename);
|
|
@@ -45,6 +46,11 @@ export const buildPdfForExercise = (exo) => {
|
|
|
45
46
|
for (const match of signVarTableMatches) {
|
|
46
47
|
question.instruction = question.instruction.replace(match[0], signVarTableToLatex(JSON.parse(match[1])));
|
|
47
48
|
}
|
|
49
|
+
const treeDiagramRegex = /<svg id=["']treeDiagram["']>([\s\S]*?)<\/svg>/g;
|
|
50
|
+
const treeDiagramMatches = question.instruction.matchAll(treeDiagramRegex);
|
|
51
|
+
for (const match of treeDiagramMatches) {
|
|
52
|
+
question.instruction = question.instruction.replace(match[0], treeDiagramToLatex(match[1]));
|
|
53
|
+
}
|
|
48
54
|
const formatted = formatMarkdownToLatex(question.instruction);
|
|
49
55
|
content += `
|
|
50
56
|
${formatted} \n
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quizPdfPreambule.d.ts","sourceRoot":"","sources":["../../../src/tests/pdfs/quizPdfPreambule.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"quizPdfPreambule.d.ts","sourceRoot":"","sources":["../../../src/tests/pdfs/quizPdfPreambule.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,cA8E5B,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param tree string[][][][] stringified, avec des £ au lieu des dollars
|
|
4
|
+
* @returns
|
|
5
|
+
*
|
|
6
|
+
* [//arbre
|
|
7
|
+
* [//etage
|
|
8
|
+
* [//block
|
|
9
|
+
* [proba, event]
|
|
10
|
+
* ]
|
|
11
|
+
* ]
|
|
12
|
+
* ]
|
|
13
|
+
*/
|
|
14
|
+
export declare const treeDiagramToLatex: (tree: string) => string;
|
|
15
|
+
//# sourceMappingURL=treeDiagramToLatex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"treeDiagramToLatex.d.ts","sourceRoot":"","sources":["../../../src/tests/pdfs/treeDiagramToLatex.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,kBAAkB,GAAI,MAAM,MAAM,WAmC9C,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { dollarizeString } from "./dollarizeString.js";
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @param tree string[][][][] stringified, avec des £ au lieu des dollars
|
|
5
|
+
* @returns
|
|
6
|
+
*
|
|
7
|
+
* [//arbre
|
|
8
|
+
* [//etage
|
|
9
|
+
* [//block
|
|
10
|
+
* [proba, event]
|
|
11
|
+
* ]
|
|
12
|
+
* ]
|
|
13
|
+
* ]
|
|
14
|
+
*/
|
|
15
|
+
export const treeDiagramToLatex = (tree) => {
|
|
16
|
+
const parsedTree = JSON.parse(tree.replaceAll("£", "$"));
|
|
17
|
+
const mainEvent = dollarizeString(parsedTree[0][0][0][1]);
|
|
18
|
+
const mainProba = dollarizeString(parsedTree[0][0][0][0]);
|
|
19
|
+
const oppMainEvent = dollarizeString(parsedTree[0][0][1][1]);
|
|
20
|
+
const oppMainProba = dollarizeString(parsedTree[0][0][1][0]);
|
|
21
|
+
const firstSubEvent = dollarizeString(parsedTree[1][0][0][1]);
|
|
22
|
+
const firstSubProba = dollarizeString(parsedTree[1][0][0][0]);
|
|
23
|
+
const firstOppSubEvent = dollarizeString(parsedTree[1][0][1][1]);
|
|
24
|
+
const firstOppSubProba = dollarizeString(parsedTree[1][0][1][0]);
|
|
25
|
+
const secondSubEvent = dollarizeString(parsedTree[1][1][0][1]);
|
|
26
|
+
const secondSubProba = dollarizeString(parsedTree[1][1][0][0]);
|
|
27
|
+
const secondOppSubEvent = dollarizeString(parsedTree[1][1][1][1]);
|
|
28
|
+
const secondOppSubProba = dollarizeString(parsedTree[1][1][1][0]);
|
|
29
|
+
return `
|
|
30
|
+
|
|
31
|
+
\\begin{tikzpicture}[
|
|
32
|
+
level 1/.style={sibling distance=4cm},
|
|
33
|
+
level 2/.style={sibling distance=2cm},
|
|
34
|
+
edge from parent/.style={draw, -latex}
|
|
35
|
+
]
|
|
36
|
+
\\node {}
|
|
37
|
+
child { node {${mainEvent}} }
|
|
38
|
+
child { node {${firstSubEvent}} edge from parent node[left] {${firstSubProba}} }
|
|
39
|
+
child { node {${firstOppSubEvent}} edge from parent node[right] {${firstOppSubProba}} }
|
|
40
|
+
edge from parent node[left] {${mainProba}}
|
|
41
|
+
}
|
|
42
|
+
child { node {${oppMainEvent}}
|
|
43
|
+
child { node {${secondSubEvent}} edge from parent node[left] {${secondSubProba}} }
|
|
44
|
+
child { node {${secondOppSubEvent}} edge from parent node[right] {${secondOppSubProba}} }
|
|
45
|
+
edge from parent node[right] {${oppMainProba}}
|
|
46
|
+
};
|
|
47
|
+
\\end{tikzpicture}
|
|
48
|
+
`;
|
|
49
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"questionTest.d.ts","sourceRoot":"","sources":["../../src/tests/questionTest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"questionTest.d.ts","sourceRoot":"","sources":["../../src/tests/questionTest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AA0BjE,eAAO,MAAM,YAAY,GACvB,KAAK,QAAQ,CAAC,MAAM,CAAC,EACrB,UAAU,QAAQ,CAAC,MAAM,CAAC;;;CAsU3B,CAAC"}
|
|
@@ -1,6 +1,25 @@
|
|
|
1
1
|
import { latexTester } from "../latexTester.js";
|
|
2
2
|
import { assertJsonStringifiable } from "./assertJsonStringifiable.js";
|
|
3
3
|
import { formatMarkdownToLatex } from "./pdfs/formatMdToLatex.js";
|
|
4
|
+
/* //TODO
|
|
5
|
+
- tester les touches du clavier (si touche manquante erreur)
|
|
6
|
+
- tests sur les tableaux (ya-t-il bien au moins un input, la structure est-elle bonne, ...)
|
|
7
|
+
- tests sur les arbres (ya-t-il bien au moins un input, la structure est-elle bonne, ...)
|
|
8
|
+
-
|
|
9
|
+
|
|
10
|
+
*/
|
|
11
|
+
/*
|
|
12
|
+
touches du clavier basiques :
|
|
13
|
+
0-9
|
|
14
|
+
,
|
|
15
|
+
+-* et /
|
|
16
|
+
sqrt et square
|
|
17
|
+
power
|
|
18
|
+
( et )
|
|
19
|
+
|
|
20
|
+
un test basique serait si l'exo n'a pas de touche mais la réponse contient n'importe quel symbole hors des précédents
|
|
21
|
+
c'est basique car il faudrait aussi pouvoir tester les cas où y'a des touches mais certaines manquent
|
|
22
|
+
*/
|
|
4
23
|
export const questionTest = (exo, question) => {
|
|
5
24
|
let qcmTime = -1;
|
|
6
25
|
let veaTime = -1;
|