math-exercises 2.2.78 → 2.2.79
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/derivation/derivative/firstDegreeDerivative.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/firstDegreeDerivative.js +44 -5
- package/lib/exercises/math/derivation/derivative/rootFunctionDerivative.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/rootFunctionDerivative.js +57 -26
- package/lib/exercises/math/derivation/derivative/secondDegreeDerivative.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/secondDegreeDerivative.js +50 -8
- package/lib/exercises/math/derivation/derivative/thirdDegreeDerivative.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/thirdDegreeDerivative.js +67 -13
- package/lib/exercises/math/derivation/derivative/usualderivative.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/usualderivative.js +1 -2
- package/lib/exercises/math/functions/exponentials/exponentialsVariations.d.ts +9 -0
- package/lib/exercises/math/functions/exponentials/exponentialsVariations.d.ts.map +1 -0
- package/lib/exercises/math/functions/exponentials/exponentialsVariations.js +124 -0
- package/lib/exercises/math/functions/exponentials/index.d.ts +2 -0
- package/lib/exercises/math/functions/exponentials/index.d.ts.map +1 -0
- package/lib/exercises/math/functions/exponentials/index.js +17 -0
- package/lib/exercises/math/functions/index.d.ts +1 -0
- package/lib/exercises/math/functions/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/index.js +1 -0
- package/lib/exercises/math/geometry/areas/rectangleArea.d.ts.map +1 -1
- package/lib/exercises/math/geometry/areas/rectangleArea.js +5 -2
- package/lib/exercises/math/index.d.ts +1 -0
- package/lib/exercises/math/index.d.ts.map +1 -1
- package/lib/exercises/math/index.js +1 -0
- package/lib/exercises/math/percent/applyPercent.d.ts.map +1 -1
- package/lib/exercises/math/percent/applyPercent.js +2 -0
- package/lib/exercises/math/percent/findEndValueAfterEvolution.d.ts +8 -0
- package/lib/exercises/math/percent/findEndValueAfterEvolution.d.ts.map +1 -0
- package/lib/exercises/math/percent/findEndValueAfterEvolution.js +104 -0
- package/lib/exercises/math/percent/index.d.ts +1 -0
- package/lib/exercises/math/percent/index.d.ts.map +1 -1
- package/lib/exercises/math/percent/index.js +1 -0
- package/lib/exercises/math/powers/index.d.ts +1 -0
- package/lib/exercises/math/powers/index.d.ts.map +1 -1
- package/lib/exercises/math/powers/index.js +1 -0
- package/lib/exercises/math/powers/powersMixOperations.d.ts +11 -0
- package/lib/exercises/math/powers/powersMixOperations.d.ts.map +1 -0
- package/lib/exercises/math/powers/powersMixOperations.js +99 -0
- package/lib/exercises/math/sampling/confidenceInterval.d.ts +9 -0
- package/lib/exercises/math/sampling/confidenceInterval.d.ts.map +1 -0
- package/lib/exercises/math/sampling/confidenceInterval.js +134 -0
- package/lib/exercises/math/sampling/fluctuationInterval.d.ts +9 -0
- package/lib/exercises/math/sampling/fluctuationInterval.d.ts.map +1 -0
- package/lib/exercises/math/sampling/fluctuationInterval.js +131 -0
- package/lib/exercises/math/sampling/index.d.ts +4 -0
- package/lib/exercises/math/sampling/index.d.ts.map +1 -0
- package/lib/exercises/math/sampling/index.js +19 -0
- package/lib/exercises/math/sampling/isSamplingRepresentative.d.ts +11 -0
- package/lib/exercises/math/sampling/isSamplingRepresentative.d.ts.map +1 -0
- package/lib/exercises/math/sampling/isSamplingRepresentative.js +116 -0
- package/lib/exercises/math/sequences/geometric/geometricVariations.d.ts +9 -0
- package/lib/exercises/math/sequences/geometric/geometricVariations.d.ts.map +1 -0
- package/lib/exercises/math/sequences/geometric/geometricVariations.js +124 -0
- package/lib/exercises/math/sequences/geometric/index.d.ts +1 -0
- package/lib/exercises/math/sequences/geometric/index.d.ts.map +1 -1
- package/lib/exercises/math/sequences/geometric/index.js +1 -0
- package/lib/index.d.ts +29 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/math/numbers/rationals/rational.d.ts +3 -1
- package/lib/math/numbers/rationals/rational.d.ts.map +1 -1
- package/lib/math/numbers/rationals/rational.js +3 -1
- package/lib/playground.d.ts.map +1 -1
- package/lib/playground.js +6 -1
- package/lib/tree/nodes/operators/addNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/addNode.js +15 -1
- package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/fractionNode.js +8 -0
- package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/multiplyNode.js +4 -0
- package/lib/tree/nodes/polynomials/monomNode.d.ts +6 -0
- package/lib/tree/nodes/polynomials/monomNode.d.ts.map +1 -1
- package/lib/tree/nodes/polynomials/monomNode.js +126 -2
- package/lib/tree/parsers/affineParser.d.ts.map +1 -1
- package/lib/tree/parsers/affineParser.js +2 -1
- package/lib/tree/parsers/intervalParser.d.ts +8 -0
- package/lib/tree/parsers/intervalParser.d.ts.map +1 -0
- package/lib/tree/parsers/intervalParser.js +38 -0
- package/lib/tree/parsers/monomParser.d.ts +1 -3
- package/lib/tree/parsers/monomParser.d.ts.map +1 -1
- package/lib/tree/parsers/monomParser.js +7 -129
- package/lib/tree/parsers/polynomialParser.d.ts.map +1 -1
- package/lib/tree/parsers/polynomialParser.js +2 -1
- package/lib/tree/parsers/powerParser.d.ts +1 -1
- package/lib/tree/parsers/powerParser.d.ts.map +1 -1
- package/lib/tree/parsers/powerParser.js +2 -1
- package/lib/tree/parsers/trinomParser.js +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isSamplingRepresentative = void 0;
|
|
4
|
+
const exercise_1 = require("../../../exercises/exercise");
|
|
5
|
+
const getDistinctQuestions_1 = require("../../../exercises/utils/getDistinctQuestions");
|
|
6
|
+
const randfloat_1 = require("../../../math/utils/random/randfloat");
|
|
7
|
+
const randint_1 = require("../../../math/utils/random/randint");
|
|
8
|
+
const round_1 = require("../../../math/utils/round");
|
|
9
|
+
const coinFlip_1 = require("../../../utils/alea/coinFlip");
|
|
10
|
+
const getPropositions = (n, { answer }) => {
|
|
11
|
+
const propositions = [];
|
|
12
|
+
(0, exercise_1.addValidProp)(propositions, answer, "raw");
|
|
13
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, "Oui", "raw");
|
|
14
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, "Non", "raw");
|
|
15
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, "On ne peut pas savoir", "raw");
|
|
16
|
+
return (0, exercise_1.shuffleProps)(propositions, n);
|
|
17
|
+
};
|
|
18
|
+
const getAnswer = (identifiers) => {
|
|
19
|
+
return identifiers.isRepresentative ? "Oui" : "Non";
|
|
20
|
+
};
|
|
21
|
+
const getInstruction = (identifiers) => {
|
|
22
|
+
const { p, k, n, wordingType } = identifiers;
|
|
23
|
+
switch (wordingType) {
|
|
24
|
+
case 1:
|
|
25
|
+
return `La fréquence des yeux bleus en France est d'environ $${p.frenchify()}$. On a prélevé un échantillon de $${n}$ individus dont $${k}$ ont les yeux bleus. Cet échantillon est-il représentatif de la population pour ce caractère ?`;
|
|
26
|
+
case 2:
|
|
27
|
+
return `La proportion de français possédant un animal de compagnie est d'environ $${p.frenchify()}$. On a prélevé un échantillon de $${n}$ individus dont $${k}$ possèdent un animal de compagnie. Cet échantillon est-il représentatif de la population pour ce caractère ?`;
|
|
28
|
+
case 3:
|
|
29
|
+
default:
|
|
30
|
+
return `La proportion de français lisant au moins un livre par an est d'environ $${p.frenchify()}$. On a prélevé un échantillon de $${n}$ individus dont $${k}$ lisent au moins un livre par an. Cet échantillon est-il représentatif de la population pour ce caractère ?`;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
const getHint = (identifiers) => {
|
|
34
|
+
return `Déterminer l'intervalle de fluctuation au seuil de $95\\%$ :
|
|
35
|
+
|
|
36
|
+
$$
|
|
37
|
+
\\left[p-\\frac{1}{\\sqrt{n}}; p+\\frac{1}{\\sqrt{n}}\\right]
|
|
38
|
+
$$
|
|
39
|
+
|
|
40
|
+
où $p$ est la proportion théorique et $n$ est la taille de l'échantillon.
|
|
41
|
+
|
|
42
|
+
Si la fréquence $f$ observée est comprise dans cet intervalle, alors l'échantillon est représentatif de la population pour ce caractère, au seuil de $95\\%$.
|
|
43
|
+
`;
|
|
44
|
+
};
|
|
45
|
+
const getCorrection = (identifiers) => {
|
|
46
|
+
const { p, n, k } = identifiers;
|
|
47
|
+
return `L'échantillon est représentatif si la fréquence $f$ observée est comprise dans l'intervalle de fluctuation.
|
|
48
|
+
|
|
49
|
+
On détermine l'intervalle de fluctuation au seuil de $95\\%$ :
|
|
50
|
+
|
|
51
|
+
$$
|
|
52
|
+
\\left[p-\\frac{1}{\\sqrt{n}}; p+\\frac{1}{\\sqrt{n}}\\right] \\approx \\left[${(0, round_1.round)(p - 1 / Math.sqrt(n), 2).frenchify()} ; ${(0, round_1.round)(p + 1 / Math.sqrt(n), 2).frenchify()} \\right]
|
|
53
|
+
$$
|
|
54
|
+
|
|
55
|
+
Puis, on calcule la fréquence $f$ observée :
|
|
56
|
+
|
|
57
|
+
$$
|
|
58
|
+
f = \\frac{${k}}{${n}} \\approx ${(0, round_1.round)(k / n, 2).frenchify()}
|
|
59
|
+
$$
|
|
60
|
+
|
|
61
|
+
${identifiers.isRepresentative
|
|
62
|
+
? `Puisque $f$ appartient bien à l'intervalle de fluctuation, on peut affirmer que l'échantillon est représentatif au seuil de $95\\%$.`
|
|
63
|
+
: `Puisque $f$ n'appartient pas à l'intervalle de fluctuation, on peut affirmer que l'échantillon n'est pas représentatif au seuil de $95\\%$.`}`;
|
|
64
|
+
};
|
|
65
|
+
const getKeys = (identifiers) => {
|
|
66
|
+
return [];
|
|
67
|
+
};
|
|
68
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
69
|
+
throw Error("VEA not implemented");
|
|
70
|
+
};
|
|
71
|
+
const getIsSamplingRepresentativeQuestion = (ops) => {
|
|
72
|
+
const p = (0, randfloat_1.randfloat)(0.2, 0.8, 2);
|
|
73
|
+
const n = 50 * (0, randint_1.randint)(1, 20);
|
|
74
|
+
const isRepresentative = (0, coinFlip_1.coinFlip)();
|
|
75
|
+
//k est dans n*(p-1/sqrt(n)), n*(p+1/sqrt(n))
|
|
76
|
+
const interval = [p - 1 / Math.sqrt(n), p + 1 / Math.sqrt(n)];
|
|
77
|
+
const k = isRepresentative
|
|
78
|
+
? (0, randint_1.randint)(Math.ceil(n * interval[0]), Math.floor(n * interval[1]))
|
|
79
|
+
: (0, coinFlip_1.coinFlip)()
|
|
80
|
+
? (0, randint_1.randint)(1, Math.floor(n * interval[0]))
|
|
81
|
+
: (0, randint_1.randint)(Math.ceil(n * interval[1]), n - 1);
|
|
82
|
+
const identifiers = {
|
|
83
|
+
p,
|
|
84
|
+
k,
|
|
85
|
+
n,
|
|
86
|
+
isRepresentative,
|
|
87
|
+
wordingType: (0, randint_1.randint)(1, 4),
|
|
88
|
+
};
|
|
89
|
+
const question = {
|
|
90
|
+
answer: getAnswer(identifiers),
|
|
91
|
+
instruction: getInstruction(identifiers),
|
|
92
|
+
keys: getKeys(identifiers),
|
|
93
|
+
answerFormat: "tex",
|
|
94
|
+
identifiers,
|
|
95
|
+
hint: getHint(identifiers),
|
|
96
|
+
correction: getCorrection(identifiers),
|
|
97
|
+
};
|
|
98
|
+
return question;
|
|
99
|
+
};
|
|
100
|
+
exports.isSamplingRepresentative = {
|
|
101
|
+
id: "isSamplingRepresentative",
|
|
102
|
+
label: "Déterminer si un échantillon est représentatif",
|
|
103
|
+
isSingleStep: true,
|
|
104
|
+
generator: (nb, opts) => (0, getDistinctQuestions_1.getDistinctQuestions)(() => getIsSamplingRepresentativeQuestion(opts), nb),
|
|
105
|
+
qcmTimer: 60,
|
|
106
|
+
freeTimer: 60,
|
|
107
|
+
getPropositions,
|
|
108
|
+
isAnswerValid,
|
|
109
|
+
subject: "Mathématiques",
|
|
110
|
+
getInstruction,
|
|
111
|
+
getHint,
|
|
112
|
+
getCorrection,
|
|
113
|
+
getAnswer,
|
|
114
|
+
hasHintAndCorrection: true,
|
|
115
|
+
answerType: "QCU",
|
|
116
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Exercise } from "../../../../exercises/exercise";
|
|
2
|
+
import { NodeIdentifiers } from "../../../../tree/nodes/nodeConstructor";
|
|
3
|
+
type Identifiers = {
|
|
4
|
+
q: NodeIdentifiers;
|
|
5
|
+
a: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const geometricVariations: Exercise<Identifiers>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=geometricVariations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometricVariations.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/geometricVariations.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAcT,MAAM,0BAA0B,CAAC;AAKlC,OAAO,EACL,eAAe,EAEhB,MAAM,kCAAkC,CAAC;AAM1C,KAAK,WAAW,GAAG;IACjB,CAAC,EAAE,eAAe,CAAC;IACnB,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAiHF,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,WAAW,CAiBrD,CAAC"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.geometricVariations = void 0;
|
|
4
|
+
const exercise_1 = require("../../../../exercises/exercise");
|
|
5
|
+
const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
|
|
6
|
+
const rational_1 = require("../../../../math/numbers/rationals/rational");
|
|
7
|
+
const randfloat_1 = require("../../../../math/utils/random/randfloat");
|
|
8
|
+
const nodeConstructor_1 = require("../../../../tree/nodes/nodeConstructor");
|
|
9
|
+
const multiplyNode_1 = require("../../../../tree/nodes/operators/multiplyNode");
|
|
10
|
+
const powerNode_1 = require("../../../../tree/nodes/operators/powerNode");
|
|
11
|
+
const coinFlip_1 = require("../../../../utils/alea/coinFlip");
|
|
12
|
+
const getPropositions = (n, { answer }) => {
|
|
13
|
+
const propositions = [];
|
|
14
|
+
(0, exercise_1.addValidProp)(propositions, answer, "raw");
|
|
15
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, "Strictement croissante", "raw");
|
|
16
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, "Strictement décroissante", "raw");
|
|
17
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, "Constante", "raw");
|
|
18
|
+
(0, exercise_1.tryToAddWrongProp)(propositions, "Non monotone", "raw");
|
|
19
|
+
return (0, exercise_1.shuffleProps)(propositions, n);
|
|
20
|
+
};
|
|
21
|
+
const getAnswer = (identifiers) => {
|
|
22
|
+
const qEv = (0, nodeConstructor_1.reifyAlgebraic)(identifiers.q).evaluate();
|
|
23
|
+
if (qEv > 1) {
|
|
24
|
+
return identifiers.a > 0
|
|
25
|
+
? "Strictement croissante"
|
|
26
|
+
: "Strictement décroissante";
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
return identifiers.a > 0
|
|
30
|
+
? "Strictement décroissante"
|
|
31
|
+
: "Strictement croissante";
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const getInstruction = (identifiers) => {
|
|
35
|
+
const q = (0, nodeConstructor_1.reifyAlgebraic)(identifiers.q);
|
|
36
|
+
const a = identifiers.a;
|
|
37
|
+
const statement = (0, multiplyNode_1.multiply)(a, (0, powerNode_1.power)(q, "n")).simplify();
|
|
38
|
+
return `Soit $u$ la suite définie sur $\\mathbb{N}$ par
|
|
39
|
+
|
|
40
|
+
$$
|
|
41
|
+
u_n = ${statement.toTex()}
|
|
42
|
+
$$
|
|
43
|
+
|
|
44
|
+
Quel est le sens de variations de $u$ ?`;
|
|
45
|
+
};
|
|
46
|
+
const getHint = (identifiers) => {
|
|
47
|
+
return `La suite géométrique $u_n = q^n$ est :
|
|
48
|
+
|
|
49
|
+
- strictement croissante si $q>1$;
|
|
50
|
+
- strictement décroissante si $0<q<1$.
|
|
51
|
+
|
|
52
|
+
Puis, multiplier $u$ par un nombre positif ne change pas son sens de variations, tandis que multiplier par un nombre negatif inverse le sens de variations.
|
|
53
|
+
`;
|
|
54
|
+
};
|
|
55
|
+
const getCorrection = (identifiers) => {
|
|
56
|
+
const q = (0, nodeConstructor_1.reifyAlgebraic)(identifiers.q);
|
|
57
|
+
const qEv = q.evaluate();
|
|
58
|
+
const qLessThanOne = qEv < 1;
|
|
59
|
+
const a = identifiers.a;
|
|
60
|
+
const answer = getAnswer(identifiers);
|
|
61
|
+
const statement = (0, multiplyNode_1.multiply)(a, (0, powerNode_1.power)(q, "x")).simplify();
|
|
62
|
+
return `Puisque $${qLessThanOne ? `0 < ${q.toTex()} < 1` : `${q.toTex()}>1`}$, la suite $${(0, powerNode_1.power)(q, "n").toTex()}$ est strictement ${qLessThanOne ? "décroissante" : " croissante"}.
|
|
63
|
+
|
|
64
|
+
En multipliant $${(0, powerNode_1.power)(q, "n").toTex()}$ par $${a.frenchify()} ${a < 0 ? "<0" : ">0"}$, ${a < 0
|
|
65
|
+
? `on inverse son sens de variations.`
|
|
66
|
+
: `on ne change pas son sens de variation.`}
|
|
67
|
+
|
|
68
|
+
Ainsi, la suite $u_n = ${statement.toTex()}$ est ${answer.toLocaleLowerCase()}.
|
|
69
|
+
`;
|
|
70
|
+
};
|
|
71
|
+
const getKeys = (identifiers) => {
|
|
72
|
+
return [];
|
|
73
|
+
};
|
|
74
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
75
|
+
return ans === answer;
|
|
76
|
+
};
|
|
77
|
+
const getGeometricVariationsQuestion = (ops) => {
|
|
78
|
+
const a = (0, randfloat_1.randfloat)(0.1, 3, 2, [1]) * ((0, coinFlip_1.coinFlip)() ? 1 : -1);
|
|
79
|
+
const qLessThanOne = (0, coinFlip_1.coinFlip)();
|
|
80
|
+
let q;
|
|
81
|
+
if (qLessThanOne) {
|
|
82
|
+
q = (0, coinFlip_1.coinFlip)()
|
|
83
|
+
? (0, randfloat_1.randfloat)(0.1, 1, 2).toTree()
|
|
84
|
+
: rational_1.RationalConstructor.randomIrreductibleProba().toTree();
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
q = (0, coinFlip_1.coinFlip)()
|
|
88
|
+
? (0, randfloat_1.randfloat)(1.1, 10, 2).toTree()
|
|
89
|
+
: rational_1.RationalConstructor.randomIrreductible(11, {
|
|
90
|
+
onlySupOne: true,
|
|
91
|
+
}).toTree();
|
|
92
|
+
}
|
|
93
|
+
const identifiers = {
|
|
94
|
+
a,
|
|
95
|
+
q: q.toIdentifiers(),
|
|
96
|
+
};
|
|
97
|
+
const question = {
|
|
98
|
+
answer: getAnswer(identifiers),
|
|
99
|
+
instruction: getInstruction(identifiers),
|
|
100
|
+
keys: getKeys(identifiers),
|
|
101
|
+
answerFormat: "raw",
|
|
102
|
+
identifiers,
|
|
103
|
+
hint: getHint(identifiers),
|
|
104
|
+
correction: getCorrection(identifiers),
|
|
105
|
+
};
|
|
106
|
+
return question;
|
|
107
|
+
};
|
|
108
|
+
exports.geometricVariations = {
|
|
109
|
+
id: "geometricVariations",
|
|
110
|
+
label: "Déterminer le sens de variations d'une suite géométrique",
|
|
111
|
+
isSingleStep: true,
|
|
112
|
+
generator: (nb, opts) => (0, getDistinctQuestions_1.getDistinctQuestions)(() => getGeometricVariationsQuestion(opts), nb),
|
|
113
|
+
qcmTimer: 60,
|
|
114
|
+
freeTimer: 60,
|
|
115
|
+
getPropositions,
|
|
116
|
+
isAnswerValid,
|
|
117
|
+
subject: "Mathématiques",
|
|
118
|
+
getInstruction,
|
|
119
|
+
getHint,
|
|
120
|
+
getCorrection,
|
|
121
|
+
getAnswer,
|
|
122
|
+
answerType: "QCU",
|
|
123
|
+
hasHintAndCorrection: true,
|
|
124
|
+
};
|
|
@@ -8,4 +8,5 @@ export * from "./geometricFindExplicitFormulaFirstTermRandom";
|
|
|
8
8
|
export * from "./geometricFindTerm";
|
|
9
9
|
export * from "./geometricRecognizeReasonFromFirstTerms";
|
|
10
10
|
export * from "./geometricFirstTermsGeneralSum";
|
|
11
|
+
export * from "./geometricVariations";
|
|
11
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mCAAmC,CAAC;AAClD,cAAc,+CAA+C,CAAC;AAC9D,cAAc,qBAAqB,CAAC;AACpC,cAAc,0CAA0C,CAAC;AACzD,cAAc,iCAAiC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sequences/geometric/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mCAAmC,CAAC;AAClD,cAAc,+CAA+C,CAAC;AAC9D,cAAc,qBAAqB,CAAC;AACpC,cAAc,0CAA0C,CAAC;AACzD,cAAc,iCAAiC,CAAC;AAChD,cAAc,uBAAuB,CAAC"}
|
|
@@ -24,3 +24,4 @@ __exportStar(require("./geometricFindExplicitFormulaFirstTermRandom"), exports);
|
|
|
24
24
|
__exportStar(require("./geometricFindTerm"), exports);
|
|
25
25
|
__exportStar(require("./geometricRecognizeReasonFromFirstTerms"), exports);
|
|
26
26
|
__exportStar(require("./geometricFirstTermsGeneralSum"), exports);
|
|
27
|
+
__exportStar(require("./geometricVariations"), exports);
|
package/lib/index.d.ts
CHANGED
|
@@ -903,6 +903,9 @@ declare const mathExercises: (Exercise<{
|
|
|
903
903
|
b: number;
|
|
904
904
|
aU: number;
|
|
905
905
|
bU: number;
|
|
906
|
+
}, {}> | Exercise<{
|
|
907
|
+
q: import("./tree/nodes/nodeConstructor").NodeIdentifiers;
|
|
908
|
+
a: number;
|
|
906
909
|
}, {}> | Exercise<{
|
|
907
910
|
coin: boolean;
|
|
908
911
|
radius: number;
|
|
@@ -1308,6 +1311,9 @@ declare const mathExercises: (Exercise<{
|
|
|
1308
1311
|
subPopulationEffectif: number;
|
|
1309
1312
|
subPopulationPercent: number;
|
|
1310
1313
|
contextType: number;
|
|
1314
|
+
}, {}> | Exercise<{
|
|
1315
|
+
vd: number;
|
|
1316
|
+
percentRate: number;
|
|
1311
1317
|
}, {}> | Exercise<{
|
|
1312
1318
|
int: number;
|
|
1313
1319
|
power: number;
|
|
@@ -1342,6 +1348,12 @@ declare const mathExercises: (Exercise<{
|
|
|
1342
1348
|
}> | Exercise<{
|
|
1343
1349
|
tenPower: number;
|
|
1344
1350
|
decimal: number;
|
|
1351
|
+
}, {}> | Exercise<{
|
|
1352
|
+
a: number;
|
|
1353
|
+
b: number;
|
|
1354
|
+
k: number;
|
|
1355
|
+
l: number;
|
|
1356
|
+
m: number;
|
|
1345
1357
|
}, {}> | Exercise<{
|
|
1346
1358
|
c: number;
|
|
1347
1359
|
}, {}> | Exercise<{
|
|
@@ -1593,6 +1605,9 @@ declare const mathExercises: (Exercise<{
|
|
|
1593
1605
|
firstValue: number;
|
|
1594
1606
|
reason: number;
|
|
1595
1607
|
nbTerms: number;
|
|
1608
|
+
}, {}> | Exercise<{
|
|
1609
|
+
q: import("./tree/nodes/nodeConstructor").NodeIdentifiers;
|
|
1610
|
+
a: number;
|
|
1596
1611
|
}, {}> | Exercise<{
|
|
1597
1612
|
rank: number;
|
|
1598
1613
|
coeffs: number[];
|
|
@@ -1774,6 +1789,20 @@ declare const mathExercises: (Exercise<{
|
|
|
1774
1789
|
n: number;
|
|
1775
1790
|
p: number;
|
|
1776
1791
|
};
|
|
1792
|
+
}, {}> | Exercise<{
|
|
1793
|
+
p: number;
|
|
1794
|
+
n: number;
|
|
1795
|
+
wordingType: number;
|
|
1796
|
+
}, {}> | Exercise<{
|
|
1797
|
+
k: number;
|
|
1798
|
+
n: number;
|
|
1799
|
+
wordingType: number;
|
|
1800
|
+
}, {}> | Exercise<{
|
|
1801
|
+
p: number;
|
|
1802
|
+
k: number;
|
|
1803
|
+
n: number;
|
|
1804
|
+
isRepresentative: boolean;
|
|
1805
|
+
wordingType: number;
|
|
1777
1806
|
}, {}>)[];
|
|
1778
1807
|
declare const pcExercises: (Exercise<{
|
|
1779
1808
|
numbers: 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,EAAE,MAAM,sBAAsB,CAAC;AAG1D,OAAO,yBAAyB,CAAC;AAEjC,QAAA,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAG1D,OAAO,yBAAyB,CAAC;AAEjC,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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ructor {
|
|
|
8
8
|
* @param maxGcd max number by which the fraction is simplifiable
|
|
9
9
|
*/
|
|
10
10
|
static randomSimplifiable(maxGcd?: number): Rational;
|
|
11
|
-
static randomIrreductible(max?: number
|
|
11
|
+
static randomIrreductible(max?: number, { onlySupOne }?: {
|
|
12
|
+
onlySupOne?: boolean;
|
|
13
|
+
}): Rational;
|
|
12
14
|
static randomIrreductibleProba(maxDenum?: number): Rational | Integer;
|
|
13
15
|
static randomIrreductibleWithSign(max?: number): Rational;
|
|
14
16
|
static randomPureRational(max?: number): Rational;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rational.d.ts","sourceRoot":"","sources":["../../../../src/math/numbers/rationals/rational.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,EAAQ,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAE1D,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAMvE,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE/C,8BAAsB,mBAAmB;IACvC;;OAEG;IACH,MAAM,CAAC,kBAAkB,CAAC,MAAM,GAAE,MAAW;IAW7C,MAAM,CAAC,kBAAkB,
|
|
1
|
+
{"version":3,"file":"rational.d.ts","sourceRoot":"","sources":["../../../../src/math/numbers/rationals/rational.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,EAAQ,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAE1D,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAMvE,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE/C,8BAAsB,mBAAmB;IACvC;;OAEG;IACH,MAAM,CAAC,kBAAkB,CAAC,MAAM,GAAE,MAAW;IAW7C,MAAM,CAAC,kBAAkB,CACvB,GAAG,GAAE,MAAW,EAChB,EAAE,UAAkB,EAAE,GAAE;QAAE,UAAU,CAAC,EAAE,OAAO,CAAA;KAAO;IASvD,MAAM,CAAC,uBAAuB,CAAC,QAAQ,GAAE,MAAW;IAKpD,MAAM,CAAC,0BAA0B,CAAC,GAAG,GAAE,MAAW;IAQlD,MAAM,CAAC,kBAAkB,CAAC,GAAG,GAAE,MAAW;CAO3C;AAED,qBAAa,QAAS,YAAW,MAAM;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,OAAO,CAAC;IACtB,IAAI,EAAE,UAAU,CAAC;gBAEL,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM;IAYlD,MAAM,CAAC,CAAC,EAAE,MAAM;IAGhB,KAAK;IAML,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM;IAkBvB,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO;IAgBxC,OAAO,CAAC,cAAc,EAAE,OAAO,GAAG,MAAM;IAIxC,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM;IAgB1B,QAAQ,IAAI,QAAQ;IAIpB,MAAM,CAAC,IAAI,CAAC,EAAE,WAAW;IAgBzB,cAAc;IAId,QAAQ,IAAI,OAAO,GAAG,QAAQ;CAqB/B"}
|
|
@@ -31,11 +31,13 @@ class RationalConstructor {
|
|
|
31
31
|
}
|
|
32
32
|
return new Rational(num, denum);
|
|
33
33
|
}
|
|
34
|
-
static randomIrreductible(max = 11) {
|
|
34
|
+
static randomIrreductible(max = 11, { onlySupOne = false } = {}) {
|
|
35
35
|
const a = (0, randint_1.randint)(2, max);
|
|
36
36
|
const b = (0, random_1.random)([...(0, coprimesOf_1.coprimesOf)(a), 1]);
|
|
37
37
|
if (b === 1)
|
|
38
38
|
return new Rational(b, a);
|
|
39
|
+
if (onlySupOne)
|
|
40
|
+
return new Rational(a, b);
|
|
39
41
|
const [num, denum] = (0, shuffle_1.shuffle)([a, b]);
|
|
40
42
|
return new Rational(num, denum);
|
|
41
43
|
}
|
package/lib/playground.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playground.d.ts","sourceRoot":"","sources":["../src/playground.ts"],"names":[],"mappings":"AAqDA,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"playground.d.ts","sourceRoot":"","sources":["../src/playground.ts"],"names":[],"mappings":"AAqDA,eAAO,MAAM,UAAU,YAKtB,CAAC"}
|
package/lib/playground.js
CHANGED
|
@@ -2,7 +2,12 @@
|
|
|
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 = () => {
|
|
5
|
+
const playground = () => {
|
|
6
|
+
// const a = multiply(-3, power("x", 2));
|
|
7
|
+
// console.log(isMonom(a));
|
|
8
|
+
// const a = "-3x^2";
|
|
9
|
+
// console.log(isMonom(parsed));
|
|
10
|
+
};
|
|
6
11
|
exports.playground = playground;
|
|
7
12
|
const logIdentifiers = () => {
|
|
8
13
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/addNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;A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M,CAAC,MAAM,EAAE,MAAM,CAAC;IAMtC,QAAQ,CAAC,IAAI,CAAC,EAAE,eAAe,GAAG,aAAa;IAmI/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"}
|
|
@@ -235,7 +235,7 @@ class AddNode {
|
|
|
235
235
|
return new numberNode_1.NumberNode(0);
|
|
236
236
|
if (externals.length === 1)
|
|
237
237
|
return externals[0];
|
|
238
|
-
return (0, operatorComposition_1.operatorComposition)(AddNode, externals);
|
|
238
|
+
return (0, operatorComposition_1.operatorComposition)(AddNode, externals.sort(addSort));
|
|
239
239
|
}
|
|
240
240
|
toIdentifiers() {
|
|
241
241
|
return {
|
|
@@ -260,6 +260,20 @@ class AddNode {
|
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
262
|
exports.AddNode = AddNode;
|
|
263
|
+
const addSort = (a, b) => {
|
|
264
|
+
//! this is super risky,
|
|
265
|
+
if (a.isNumeric !== b.isNumeric) {
|
|
266
|
+
return Number(a.isNumeric) - Number(b.isNumeric);
|
|
267
|
+
}
|
|
268
|
+
if ((0, monomNode_1.isMonom)(a) && (0, monomNode_1.isMonom)(b)) {
|
|
269
|
+
const parsedA = (0, monomNode_1.parseToMonomNode)(a);
|
|
270
|
+
const parsedB = (0, monomNode_1.parseToMonomNode)(b);
|
|
271
|
+
if (parsedA && parsedB) {
|
|
272
|
+
return Number(parsedB.degree) - Number(parsedA.degree);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
return 0;
|
|
276
|
+
};
|
|
263
277
|
const addSimplifyFrac = (a, b, opts) => {
|
|
264
278
|
if (!opts?.towardsDistribute && (0, fractionNode_1.isFractionNode)(a) && (0, fractionNode_1.isFractionNode)(b)) {
|
|
265
279
|
//c/d + e/f = cf+ed / df
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fractionNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/fractionNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,YAAY,EAAkB,MAAM,gBAAgB,CAAC;AAK3E,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAKlE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"fractionNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/fractionNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,YAAY,EAAkB,MAAM,gBAAgB,CAAC;AAK3E,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAKlE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,wBAAgB,cAAc,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,YAAY,CAEzD;AAED,eAAO,MAAM,IAAI,MACZ,aAAa,GAAG,MAAM,GAAG,MAAM,KAC/B,aAAa,GAAG,MAAM,GAAG,MAAM,SAC3B,WAAW,iBAOnB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,EAAE,EAAE,OAAO,CAAC,QAAQ,CAAC;IACrB,SAAS,EAAE,eAAe,CAAC;IAC3B,UAAU,EAAE,eAAe,CAAC;CAC7B,CAAC;AACF,qBAAa,YAAa,YAAW,YAAY;IAC/C,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB;;;OAGG;IACH,EAAE,EAAE,WAAW,CAAC;IAChB,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,aAAa,CAAC;IAC1B,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;gBAEjB,SAAS,EAAE,aAAa,EACxB,UAAU,EAAE,aAAa,EACzB,IAAI,CAAC,EAAE,WAAW;IAiBpB,YAAY,IAAI,MAAM;IAItB,aAAa,IAAI,uBAAuB;IAQxC,UAAU;IAGV,iBAAiB,CAAC,IAAI,CAAC,EAAE,WAAW;IA+BpC,cAAc,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,MAAM,EAAE;IAG5C,SAAS;IAUT,KAAK,IAAI,MAAM;IA2Bf,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAMtC,QAAQ,CAAC,IAAI,CAAC,EAAE,eAAe,GAAG,aAAa;IAqK/C,MAAM,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO;IAOpC,oBAAoB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC;IAOxD,sBAAsB;IAQtB,UAAU,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,aAAa;CAGxD"}
|
|
@@ -11,6 +11,7 @@ const multiplyNode_1 = require("./multiplyNode");
|
|
|
11
11
|
const rational_1 = require("../../../math/numbers/rationals/rational");
|
|
12
12
|
const operatorComposition_1 = require("../../../tree/utilities/operatorComposition");
|
|
13
13
|
const addNode_1 = require("./addNode");
|
|
14
|
+
const powerNode_1 = require("./powerNode");
|
|
14
15
|
function isFractionNode(a) {
|
|
15
16
|
return (0, operatorNode_1.isOperatorNode)(a) && a.id === operatorNode_1.OperatorIds.fraction;
|
|
16
17
|
}
|
|
@@ -208,6 +209,13 @@ class FractionNode {
|
|
|
208
209
|
}
|
|
209
210
|
//!ya mieux à faire pour gérer tous les cas d'un coup
|
|
210
211
|
//!s'insiprer de multiply
|
|
212
|
+
if ((0, powerNode_1.isPowerNode)(num) &&
|
|
213
|
+
(0, powerNode_1.isPowerNode)(denum) &&
|
|
214
|
+
num.rightChild.isNumeric &&
|
|
215
|
+
denum.rightChild.isNumeric &&
|
|
216
|
+
num.rightChild.evaluate() === denum.rightChild.evaluate()) {
|
|
217
|
+
return new powerNode_1.PowerNode(new FractionNode(num.leftChild, denum.leftChild), num.rightChild).simplify(opts);
|
|
218
|
+
}
|
|
211
219
|
if (num.equals(denum))
|
|
212
220
|
return new numberNode_1.NumberNode(1);
|
|
213
221
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multiplyNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/multiplyNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EACL,uBAAuB,EACvB,WAAW,EAEZ,MAAM,gBAAgB,CAAC;AAYxB,OAAO,EACL,aAAa,EACb,eAAe,EAEhB,MAAM,kBAAkB,CAAC;AAS1B,wBAAgB,cAAc,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,YAAY,CAEzD;AAED,eAAO,MAAM,QAAQ,MAChB,aAAa,GAAG,MAAM,GAAG,MAAM,KAC/B,aAAa,GAAG,MAAM,GAAG,MAAM,SAC3B,WAAW,iBAOnB,CAAC;AACF,eAAO,MAAM,iBAAiB,QAAS,aAAa,EAAE,SAWrD,CAAC;AACF,qBAAa,YAAa,YAAW,uBAAuB;IAC1D,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;gBAEjB,SAAS,EAAE,aAAa,EACxB,UAAU,EAAE,aAAa,EACzB,IAAI,CAAC,EAAE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G5C,aAAa;;;;;;;;;IAYb,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAItC,IAAI;IAGJ,cAAc;IACd,QAAQ,CAAC,IAAI,CAAC,EAAE,eAAe,GAAG,aAAa;IAiK/C,MAAM,CAAC,IAAI,EAAE,aAAa;IAU1B,oBAAoB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC;IAQxD,UAAU,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,aAAa;CAMxD"}
|
|
@@ -94,6 +94,7 @@ class MultiplyNode {
|
|
|
94
94
|
let showTimesSign = !opts?.forceDotSign &&
|
|
95
95
|
(opts?.forceTimesSign ||
|
|
96
96
|
!isNaN(+rightTex[0]) ||
|
|
97
|
+
(this.rightChild.isNumeric && this.leftChild.isNumeric) ||
|
|
97
98
|
(0, numberNode_1.isNumberNode)(this.rightChild) ||
|
|
98
99
|
((0, variableNode_1.isVariableNode)(this.leftChild) &&
|
|
99
100
|
(0, variableNode_1.isVariableNode)(this.rightChild) &&
|
|
@@ -101,6 +102,9 @@ class MultiplyNode {
|
|
|
101
102
|
((0, sqrtNode_1.isSqrtNode)(this.leftChild) && (0, sqrtNode_1.isSqrtNode)(this.rightChild)));
|
|
102
103
|
if ((0, operatorNode_1.isOperatorNode)(this.rightChild)) {
|
|
103
104
|
showTimesSign ||= [operatorNode_1.OperatorIds.fraction].includes(this.rightChild.id);
|
|
105
|
+
if ((0, fractionNode_1.isFractionNode)(this.rightChild.leftChild)) {
|
|
106
|
+
showTimesSign = true;
|
|
107
|
+
}
|
|
104
108
|
}
|
|
105
109
|
const cDotSign = opts?.forceDotSign ? ` \\cdot ` : "";
|
|
106
110
|
const nextIsLetter = rightTex[0].toLowerCase() !== rightTex[0].toUpperCase();
|
|
@@ -43,5 +43,11 @@ export declare const parseToMonom: (node: AlgebraicNode, { variable, maxDegree,
|
|
|
43
43
|
maxDegree: undefined;
|
|
44
44
|
minDegree: number;
|
|
45
45
|
}) => false | MonomNode;
|
|
46
|
+
type Opts = {
|
|
47
|
+
variable?: string;
|
|
48
|
+
maxDegree?: number;
|
|
49
|
+
minDegree?: number;
|
|
50
|
+
};
|
|
51
|
+
export declare const isMonom: (node: AlgebraicNode, { variable, maxDegree, minDegree }?: Opts) => boolean;
|
|
46
52
|
export {};
|
|
47
53
|
//# sourceMappingURL=monomNode.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"monomNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/polynomials/monomNode.ts"],"names":[],"mappings":"
|
|
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,kBAAkB,CAAC;AAE1B,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAO/D,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,EAAE,QAAQ,SAAM,qBAGvD;AACD,KAAK,gBAAgB,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAO7C;;;GAGG;AACH,qBAAa,SAAU,YAAW,aAAa;IAC7C,CAAC,EAAE,aAAa,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,QAAQ,CAAkB;gBAG9B,CAAC,EAAE,aAAa,GAAG,MAAM,EACzB,MAAM,EAAE,MAAM,EACd,IAAI,CA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