math-exercises 2.2.66 → 2.2.68
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/fractionAndIntegerSum.d.ts +1 -0
- package/lib/exercises/math/calcul/fractions/fractionAndIntegerSum.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionAndIntegerSum.js +51 -37
- package/lib/exercises/math/calcul/fractions/fractionsOperations.d.ts +8 -0
- package/lib/exercises/math/calcul/fractions/fractionsOperations.d.ts.map +1 -0
- package/lib/exercises/math/calcul/fractions/fractionsOperations.js +85 -0
- package/lib/exercises/math/calcul/fractions/index.d.ts +1 -0
- package/lib/exercises/math/calcul/fractions/index.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/index.js +1 -0
- package/lib/exercises/math/derivation/derivative/rootFunctionDerivative.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/rootFunctionDerivative.js +11 -1
- package/lib/exercises/math/functions/affines/leadingCoefficient.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/leadingCoefficient.js +9 -16
- package/lib/exercises/math/geometry/cartesian/distanceBetweenTwoPoints.d.ts.map +1 -1
- package/lib/exercises/math/geometry/cartesian/distanceBetweenTwoPoints.js +3 -1
- package/lib/exercises/math/geometry/cartesian/placeAbscissOnLine.js +1 -1
- package/lib/exercises/math/percent/applyPercent.d.ts.map +1 -1
- package/lib/exercises/math/percent/applyPercent.js +2 -4
- package/lib/exercises/math/probaStat/probabilityTree.d.ts +10 -7
- package/lib/exercises/math/probaStat/probabilityTree.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/probabilityTree.js +194 -90
- package/lib/exercises/math/spaceGeometry/vectors/spaceVectorNormCalculation.d.ts.map +1 -1
- package/lib/exercises/math/spaceGeometry/vectors/spaceVectorNormCalculation.js +7 -3
- package/lib/exercises/vea/rationalVEA.d.ts +7 -1
- package/lib/exercises/vea/rationalVEA.d.ts.map +1 -1
- package/lib/exercises/vea/rationalVEA.js +28 -3
- package/lib/index.d.ts +12 -7
- package/lib/index.d.ts.map +1 -1
- package/lib/math/complex/complex.d.ts +1 -1
- package/lib/math/numbers/rationals/rational.d.ts +1 -1
- package/lib/math/numbers/reals/extendedRingElement.d.ts +1 -1
- package/lib/math/polynomials/generalAffine.d.ts +1 -1
- package/lib/math/polynomials/generalTrinom.d.ts +1 -1
- package/lib/math/polynomials/trinom.d.ts +3 -3
- package/lib/playground.d.ts.map +1 -1
- package/lib/playground.js +1 -5
- package/lib/prototypesEnhancement.d.ts +3 -1
- package/lib/prototypesEnhancement.d.ts.map +1 -1
- package/lib/tree/nodes/algebraicNode.d.ts +1 -0
- package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/absNode.d.ts +2 -1
- package/lib/tree/nodes/functions/absNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/absNode.js +7 -0
- package/lib/tree/nodes/functions/arcSinNode.d.ts +1 -0
- package/lib/tree/nodes/functions/arcSinNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/arcSinNode.js +3 -0
- package/lib/tree/nodes/functions/arccosNode.d.ts +1 -0
- package/lib/tree/nodes/functions/arccosNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/arccosNode.js +3 -0
- package/lib/tree/nodes/functions/arctanNode.d.ts +1 -0
- package/lib/tree/nodes/functions/arctanNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/arctanNode.js +3 -0
- package/lib/tree/nodes/functions/cosNode.d.ts +2 -0
- package/lib/tree/nodes/functions/cosNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/cosNode.js +9 -1
- package/lib/tree/nodes/functions/expNode.d.ts +2 -0
- package/lib/tree/nodes/functions/expNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/expNode.js +10 -1
- package/lib/tree/nodes/functions/log10Node.d.ts +1 -0
- package/lib/tree/nodes/functions/log10Node.d.ts.map +1 -1
- package/lib/tree/nodes/functions/log10Node.js +3 -0
- package/lib/tree/nodes/functions/logNode.d.ts +1 -0
- package/lib/tree/nodes/functions/logNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/logNode.js +3 -0
- package/lib/tree/nodes/functions/oppositeNode.d.ts +1 -0
- package/lib/tree/nodes/functions/oppositeNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/oppositeNode.js +3 -0
- package/lib/tree/nodes/functions/sinNode.d.ts +2 -0
- package/lib/tree/nodes/functions/sinNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/sinNode.js +11 -1
- package/lib/tree/nodes/functions/sqrtNode.d.ts +1 -0
- package/lib/tree/nodes/functions/sqrtNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/sqrtNode.js +3 -0
- package/lib/tree/nodes/functions/tanNode.d.ts +2 -0
- package/lib/tree/nodes/functions/tanNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/tanNode.js +9 -1
- package/lib/tree/nodes/geometry/degree.d.ts +1 -0
- package/lib/tree/nodes/geometry/degree.d.ts.map +1 -1
- package/lib/tree/nodes/geometry/degree.js +3 -0
- package/lib/tree/nodes/geometry/lengthNode.d.ts +1 -0
- package/lib/tree/nodes/geometry/lengthNode.d.ts.map +1 -1
- package/lib/tree/nodes/geometry/lengthNode.js +3 -0
- package/lib/tree/nodes/node.d.ts +1 -0
- package/lib/tree/nodes/node.d.ts.map +1 -1
- package/lib/tree/nodes/numbers/constantNode.d.ts +2 -0
- package/lib/tree/nodes/numbers/constantNode.d.ts.map +1 -1
- package/lib/tree/nodes/numbers/constantNode.js +10 -1
- package/lib/tree/nodes/numbers/infiniteNode.d.ts +0 -2
- package/lib/tree/nodes/numbers/infiniteNode.d.ts.map +1 -1
- package/lib/tree/nodes/numbers/infiniteNode.js +1 -6
- package/lib/tree/nodes/numbers/numberNode.d.ts +1 -0
- package/lib/tree/nodes/numbers/numberNode.d.ts.map +1 -1
- package/lib/tree/nodes/numbers/numberNode.js +3 -0
- package/lib/tree/nodes/operators/addNode.d.ts +1 -0
- package/lib/tree/nodes/operators/addNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/addNode.js +5 -1
- package/lib/tree/nodes/operators/binomialCoefficientNode.d.ts +1 -0
- package/lib/tree/nodes/operators/binomialCoefficientNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/binomialCoefficientNode.js +3 -0
- package/lib/tree/nodes/operators/divideNode.d.ts +4 -1
- package/lib/tree/nodes/operators/divideNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/divideNode.js +17 -2
- package/lib/tree/nodes/operators/fractionNode.d.ts +9 -9
- package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/fractionNode.js +18 -0
- package/lib/tree/nodes/operators/limitNode.d.ts +1 -0
- package/lib/tree/nodes/operators/limitNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/limitNode.js +3 -0
- package/lib/tree/nodes/operators/multiplyNode.d.ts +1 -0
- package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/multiplyNode.js +10 -2
- package/lib/tree/nodes/operators/powerNode.d.ts +1 -0
- package/lib/tree/nodes/operators/powerNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/powerNode.js +6 -0
- package/lib/tree/nodes/operators/substractNode.d.ts +4 -2
- package/lib/tree/nodes/operators/substractNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/substractNode.js +9 -2
- package/lib/tree/nodes/sets/intervalNode.d.ts.map +1 -1
- package/lib/tree/nodes/sets/intervalNode.js +8 -8
- package/lib/tree/nodes/variables/variableNode.d.ts +1 -0
- package/lib/tree/nodes/variables/variableNode.d.ts.map +1 -1
- package/lib/tree/nodes/variables/variableNode.js +7 -0
- package/lib/tree/parsers/affineParser.d.ts +1 -2
- package/lib/tree/parsers/affineParser.d.ts.map +1 -1
- package/lib/tree/parsers/affineParser.js +16 -16
- package/lib/tree/parsers/latexParser.d.ts +1 -1
- package/lib/tree/parsers/monomParser.d.ts +9 -1
- package/lib/tree/parsers/monomParser.d.ts.map +1 -1
- package/lib/tree/parsers/monomParser.js +65 -2
- package/lib/tree/parsers/powerParser.d.ts +1 -1
- package/lib/tree/parsers/purifyLatex.d.ts +9 -0
- package/lib/tree/parsers/purifyLatex.d.ts.map +1 -0
- package/lib/tree/parsers/purifyLatex.js +17 -0
- package/lib/tree/parsers/rationalParser.d.ts +1 -1
- package/lib/tree/parsers/rationalParser.d.ts.map +1 -1
- package/lib/tree/parsers/trinomParser.d.ts +2 -0
- package/lib/tree/parsers/trinomParser.d.ts.map +1 -0
- package/lib/tree/parsers/trinomParser.js +31 -0
- package/package.json +1 -1
|
@@ -1,72 +1,181 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.probabilityTree = void 0;
|
|
4
|
+
const rationalVEA_1 = require("../../../exercises/vea/rationalVEA");
|
|
4
5
|
const geogebraConstructor_1 = require("../../../geogebra/geogebraConstructor");
|
|
5
|
-
const
|
|
6
|
+
const rational_1 = require("../../../math/numbers/rationals/rational");
|
|
7
|
+
const randfloat_1 = require("../../../math/utils/random/randfloat");
|
|
6
8
|
const randint_1 = require("../../../math/utils/random/randint");
|
|
7
9
|
const round_1 = require("../../../math/utils/round");
|
|
10
|
+
const nodeConstructor_1 = require("../../../tree/nodes/nodeConstructor");
|
|
11
|
+
const addNode_1 = require("../../../tree/nodes/operators/addNode");
|
|
8
12
|
const fractionNode_1 = require("../../../tree/nodes/operators/fractionNode");
|
|
9
13
|
const multiplyNode_1 = require("../../../tree/nodes/operators/multiplyNode");
|
|
10
|
-
const
|
|
14
|
+
const substractNode_1 = require("../../../tree/nodes/operators/substractNode");
|
|
15
|
+
const random_1 = require("../../../utils/alea/random");
|
|
11
16
|
const shuffle_1 = require("../../../utils/alea/shuffle");
|
|
12
17
|
const exercise_1 = require("../../exercise");
|
|
13
18
|
const getDistinctQuestions_1 = require("../../utils/getDistinctQuestions");
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
switch (type) {
|
|
19
|
+
const rebuildIdentifiers = (oldIdentifiers) => {
|
|
20
|
+
if (oldIdentifiers.probaName)
|
|
21
|
+
return oldIdentifiers;
|
|
22
|
+
const ABTotal = oldIdentifiers.A + oldIdentifiers.B;
|
|
23
|
+
const ASubTotal = oldIdentifiers.AC + oldIdentifiers.AD;
|
|
24
|
+
const BSubTotal = oldIdentifiers.BC + oldIdentifiers.BD;
|
|
25
|
+
let probaName = "";
|
|
26
|
+
switch (oldIdentifiers.type) {
|
|
22
27
|
case 1:
|
|
23
|
-
|
|
28
|
+
probaName = "P(A\\cap C)";
|
|
29
|
+
break;
|
|
24
30
|
case 2:
|
|
25
|
-
|
|
31
|
+
probaName = "P(A\\cap D)";
|
|
32
|
+
break;
|
|
26
33
|
case 3:
|
|
27
|
-
|
|
34
|
+
probaName = "P(B\\cap C)";
|
|
35
|
+
break;
|
|
28
36
|
case 4:
|
|
37
|
+
probaName = "P(B\\cap D)";
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
probaName,
|
|
42
|
+
A: (0, fractionNode_1.frac)(oldIdentifiers.A, ABTotal).simplify().toIdentifiers(),
|
|
43
|
+
B: (0, fractionNode_1.frac)(oldIdentifiers.B, ABTotal).simplify().toIdentifiers(),
|
|
44
|
+
AC: (0, fractionNode_1.frac)(oldIdentifiers.AC, ASubTotal).simplify().toIdentifiers(),
|
|
45
|
+
AD: (0, fractionNode_1.frac)(oldIdentifiers.AD, ASubTotal).simplify().toIdentifiers(),
|
|
46
|
+
BC: (0, fractionNode_1.frac)(oldIdentifiers.BC, BSubTotal).simplify().toIdentifiers(),
|
|
47
|
+
BD: (0, fractionNode_1.frac)(oldIdentifiers.BD, BSubTotal).simplify().toIdentifiers(),
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
const optionValues = [
|
|
51
|
+
"Probabilité d'intersection $P(A\\cap C)$",
|
|
52
|
+
"Probabilité totale $P(C)$",
|
|
53
|
+
"Probabilité conditionnelle $P_B(A)$",
|
|
54
|
+
"Probabilité 'simple' $P(A)$",
|
|
55
|
+
];
|
|
56
|
+
const defaultOptionValues = [
|
|
57
|
+
"Probabilité d'intersection $P(A\\cap C)$",
|
|
58
|
+
"Probabilité totale $P(C)$",
|
|
59
|
+
"Probabilité conditionnelle $P_B(A)$",
|
|
60
|
+
];
|
|
61
|
+
const buildAll = (identifiers) => {
|
|
62
|
+
return {
|
|
63
|
+
pA: nodeConstructor_1.NodeConstructor.fromIdentifiers(identifiers.A),
|
|
64
|
+
pAC: nodeConstructor_1.NodeConstructor.fromIdentifiers(identifiers.AC),
|
|
65
|
+
pAD: nodeConstructor_1.NodeConstructor.fromIdentifiers(identifiers.AD),
|
|
66
|
+
pB: nodeConstructor_1.NodeConstructor.fromIdentifiers(identifiers.B),
|
|
67
|
+
pBC: nodeConstructor_1.NodeConstructor.fromIdentifiers(identifiers.BC),
|
|
68
|
+
pBD: nodeConstructor_1.NodeConstructor.fromIdentifiers(identifiers.BD),
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
const getAnswerNode = (identifiers) => {
|
|
72
|
+
const probas = buildAll(identifiers);
|
|
73
|
+
switch (identifiers.probaName) {
|
|
74
|
+
case "P(A)":
|
|
75
|
+
return probas.pA;
|
|
76
|
+
case "P(B)":
|
|
77
|
+
return probas.pB;
|
|
78
|
+
case "P(A\\cap C)":
|
|
79
|
+
return (0, multiplyNode_1.multiply)(probas.pA, probas.pAC).simplify();
|
|
80
|
+
case "P(A\\cap D)":
|
|
81
|
+
return (0, multiplyNode_1.multiply)(probas.pA, probas.pAD).simplify();
|
|
82
|
+
case "P(B\\cap C)":
|
|
83
|
+
return (0, multiplyNode_1.multiply)(probas.pB, probas.pBC).simplify();
|
|
84
|
+
case "P(B\\cap D)":
|
|
85
|
+
return (0, multiplyNode_1.multiply)(probas.pB, probas.pBD).simplify();
|
|
86
|
+
case "P_A(C)":
|
|
87
|
+
return probas.pAC;
|
|
88
|
+
case "P_A(D)":
|
|
89
|
+
return probas.pAD;
|
|
90
|
+
case "P_B(C)":
|
|
91
|
+
return probas.pBC;
|
|
92
|
+
case "P_B(D)":
|
|
93
|
+
return probas.pBD;
|
|
94
|
+
case "P(C)":
|
|
95
|
+
return (0, addNode_1.add)((0, multiplyNode_1.multiply)(probas.pA, probas.pAC), (0, multiplyNode_1.multiply)(probas.pB, probas.pBC)).simplify();
|
|
96
|
+
case "P(D)":
|
|
29
97
|
default:
|
|
30
|
-
return (0, multiplyNode_1.multiply)(pB,
|
|
98
|
+
return (0, addNode_1.add)((0, multiplyNode_1.multiply)(probas.pA, probas.pAD), (0, multiplyNode_1.multiply)(probas.pB, probas.pBD)).simplify();
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
const getAnswer = (identifiers) => {
|
|
102
|
+
return getAnswerNode(identifiers).toTex();
|
|
103
|
+
};
|
|
104
|
+
const getInstruction = (identifiers, options) => {
|
|
105
|
+
let instr = `On considère l'arbre de probabilités ci-dessous. Calculer :
|
|
106
|
+
|
|
107
|
+
$$
|
|
108
|
+
${identifiers.probaName}
|
|
109
|
+
$$`;
|
|
110
|
+
if (options?.allowApproximate) {
|
|
111
|
+
instr += `
|
|
112
|
+
|
|
113
|
+
Donner la valeur exacte ou une valeur arrondie au ${options.allowApproximate}.`;
|
|
114
|
+
}
|
|
115
|
+
return instr;
|
|
116
|
+
};
|
|
117
|
+
const getProbaAndOpposite = (decimal = false) => {
|
|
118
|
+
if (!decimal) {
|
|
119
|
+
const proba = rational_1.RationalConstructor.randomIrreductibleProba().toTree();
|
|
120
|
+
return [proba, (0, substractNode_1.substract)(1, proba).simplify()];
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
const proba = (0, round_1.round)((0, randfloat_1.randfloat)(0.01, 1, 2), 2);
|
|
124
|
+
return [proba.toTree(), (0, round_1.round)(1 - proba, 2).toTree()];
|
|
31
125
|
}
|
|
32
126
|
};
|
|
33
127
|
const getProbabilityTree = (opts) => {
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
128
|
+
const isDecimal = opts?.probaType === "Décimales";
|
|
129
|
+
const [pA, pB] = getProbaAndOpposite(isDecimal);
|
|
130
|
+
const [pC_A, pD_A] = getProbaAndOpposite(isDecimal);
|
|
131
|
+
const [pC_B, pD_B] = getProbaAndOpposite(isDecimal);
|
|
132
|
+
const eventTypes = opts?.eventTypes?.length
|
|
133
|
+
? opts.eventTypes
|
|
134
|
+
: defaultOptionValues;
|
|
135
|
+
const type = (0, random_1.random)(eventTypes);
|
|
136
|
+
const index = optionValues.indexOf(type);
|
|
137
|
+
let probaName = "";
|
|
138
|
+
switch (index) {
|
|
139
|
+
case 0: //inter
|
|
140
|
+
probaName = (0, random_1.random)([
|
|
141
|
+
"P(A\\cap C)",
|
|
142
|
+
"P(A\\cap D)",
|
|
143
|
+
"P(B\\cap C)",
|
|
144
|
+
"P(B\\cap D)",
|
|
145
|
+
]);
|
|
49
146
|
break;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
instruction += `calculer $P(A \\cap D)$.`;
|
|
53
|
-
startStatement = `P(A \\cap D)`;
|
|
147
|
+
case 1: //totale
|
|
148
|
+
probaName = (0, random_1.random)(["P(C)", "P(D)"]);
|
|
54
149
|
break;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
instruction += `calculer $P(B \\cap C)$.`;
|
|
58
|
-
startStatement = `P(B \\cap C)`;
|
|
150
|
+
case 2: //conditionnal
|
|
151
|
+
probaName = (0, random_1.random)(["P_A(C)", "P_A(D)", "P_B(C)", "P_B(D)"]);
|
|
59
152
|
break;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
instruction += `calculer $P(B \\cap D)$.`;
|
|
63
|
-
startStatement = `P(B \\cap D)`;
|
|
153
|
+
case 3: //simple
|
|
154
|
+
probaName = (0, random_1.random)(["P(A)", "P(B)"]);
|
|
64
155
|
break;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
if (opts?.allowApproximate) {
|
|
68
|
-
instruction += ` Donner la valeur exacte ou une valeur arrondie au ${opts.allowApproximate}.`;
|
|
69
156
|
}
|
|
157
|
+
const identifiers = {
|
|
158
|
+
A: pA.toIdentifiers(),
|
|
159
|
+
B: pB.toIdentifiers(),
|
|
160
|
+
AC: pC_A.toIdentifiers(),
|
|
161
|
+
AD: pD_A.toIdentifiers(),
|
|
162
|
+
BC: pC_B.toIdentifiers(),
|
|
163
|
+
BD: pD_B.toIdentifiers(),
|
|
164
|
+
probaName,
|
|
165
|
+
};
|
|
166
|
+
const question = {
|
|
167
|
+
instruction: getInstruction(identifiers, opts),
|
|
168
|
+
startStatement: probaName,
|
|
169
|
+
answer: getAnswer(identifiers),
|
|
170
|
+
keys: [],
|
|
171
|
+
ggbOptions: getGGBOptions(identifiers, opts),
|
|
172
|
+
answerFormat: "tex",
|
|
173
|
+
identifiers,
|
|
174
|
+
};
|
|
175
|
+
return question;
|
|
176
|
+
};
|
|
177
|
+
const getGGBOptions = (identifiers, opts) => {
|
|
178
|
+
const probas = buildAll(identifiers);
|
|
70
179
|
let commands = [
|
|
71
180
|
"A = Point({2,2})",
|
|
72
181
|
"B = Point({2,-2})",
|
|
@@ -80,12 +189,12 @@ const getProbabilityTree = (opts) => {
|
|
|
80
189
|
"Segment(Point({0,0}),B)",
|
|
81
190
|
"Segment(B,BC)",
|
|
82
191
|
"Segment(B,BD)",
|
|
83
|
-
`Text("\\scriptsize ${
|
|
84
|
-
`Text("\\scriptsize ${
|
|
85
|
-
`Text("\\scriptsize ${
|
|
86
|
-
`Text("\\scriptsize ${
|
|
87
|
-
`Text("\\scriptsize ${
|
|
88
|
-
`Text("\\scriptsize ${
|
|
192
|
+
`Text("\\scriptsize ${probas.pA.toTex()}", (0.1, 2.2), true, true)`,
|
|
193
|
+
`Text("\\scriptsize ${probas.pAC.toTex()}", (2.8, 4), true, true)`,
|
|
194
|
+
`Text("\\scriptsize ${probas.pAD.toTex()}", (2.8, 1.6), true, true)`,
|
|
195
|
+
`Text("\\scriptsize ${probas.pB.toTex()}", (0.1, -0.8), true, true)`,
|
|
196
|
+
`Text("\\scriptsize ${probas.pBC.toTex()}", (2.8, -0.6), true, true)`,
|
|
197
|
+
`Text("\\scriptsize ${probas.pBD.toTex()}", (2.8, -2.5), true, true)`,
|
|
89
198
|
'Text("A", (1.85 , 2.5))',
|
|
90
199
|
'Text("B", (1.85 , -2.8))',
|
|
91
200
|
'Text("C", (5.5 , 2.85))',
|
|
@@ -98,44 +207,30 @@ const getProbabilityTree = (opts) => {
|
|
|
98
207
|
hideAxes: true,
|
|
99
208
|
hideGrid: true,
|
|
100
209
|
});
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
answer: answerTex,
|
|
105
|
-
keys: [],
|
|
106
|
-
ggbOptions: ggb.getOptions({
|
|
107
|
-
coords: [-2, 8, -5, 5],
|
|
108
|
-
}),
|
|
109
|
-
answerFormat: "tex",
|
|
110
|
-
identifiers: { A, AC, AD, B, BC, BD, type },
|
|
111
|
-
};
|
|
112
|
-
return question;
|
|
210
|
+
return ggb.getOptions({
|
|
211
|
+
coords: [-2, 8, -5, 5],
|
|
212
|
+
});
|
|
113
213
|
};
|
|
114
|
-
const getPropositions = (n, { answer,
|
|
214
|
+
const getPropositions = (n, { answer, ...identifiers }) => {
|
|
115
215
|
const propositions = [];
|
|
116
216
|
(0, exercise_1.addValidProp)(propositions, answer);
|
|
117
|
-
const answerNode = getAnswerNode(
|
|
217
|
+
const answerNode = getAnswerNode(identifiers);
|
|
118
218
|
while (propositions.length < n) {
|
|
119
219
|
const wrongAnswer = (0, multiplyNode_1.multiply)(answerNode, (0, randint_1.randint)(2, 11)).simplify();
|
|
120
220
|
(0, exercise_1.tryToAddWrongProp)(propositions, wrongAnswer.toTex());
|
|
121
221
|
}
|
|
122
222
|
return (0, shuffle_1.shuffle)(propositions);
|
|
123
223
|
};
|
|
124
|
-
const isAnswerValid = (ans, { answer,
|
|
224
|
+
const isAnswerValid = (ans, { answer, ...identifiers }, opts) => {
|
|
125
225
|
try {
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
(0, round_1.round)(getAnswerNode({ type, A, AC, AD, B, BC, BD }).evaluate(), rank + 1));
|
|
135
|
-
}
|
|
136
|
-
return answer === simplified.toTex();
|
|
137
|
-
// const answer = getAnswerNode({ type, A, AC, AD, B, BC, BD });
|
|
138
|
-
// const texs = answer.toTree({ allowFractionToDecimal: true }).toAllValidTexs();
|
|
226
|
+
const rank = opts?.allowApproximate
|
|
227
|
+
? ["dixième", "centième", "millième"].indexOf(opts.allowApproximate) + 1
|
|
228
|
+
: undefined;
|
|
229
|
+
return (0, rationalVEA_1.rationalVEA)(ans, answer, {
|
|
230
|
+
allowNonIrreductible: true,
|
|
231
|
+
allowDecimal: true,
|
|
232
|
+
decimalPrecision: rank,
|
|
233
|
+
});
|
|
139
234
|
}
|
|
140
235
|
catch (err) {
|
|
141
236
|
return false;
|
|
@@ -147,25 +242,31 @@ const options = [
|
|
|
147
242
|
label: "Autoriser les valeurs approchées au : ",
|
|
148
243
|
target: exercise_1.GeneratorOptionTarget.vea,
|
|
149
244
|
type: exercise_1.GeneratorOptionType.select,
|
|
150
|
-
defaultValue: "
|
|
245
|
+
defaultValue: "centième",
|
|
151
246
|
values: ["dixième", "centième", "millième"],
|
|
152
247
|
},
|
|
248
|
+
{
|
|
249
|
+
id: "eventTypes",
|
|
250
|
+
label: "Types de questions",
|
|
251
|
+
target: exercise_1.GeneratorOptionTarget.generation,
|
|
252
|
+
type: exercise_1.GeneratorOptionType.multiselect,
|
|
253
|
+
defaultValue: defaultOptionValues,
|
|
254
|
+
values: optionValues,
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
id: "probaType",
|
|
258
|
+
label: "Format des probabilités",
|
|
259
|
+
target: exercise_1.GeneratorOptionTarget.generation,
|
|
260
|
+
type: exercise_1.GeneratorOptionType.select,
|
|
261
|
+
defaultValue: "Fractions",
|
|
262
|
+
values: ["Fractions", "Décimales"],
|
|
263
|
+
},
|
|
153
264
|
];
|
|
154
265
|
exports.probabilityTree = {
|
|
155
266
|
id: "probabilityTree",
|
|
156
267
|
connector: "=",
|
|
157
268
|
label: "Calculs de probabilités à l'aide d'un arbre pondéré",
|
|
158
|
-
levels: [
|
|
159
|
-
"2nde",
|
|
160
|
-
"1reESM",
|
|
161
|
-
"1reSpé",
|
|
162
|
-
"1reTech",
|
|
163
|
-
"1rePro",
|
|
164
|
-
"TermPro",
|
|
165
|
-
"TermTech",
|
|
166
|
-
],
|
|
167
269
|
isSingleStep: false,
|
|
168
|
-
sections: ["Probabilités"],
|
|
169
270
|
generator: (nb, opts) => (0, getDistinctQuestions_1.getDistinctQuestions)(() => getProbabilityTree(opts), nb),
|
|
170
271
|
qcmTimer: 60,
|
|
171
272
|
freeTimer: 60,
|
|
@@ -174,4 +275,7 @@ exports.probabilityTree = {
|
|
|
174
275
|
hasGeogebra: true,
|
|
175
276
|
subject: "Mathématiques",
|
|
176
277
|
options,
|
|
278
|
+
rebuildIdentifiers,
|
|
279
|
+
getInstruction,
|
|
280
|
+
getAnswer,
|
|
177
281
|
};
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;AA+FF,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,WAAW,CAkB5D,CAAC"}
|
|
@@ -10,11 +10,11 @@ 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
12
|
const getHint = (identifiers) => {
|
|
13
|
-
return "
|
|
13
|
+
return "Dans un repère dans l'espace orthonormé, la norme d'un vecteur est la racine carrée de la somme des carrés de ses coordonnées.";
|
|
14
14
|
};
|
|
15
15
|
const getCorrection = ({ x, y, z }) => {
|
|
16
16
|
const answer = getAnswer({ x, y, z });
|
|
17
|
-
return `
|
|
17
|
+
return `Dans un repère de l'espace orthonormé, la norme d'un vecteur est la racine carrée de la somme des carrés de ses coordonnées. Ici, on a donc :
|
|
18
18
|
|
|
19
19
|
${(0, alignTex_1.alignTex)([
|
|
20
20
|
[
|
|
@@ -35,7 +35,11 @@ const getAnswer = (identifiers) => {
|
|
|
35
35
|
};
|
|
36
36
|
const getInstruction = (identifiers) => {
|
|
37
37
|
const u = new spaceVector_1.SpaceVector("u", identifiers.x.toTree(), identifiers.y.toTree(), identifiers.z.toTree());
|
|
38
|
-
return `
|
|
38
|
+
return `On se place dans un repère de l'espace orthonormé. Calculer la norme du vecteur :
|
|
39
|
+
|
|
40
|
+
$$
|
|
41
|
+
${u.toTexWithCoords()}
|
|
42
|
+
$$`;
|
|
39
43
|
};
|
|
40
44
|
const getSpaceVectorNormCalculationQuestion = () => {
|
|
41
45
|
const u = spaceVector_1.SpaceVectorConstructor.random("u", false);
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
type Opts = {
|
|
2
|
+
allowNonIrreductible?: boolean;
|
|
3
|
+
allowDecimal?: boolean;
|
|
4
|
+
decimalPrecision?: number;
|
|
5
|
+
};
|
|
6
|
+
export declare const rationalVEA: (studentAns: string, answer: string, { allowNonIrreductible, decimalPrecision, allowDecimal }?: Opts) => boolean;
|
|
7
|
+
export {};
|
|
2
8
|
//# sourceMappingURL=rationalVEA.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rationalVEA.d.ts","sourceRoot":"","sources":["../../../src/exercises/vea/rationalVEA.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rationalVEA.d.ts","sourceRoot":"","sources":["../../../src/exercises/vea/rationalVEA.ts"],"names":[],"mappings":"AAKA,KAAK,IAAI,GAAG;IACV,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AACF,eAAO,MAAM,WAAW,eACV,MAAM,UACV,MAAM,6DAC4C,IAAI,YAqC/D,CAAC"}
|
|
@@ -1,16 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.rationalVEA = void 0;
|
|
4
|
+
const numberNode_1 = require("../../tree/nodes/numbers/numberNode");
|
|
4
5
|
const latexParser_1 = require("../../tree/parsers/latexParser");
|
|
5
6
|
const rationalParser_1 = require("../../tree/parsers/rationalParser");
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
const rationalVEA = (studentAns, answer, { allowNonIrreductible, decimalPrecision, allowDecimal } = {
|
|
8
|
+
allowNonIrreductible: true,
|
|
9
|
+
decimalPrecision: undefined,
|
|
10
|
+
allowDecimal: true,
|
|
11
|
+
}) => {
|
|
12
|
+
allowDecimal = allowDecimal ?? true;
|
|
13
|
+
allowNonIrreductible = allowNonIrreductible ?? true;
|
|
14
|
+
decimalPrecision = decimalPrecision ?? undefined;
|
|
8
15
|
const parsed = (0, rationalParser_1.rationalParser)(studentAns);
|
|
9
16
|
if (!parsed)
|
|
10
17
|
return false;
|
|
11
18
|
try {
|
|
12
19
|
const parsedAnswer = (0, latexParser_1.parseAlgebraic)(answer);
|
|
13
|
-
|
|
20
|
+
if ((0, numberNode_1.isNumberNode)(parsed)) {
|
|
21
|
+
if (!allowDecimal)
|
|
22
|
+
return false;
|
|
23
|
+
if (decimalPrecision === undefined)
|
|
24
|
+
return (Math.abs(parsed.evaluate() - parsedAnswer.evaluate()) < 0.0000001);
|
|
25
|
+
else {
|
|
26
|
+
//! accepte bien les arrondis au centième par ex, mais va aussi accepter les arrondis au millième
|
|
27
|
+
//! je juge ca ok
|
|
28
|
+
return (Math.abs(parsed.evaluate() - parsedAnswer.evaluate()) <
|
|
29
|
+
Math.pow(10, -decimalPrecision - 1));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
else if (allowNonIrreductible) {
|
|
33
|
+
return Math.abs(parsed.evaluate() - parsedAnswer.evaluate()) < 0.0000001;
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
//parsed est une fraction ou opposite(frac)
|
|
37
|
+
return parsed.equals(parsedAnswer);
|
|
38
|
+
}
|
|
14
39
|
}
|
|
15
40
|
catch (err) {
|
|
16
41
|
return false;
|
package/lib/index.d.ts
CHANGED
|
@@ -35,6 +35,7 @@ declare const mathExercises: (Exercise<{
|
|
|
35
35
|
}, {
|
|
36
36
|
allowNonIrreductible?: boolean | undefined;
|
|
37
37
|
}> | Exercise<{
|
|
38
|
+
isIntegerFirst: boolean;
|
|
38
39
|
integer: number;
|
|
39
40
|
rational: [number, number];
|
|
40
41
|
}, {
|
|
@@ -77,6 +78,8 @@ declare const mathExercises: (Exercise<{
|
|
|
77
78
|
num2: number;
|
|
78
79
|
denom1: number;
|
|
79
80
|
denom2: number;
|
|
81
|
+
}, {}> | Exercise<{
|
|
82
|
+
statementIdentifiers: import("./tree/nodes/nodeConstructor").NodeIdentifiers;
|
|
80
83
|
}, {}> | Exercise<{
|
|
81
84
|
numbers: number[];
|
|
82
85
|
}, {}> | Exercise<{
|
|
@@ -1327,15 +1330,17 @@ declare const mathExercises: (Exercise<{
|
|
|
1327
1330
|
nbFaces: number;
|
|
1328
1331
|
faceAsked: number;
|
|
1329
1332
|
}, {}> | Exercise<{
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1333
|
+
A: import("./tree/nodes/nodeConstructor").NodeIdentifiers;
|
|
1334
|
+
B: import("./tree/nodes/nodeConstructor").NodeIdentifiers;
|
|
1335
|
+
AC: import("./tree/nodes/nodeConstructor").NodeIdentifiers;
|
|
1336
|
+
AD: import("./tree/nodes/nodeConstructor").NodeIdentifiers;
|
|
1337
|
+
BC: import("./tree/nodes/nodeConstructor").NodeIdentifiers;
|
|
1338
|
+
BD: import("./tree/nodes/nodeConstructor").NodeIdentifiers;
|
|
1339
|
+
probaName: string;
|
|
1337
1340
|
}, {
|
|
1338
1341
|
allowApproximate: string;
|
|
1342
|
+
eventTypes: string[];
|
|
1343
|
+
probaType: string;
|
|
1339
1344
|
}> | Exercise<{
|
|
1340
1345
|
randomValues: number[];
|
|
1341
1346
|
randomEffectives: number[];
|
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,EA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAA6B,CAAC;AAE/C,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -18,7 +18,7 @@ export declare class Complex {
|
|
|
18
18
|
times(n: number): Complex;
|
|
19
19
|
opposite(): Complex;
|
|
20
20
|
conjugate(): Complex;
|
|
21
|
-
toArgumentTree(): NumberNode | import("../../tree/nodes/numbers/constantNode").ConstantNode |
|
|
21
|
+
toArgumentTree(): NumberNode | import("../../tree/nodes/numbers/constantNode").ConstantNode | OppositeNode | FractionNode | undefined;
|
|
22
22
|
toModuleTree(): import("../../tree/nodes/algebraicNode").AlgebraicNode;
|
|
23
23
|
toTree(): ComplexNode;
|
|
24
24
|
}
|
|
@@ -28,7 +28,7 @@ export declare class Rational implements Nombre {
|
|
|
28
28
|
reverse(shouldSimplify: boolean): Nombre;
|
|
29
29
|
divide(nb: Nombre): Nombre;
|
|
30
30
|
opposite(): Rational;
|
|
31
|
-
toTree(opts?: NodeOptions):
|
|
31
|
+
toTree(opts?: NodeOptions): OppositeNode | FractionNode;
|
|
32
32
|
isIrreductible(): boolean;
|
|
33
33
|
simplify(): Integer | Rational;
|
|
34
34
|
}
|
|
@@ -13,6 +13,6 @@ export declare class ExtendedRingElement {
|
|
|
13
13
|
b: number;
|
|
14
14
|
algebraicElement: Nombre;
|
|
15
15
|
constructor(a: number, b: number, algebraicElement: Nombre);
|
|
16
|
-
toTree(): import("../../../tree/nodes/algebraicNode").AlgebraicNode | NumberNode |
|
|
16
|
+
toTree(): import("../../../tree/nodes/algebraicNode").AlgebraicNode | NumberNode | SubstractNode | AddNode | OppositeNode | MultiplyNode;
|
|
17
17
|
}
|
|
18
18
|
//# sourceMappingURL=extendedRingElement.d.ts.map
|
|
@@ -5,6 +5,6 @@ export declare class GeneralAffine {
|
|
|
5
5
|
variable: string;
|
|
6
6
|
constructor(a: number | AlgebraicNode, b: number | AlgebraicNode, variable?: string);
|
|
7
7
|
getRoot(): AlgebraicNode;
|
|
8
|
-
toTree(): import("../../tree/nodes/operators/
|
|
8
|
+
toTree(): import("../../tree/nodes/operators/addNode").AddNode | import("../../tree/nodes/operators/multiplyNode").MultiplyNode;
|
|
9
9
|
}
|
|
10
10
|
//# sourceMappingURL=generalAffine.d.ts.map
|
|
@@ -51,7 +51,7 @@ export declare class GeneralTrinom {
|
|
|
51
51
|
constructor(a: AlgebraicNode | number, b: AlgebraicNode | number, c: AlgebraicNode | number, opts?: GeneralTrinomOptions);
|
|
52
52
|
getDelta(): AlgebraicNode;
|
|
53
53
|
getRoots(): AlgebraicNode[];
|
|
54
|
-
toTree(): import("../../tree/nodes/operators/
|
|
54
|
+
toTree(): import("../../tree/nodes/operators/addNode").AddNode | import("../../tree/nodes/operators/multiplyNode").MultiplyNode;
|
|
55
55
|
toTex(): string;
|
|
56
56
|
getCoeffs(): number[];
|
|
57
57
|
toIdentifiers(): GeneralTrinomIdentifiers;
|
|
@@ -65,11 +65,11 @@ export declare class Trinom extends Polynomial {
|
|
|
65
65
|
getRootsNode(): AlgebraicNode[];
|
|
66
66
|
getRootsEquationSolutionTex(): string;
|
|
67
67
|
getAlpha(): number;
|
|
68
|
-
getAlphaNode(): NumberNode |
|
|
68
|
+
getAlphaNode(): NumberNode | OppositeNode | FractionNode;
|
|
69
69
|
getBeta(): number;
|
|
70
|
-
getBetaNode(): NumberNode |
|
|
70
|
+
getBetaNode(): NumberNode | OppositeNode | FractionNode;
|
|
71
71
|
getFactorizedForm(): AlgebraicNode | MultiplyNode;
|
|
72
|
-
getCanonicalForm():
|
|
72
|
+
getCanonicalForm(): AddNode | MultiplyNode;
|
|
73
73
|
getSommet(): Point;
|
|
74
74
|
getCoords(): number[];
|
|
75
75
|
toPython(): string;
|
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":"AA8CA,eAAO,MAAM,UAAU,YAAW,CAAC"}
|
package/lib/playground.js
CHANGED
|
@@ -2,11 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.playground = void 0;
|
|
4
4
|
const nodeConstructor_1 = require("./tree/nodes/nodeConstructor");
|
|
5
|
-
const playground = () => {
|
|
6
|
-
// logIdentifiers();
|
|
7
|
-
// const parsed = parseLatex("x\\times +3");
|
|
8
|
-
// console.log(parsed.toTex());
|
|
9
|
-
};
|
|
5
|
+
const playground = () => { };
|
|
10
6
|
exports.playground = playground;
|
|
11
7
|
const logIdentifiers = () => {
|
|
12
8
|
const ids = '{"xA":-3,"yA":-2,"yPrimeA":{"id":31,"child":{"id":3,"leftChild":{"id":7,"value":3},"rightChild":{"id":7,"value":2}}},"trinomCoeffs":[0.3888888888888889,0.833333333333333,-3]}';
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { AlgebraicNode } from "./tree/nodes/algebraicNode";
|
|
2
2
|
import { NodeOptions } from "./tree/nodes/node";
|
|
3
|
+
import { ConstantNode } from "./tree/nodes/numbers/constantNode";
|
|
4
|
+
import { NumberNode } from "./tree/nodes/numbers/numberNode";
|
|
3
5
|
declare global {
|
|
4
6
|
interface Number {
|
|
5
|
-
toTree: (opts?: NodeOptions) =>
|
|
7
|
+
toTree: (opts?: NodeOptions) => NumberNode | ConstantNode;
|
|
6
8
|
frenchify: () => string;
|
|
7
9
|
toScientific: (decimals?: number) => AlgebraicNode;
|
|
8
10
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prototypesEnhancement.d.ts","sourceRoot":"","sources":["../src/prototypesEnhancement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAQ,WAAW,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"prototypesEnhancement.d.ts","sourceRoot":"","sources":["../src/prototypesEnhancement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAQ,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAKjE,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAI7D,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,WAAW,KAAK,UAAU,GAAG,YAAY,CAAC;QAC1D,SAAS,EAAE,MAAM,MAAM,CAAC;QACxB,YAAY,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,KAAK,aAAa,CAAC;KACpD;IACD,UAAU,MAAM;QACd,MAAM,EAAE,MAAM,aAAa,CAAC;QAC5B,WAAW,EAAE,MAAM,MAAM,CAAC;KAC3B;CACF;AAqBD,OAAO,EAAE,CAAC"}
|
|
@@ -14,6 +14,7 @@ export interface AlgebraicNode extends Node {
|
|
|
14
14
|
simplify: (opts?: SimplifyOptions) => AlgebraicNode;
|
|
15
15
|
equals: (node: AlgebraicNode) => boolean;
|
|
16
16
|
isNumeric: boolean;
|
|
17
|
+
derivative: (varName?: string) => AlgebraicNode;
|
|
17
18
|
}
|
|
18
19
|
export declare const isAlgebraicNode: (node: Node) => node is AlgebraicNode;
|
|
19
20
|
//# 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,QAAQ,CAAC;AAE3C,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;CAC7B,CAAC;AACF,MAAM,WAAW,aAAc,SAAQ,IAAI;IACzC,QAAQ,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,MAAM,CAAC;IACpD,oBAAoB,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,KAAK,aAAa,CAAC;IAC7E,iBAAiB,EAAE,CAAC,IAAI,CAAC,EAAE,WAAW,KAAK,aAAa,EAAE,CAAC;IAC3D,QAAQ,EAAE,CAAC,IAAI,CAAC,EAAE,eAAe,KAAK,aAAa,CAAC;IACpD,MAAM,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,OAAO,CAAC;IACzC,SAAS,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"algebraicNode.d.ts","sourceRoot":"","sources":["../../../src/tree/nodes/algebraicNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAE3C,MAAM,MAAM,eAAe,GAAG;IAC5B,e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