math-exercises 2.2.78 → 2.2.80
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType0.d.ts +5 -1
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType0.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType0.js +95 -20
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType1.d.ts +4 -1
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType1.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/inequations/firstDegreeInequationsType1.js +104 -26
- 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/lnDerivativeOne.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/lnDerivativeOne.js +17 -7
- package/lib/exercises/math/derivation/derivative/lnDerivativeThree.d.ts.map +1 -1
- package/lib/exercises/math/derivation/derivative/lnDerivativeThree.js +46 -27
- package/lib/exercises/math/derivation/derivative/lnDerivativeTwo.js +1 -1
- 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/secondDerivativeOfExpoFunction.js +1 -1
- 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/affines/signFunction.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/signFunction.js +66 -27
- package/lib/exercises/math/functions/basics/graphicInequation.d.ts.map +1 -1
- package/lib/exercises/math/functions/basics/graphicInequation.js +57 -36
- package/lib/exercises/math/functions/exponential/expEquation.js +1 -1
- 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/functions/integral/integralFractions.js +1 -1
- package/lib/exercises/math/functions/logarithm/log10Simplifying.d.ts.map +1 -1
- package/lib/exercises/math/functions/logarithm/log10Simplifying.js +6 -2
- package/lib/exercises/math/functions/logarithm/logEquation.d.ts.map +1 -1
- package/lib/exercises/math/functions/logarithm/logEquation.js +22 -14
- package/lib/exercises/math/functions/logarithm/logPowerEquation.d.ts.map +1 -1
- package/lib/exercises/math/functions/logarithm/logPowerEquation.js +14 -12
- package/lib/exercises/math/functions/logarithm/logSimplifiying.d.ts.map +1 -1
- package/lib/exercises/math/functions/logarithm/logSimplifiying.js +36 -16
- 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/geometry/vectors/vectorLinearCombination.js +4 -4
- 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/matrices/matrixInversibilityDomain.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/primitive/logarithmePrimitive.d.ts.map +1 -1
- package/lib/exercises/math/primitive/logarithmePrimitive.js +11 -3
- 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/exercises/math/sets/intervals/inequalityToInterval.d.ts.map +1 -1
- package/lib/exercises/math/sets/intervals/inequalityToInterval.js +11 -11
- package/lib/exercises/options/inequationSolutionFormat.d.ts +3 -0
- package/lib/exercises/options/inequationSolutionFormat.d.ts.map +1 -0
- package/lib/exercises/options/inequationSolutionFormat.js +12 -0
- package/lib/exercises/pc/pH.js +1 -1
- package/lib/index.d.ts +35 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/math/numbers/integer/integer.d.ts +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/math/numbers/reals/real.d.ts +1 -1
- package/lib/playground.d.ts.map +1 -1
- package/lib/playground.js +6 -1
- package/lib/tree/nodes/algebraicNode.d.ts +1 -0
- package/lib/tree/nodes/algebraicNode.d.ts.map +1 -1
- package/lib/tree/nodes/inequations/inequationNode.d.ts +5 -2
- package/lib/tree/nodes/inequations/inequationNode.d.ts.map +1 -1
- package/lib/tree/nodes/inequations/inequationNode.js +40 -3
- package/lib/tree/nodes/numbers/numberNode.d.ts +2 -2
- package/lib/tree/nodes/numbers/numberNode.d.ts.map +1 -1
- package/lib/tree/nodes/numbers/numberNode.js +7 -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/nodes/sets/intervalNode.d.ts +2 -2
- package/lib/tree/nodes/sets/intervalNode.d.ts.map +1 -1
- package/lib/tree/nodes/sets/intervalNode.js +2 -2
- package/lib/tree/nodes/sets/setNode.d.ts +1 -0
- package/lib/tree/nodes/sets/setNode.d.ts.map +1 -1
- package/lib/tree/nodes/sets/unionIntervalNode.d.ts +1 -1
- package/lib/tree/nodes/sets/unionIntervalNode.d.ts.map +1 -1
- package/lib/tree/nodes/sets/unionIntervalNode.js +1 -1
- package/lib/tree/parsers/affineParser.d.ts.map +1 -1
- package/lib/tree/parsers/affineParser.js +2 -1
- package/lib/tree/parsers/inequationParser.d.ts +7 -0
- package/lib/tree/parsers/inequationParser.d.ts.map +1 -0
- package/lib/tree/parsers/inequationParser.js +30 -0
- 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 +44 -0
- package/lib/tree/parsers/latexParser.d.ts.map +1 -1
- package/lib/tree/parsers/latexParser.js +29 -6
- 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/rationalParser.d.ts +1 -1
- package/lib/tree/parsers/trinomParser.js +2 -2
- package/lib/tree/parsers/unionIntervalParser.d.ts +9 -0
- package/lib/tree/parsers/unionIntervalParser.d.ts.map +1 -0
- package/lib/tree/parsers/unionIntervalParser.js +26 -0
- package/lib/types/keyIds.d.ts +1 -1
- package/lib/types/keyIds.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -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);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inequalityToInterval.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sets/intervals/inequalityToInterval.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AASlC,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"inequalityToInterval.d.ts","sourceRoot":"","sources":["../../../../../src/exercises/math/sets/intervals/inequalityToInterval.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,0BAA0B,CAAC;AASlC,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAO5D,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,eAAe,EAAE,WAAW,CAAC;CAC9B,CAAC;AAkFF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CActD,CAAC"}
|
|
@@ -4,8 +4,7 @@ exports.inequalityToInterval = void 0;
|
|
|
4
4
|
const exercise_1 = require("../../../../exercises/exercise");
|
|
5
5
|
const getDistinctQuestions_1 = require("../../../../exercises/utils/getDistinctQuestions");
|
|
6
6
|
const intervals_1 = require("../../../../math/sets/intervals/intervals");
|
|
7
|
-
const
|
|
8
|
-
const variableNode_1 = require("../../../../tree/nodes/variables/variableNode");
|
|
7
|
+
const intervalParser_1 = require("../../../../tree/parsers/intervalParser");
|
|
9
8
|
const shuffle_1 = require("../../../../utils/alea/shuffle");
|
|
10
9
|
const getInequalityToIntervalQuestion = () => {
|
|
11
10
|
const interval = intervals_1.IntervalConstructor.random();
|
|
@@ -55,15 +54,16 @@ const getPropositions = (n, { answer, intervalClosure, intervalMax, intervalMin
|
|
|
55
54
|
});
|
|
56
55
|
return (0, shuffle_1.shuffle)(propositions);
|
|
57
56
|
};
|
|
58
|
-
const isAnswerValid = (ans, { intervalClosure, intervalMax, intervalMin }) => {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
57
|
+
const isAnswerValid = (ans, { intervalClosure, intervalMax, intervalMin, answer }) => {
|
|
58
|
+
try {
|
|
59
|
+
const parsed = (0, intervalParser_1.intervalParser)(ans.replaceAll("x\\in", ""));
|
|
60
|
+
if (!parsed)
|
|
61
|
+
return false;
|
|
62
|
+
return "x\\in\\ " + parsed.simplify().toTex() === answer;
|
|
63
|
+
}
|
|
64
|
+
catch (err) {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
67
|
};
|
|
68
68
|
exports.inequalityToInterval = {
|
|
69
69
|
id: "inequalityToInterval",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inequationSolutionFormat.d.ts","sourceRoot":"","sources":["../../../src/exercises/options/inequationSolutionFormat.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAGhB,MAAM,aAAa,CAAC;AAErB,eAAO,MAAM,wBAAwB,EAAE,eAOtC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.inequationSolutionFormat = void 0;
|
|
4
|
+
const exercise_1 = require("../exercise");
|
|
5
|
+
exports.inequationSolutionFormat = {
|
|
6
|
+
id: "inequationSolutionFormat",
|
|
7
|
+
label: "Format de la solution",
|
|
8
|
+
target: exercise_1.GeneratorOptionTarget.answer,
|
|
9
|
+
type: exercise_1.GeneratorOptionType.select,
|
|
10
|
+
values: ["Intervalle (S = [a;b])", "Inégalité (x>a)"],
|
|
11
|
+
defaultValue: "Inégalité (x>a)",
|
|
12
|
+
};
|
package/lib/exercises/pc/pH.js
CHANGED
package/lib/index.d.ts
CHANGED
|
@@ -341,11 +341,15 @@ declare const mathExercises: (Exercise<{
|
|
|
341
341
|
b: number;
|
|
342
342
|
c: number;
|
|
343
343
|
ineqType: import("./math/inequations/inequation").InegalitySymbols;
|
|
344
|
-
}, {
|
|
344
|
+
}, {
|
|
345
|
+
inequationSolutionFormat: string;
|
|
346
|
+
}> | Exercise<{
|
|
345
347
|
a: number;
|
|
346
348
|
b: number;
|
|
347
349
|
ineqType: import("./math/inequations/inequation").InegalitySymbols;
|
|
348
|
-
}, {
|
|
350
|
+
}, {
|
|
351
|
+
inequationSolutionFormat: string;
|
|
352
|
+
}> | Exercise<{
|
|
349
353
|
ineqType: import("./math/inequations/inequation").InegalitySymbols;
|
|
350
354
|
a: number;
|
|
351
355
|
b: number;
|
|
@@ -903,6 +907,9 @@ declare const mathExercises: (Exercise<{
|
|
|
903
907
|
b: number;
|
|
904
908
|
aU: number;
|
|
905
909
|
bU: number;
|
|
910
|
+
}, {}> | Exercise<{
|
|
911
|
+
q: import("./tree/nodes/nodeConstructor").NodeIdentifiers;
|
|
912
|
+
a: number;
|
|
906
913
|
}, {}> | Exercise<{
|
|
907
914
|
coin: boolean;
|
|
908
915
|
radius: number;
|
|
@@ -1308,6 +1315,9 @@ declare const mathExercises: (Exercise<{
|
|
|
1308
1315
|
subPopulationEffectif: number;
|
|
1309
1316
|
subPopulationPercent: number;
|
|
1310
1317
|
contextType: number;
|
|
1318
|
+
}, {}> | Exercise<{
|
|
1319
|
+
vd: number;
|
|
1320
|
+
percentRate: number;
|
|
1311
1321
|
}, {}> | Exercise<{
|
|
1312
1322
|
int: number;
|
|
1313
1323
|
power: number;
|
|
@@ -1342,6 +1352,12 @@ declare const mathExercises: (Exercise<{
|
|
|
1342
1352
|
}> | Exercise<{
|
|
1343
1353
|
tenPower: number;
|
|
1344
1354
|
decimal: number;
|
|
1355
|
+
}, {}> | Exercise<{
|
|
1356
|
+
a: number;
|
|
1357
|
+
b: number;
|
|
1358
|
+
k: number;
|
|
1359
|
+
l: number;
|
|
1360
|
+
m: number;
|
|
1345
1361
|
}, {}> | Exercise<{
|
|
1346
1362
|
c: number;
|
|
1347
1363
|
}, {}> | Exercise<{
|
|
@@ -1593,6 +1609,9 @@ declare const mathExercises: (Exercise<{
|
|
|
1593
1609
|
firstValue: number;
|
|
1594
1610
|
reason: number;
|
|
1595
1611
|
nbTerms: number;
|
|
1612
|
+
}, {}> | Exercise<{
|
|
1613
|
+
q: import("./tree/nodes/nodeConstructor").NodeIdentifiers;
|
|
1614
|
+
a: number;
|
|
1596
1615
|
}, {}> | Exercise<{
|
|
1597
1616
|
rank: number;
|
|
1598
1617
|
coeffs: number[];
|
|
@@ -1774,6 +1793,20 @@ declare const mathExercises: (Exercise<{
|
|
|
1774
1793
|
n: number;
|
|
1775
1794
|
p: number;
|
|
1776
1795
|
};
|
|
1796
|
+
}, {}> | Exercise<{
|
|
1797
|
+
p: number;
|
|
1798
|
+
n: number;
|
|
1799
|
+
wordingType: number;
|
|
1800
|
+
}, {}> | Exercise<{
|
|
1801
|
+
k: number;
|
|
1802
|
+
n: number;
|
|
1803
|
+
wordingType: number;
|
|
1804
|
+
}, {}> | Exercise<{
|
|
1805
|
+
p: number;
|
|
1806
|
+
k: number;
|
|
1807
|
+
n: number;
|
|
1808
|
+
isRepresentative: boolean;
|
|
1809
|
+
wordingType: number;
|
|
1777
1810
|
}, {}>)[];
|
|
1778
1811
|
declare const pcExercises: (Exercise<{
|
|
1779
1812
|
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":"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"}
|
|
@@ -15,7 +15,7 @@ export declare class Integer implements Nombre {
|
|
|
15
15
|
constructor(value: number, tex?: string);
|
|
16
16
|
equals(n: Nombre): boolean;
|
|
17
17
|
toTree(): NumberNode;
|
|
18
|
-
times(n: number | Nombre):
|
|
18
|
+
times(n: number | Nombre): Decimal | Integer;
|
|
19
19
|
round(precision: number): Integer;
|
|
20
20
|
divide(nb: Nombre): Nombre;
|
|
21
21
|
multiply(nb: Nombre): Rational | Integer;
|
|
@@ -8,7 +8,9 @@ export declare abstract class RationalConstructor {
|
|
|
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
|
}
|
|
@@ -2,7 +2,7 @@ import { AlgebraicNode } from "../../../tree/nodes/algebraicNode";
|
|
|
2
2
|
import { SqrtNode } from "../../../tree/nodes/functions/sqrtNode";
|
|
3
3
|
import { Nombre, NumberType } from "../nombre";
|
|
4
4
|
export declare abstract class RealConstructor {
|
|
5
|
-
static random():
|
|
5
|
+
static random(): SquareRoot | Real;
|
|
6
6
|
}
|
|
7
7
|
export declare class Real implements Nombre {
|
|
8
8
|
value: number;
|
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":"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;
|
|
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;IAC5B,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B,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;IACnB,UAAU,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,KAAK,aAAa,CAAC;CACjD;AAED,eAAO,MAAM,eAAe,SAAU,IAAI,0BACA,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { InegalitySymbols } from "../../../math/inequations/inequation";
|
|
2
2
|
import { Node, NodeIds, NodeOptions, NodeType } from "../node";
|
|
3
3
|
import { IntervalNode } from "../sets/intervalNode";
|
|
4
|
-
import { AlgebraicNode } from "../algebraicNode";
|
|
4
|
+
import { AlgebraicNode, SimplifyOptions } from "../algebraicNode";
|
|
5
|
+
import { Affine } from "../../../math/polynomials/affine";
|
|
5
6
|
export declare class InequationNode implements Node {
|
|
6
7
|
opts?: NodeOptions | undefined;
|
|
7
8
|
type: NodeType;
|
|
@@ -18,12 +19,14 @@ export declare class InequationNode implements Node {
|
|
|
18
19
|
};
|
|
19
20
|
toInterval(): IntervalNode;
|
|
20
21
|
toReversed(): InequationNode;
|
|
22
|
+
toSwitched(): InequationNode;
|
|
21
23
|
toAllValidTexs(): string[];
|
|
22
24
|
toEquivalentNodes(opts?: NodeOptions | undefined): InequationNode[];
|
|
23
25
|
toMathString(): string;
|
|
24
26
|
toMathjs(): string;
|
|
25
27
|
toAllTexs(): string[];
|
|
26
28
|
toTex(): string;
|
|
27
|
-
simplify():
|
|
29
|
+
simplify(opts?: SimplifyOptions): InequationNode;
|
|
28
30
|
}
|
|
31
|
+
export declare const firstDegreeInequationResolutionTex: (affine: Affine, order: InegalitySymbols, right: AlgebraicNode) => string;
|
|
29
32
|
//# sourceMappingURL=inequationNode.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inequationNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/inequations/inequationNode.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAEjB,MAAM,mCAAmC,CAAC;AAK3C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAG/D,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"inequationNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/inequations/inequationNode.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAEjB,MAAM,mCAAmC,CAAC;AAK3C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAG/D,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAMvD,qBAAa,cAAe,YAAW,IAAI;IACzC,IAAI,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IAC/B,IAAI,EAAE,QAAQ,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,OAAO,EAAE,gBAAgB,EAAE,CAAC;gBAE1B,QAAQ,EAAE,aAAa,EAAE,EACzB,OAAO,EAAE,gBAAgB,EAAE,GAAG,gBAAgB;IAuBhD,aAAa;;;;;;;IAOb,UAAU;IA6CV,UAAU;IAQV,UAAU;IAMV,cAAc;IAGd,iBAAiB,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,SAAS;IAYhD,YAAY;IAGZ,QAAQ;IAGR,SAAS;IAGT,KAAK;IAGL,QAAQ,CAAC,IAAI,CAAC,EAAE,eAAe,GAAG,cAAc;CAcjD;AAED,eAAO,MAAM,kCAAkC,WACrC,MAAM,SACP,gBAAgB,SAChB,aAAa,WAuBrB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InequationNode = void 0;
|
|
3
|
+
exports.firstDegreeInequationResolutionTex = exports.InequationNode = void 0;
|
|
4
4
|
const inequation_1 = require("../../../math/inequations/inequation");
|
|
5
5
|
const cartesianProducts_1 = require("../../../utils/arrays/cartesianProducts");
|
|
6
6
|
const isLetter_1 = require("../../../utils/strings/isLetter");
|
|
@@ -8,6 +8,9 @@ const node_1 = require("../node");
|
|
|
8
8
|
const infiniteNode_1 = require("../numbers/infiniteNode");
|
|
9
9
|
const closure_1 = require("../sets/closure");
|
|
10
10
|
const intervalNode_1 = require("../sets/intervalNode");
|
|
11
|
+
const alignTex_1 = require("../../../utils/latex/alignTex");
|
|
12
|
+
const fractionNode_1 = require("../operators/fractionNode");
|
|
13
|
+
const substractNode_1 = require("../operators/substractNode");
|
|
11
14
|
class InequationNode {
|
|
12
15
|
constructor(children, symbols) {
|
|
13
16
|
if (children.length < 2)
|
|
@@ -81,6 +84,9 @@ class InequationNode {
|
|
|
81
84
|
const newSymbols = this.symbols.map((el) => new inequation_1.InequationSymbol(el).reversed());
|
|
82
85
|
return new InequationNode(newChildren, newSymbols);
|
|
83
86
|
}
|
|
87
|
+
toSwitched() {
|
|
88
|
+
return new InequationNode(this.children, this.symbols.map((el) => new inequation_1.InequationSymbol(el).reversed()));
|
|
89
|
+
}
|
|
84
90
|
toAllValidTexs() {
|
|
85
91
|
return this.toEquivalentNodes().map((node) => node.toTex());
|
|
86
92
|
}
|
|
@@ -108,8 +114,39 @@ class InequationNode {
|
|
|
108
114
|
toTex() {
|
|
109
115
|
return this.tex;
|
|
110
116
|
}
|
|
111
|
-
simplify() {
|
|
112
|
-
|
|
117
|
+
simplify(opts) {
|
|
118
|
+
if (this.children.length === 2 &&
|
|
119
|
+
this.children[0].isNumeric &&
|
|
120
|
+
!this.children[1].isNumeric) {
|
|
121
|
+
return this.toReversed().simplify(opts);
|
|
122
|
+
}
|
|
123
|
+
return new InequationNode(this.children.map((el) => el.simplify(opts)), this.symbols);
|
|
113
124
|
}
|
|
114
125
|
}
|
|
115
126
|
exports.InequationNode = InequationNode;
|
|
127
|
+
const firstDegreeInequationResolutionTex = (affine, order, right) => {
|
|
128
|
+
if (!right.isNumeric)
|
|
129
|
+
throw Error("unimplemented general resolution");
|
|
130
|
+
const b = affine.b;
|
|
131
|
+
const a = affine.a;
|
|
132
|
+
if (a === 1 && b === 0)
|
|
133
|
+
return new InequationNode([affine.toTree(), right], [order]).toTex();
|
|
134
|
+
const steps = [[affine.toTex(), order, right.toTex()]];
|
|
135
|
+
if (b !== 0)
|
|
136
|
+
steps.push([
|
|
137
|
+
affine.add(-b).toTex(),
|
|
138
|
+
order,
|
|
139
|
+
(0, substractNode_1.substract)(right, b).simplify().toTex(),
|
|
140
|
+
]);
|
|
141
|
+
if (a !== 1) {
|
|
142
|
+
if (a < 0)
|
|
143
|
+
order = new inequation_1.InequationSymbol(order).reversed();
|
|
144
|
+
steps.push([
|
|
145
|
+
affine.variable,
|
|
146
|
+
order,
|
|
147
|
+
(0, fractionNode_1.frac)((0, substractNode_1.substract)(right, b), a).simplify().toTex(),
|
|
148
|
+
]);
|
|
149
|
+
}
|
|
150
|
+
return (0, alignTex_1.alignTex)(steps);
|
|
151
|
+
};
|
|
152
|
+
exports.firstDegreeInequationResolutionTex = firstDegreeInequationResolutionTex;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Node, NodeIds, NodeOptions, NodeType, ToTexOptions } from "../node";
|
|
2
|
-
import { AlgebraicNode } from "../algebraicNode";
|
|
2
|
+
import { AlgebraicNode, SimplifyOptions } from "../algebraicNode";
|
|
3
3
|
import { OppositeNode } from "../functions/oppositeNode";
|
|
4
4
|
export declare function isNumberNode(a: Node): a is NumberNode;
|
|
5
5
|
export declare function isNumberOrOppositeNumberNode(a: Node): a is NumberNode | OppositeNode<NumberNode>;
|
|
@@ -24,7 +24,7 @@ export declare class NumberNode implements AlgebraicNode {
|
|
|
24
24
|
toAllValidTexs(): string[];
|
|
25
25
|
toEquivalentNodes(): this[];
|
|
26
26
|
evaluate(vars?: Record<string, number>): number;
|
|
27
|
-
simplify():
|
|
27
|
+
simplify(opts?: SimplifyOptions): NumberNode | import("../operators/fractionNode").FractionNode | OppositeNode<import("../operators/fractionNode").FractionNode>;
|
|
28
28
|
equals(node: AlgebraicNode): boolean;
|
|
29
29
|
toDetailedEvaluation(vars: Record<string, AlgebraicNode>): this;
|
|
30
30
|
derivative(varName?: string | undefined): AlgebraicNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"numberNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/numbers/numberNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"numberNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/numbers/numberNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGlE,OAAO,EAAE,YAAY,EAAkB,MAAM,2BAA2B,CAAC;AAEzE,wBAAgB,YAAY,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,UAAU,CAErD;AACD,wBAAgB,4BAA4B,CAC1C,CAAC,EAAE,IAAI,GACN,CAAC,IAAI,UAAU,GAAG,YAAY,CAAC,UAAU,CAAC,CAE5C;AACD,8BAAsB,qBAAqB;IACzC,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAM,EAAO;CAGhE;AACD,qBAAa,UAAW,YAAW,aAAa;IAC9C,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,QAAQ,CAAmB;IACjC,SAAS,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,WAAW,CAAC;gBAEjB,KAAK,EAAE,MAAM,EACb,GAAG,CAAC,EAAE,MAAM,EACZ,UAAU,CAAC,EAAE,MAAM,EACnB,IAAI,CAAC,EAAE,WAAW;IASpB,YAAY,IAAI,MAAM;IAGtB,KAAK,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,MAAM;IAKrC,QAAQ;IAGR,aAAa;;;;IAMb,cAAc;IAOd,iBAAiB;IAGjB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAGtC,QAAQ,CAAC,IAAI,CAAC,EAAE,eAAe;IAQ/B,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;CAGxC"}
|
|
@@ -5,6 +5,7 @@ const node_1 = require("../node");
|
|
|
5
5
|
const randint_1 = require("../../../math/utils/random/randint");
|
|
6
6
|
const colorize_1 = require("../../../utils/latex/colorize");
|
|
7
7
|
const oppositeNode_1 = require("../functions/oppositeNode");
|
|
8
|
+
const decimal_1 = require("../../../math/numbers/decimals/decimal");
|
|
8
9
|
function isNumberNode(a) {
|
|
9
10
|
return a.type === node_1.NodeType.number;
|
|
10
11
|
}
|
|
@@ -59,7 +60,12 @@ class NumberNode {
|
|
|
59
60
|
evaluate(vars) {
|
|
60
61
|
return this.value;
|
|
61
62
|
}
|
|
62
|
-
simplify() {
|
|
63
|
+
simplify(opts) {
|
|
64
|
+
if (opts?.decimalToFractions) {
|
|
65
|
+
if (this.value % 1 !== 0) {
|
|
66
|
+
return new decimal_1.Decimal(this.value).toRational().toTree();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
63
69
|
return this;
|
|
64
70
|
}
|
|
65
71
|
equals(node) {
|
|
@@ -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;AAC7E,OAAO,EACL,uBAAuB,EACvB,WAAW,EAGZ,MAAM,gBAAgB,CAAC;AAKxB,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;
|
|
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;AAC7E,OAAO,EACL,uBAAuB,EACvB,WAAW,EAGZ,MAAM,gBAAgB,CAAC;AAKxB,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAWlE,wBAAgB,SAAS,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,OAAO,CAE/C;AAED,eAAO,MAAM,GAAG,MACX,aAAa,GAAG,MAAM,GAAG,MAAM,KAC/B,aAAa,GAAG,MAAM,GAAG,MAAM,YAOnC,CAAC;AAEF,qBAAa,OAAQ,YAAW,uBAAuB;IACrD,EAAE,EAAE,WAAW,CAAC;IAChB,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,aAAa,CAAC;IAC1B,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;gBAEjB,SAAS,EAAE,aAAa,EACxB,UAAU,EAAE,aAAa,EACzB,IAAI,CAAC,EAAE,WAAW;IASpB,OAAO,aAGL;IAEF,YAAY,IAAI,MAAM;IAItB,iBAAiB,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,aAAa,EAAE;IAoCtD,SAAS,IAAI,MAAM,EAAE;IAIrB,cAAc,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,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;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;
|