math-exercises 3.0.12 → 3.0.14
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/fractions/fractionsProduct.d.ts +2 -2
- package/lib/exercises/math/calcul/fractions/fractionsProduct.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionsProduct.js +68 -40
- package/lib/exercises/math/calcul/index.d.ts +1 -0
- package/lib/exercises/math/calcul/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/index.js +1 -1
- package/lib/exercises/math/calcul/sign/index.d.ts +1 -1
- package/lib/exercises/math/calcul/sign/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/sign/index.js +1 -1
- package/lib/exercises/math/calcul/sign/signFromAx.d.ts +6 -0
- package/lib/exercises/math/calcul/sign/signFromAx.d.ts.map +1 -1
- package/lib/exercises/math/calcul/sign/signFromAx.js +110 -80
- package/lib/exercises/math/calculLitteral/simplifying/evaluateExpression.js +1 -1
- package/lib/exercises/math/calculLitteral/simplifying/index.d.ts +1 -0
- package/lib/exercises/math/calculLitteral/simplifying/index.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/simplifying/index.js +1 -0
- package/lib/exercises/math/calculLitteral/simplifying/valuateExpression.d.ts +10 -0
- package/lib/exercises/math/calculLitteral/simplifying/valuateExpression.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/simplifying/valuateExpression.js +101 -0
- package/lib/exercises/math/functions/basics/imageFunction.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/imageFunction.js +5 -1
- package/lib/exercises/math/functions/basics/inverseImageFunction.js +1 -1
- package/lib/exercises/math/squareRoots/squareRootsSum.d.ts.map +1 -1
- package/lib/exercises/math/squareRoots/squareRootsSum.js +38 -22
- package/lib/exercises/pc/dosage/beerLambertRandomValue.d.ts.map +1 -1
- package/lib/exercises/pc/dosage/beerLambertRandomValue.js +25 -18
- package/lib/index.d.ts +10 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/latexTester.js +2 -0
- package/lib/math/polynomials/affine.d.ts +0 -1
- package/lib/math/polynomials/affine.d.ts.map +1 -1
- package/lib/math/polynomials/affine.js +1 -4
- package/lib/math/polynomials/polynomial.d.ts +1 -1
- package/lib/math/polynomials/polynomial.d.ts.map +1 -1
- package/lib/math/polynomials/polynomial.js +1 -1
- package/lib/playground.d.ts.map +1 -1
- package/lib/playground.js +19 -1
- package/lib/tree/nodes/algebraicNode.d.ts +4 -0
- package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
- package/lib/tree/nodes/algebraicNode.js +6 -0
- package/lib/tree/nodes/operators/addNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/limitNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/substractNode.d.ts.map +1 -1
- package/lib/tree/nodes/polynomials/monomNode.d.ts +2 -2
- package/lib/tree/nodes/polynomials/monomNode.d.ts.map +1 -1
- package/lib/tree/nodes/polynomials/monomNode.js +3 -2
- package/lib/tree/nodes/polynomials/trinomNode.d.ts +2 -2
- package/lib/tree/nodes/polynomials/trinomNode.d.ts.map +1 -1
- package/lib/tree/nodes/polynomials/trinomNode.js +3 -1
- package/lib/tree/nodes/variables/variableNode.d.ts +2 -2
- package/lib/tree/nodes/variables/variableNode.d.ts.map +1 -1
- package/lib/tree/nodes/variables/variableNode.js +3 -1
- package/lib/utils/alea/probaLawFlip.js +2 -2
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fractionsProduct.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionsProduct.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"fractionsProduct.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/fractions/fractionsProduct.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAaT,MAAM,6BAA6B,CAAC;AAiBrC,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AA2HF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAoB3D,CAAC"}
|
|
@@ -2,49 +2,75 @@ import { addValidProp, tryToAddWrongProp, } from "../../../../exercises/exercise
|
|
|
2
2
|
import { allowNonIrreductibleOption } from "../../../../exercises/options/allowNonIrreductibleFractions.js";
|
|
3
3
|
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
4
4
|
import { Rational, RationalConstructor, } from "../../../../math/numbers/rationals/rational.js";
|
|
5
|
-
import {
|
|
5
|
+
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
6
|
+
import { multiply, MultiplyNode, } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
6
7
|
import { rationalParser } from "../../../../tree/parsers/rationalParser.js";
|
|
7
8
|
import { shuffle } from "../../../../utils/alea/shuffle.js";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
9
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
10
|
+
const getStatementNode = (identifiers) => {
|
|
11
|
+
const { rationalNum, rationalDenum } = identifiers;
|
|
12
|
+
const rational = frac(rationalNum[0], rationalNum[1]);
|
|
13
|
+
const rational2 = frac(rationalDenum[0], rationalDenum[1]);
|
|
14
|
+
const statementTree = new MultiplyNode(rational, rational2);
|
|
15
|
+
return statementTree;
|
|
16
|
+
};
|
|
17
|
+
const getStartStatement = (identifiers) => {
|
|
18
|
+
return getStatementNode(identifiers).toTex();
|
|
19
|
+
};
|
|
20
|
+
const getInstruction = (identifiers, opts) => {
|
|
21
|
+
return `Calculer ${opts?.allowNonIrreductible
|
|
22
|
+
? "et donner le résultat sous la forme d'une fraction"
|
|
23
|
+
: "et donner le résultat sous la forme d'une fraction la plus simplifiée possible"} :
|
|
19
24
|
|
|
20
25
|
$$
|
|
21
|
-
${
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
${getStartStatement(identifiers)}
|
|
27
|
+
$$`;
|
|
28
|
+
};
|
|
29
|
+
const getAnswer = (identifiers) => {
|
|
30
|
+
const { rationalNum, rationalDenum } = identifiers;
|
|
31
|
+
const rational = frac(rationalNum[0], rationalNum[1]);
|
|
32
|
+
const rational2 = frac(rationalDenum[0], rationalDenum[1]);
|
|
33
|
+
return multiply(rational, rational2).simplify().toTex();
|
|
34
|
+
};
|
|
35
|
+
const getHint = (identifiers) => {
|
|
36
|
+
return "Pour multiplier deux fractions, on multiplie les numérateurs entre eux et les dénominateurs entre eux, puis on simplifie la fraction obtenue si nécessaire.";
|
|
37
|
+
};
|
|
38
|
+
const getCorrection = (identifiers, opts) => {
|
|
39
|
+
const { rationalNum, rationalDenum } = identifiers;
|
|
40
|
+
const beforeSimplification = new Rational(rationalNum[0] * rationalDenum[0], rationalNum[1] * rationalDenum[1]);
|
|
41
|
+
const answer = getAnswer(identifiers, opts);
|
|
42
|
+
return `On multiplie les numérateurs entre eux et les dénominateurs entre eux :
|
|
33
43
|
|
|
34
44
|
$$
|
|
35
|
-
\\frac{${
|
|
45
|
+
\\frac{${rationalNum[0]}\\times${rationalDenum[0]}}{${rationalNum[1]}\\times${rationalDenum[1]}} = ${beforeSimplification.toTree().toTex()}
|
|
36
46
|
$$
|
|
37
47
|
|
|
38
48
|
${!beforeSimplification.isIrreductible()
|
|
39
|
-
|
|
49
|
+
? `On peut alors simplifier cette fraction :
|
|
40
50
|
|
|
41
51
|
$$
|
|
42
52
|
${beforeSimplification.toTree().toTex()} = ${answer}
|
|
43
53
|
$$`
|
|
44
|
-
|
|
54
|
+
: "Cette fraction est déjà simplifiée."}
|
|
45
55
|
|
|
46
|
-
Ainsi, le résultat attendu est $${answer}
|
|
47
|
-
|
|
56
|
+
Ainsi, le résultat attendu est $${answer}$.`;
|
|
57
|
+
};
|
|
58
|
+
const getFractionsProduct = (opts) => {
|
|
59
|
+
const rational = RationalConstructor.randomIrreductible();
|
|
60
|
+
const rational2 = RationalConstructor.randomIrreductible();
|
|
61
|
+
const identifiers = {
|
|
62
|
+
rationalNum: [rational.num, rational.denum],
|
|
63
|
+
rationalDenum: [rational2.num, rational2.denum],
|
|
64
|
+
};
|
|
65
|
+
const question = {
|
|
66
|
+
instruction: getInstruction(identifiers, opts),
|
|
67
|
+
startStatement: getStartStatement(identifiers, opts),
|
|
68
|
+
answer: getAnswer(identifiers, opts),
|
|
69
|
+
keys: [],
|
|
70
|
+
answerFormat: "tex",
|
|
71
|
+
identifiers,
|
|
72
|
+
hint: getHint(identifiers, opts),
|
|
73
|
+
correction: getCorrection(identifiers, opts),
|
|
48
74
|
};
|
|
49
75
|
return question;
|
|
50
76
|
};
|
|
@@ -59,21 +85,19 @@ const getPropositions = (n, { answer, rationalNum, rationalDenum }) => {
|
|
|
59
85
|
}
|
|
60
86
|
return shuffle(propositions);
|
|
61
87
|
};
|
|
62
|
-
const isAnswerValid = (ans, { rationalDenum, rationalNum }, opts) => {
|
|
63
|
-
|
|
64
|
-
const rational2 = new Rational(rationalDenum[0], rationalDenum[1]);
|
|
65
|
-
const answerTree = rational
|
|
66
|
-
.multiply(rational2)
|
|
67
|
-
.toTree({ allowFractionToDecimal: true });
|
|
68
|
-
const texs = answerTree.toAllValidTexs();
|
|
69
|
-
if (opts?.allowNonIrreductible) {
|
|
88
|
+
const isAnswerValid = (ans, { answer, rationalDenum, rationalNum }, opts) => {
|
|
89
|
+
try {
|
|
70
90
|
const parsed = rationalParser(ans);
|
|
71
91
|
if (!parsed)
|
|
72
92
|
return false;
|
|
73
|
-
|
|
93
|
+
if (opts?.allowNonIrreductible) {
|
|
94
|
+
return parsed.simplify().toTex() === answer;
|
|
95
|
+
}
|
|
96
|
+
else
|
|
97
|
+
return parsed.toTex() === answer;
|
|
74
98
|
}
|
|
75
|
-
|
|
76
|
-
return
|
|
99
|
+
catch (err) {
|
|
100
|
+
return handleVEAError(err);
|
|
77
101
|
}
|
|
78
102
|
};
|
|
79
103
|
const options = [allowNonIrreductibleOption];
|
|
@@ -92,4 +116,8 @@ export const fractionsProduct = {
|
|
|
92
116
|
subject: "Mathématiques",
|
|
93
117
|
hasHintAndCorrection: true,
|
|
94
118
|
options,
|
|
119
|
+
getInstruction,
|
|
120
|
+
getAnswer,
|
|
121
|
+
getHint,
|
|
122
|
+
getCorrection,
|
|
95
123
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/calcul/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gCAAgC,CAAC;AAC/C,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/calcul/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gCAAgC,CAAC;AAC/C,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AAEpC,cAAc,iBAAiB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from "./signFromAx.js";
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/sign/index.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/sign/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from "./signFromAx.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signFromAx.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/sign/signFromAx.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"signFromAx.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calcul/sign/signFromAx.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAwGF,eAAO,MAAM,UAAU,EAAE,QAAQ,CAAC,WAAW,CAiB5C,CAAC"}
|
|
@@ -1,80 +1,110 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
//
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
4
|
+
import { multiply } from "../../../../tree/nodes/operators/multiplyNode.js";
|
|
5
|
+
import { monom } from "../../../../tree/nodes/polynomials/monomNode.js";
|
|
6
|
+
import { probaLawFlip } from "../../../../utils/alea/probaLawFlip.js";
|
|
7
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
8
|
+
//-x pos/nég/nul
|
|
9
|
+
//ax pos/nég/nul avec a>0 donné ou <0
|
|
10
|
+
const getPropositions = (n, { answer }) => {
|
|
11
|
+
const propositions = [];
|
|
12
|
+
addValidProp(propositions, answer, "raw");
|
|
13
|
+
tryToAddWrongProp(propositions, `$x$ est négatif.`, "raw");
|
|
14
|
+
tryToAddWrongProp(propositions, `$x$ est positif.`, "raw");
|
|
15
|
+
tryToAddWrongProp(propositions, `$x$ est égal à $0$.`, "raw");
|
|
16
|
+
tryToAddWrongProp(propositions, `On ne peut rien dire sur le signe de $x$.`, "raw");
|
|
17
|
+
return shuffleProps(propositions, n);
|
|
18
|
+
};
|
|
19
|
+
const getAnswer = (identifiers) => {
|
|
20
|
+
const { a, sign } = identifiers;
|
|
21
|
+
if (sign === 0)
|
|
22
|
+
return `$x$ est égal à $0$.`;
|
|
23
|
+
if (a > 0 === sign > 0) {
|
|
24
|
+
return `$x$ est positif.`;
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
return `$x$ est négatif.`;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
const getInstruction = (identifiers) => {
|
|
31
|
+
const { a, sign } = identifiers;
|
|
32
|
+
const signString = sign === 0
|
|
33
|
+
? "égal à $0$"
|
|
34
|
+
: sign === 1
|
|
35
|
+
? "strictement positif"
|
|
36
|
+
: "strictement négatif";
|
|
37
|
+
return `On considère un nombre relatif $x$ tel que $${multiply(a, "x").toTex()}$ est ${signString}.
|
|
38
|
+
|
|
39
|
+
Quel est le signe de $x$ ?`;
|
|
40
|
+
};
|
|
41
|
+
const getHint = (identifiers) => {
|
|
42
|
+
return `On rappelle que :
|
|
43
|
+
|
|
44
|
+
- le produit de deux nombres positifs est positif ;
|
|
45
|
+
- le produit de deux nombres négatifs est positif ;
|
|
46
|
+
- le produit de deux nombres de signes différents est négatif.`;
|
|
47
|
+
};
|
|
48
|
+
const getCorrection = (identifiers) => {
|
|
49
|
+
const { a, sign } = identifiers;
|
|
50
|
+
const monomTex = monom(a, 1).toTex();
|
|
51
|
+
if (sign === 0) {
|
|
52
|
+
return `Puisque $${monomTex}$ est égal à $0$, alors $x$ est égal à $0$.`;
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
if (a > 0) {
|
|
56
|
+
return `Puisque $${a}$ est positif, et que $${monomTex}$ est ${sign > 0 ? "positif" : "négatif"}, alors $x$ est ${sign > 0 ? "positif" : "négatif"}.`;
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
return `Puisque $${a}$ est négatif, et que $${monomTex}$ est ${sign > 0 ? "positif" : "négatif"}, alors $x$ est ${sign > 0 ? "négatif" : "positif"}.`;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
const getKeys = (identifiers) => {
|
|
64
|
+
return [];
|
|
65
|
+
};
|
|
66
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
67
|
+
try {
|
|
68
|
+
throw Error("VEA not implemented");
|
|
69
|
+
}
|
|
70
|
+
catch (err) {
|
|
71
|
+
return handleVEAError(err);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
const getSignFromAxQuestion = (ops) => {
|
|
75
|
+
const identifiers = {
|
|
76
|
+
a: randint(-9, 10, [0, 1]),
|
|
77
|
+
sign: probaLawFlip([
|
|
78
|
+
[-1, 0.45],
|
|
79
|
+
[0, 0.1],
|
|
80
|
+
[1, 0.45],
|
|
81
|
+
]),
|
|
82
|
+
};
|
|
83
|
+
const question = {
|
|
84
|
+
answer: getAnswer(identifiers),
|
|
85
|
+
instruction: getInstruction(identifiers),
|
|
86
|
+
keys: getKeys(identifiers),
|
|
87
|
+
answerFormat: "raw",
|
|
88
|
+
identifiers,
|
|
89
|
+
hint: getHint(identifiers),
|
|
90
|
+
correction: getCorrection(identifiers),
|
|
91
|
+
};
|
|
92
|
+
return question;
|
|
93
|
+
};
|
|
94
|
+
export const signFromAx = {
|
|
95
|
+
id: "signFromAx",
|
|
96
|
+
label: "Déterminer le signe de $x$ en fonction du signe de $ax$",
|
|
97
|
+
isSingleStep: true,
|
|
98
|
+
generator: (nb, opts) => getDistinctQuestions(() => getSignFromAxQuestion(opts), nb),
|
|
99
|
+
qcmTimer: 60,
|
|
100
|
+
freeTimer: 60,
|
|
101
|
+
getPropositions,
|
|
102
|
+
isAnswerValid,
|
|
103
|
+
subject: "Mathématiques",
|
|
104
|
+
getInstruction,
|
|
105
|
+
getHint,
|
|
106
|
+
getCorrection,
|
|
107
|
+
hasHintAndCorrection: true,
|
|
108
|
+
getAnswer,
|
|
109
|
+
answerType: "QCU",
|
|
110
|
+
};
|
|
@@ -83,7 +83,7 @@ const isAnswerValid = (ans, { answer }) => {
|
|
|
83
83
|
export const evaluateExpression = {
|
|
84
84
|
id: "evaluateExpression",
|
|
85
85
|
connector: "=",
|
|
86
|
-
label: "
|
|
86
|
+
label: "Évaluer une expression",
|
|
87
87
|
levels: ["4ème", "3ème", "2nde", "CAP", "2ndPro"],
|
|
88
88
|
sections: ["Calcul littéral"],
|
|
89
89
|
isSingleStep: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/simplifying/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/simplifying/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise.js";
|
|
2
|
+
type Identifiers = {
|
|
3
|
+
xValue: number;
|
|
4
|
+
a: number;
|
|
5
|
+
b: number;
|
|
6
|
+
monomFirst: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare const valuateExpression: Exercise<Identifiers>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=valuateExpression.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"valuateExpression.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/calculLitteral/simplifying/valuateExpression.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,6BAA6B,CAAC;AAcrC,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AA2GF,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAiBnD,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
4
|
+
import { add } from "../../../../tree/nodes/operators/addNode.js";
|
|
5
|
+
import { power } from "../../../../tree/nodes/operators/powerNode.js";
|
|
6
|
+
import { monom } from "../../../../tree/nodes/polynomials/monomNode.js";
|
|
7
|
+
import { coinFlip } from "../../../../utils/alea/coinFlip.js";
|
|
8
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
9
|
+
const getExpression = (identifiers) => {
|
|
10
|
+
const { xValue, a, b, monomFirst } = identifiers;
|
|
11
|
+
return add(monomFirst ? monom(a, 1) : b, monomFirst ? b : monom(a, 1));
|
|
12
|
+
};
|
|
13
|
+
const getPropositions = (n, { answer, ...identifiers }) => {
|
|
14
|
+
const propositions = [];
|
|
15
|
+
addValidProp(propositions, answer);
|
|
16
|
+
const { xValue, a, b, monomFirst } = identifiers;
|
|
17
|
+
const expressionSquare = add(monomFirst ? power(xValue, a) : b, monomFirst ? b : power(xValue, a));
|
|
18
|
+
const expressionAdd = add(monomFirst ? add(a, xValue) : b, monomFirst ? b : add(a, xValue));
|
|
19
|
+
const wrongOp = (a > 0 ? 1 : -1) * (Math.abs(a) * 10 + Math.abs(xValue));
|
|
20
|
+
const expressionNoOp = add(monomFirst ? wrongOp : b, monomFirst ? b : wrongOp);
|
|
21
|
+
tryToAddWrongProp(propositions, expressionSquare.toDetailedEvaluation({ x: xValue.toTree() }).toTex());
|
|
22
|
+
tryToAddWrongProp(propositions, expressionAdd.toDetailedEvaluation({ x: xValue.toTree() }).toTex());
|
|
23
|
+
tryToAddWrongProp(propositions, expressionNoOp.toDetailedEvaluation({ x: xValue.toTree() }).toTex());
|
|
24
|
+
return shuffleProps(propositions, n);
|
|
25
|
+
};
|
|
26
|
+
const getAnswer = (identifiers) => {
|
|
27
|
+
const { xValue, a, b, monomFirst } = identifiers;
|
|
28
|
+
const expression = getExpression(identifiers);
|
|
29
|
+
return expression.toDetailedEvaluation({ x: xValue.toTree() }).toTex();
|
|
30
|
+
};
|
|
31
|
+
const getInstruction = (identifiers) => {
|
|
32
|
+
const { xValue, a, b, monomFirst } = identifiers;
|
|
33
|
+
return `Voici une expression algébrique :
|
|
34
|
+
|
|
35
|
+
$$
|
|
36
|
+
${getExpression(identifiers).toTex()}
|
|
37
|
+
$$
|
|
38
|
+
|
|
39
|
+
Quelle est la valeur de cette expression pour $x=${xValue}$ ?`;
|
|
40
|
+
};
|
|
41
|
+
const getHint = (identifiers) => {
|
|
42
|
+
return `L'écriture $ax$ signifie : $a\\times x$.`;
|
|
43
|
+
};
|
|
44
|
+
const getCorrection = (identifiers) => {
|
|
45
|
+
return `Quand on écrit $ax$, on parle d'une multiplication de $a$ par $x$ : c'est à dire que $ax = a\\times x$.
|
|
46
|
+
|
|
47
|
+
Ici, le bon calcul est donc :
|
|
48
|
+
|
|
49
|
+
$$
|
|
50
|
+
${getAnswer(identifiers)}
|
|
51
|
+
$$`;
|
|
52
|
+
};
|
|
53
|
+
const getKeys = (identifiers) => {
|
|
54
|
+
return [];
|
|
55
|
+
};
|
|
56
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
57
|
+
try {
|
|
58
|
+
throw Error("VEA not implemented");
|
|
59
|
+
}
|
|
60
|
+
catch (err) {
|
|
61
|
+
return handleVEAError(err);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
const getValuateExpressionQuestion = (ops) => {
|
|
65
|
+
const a = randint(-9, 10, [0, 1, -1]);
|
|
66
|
+
const b = randint(-9, 10, [0]);
|
|
67
|
+
const monomFirst = coinFlip();
|
|
68
|
+
const identifiers = {
|
|
69
|
+
xValue: randint(-9, 10),
|
|
70
|
+
a,
|
|
71
|
+
b,
|
|
72
|
+
monomFirst,
|
|
73
|
+
};
|
|
74
|
+
const question = {
|
|
75
|
+
answer: getAnswer(identifiers),
|
|
76
|
+
instruction: getInstruction(identifiers),
|
|
77
|
+
keys: getKeys(identifiers),
|
|
78
|
+
answerFormat: "tex",
|
|
79
|
+
identifiers,
|
|
80
|
+
hint: getHint(identifiers),
|
|
81
|
+
correction: getCorrection(identifiers),
|
|
82
|
+
};
|
|
83
|
+
return question;
|
|
84
|
+
};
|
|
85
|
+
export const valuateExpression = {
|
|
86
|
+
id: "valuateExpression",
|
|
87
|
+
label: "Trouver le bon calcul pour évaluer une expression algébrique",
|
|
88
|
+
isSingleStep: true,
|
|
89
|
+
generator: (nb, opts) => getDistinctQuestions(() => getValuateExpressionQuestion(opts), nb),
|
|
90
|
+
qcmTimer: 60,
|
|
91
|
+
freeTimer: 60,
|
|
92
|
+
getPropositions,
|
|
93
|
+
isAnswerValid,
|
|
94
|
+
subject: "Mathématiques",
|
|
95
|
+
getInstruction,
|
|
96
|
+
getHint,
|
|
97
|
+
getCorrection,
|
|
98
|
+
getAnswer,
|
|
99
|
+
answerType: "QCU",
|
|
100
|
+
hasHintAndCorrection: true,
|
|
101
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imageFunction.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/imageFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAWrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAW7C,KAAK,WAAW,GAAG;IAOjB,MAAM,EAAE,eAAe,CAAC;IACxB,cAAc,EAAE,eAAe,EAAE,CAAC;IAClC,eAAe,EAAE,OAAO,CAAC;CAC1B,CAAC;
|
|
1
|
+
{"version":3,"file":"imageFunction.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/functions/basics/imageFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAkBT,MAAM,6BAA6B,CAAC;AAWrC,OAAO,EACL,eAAe,EAEhB,MAAM,qCAAqC,CAAC;AAW7C,KAAK,WAAW,GAAG;IAOjB,MAAM,EAAE,eAAe,CAAC;IACxB,cAAc,EAAE,eAAe,EAAE,CAAC;IAClC,eAAe,EAAE,OAAO,CAAC;CAC1B,CAAC;AA+LF,KAAK,OAAO,GAAG;IACb,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AA4BF,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAoBxD,CAAC"}
|
|
@@ -35,7 +35,11 @@ const getInstruction = (identifiers, opts) => {
|
|
|
35
35
|
const xValueTex = reifyAlgebraic(xValue).toTex();
|
|
36
36
|
const coeffsNode = polynomeCoeffs.map((coeff) => reifyAlgebraic(coeff));
|
|
37
37
|
const polynome = new GeneralPolynomial(coeffsNode);
|
|
38
|
-
const statement = `Soit $f
|
|
38
|
+
const statement = `Soit $f$ la fonction définie par :
|
|
39
|
+
|
|
40
|
+
$$
|
|
41
|
+
f(x) = ${polynome.toTree().toTex()}
|
|
42
|
+
$$
|
|
39
43
|
|
|
40
44
|
Calculer ${imageSyntaxText
|
|
41
45
|
? `l'image de $${xValueTex}$ par $f$.`
|
|
@@ -89,7 +89,7 @@ const getPropositions = (n, { answer, coeffs, yValue }) => {
|
|
|
89
89
|
tryToAddWrongProp(propositions, "x=" + yValue);
|
|
90
90
|
while (propositions.length < n) {
|
|
91
91
|
const wrongAnswer = add(x, randint(-10, 11, [0])).simplify();
|
|
92
|
-
tryToAddWrongProp(propositions, "x=" + wrongAnswer);
|
|
92
|
+
tryToAddWrongProp(propositions, "x=" + wrongAnswer.toTex());
|
|
93
93
|
}
|
|
94
94
|
return shuffle(propositions);
|
|
95
95
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"squareRootsSum.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/squareRoots/squareRootsSum.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,
|
|
1
|
+
{"version":3,"file":"squareRootsSum.d.ts","sourceRoot":"","sources":["../../../../src/exercises/math/squareRoots/squareRootsSum.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAWT,MAAM,6BAA6B,CAAC;AAYrC,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACvB,CAAC;AA6FF,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAahD,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { addValidProp, shuffleProps, tryToAddWrongProp, } from "../../../exercises/exercise.js";
|
|
2
2
|
import { getDistinctQuestions } from "../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { sqrtVEA } from "../../../exercises/vea/sqrtVEA.js";
|
|
3
4
|
import { SquareRootConstructor } from "../../../math/numbers/reals/real.js";
|
|
4
5
|
import { randint } from "../../../math/utils/random/randint.js";
|
|
5
6
|
import { SqrtNode } from "../../../tree/nodes/functions/sqrtNode.js";
|
|
@@ -7,20 +8,42 @@ import { NumberNode } from "../../../tree/nodes/numbers/numberNode.js";
|
|
|
7
8
|
import { AddNode } from "../../../tree/nodes/operators/addNode.js";
|
|
8
9
|
import { MultiplyNode } from "../../../tree/nodes/operators/multiplyNode.js";
|
|
9
10
|
import { coinFlip } from "../../../utils/alea/coinFlip.js";
|
|
11
|
+
import { handleVEAError } from "../../../utils/errors/handleVEAError.js";
|
|
10
12
|
//a sqrt(x*b) + c sqrt(y*b) (+ d sqrt(z*b))
|
|
11
13
|
//avec x,y,z carrés parfait
|
|
14
|
+
const getStatementNode = (identifiers) => {
|
|
15
|
+
const { a, b, c, d, x, y, z } = identifiers;
|
|
16
|
+
const aNode = new NumberNode(a);
|
|
17
|
+
const cNode = new NumberNode(c);
|
|
18
|
+
const xbNode = new NumberNode(b * x);
|
|
19
|
+
const ybNode = new NumberNode(b * y);
|
|
20
|
+
let statement = new AddNode(new MultiplyNode(aNode, new SqrtNode(xbNode)), new MultiplyNode(cNode, new SqrtNode(ybNode)));
|
|
21
|
+
if (!!d && !!z) {
|
|
22
|
+
const dNode = new NumberNode(d);
|
|
23
|
+
const zbNode = new NumberNode(z * b);
|
|
24
|
+
statement = new AddNode(statement, new MultiplyNode(dNode, new SqrtNode(zbNode)));
|
|
25
|
+
}
|
|
26
|
+
return statement;
|
|
27
|
+
};
|
|
28
|
+
const getInstruction = (identifiers) => {
|
|
29
|
+
return `Simplifier sous la forme $a\\sqrt{b}$ avec $b$ le plus petit possible :
|
|
30
|
+
|
|
31
|
+
$$
|
|
32
|
+
${getStatementNode(identifiers).toTex()}
|
|
33
|
+
$$`;
|
|
34
|
+
};
|
|
35
|
+
const getAnswer = (identifiers) => {
|
|
36
|
+
const answer = getStatementNode(identifiers).simplify().toTex();
|
|
37
|
+
return answer;
|
|
38
|
+
};
|
|
12
39
|
const getSquareRootsSumQuestion = () => {
|
|
13
40
|
const a = randint(-9, 10, [0]);
|
|
14
|
-
const aNode = new NumberNode(a);
|
|
15
41
|
const c = randint(-9, 10, [0]);
|
|
16
|
-
const cNode = new NumberNode(c);
|
|
17
42
|
const b = SquareRootConstructor.randomIrreductible(10).operand;
|
|
18
43
|
let x = randint(1, 6);
|
|
19
44
|
x *= x;
|
|
20
|
-
const xbNode = new NumberNode(b * x);
|
|
21
45
|
let y = randint(1, 6);
|
|
22
46
|
y *= y;
|
|
23
|
-
const ybNode = new NumberNode(b * y);
|
|
24
47
|
let d;
|
|
25
48
|
let z;
|
|
26
49
|
if (coinFlip()) {
|
|
@@ -28,19 +51,13 @@ const getSquareRootsSumQuestion = () => {
|
|
|
28
51
|
z = randint(1, 6);
|
|
29
52
|
z *= z;
|
|
30
53
|
}
|
|
31
|
-
|
|
32
|
-
if (!!d && !!z) {
|
|
33
|
-
const dNode = new NumberNode(d);
|
|
34
|
-
const zbNode = new NumberNode(z * b);
|
|
35
|
-
statement = new AddNode(statement, new MultiplyNode(dNode, new SqrtNode(zbNode)));
|
|
36
|
-
}
|
|
37
|
-
const answer = statement.simplify().toTex();
|
|
54
|
+
const identifiers = { a, b, c, d, x, y, z };
|
|
38
55
|
const question = {
|
|
39
|
-
answer,
|
|
40
|
-
instruction:
|
|
56
|
+
answer: getAnswer(identifiers),
|
|
57
|
+
instruction: getInstruction(identifiers),
|
|
41
58
|
keys: [],
|
|
42
59
|
answerFormat: "tex",
|
|
43
|
-
identifiers
|
|
60
|
+
identifiers,
|
|
44
61
|
};
|
|
45
62
|
return question;
|
|
46
63
|
};
|
|
@@ -53,25 +70,24 @@ const getPropositions = (n, { answer, b }) => {
|
|
|
53
70
|
return shuffleProps(propositions, n);
|
|
54
71
|
};
|
|
55
72
|
const isAnswerValid = (ans, { answer, a, b, c, d, y, x, z }) => {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
73
|
+
try {
|
|
74
|
+
return sqrtVEA(ans, answer);
|
|
75
|
+
}
|
|
76
|
+
catch (err) {
|
|
77
|
+
return handleVEAError(err);
|
|
59
78
|
}
|
|
60
|
-
const tree = new MultiplyNode(new NumberNode(coeff), new SqrtNode(new NumberNode(b))).simplify();
|
|
61
|
-
const texs = tree.toAllValidTexs();
|
|
62
|
-
return texs.includes(ans);
|
|
63
79
|
};
|
|
64
80
|
export const squareRootsSum = {
|
|
65
81
|
id: "squareRootsSum",
|
|
66
82
|
connector: "=",
|
|
67
83
|
label: "Simplifier une somme de racines carrées",
|
|
68
|
-
levels: ["2nde"],
|
|
69
84
|
isSingleStep: true,
|
|
70
|
-
sections: ["Racines carrées"],
|
|
71
85
|
generator: (nb) => getDistinctQuestions(getSquareRootsSumQuestion, nb),
|
|
72
86
|
qcmTimer: 60,
|
|
73
87
|
freeTimer: 60,
|
|
74
88
|
getPropositions,
|
|
75
89
|
isAnswerValid,
|
|
76
90
|
subject: "Mathématiques",
|
|
91
|
+
getInstruction,
|
|
92
|
+
getAnswer,
|
|
77
93
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"beerLambertRandomValue.d.ts","sourceRoot":"","sources":["../../../../src/exercises/pc/dosage/beerLambertRandomValue.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EAST,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;
|
|
1
|
+
{"version":3,"file":"beerLambertRandomValue.d.ts","sourceRoot":"","sources":["../../../../src/exercises/pc/dosage/beerLambertRandomValue.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,EAST,MAAM,6BAA6B,CAAC;AASrC,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AA0NF,eAAO,MAAM,8BAA8B,EAAE,QAAQ,CAAC,WAAW,CAchE,CAAC"}
|
|
@@ -63,39 +63,46 @@ const getBeerLambertRandomValueQuestion = () => {
|
|
|
63
63
|
|
|
64
64
|
Réorganisez cette formule pour isoler la variable à trouver.`;
|
|
65
65
|
const correction = `La loi de Beer-Lambert est donnée par :
|
|
66
|
-
|
|
66
|
+
|
|
67
|
+
$$
|
|
68
|
+
A = \\varepsilon \\cdot \\ell \\cdot C
|
|
69
|
+
$$
|
|
67
70
|
|
|
68
71
|
Pour résoudre le problème, nous devons réorganiser la formule pour isoler la variable inconnue. En utilisant les valeurs fournies pour $\\varepsilon$, $C$, et $\\ell$, nous pouvons résoudre pour trouver la variable manquante.
|
|
69
72
|
|
|
70
73
|
Si $A$ est l'absorbance, $\\varepsilon$ est le coefficient d'absorption molaire, $C$ est la concentration et $\\ell$ est la longueur du trajet optique, alors:
|
|
71
74
|
|
|
72
|
-
|
|
73
|
-
|
|
75
|
+
$$
|
|
76
|
+
${targetVariable.name === "concentration"
|
|
77
|
+
? "C = \\frac{A}{\\varepsilon \\cdot \\ell}"
|
|
74
78
|
: ""}
|
|
75
|
-
|
|
76
|
-
? "
|
|
79
|
+
${targetVariable.name === "molarAbsorptivity"
|
|
80
|
+
? "\\varepsilon = \\frac{A}{C \\cdot \\ell}"
|
|
77
81
|
: ""}
|
|
78
|
-
|
|
79
|
-
? "
|
|
82
|
+
${targetVariable.name === "pathLength"
|
|
83
|
+
? "\\ell = \\frac{A}{\\varepsilon \\cdot C}"
|
|
80
84
|
: ""}
|
|
81
|
-
|
|
82
|
-
? "
|
|
85
|
+
${targetVariable.name === "absorbance"
|
|
86
|
+
? "A = \\varepsilon \\cdot C \\cdot \\ell"
|
|
83
87
|
: ""}
|
|
88
|
+
$$
|
|
84
89
|
|
|
85
90
|
En appliquant les valeurs:
|
|
86
91
|
|
|
87
|
-
|
|
88
|
-
|
|
92
|
+
$$
|
|
93
|
+
${targetVariable.name === "concentration"
|
|
94
|
+
? `C = \\frac{${frenchify(absorbance)}}{${frenchify(molarAbsorptivity)} \\cdot ${frenchify(pathLength)}} = ${frenchify(round(absorbance / (molarAbsorptivity * pathLength), 2))}\\ \\text{mol} \\cdot \\text{L}^{-1}`
|
|
95
|
+
: ""}
|
|
96
|
+
${targetVariable.name === "molarAbsorptivity"
|
|
97
|
+
? `\\varepsilon = \\frac{${frenchify(absorbance)}}{${frenchify(concentration)} \\cdot ${frenchify(pathLength)}} = ${frenchify(round(absorbance / (concentration * pathLength), 1))}\\ \\text{L} \\cdot \\text{mol}^{-1} \\cdot \\text{cm}^{-1}`
|
|
89
98
|
: ""}
|
|
90
|
-
|
|
91
|
-
?
|
|
99
|
+
${targetVariable.name === "pathLength"
|
|
100
|
+
? `\\ell = \\frac{${frenchify(absorbance)}}{${frenchify(molarAbsorptivity)} \\cdot ${frenchify(concentration)}} = ${frenchify(round(absorbance / (molarAbsorptivity * concentration), 1))}\\ \\text{cm}`
|
|
92
101
|
: ""}
|
|
93
|
-
|
|
94
|
-
?
|
|
102
|
+
${targetVariable.name === "absorbance"
|
|
103
|
+
? `A = ${frenchify(molarAbsorptivity)} \\cdot ${frenchify(concentration)} \\cdot ${frenchify(pathLength)} = ${frenchify(absorbance)}`
|
|
95
104
|
: ""}
|
|
96
|
-
|
|
97
|
-
? `$$A = ${frenchify(molarAbsorptivity)} \\cdot ${frenchify(concentration)} \\cdot ${frenchify(pathLength)} = ${frenchify(absorbance)}$$`
|
|
98
|
-
: ""}`;
|
|
105
|
+
$$`;
|
|
99
106
|
const question = {
|
|
100
107
|
answer: targetVariable.value.toTree().toTex(),
|
|
101
108
|
instruction,
|
package/lib/index.d.ts
CHANGED
|
@@ -49,8 +49,8 @@ declare const mathExercises: (Exercise<{
|
|
|
49
49
|
rationalNum: [number, number];
|
|
50
50
|
rationalDenum: [number, number];
|
|
51
51
|
}, {}> | Exercise<{
|
|
52
|
-
rationalNum: [
|
|
53
|
-
rationalDenum: [
|
|
52
|
+
rationalNum: number[];
|
|
53
|
+
rationalDenum: number[];
|
|
54
54
|
}, {
|
|
55
55
|
allowNonIrreductible?: boolean;
|
|
56
56
|
}> | Exercise<{
|
|
@@ -202,6 +202,9 @@ declare const mathExercises: (Exercise<{
|
|
|
202
202
|
}, {}> | Exercise<{
|
|
203
203
|
dec: number;
|
|
204
204
|
pow: number;
|
|
205
|
+
}, {}> | Exercise<{
|
|
206
|
+
a: number;
|
|
207
|
+
sign: number;
|
|
205
208
|
}, {}> | Exercise<{
|
|
206
209
|
a: number;
|
|
207
210
|
b: number;
|
|
@@ -396,6 +399,11 @@ declare const mathExercises: (Exercise<{
|
|
|
396
399
|
e: number;
|
|
397
400
|
f: number;
|
|
398
401
|
g: number;
|
|
402
|
+
}, {}> | Exercise<{
|
|
403
|
+
xValue: number;
|
|
404
|
+
a: number;
|
|
405
|
+
b: number;
|
|
406
|
+
monomFirst: boolean;
|
|
399
407
|
}, {}> | Exercise<{
|
|
400
408
|
coeffs: number[][];
|
|
401
409
|
isXAsked: boolean;
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAG7D,OAAO,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AA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
|
|
52
52
|
}
|
|
53
|
-
toString() {
|
|
54
|
-
return super.toTex();
|
|
55
|
-
}
|
|
56
53
|
toReducedEquation() {
|
|
57
54
|
return `y=${this.toTex()}`;
|
|
58
55
|
}
|
|
59
56
|
toGGBCommands() {
|
|
60
|
-
return [`f(x) = ${this.
|
|
57
|
+
return [`f(x) = ${this.toMathString()}`, `SetColor(f, "${randomColor()}")`];
|
|
61
58
|
}
|
|
62
59
|
}
|
|
@@ -43,6 +43,6 @@ export declare class Polynomial {
|
|
|
43
43
|
getLimitNode(to: "+\\infty" | "-\\infty"): import("../../tree/nodes/numbers/constantNode.js").ConstantNode | NumberNode;
|
|
44
44
|
toTree(opts?: NodeOptions): AlgebraicNode;
|
|
45
45
|
toTex(): string;
|
|
46
|
-
|
|
46
|
+
toMathString(): string;
|
|
47
47
|
}
|
|
48
48
|
//# sourceMappingURL=polynomial.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"polynomial.d.ts","sourceRoot":"","sources":["../../../src/math/polynomials/polynomial.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AAcpE,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAElE,8BAAsB,qBAAqB;IACzC,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAY;IAa5D,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAY;IActD;;;;;;OAMG;IACH,MAAM,CAAC,gBAAgB,CACrB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,QAAQ,GAAE,MAAY;IAoBxB,MAAM,CAAC,4BAA4B,CACjC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,QAAQ,GAAE,MAAY;IAqBxB,MAAM,CAA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EAAE,CAAC;IAEvB;;;;OAIG;gBACS,YAAY,EAAE,MAAM,EAAE,EAAE,QAAQ,GAAE,MAAY;IAa1D,MAAM,CAAC,CAAC,EAAE,UAAU,GAAG,OAAO;IAM9B,QAAQ,IAAI,MAAM,EAAE;IAkCpB,GAAG,CAAC,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,UAAU;IAyBvC,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,UAAU;IAQ7B,QAAQ,CAAC,CAAC,EAAE,UAAU,GAAG,UAAU;IAuBnC,YAAY,CAAC,CAAC,EAAE,MAAM,GAAG,UAAU;IAqBnC,QAAQ,IAAI,UAAU;IAOtB,QAAQ,IAAI,UAAU;IAWtB,cAAc,IAAI,UAAU;IAiB5B,eAAe,CAAC,IAAI,CAAC,EAAE,WAAW;IA+BlC,SAAS,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IAO5B,QAAQ,CAAC,EAAE,EAAE,UAAU,GAAG,UAAU,GAAG,MAAM;IAiB7C,YAAY,CAAC,EAAE,EAAE,UAAU,GAAG,UAAU;IAiBxC,MAAM,CAAC,IAAI,CAAC,EAAE,WAAW;IAuCzB,KAAK,IAAI,MAAM;IA0Bf,YAAY,IAAI,MAAM;CAGvB"}
|
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":"AAcA,eAAO,MAAM,UAAU,YAiBtB,CAAC"}
|
package/lib/playground.js
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
import { probaLawFlip } from "./utils/alea/probaLawFlip.js";
|
|
1
2
|
export const playground = () => {
|
|
2
|
-
|
|
3
|
+
const res = [0, 0, 0];
|
|
4
|
+
for (let i = 0; i < 1000; i++) {
|
|
5
|
+
const x = probaLawFlip([
|
|
6
|
+
[-1, 0.45],
|
|
7
|
+
[0, 0.1],
|
|
8
|
+
[1, 0.45],
|
|
9
|
+
]);
|
|
10
|
+
if (x === -1) {
|
|
11
|
+
res[0]++;
|
|
12
|
+
}
|
|
13
|
+
else if (x === 0) {
|
|
14
|
+
res[1]++;
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
res[2]++;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
console.log(res);
|
|
3
21
|
};
|
|
@@ -21,5 +21,9 @@ export interface AlgebraicNode extends Node {
|
|
|
21
21
|
isNumeric: boolean;
|
|
22
22
|
derivative: (varName?: string) => AlgebraicNode;
|
|
23
23
|
}
|
|
24
|
+
export declare abstract class CAlgebraicNode {
|
|
25
|
+
constructor();
|
|
26
|
+
private static toString;
|
|
27
|
+
}
|
|
24
28
|
export declare const isAlgebraicNode: (node: Node) => node is AlgebraicNode;
|
|
25
29
|
//# sourceMappingURL=algebraicNode.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"algebraicNode.d.ts","sourceRoot":"","sources":["../../../src/tree/nodes/algebraicNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE9C,MAAM,MAAM,eAAe,GAAG;IAC5B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,kCAAkC,CAAC,EAAE,OAAO,CAAC;IAC7C,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,WAAW,CAAC,EAAE,OAAO,CAAC;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G,MAAM,EAAE;IAK5C,KAAK,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,MAAM;IAerC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAMtC,QAAQ,CAAC,IAAI,CAAC,EAAE,eAAe,GAAG,aAAa;IAsJ/C,aAAa;;;;;;;;;IAOb,MAAM,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO;IAUpC,oBAAoB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC;IAMxD,UAAU,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,aAAa;CAMxD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"limitNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/limitNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,YAAY,EAAkB,MAAM,mBAAmB,CAAC;AAG9E,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAErE,wBAAgB,WAAW,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,SAAS,CAEnD;AAED,qBAAa,SAAU,YAAW,YAAY;IAC5C,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,EAAE,EAAE,WAAW,CAAC;IAChB,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,aAAa,CAAC;IAC1B,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;IACnB,IAAI,EAAE,GAAG,GAAG,GAAG,GAAG,SAAS,CAAC;IAE5B;;;;;;OAMG;
|
|
1
|
+
{"version":3,"file":"limitNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/limitNode.ts"],"names":[],"mappings":"AACA,OA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D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"substractNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/substractNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,YAAY,EAAkB,MAAM,mBAAmB,CAAC;AAG9E,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAGrE,wBAAgB,eAAe,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,aAAa,CAE3D;AAED,eAAO,MAAM,SAAS,MACjB,aAAa,GAAG,MAAM,GAAG,MAAM,KAC/B,aAAa,GAAG,MAAM,GAAG,MAAM,kBAOnC,CAAC;AAEF,qBAAa,aAAc,YAAW,YAAY;IAChD,EAAE,EAAE,WAAW,CAAC;IAChB,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,aAAa,CAAC;IAC1B,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,WAAW,CAAC;gBAEjB,SAAS,EAAE,aAAa,EACxB,UAAU,EAAE,aAAa,EACzB,IAAI,CAAC,EAAE,WAAW;
|
|
1
|
+
{"version":3,"file":"substractNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/substractNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,YAAY,EAAkB,MAAM,mBAAmB,CAAC;AAG9E,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAGrE,wBAAgB,eAAe,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,aAAa,CAE3D;AAED,eAAO,MAAM,SAAS,MACjB,aAAa,GAAG,MAAM,GAAG,MAAM,KAC/B,aAAa,GAAG,MAAM,GAAG,MAAM,kBAOnC,CAAC;AAEF,qBAAa,aAAc,YAAW,YAAY;IAChD,EAAE,EAAE,WAAW,CAAC;IAChB,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,aAAa,CAAC;IAC1B,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,WAAW,CAAC;gBAEjB,SAAS,EAAE,aAAa,EACxB,UAAU,EAAE,aAAa,EACzB,IAAI,CAAC,EAAE,WAAW;IASpB,YAAY,IAAI,MAAM;IAGtB,aAAa;;;;;;;;;IAOb,iBAAiB,IAAI,aAAa,EAAE;IAapC,cAAc,IAAI,MAAM,EAAE;IAG1B,kBAAkB;IAIlB,KAAK,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,MAAM;IAoBrC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAMtC,QAAQ,CAAC,IAAI,CAAC,EAAE,eAAe;IAM/B,MAAM,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO;IAOpC,oBAAoB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC;IAMxD,UAAU,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,aAAa;IAMvD,OAAO,aAGL;CACH"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AlgebraicNode, SimplifyOptions } from "../algebraicNode.js";
|
|
1
|
+
import { AlgebraicNode, CAlgebraicNode, SimplifyOptions } from "../algebraicNode.js";
|
|
2
2
|
import { Node, NodeIds, NodeOptions, NodeType } from "../node.js";
|
|
3
3
|
export declare const monom: (a: AlgebraicNode | number | string, degree: number, opts?: MonomNodeOptions) => MonomNode;
|
|
4
4
|
export declare function isMonomNode(a: Node): a is MonomNode;
|
|
@@ -10,7 +10,7 @@ type MonomNodeOptions = {
|
|
|
10
10
|
* un monom est une expression du type ax^degree
|
|
11
11
|
* avec a réel !==0 et degree > 0 (convention)
|
|
12
12
|
*/
|
|
13
|
-
export declare class MonomNode implements AlgebraicNode {
|
|
13
|
+
export declare class MonomNode extends CAlgebraicNode implements AlgebraicNode {
|
|
14
14
|
a: AlgebraicNode;
|
|
15
15
|
degree: number;
|
|
16
16
|
isNumeric: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"monomNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/polynomials/monomNode.ts"],"names":[],"mappings":"AACA,OAAO,EACL,aAAa,EACb,eAAe,EAEhB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAMlE,eAAO,MAAM,KAAK,MACb,aAAa,GAAG,MAAM,GAAG,MAAM,UAC1B,MAAM,SACP,gBAAgB,cAMxB,CAAC;AACF,wBAAgB,WAAW,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,SAAS,CAEnD;AAED,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,IAAI,qBAGvC;AACD,KAAK,gBAAgB,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAO7C;;;GAGG;AACH,qBAAa,SAAU,YAAW,aAAa;
|
|
1
|
+
{"version":3,"file":"monomNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/polynomials/monomNode.ts"],"names":[],"mappings":"AACA,OAAO,EACL,aAAa,EACb,cAAc,EACd,eAAe,EAEhB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAMlE,eAAO,MAAM,KAAK,MACb,aAAa,GAAG,MAAM,GAAG,MAAM,UAC1B,MAAM,SACP,gBAAgB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,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isAlgebraicNode, } from "../algebraicNode.js";
|
|
1
|
+
import { CAlgebraicNode, isAlgebraicNode, } from "../algebraicNode.js";
|
|
2
2
|
import { isOppositeNode, opposite } from "../functions/oppositeNode.js";
|
|
3
3
|
import { NodeIds, NodeType } from "../node.js";
|
|
4
4
|
import { isMultiplyNode, multiply } from "../operators/multiplyNode.js";
|
|
@@ -20,7 +20,7 @@ export function parseToMonomNode(a) {
|
|
|
20
20
|
* un monom est une expression du type ax^degree
|
|
21
21
|
* avec a réel !==0 et degree > 0 (convention)
|
|
22
22
|
*/
|
|
23
|
-
export class MonomNode {
|
|
23
|
+
export class MonomNode extends CAlgebraicNode {
|
|
24
24
|
a;
|
|
25
25
|
degree;
|
|
26
26
|
isNumeric;
|
|
@@ -28,6 +28,7 @@ export class MonomNode {
|
|
|
28
28
|
type = NodeType.monom;
|
|
29
29
|
// roots: AlgebraicNode[];
|
|
30
30
|
constructor(a, degree, opts) {
|
|
31
|
+
super();
|
|
31
32
|
// super([c, b, a], opts?.variable ?? "x");
|
|
32
33
|
this.a = typeof a === "number" ? a.toTree() : a;
|
|
33
34
|
if (this.a.evaluate() === 0)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AlgebraicNode, SimplifyOptions } from "../../../tree/nodes/algebraicNode.js";
|
|
1
|
+
import { AlgebraicNode, CAlgebraicNode, SimplifyOptions } from "../../../tree/nodes/algebraicNode.js";
|
|
2
2
|
import { NodeIds, NodeOptions, NodeType } from "../../../tree/nodes/node.js";
|
|
3
3
|
import { NodeIdentifiers } from "../../../tree/nodes/nodeConstructor.js";
|
|
4
4
|
export declare abstract class TrinomNodeConstructor {
|
|
@@ -43,7 +43,7 @@ export type TrinomNodeIdentifiers = {
|
|
|
43
43
|
type TrinomNodeOptions = {
|
|
44
44
|
variable: string;
|
|
45
45
|
};
|
|
46
|
-
export declare class TrinomNode implements AlgebraicNode {
|
|
46
|
+
export declare class TrinomNode extends CAlgebraicNode implements AlgebraicNode {
|
|
47
47
|
a: AlgebraicNode;
|
|
48
48
|
b: AlgebraicNode;
|
|
49
49
|
c: AlgebraicNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trinomNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/polynomials/trinomNode.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,aAAa,EACb,eAAe,EAChB,MAAM,mCAAmC,CAAC;AAG3C,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAC1E,OAAO,EAEL,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAE7C,8BAAsB,qBAAqB;IACzC,MAAM,CAAC,MAAM,CACX,KAAK,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,EAC3D,KAAK,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,EAC3D,KAAK,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,GAC1D,UAAU;IAmBb,MAAM,CAAC,eAAe,CACpB,KAAK,CAAC,EAAE;QACN,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;QACpB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;KACjB,EACD,SAAS,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;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AC;AAEF,KAAK,iBAAiB,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAC9C,qBAAa,UAAW,SAAQ,cAAe,YAAW,aAAa;IACrE,CAAC,EAAE,aAAa,CAAC;IACjB,CAAC,EAAE,aAAa,CAAC;IACjB,CAAC,EAAE,aAAa,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,QAAQ,CAAmB;gBAG/B,CAAC,EAAE,aAAa,GAAG,MAAM,EACzB,CAAC,EAAE,aAAa,GAAG,MAAM,EACzB,CAAC,EAAE,aAAa,GAAG,MAAM,EACzB,IAAI,CAAC,EAAE,iBAAiB;IAY1B,QAAQ;IAgBR,UAAU,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS;IAGvC,MAAM,CAAC,IAAI,EAAE,aAAa;IAG1B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAGtC,oBAAoB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC;IAGxD,QAAQ,CAAC,IAAI,CAAC,EAAE,eAAe;IAG/B,cAAc,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,SAAS;IAG7C,iBAAiB,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,SAAS;IAGhD,YAAY;IAIZ,QAAQ,IAAI,aAAa,EAAE;IAgB3B,MAAM;IAYN,YAAY;IAiBZ,KAAK;IAGL,SAAS;IAIT,aAAa,IAAI,qBAAqB;CASvC"}
|
|
@@ -5,6 +5,7 @@ import { multiply } from "../../../tree/nodes/operators/multiplyNode.js";
|
|
|
5
5
|
import { square } from "../../../tree/nodes/operators/powerNode.js";
|
|
6
6
|
import { substract } from "../../../tree/nodes/operators/substractNode.js";
|
|
7
7
|
import { opposite } from "../../../tree/nodes/functions/oppositeNode.js";
|
|
8
|
+
import { CAlgebraicNode, } from "../../../tree/nodes/algebraicNode.js";
|
|
8
9
|
import { randint } from "../../../math/utils/random/randint.js";
|
|
9
10
|
import { random } from "../../../utils/alea/random.js";
|
|
10
11
|
import { NodeIds, NodeType } from "../../../tree/nodes/node.js";
|
|
@@ -61,7 +62,7 @@ export class TrinomNodeConstructor {
|
|
|
61
62
|
: NodeConstructor.fromIdentifiers(identifiers.c), identifiers.opts);
|
|
62
63
|
}
|
|
63
64
|
}
|
|
64
|
-
export class TrinomNode {
|
|
65
|
+
export class TrinomNode extends CAlgebraicNode {
|
|
65
66
|
a;
|
|
66
67
|
b;
|
|
67
68
|
c;
|
|
@@ -70,6 +71,7 @@ export class TrinomNode {
|
|
|
70
71
|
type = NodeType.trinom;
|
|
71
72
|
// roots: AlgebraicNode[];
|
|
72
73
|
constructor(a, b, c, opts) {
|
|
74
|
+
super();
|
|
73
75
|
// super([c, b, a], opts?.variable ?? "x");
|
|
74
76
|
this.a = typeof a === "number" ? a.toTree() : a;
|
|
75
77
|
this.b = typeof b === "number" ? b.toTree() : b;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { AlgebraicNode } from "../algebraicNode.js";
|
|
1
|
+
import { AlgebraicNode, CAlgebraicNode } from "../algebraicNode.js";
|
|
2
2
|
import { Node, NodeIds, NodeType } from "../node.js";
|
|
3
3
|
export declare function isVariableNode(a: Node): a is VariableNode;
|
|
4
|
-
export declare class VariableNode implements AlgebraicNode {
|
|
4
|
+
export declare class VariableNode extends CAlgebraicNode implements AlgebraicNode {
|
|
5
5
|
name: string;
|
|
6
6
|
type: NodeType;
|
|
7
7
|
isNumeric: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"variableNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/variables/variableNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"variableNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/variables/variableNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAErD,wBAAgB,cAAc,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,YAAY,CAEzD;AACD,qBAAa,YAAa,SAAQ,cAAe,YAAW,aAAa;IACvE,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,WAAqB;IACzB,SAAS,EAAE,OAAO,CAAC;gBACP,IAAI,EAAE,MAAM;IAMxB,aAAa;;;;IAMb,KAAK,IAAI,MAAM;IAGf,YAAY,IAAI,MAAM;IAGtB,QAAQ;IAGR,cAAc;IAGd,iBAAiB;IAIjB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAQtC,QAAQ;IAGR,MAAM,CAAC,IAAI,EAAE,aAAa;IAG1B,oBAAoB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC;IAGxD,UAAU,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,aAAa;CAKxD"}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
import { CAlgebraicNode } from "../algebraicNode.js";
|
|
1
2
|
import { NodeIds, NodeType } from "../node.js";
|
|
2
3
|
export function isVariableNode(a) {
|
|
3
4
|
return a.type === NodeType.variable;
|
|
4
5
|
}
|
|
5
|
-
export class VariableNode {
|
|
6
|
+
export class VariableNode extends CAlgebraicNode {
|
|
6
7
|
name;
|
|
7
8
|
type = NodeType.variable;
|
|
8
9
|
isNumeric;
|
|
9
10
|
constructor(name) {
|
|
11
|
+
super();
|
|
10
12
|
this.name = name;
|
|
11
13
|
this.isNumeric = false;
|
|
12
14
|
}
|
|
@@ -7,11 +7,11 @@ export const probaLawFlip = (arr) => {
|
|
|
7
7
|
if (Math.abs(arr.reduce((acc, curr) => (acc += curr[1]), 0) - 1) > 0.1)
|
|
8
8
|
throw Error("proba law does not add up t 1");
|
|
9
9
|
const rand = Math.random();
|
|
10
|
-
const sorted = [...arr].sort((a, b) => b[1] - a[1]);
|
|
10
|
+
// const sorted = [...arr].sort((a, b) => b[1] - a[1]);
|
|
11
11
|
let probaAcc = 0;
|
|
12
12
|
let i = 0;
|
|
13
13
|
while (i < arr.length - 1) {
|
|
14
|
-
probaAcc +=
|
|
14
|
+
probaAcc += arr[i][1];
|
|
15
15
|
if (rand < probaAcc)
|
|
16
16
|
return arr[i][0];
|
|
17
17
|
i++;
|