math-exercises 3.0.207 → 3.0.209
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/arithmetic/congruenceBasicComputation.d.ts +8 -0
- package/lib/exercises/math/arithmetic/congruenceBasicComputation.d.ts.map +1 -0
- package/lib/exercises/math/arithmetic/congruenceBasicComputation.js +93 -0
- package/lib/exercises/math/arithmetic/index.d.ts +2 -0
- package/lib/exercises/math/arithmetic/index.d.ts.map +1 -0
- package/lib/exercises/math/arithmetic/index.js +1 -0
- package/lib/exercises/math/functions/affines/adjustment/affineAdjustment.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/adjustment/affineAdjustment.js +15 -0
- package/lib/exercises/math/functions/affines/adjustment/affineAdjustmentRsquared.d.ts.map +1 -1
- package/lib/exercises/math/functions/affines/adjustment/affineAdjustmentRsquared.js +15 -0
- package/lib/exercises/math/functions/continuity/signTableFromVarTableWithZeroes.d.ts.map +1 -1
- package/lib/exercises/math/functions/continuity/signTableFromVarTableWithZeroes.js +8 -7
- package/lib/exercises/math/functions/continuity/thirdDegreeZeroesFramingWithCalculator.js +14 -13
- package/lib/exercises/math/functions/logarithm/log10Simplifying.d.ts.map +1 -1
- package/lib/exercises/math/functions/logarithm/log10Simplifying.js +72 -33
- package/lib/exercises/math/functions/logarithm/logEquation.d.ts.map +1 -1
- package/lib/exercises/math/functions/logarithm/logEquation.js +40 -2
- package/lib/exercises/math/functions/logarithm/logPowerEquation.d.ts.map +1 -1
- package/lib/exercises/math/functions/logarithm/logPowerEquation.js +55 -6
- package/lib/exercises/math/functions/logarithm/logSimplifiying.d.ts.map +1 -1
- package/lib/exercises/math/functions/logarithm/logSimplifiying.js +45 -5
- 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/probaStat/density/findParamToMakeDensity.d.ts +8 -0
- package/lib/exercises/math/probaStat/density/findParamToMakeDensity.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/density/findParamToMakeDensity.js +127 -0
- package/lib/exercises/math/probaStat/density/index.d.ts +2 -0
- package/lib/exercises/math/probaStat/density/index.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/density/index.js +1 -0
- package/lib/exercises/math/probaStat/exponential/exponentialLawAverage.d.ts +7 -0
- package/lib/exercises/math/probaStat/exponential/exponentialLawAverage.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/exponential/exponentialLawAverage.js +95 -0
- package/lib/exercises/math/probaStat/exponential/exponentialLawComputeIntervalProba.d.ts +9 -0
- package/lib/exercises/math/probaStat/exponential/exponentialLawComputeIntervalProba.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/exponential/exponentialLawComputeIntervalProba.js +115 -0
- package/lib/exercises/math/probaStat/exponential/exponentialLawComputeProba.d.ts +8 -0
- package/lib/exercises/math/probaStat/exponential/exponentialLawComputeProba.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/exponential/exponentialLawComputeProba.js +110 -0
- package/lib/exercises/math/probaStat/exponential/index.d.ts +4 -0
- package/lib/exercises/math/probaStat/exponential/index.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/exponential/index.js +3 -0
- package/lib/exercises/math/probaStat/geometric/geometricLawAverage.d.ts +8 -0
- package/lib/exercises/math/probaStat/geometric/geometricLawAverage.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/geometric/geometricLawAverage.js +124 -0
- package/lib/exercises/math/probaStat/geometric/geometricLawComputeProba.d.ts +9 -0
- package/lib/exercises/math/probaStat/geometric/geometricLawComputeProba.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/geometric/geometricLawComputeProba.js +121 -0
- package/lib/exercises/math/probaStat/geometric/index.d.ts +3 -0
- package/lib/exercises/math/probaStat/geometric/index.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/geometric/index.js +2 -0
- package/lib/exercises/math/probaStat/index.d.ts +4 -0
- package/lib/exercises/math/probaStat/index.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/index.js +4 -0
- package/lib/exercises/math/probaStat/stats2var/fineAdjustementExercise.d.ts.map +1 -1
- package/lib/exercises/math/probaStat/stats2var/fineAdjustementExercise.js +15 -0
- package/lib/exercises/math/probaStat/uniform/index.d.ts +3 -0
- package/lib/exercises/math/probaStat/uniform/index.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/uniform/index.js +2 -0
- package/lib/exercises/math/probaStat/uniform/uniformAverage.d.ts +8 -0
- package/lib/exercises/math/probaStat/uniform/uniformAverage.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/uniform/uniformAverage.js +100 -0
- package/lib/exercises/math/probaStat/uniform/uniformLawComputeProba.d.ts +10 -0
- package/lib/exercises/math/probaStat/uniform/uniformLawComputeProba.d.ts.map +1 -0
- package/lib/exercises/math/probaStat/uniform/uniformLawComputeProba.js +105 -0
- package/lib/index.d.ts +29 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/latexTester.js +1 -0
- package/lib/tests/pdfs/formatMdToLatex.js +1 -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 +12 -1
- 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 +12 -1
- package/package.json +1 -1
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { addValidProp, shuffleProps, propWhile, tryToAddWrongProp, } from "../../../../exercises/exercise.js";
|
|
2
|
+
import { getDistinctQuestions } from "../../../../exercises/utils/getDistinctQuestions.js";
|
|
3
|
+
import { rationalVEA } from "../../../../exercises/vea/rationalVEA.js";
|
|
4
|
+
import { RationalConstructor } from "../../../../math/numbers/rationals/rational.js";
|
|
5
|
+
import { randint } from "../../../../math/utils/random/randint.js";
|
|
6
|
+
import { frac } from "../../../../tree/nodes/operators/fractionNode.js";
|
|
7
|
+
import { substract } from "../../../../tree/nodes/operators/substractNode.js";
|
|
8
|
+
import { handleVEAError } from "../../../../utils/errors/handleVEAError.js";
|
|
9
|
+
const getPropositions = (n, { answer }) => {
|
|
10
|
+
const propositions = [];
|
|
11
|
+
addValidProp(propositions, answer);
|
|
12
|
+
propWhile(propositions, n, () => {
|
|
13
|
+
tryToAddWrongProp(propositions, RationalConstructor.randomIrreductibleProba().toTree().toTex());
|
|
14
|
+
});
|
|
15
|
+
return shuffleProps(propositions, n);
|
|
16
|
+
};
|
|
17
|
+
const getAnswer = (identifiers) => {
|
|
18
|
+
const { a, b, c, d } = identifiers;
|
|
19
|
+
return frac(d - c, b - a)
|
|
20
|
+
.simplify()
|
|
21
|
+
.toTex();
|
|
22
|
+
};
|
|
23
|
+
const getProbaTex = (identifiers) => {
|
|
24
|
+
const { a, b, c, d } = identifiers;
|
|
25
|
+
if (c === a)
|
|
26
|
+
return `P(X\\leq ${d})`;
|
|
27
|
+
if (d === b)
|
|
28
|
+
return `P(X\\geq ${c})`;
|
|
29
|
+
return `P(${c}\\leq X\\leq ${d})`;
|
|
30
|
+
};
|
|
31
|
+
const getInstruction = (identifiers) => {
|
|
32
|
+
const { a, b } = identifiers;
|
|
33
|
+
return `Soit $X$ une variable aléatoire suivant une loi uniforme sur l'intervalle $[${a};${b}]$.
|
|
34
|
+
|
|
35
|
+
Calculer $${getProbaTex(identifiers)}$.`;
|
|
36
|
+
};
|
|
37
|
+
const getHint = () => {
|
|
38
|
+
return `Si $X$ suit une loi uniforme sur $[a;b]$, alors pour tous réels $c$ et $d$ tels que $a\\leq c\\leq d\\leq b$, on a :
|
|
39
|
+
|
|
40
|
+
$$
|
|
41
|
+
P(c\\leq X\\leq d) = \\frac{d-c}{b-a}
|
|
42
|
+
$$`;
|
|
43
|
+
};
|
|
44
|
+
const getCorrection = (identifiers) => {
|
|
45
|
+
const { a, b, c, d } = identifiers;
|
|
46
|
+
return `Si $X$ suit une loi uniforme sur $[a;b]$, alors pour tous réels $c$ et $d$ tels que $a\\leq c\\leq d\\leq b$, on a :
|
|
47
|
+
|
|
48
|
+
$$
|
|
49
|
+
P(c\\leq X\\leq d) = \\frac{d-c}{b-a}
|
|
50
|
+
$$
|
|
51
|
+
|
|
52
|
+
Ici, on a donc :
|
|
53
|
+
|
|
54
|
+
$$
|
|
55
|
+
${getProbaTex(identifiers)} = ${frac(substract(d, c), substract(b, a)).toTex()} = ${getAnswer(identifiers)}
|
|
56
|
+
$$`;
|
|
57
|
+
};
|
|
58
|
+
const getKeys = () => {
|
|
59
|
+
return [];
|
|
60
|
+
};
|
|
61
|
+
const isAnswerValid = (ans, { answer }) => {
|
|
62
|
+
try {
|
|
63
|
+
return rationalVEA(ans, answer);
|
|
64
|
+
}
|
|
65
|
+
catch (err) {
|
|
66
|
+
return handleVEAError(err);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
const getUniformLawComputeProbaQuestion = () => {
|
|
70
|
+
const a = randint(1, 10);
|
|
71
|
+
const b = randint(a + 5, a + 15);
|
|
72
|
+
const c = randint(a, b);
|
|
73
|
+
const d = randint(c + 1, b + 1);
|
|
74
|
+
const identifiers = { a, b, c, d };
|
|
75
|
+
return getQuestionFromIdentifiers(identifiers);
|
|
76
|
+
};
|
|
77
|
+
const getQuestionFromIdentifiers = (identifiers) => {
|
|
78
|
+
return {
|
|
79
|
+
answer: getAnswer(identifiers),
|
|
80
|
+
instruction: getInstruction(identifiers),
|
|
81
|
+
keys: getKeys(identifiers),
|
|
82
|
+
answerFormat: "tex",
|
|
83
|
+
identifiers,
|
|
84
|
+
hint: getHint(identifiers),
|
|
85
|
+
correction: getCorrection(identifiers),
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
export const uniformLawComputeProba = {
|
|
89
|
+
id: "uniformLawComputeProba",
|
|
90
|
+
connector: "=",
|
|
91
|
+
label: "Calculer une probabilité du type $P(X\\in [a;b])$ pour une variable aléatoire suivant une loi uniforme",
|
|
92
|
+
isSingleStep: true,
|
|
93
|
+
generator: (nb, opts) => getDistinctQuestions(() => getUniformLawComputeProbaQuestion(opts), nb),
|
|
94
|
+
qcmTimer: 60,
|
|
95
|
+
freeTimer: 60,
|
|
96
|
+
getPropositions,
|
|
97
|
+
isAnswerValid,
|
|
98
|
+
subject: "Mathématiques",
|
|
99
|
+
getInstruction,
|
|
100
|
+
getHint,
|
|
101
|
+
getCorrection,
|
|
102
|
+
getAnswer,
|
|
103
|
+
getQuestionFromIdentifiers,
|
|
104
|
+
hasHintAndCorrection: true,
|
|
105
|
+
};
|
package/lib/index.d.ts
CHANGED
|
@@ -3779,6 +3779,31 @@ declare const mathExercises: (Exercise<{
|
|
|
3779
3779
|
nodeIdsV: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
3780
3780
|
nodeIdsA: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
3781
3781
|
nodeIdsPMin: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
3782
|
+
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
3783
|
+
pIds: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
3784
|
+
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
3785
|
+
pIds: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
3786
|
+
k: number;
|
|
3787
|
+
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
3788
|
+
a: number;
|
|
3789
|
+
b: number;
|
|
3790
|
+
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
3791
|
+
a: number;
|
|
3792
|
+
b: number;
|
|
3793
|
+
c: number;
|
|
3794
|
+
d: number;
|
|
3795
|
+
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
3796
|
+
a: number;
|
|
3797
|
+
b: number;
|
|
3798
|
+
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
3799
|
+
lambda: number;
|
|
3800
|
+
k: number;
|
|
3801
|
+
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
3802
|
+
lambda: number;
|
|
3803
|
+
a: number;
|
|
3804
|
+
b: number;
|
|
3805
|
+
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
3806
|
+
lambda: number;
|
|
3782
3807
|
}, Record<string, string | boolean | string[]>> | Exercise<{
|
|
3783
3808
|
firstValue: number;
|
|
3784
3809
|
askedRank: number;
|
|
@@ -5663,7 +5688,10 @@ declare const mathExercises: (Exercise<{
|
|
|
5663
5688
|
nodeIdsVariableOfIntegration: import("./tree/nodes/nodeConstructor.js").NodeIdentifiers;
|
|
5664
5689
|
}, {
|
|
5665
5690
|
texIneqABC: string;
|
|
5666
|
-
}>
|
|
5691
|
+
}> | Exercise<{
|
|
5692
|
+
a: number;
|
|
5693
|
+
mod: number;
|
|
5694
|
+
}, Record<string, string | boolean | string[]>>)[];
|
|
5667
5695
|
declare const pcExercises: (Exercise<{
|
|
5668
5696
|
numbers: number[];
|
|
5669
5697
|
}, Record<string, string | boolean | string[]>> | Exercise<{
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,aAAa,MAAM,2BAA2B,CAAC;AAE3D,OAAO,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,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,yBAAyB,CAAC;AAC7D,OAAO,KAAK,aAAa,MAAM,2BAA2B,CAAC;AAE3D,OAAO,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,QA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kDAA6B,CAAC;AAE/C,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC"}
|
package/lib/latexTester.js
CHANGED
|
@@ -2,7 +2,7 @@ import { mdCodeToLatex } from "./mdCodeToLatex.js";
|
|
|
2
2
|
import { mdTableToLatexTabular } from "./mdTableToLatexTabular.js";
|
|
3
3
|
export const formatMarkdownToLatex = (text) => {
|
|
4
4
|
const format = text
|
|
5
|
-
.replaceAll("\\left\\{", "\\left\\lbrace")
|
|
5
|
+
// .replaceAll("\\left\\{", "\\left\\lbrace")
|
|
6
6
|
.replaceAll("\\\\", "\\tabularnewline ")
|
|
7
7
|
.replaceAll("€", "\\euro");
|
|
8
8
|
return mdCodeToLatex(mdTableToLatexTabular(format));
|
|
@@ -2,6 +2,7 @@ import { Node, NodeIds, NodeOptions, NodeType } from "../node.js";
|
|
|
2
2
|
import { FunctionNode, FunctionsIds } from "./functionNode.js";
|
|
3
3
|
import { AlgebraicNode } from "../algebraicNode.js";
|
|
4
4
|
export declare function isLog10Node(a: Node): a is Log10Node;
|
|
5
|
+
export declare const log10: (a: AlgebraicNode | number | string) => Log10Node;
|
|
5
6
|
export declare class Log10Node implements FunctionNode {
|
|
6
7
|
id: FunctionsIds;
|
|
7
8
|
child: AlgebraicNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log10Node.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/functions/log10Node.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAkB,MAAM,mBAAmB,CAAC;AAE/E,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAMpD,wBAAgB,WAAW,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,SAAS,CAEnD;
|
|
1
|
+
{"version":3,"file":"log10Node.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/functions/log10Node.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAkB,MAAM,mBAAmB,CAAC;AAE/E,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAMpD,wBAAgB,WAAW,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,SAAS,CAEnD;AAED,eAAO,MAAM,KAAK,GAAI,GAAG,aAAa,GAAG,MAAM,GAAG,MAAM,cAIvD,CAAC;AACF,qBAAa,SAAU,YAAW,YAAY;IAC5C,EAAE,EAAE,YAAY,CAAC;IACjB,KAAK,EAAE,aAAa,CAAC;IACrB,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;gBACP,KAAK,EAAE,aAAa,EAAE,IAAI,CAAC,EAAE,WAAW;IAOpD,aAAa;;;;;;IAMb,YAAY,IAAI,MAAM;IAGtB,mBAAmB;IAQnB,KAAK,IAAI,MAAM;IAaf,iBAAiB,IAAI,aAAa,EAAE;IAQpC,mBAAmB;IAOnB,cAAc,IAAI,MAAM,EAAE;IAG1B,QAAQ,IAAI,aAAa;IAiCzB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAGtC,MAAM,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO;IAGpC,oBAAoB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC;IAGxD,UAAU,IAAI,aAAa;CAG5B"}
|
|
@@ -10,6 +10,10 @@ import { maxPowerDecomposition } from "../../../math/utils/arithmetic/maxPowerDe
|
|
|
10
10
|
export function isLog10Node(a) {
|
|
11
11
|
return isFunctionNode(a) && a.id === FunctionsIds.log10;
|
|
12
12
|
}
|
|
13
|
+
export const log10 = (a) => {
|
|
14
|
+
const nodeA = typeof a === "number" ? a.toTree() : typeof a === "string" ? a.toTree() : a;
|
|
15
|
+
return new Log10Node(nodeA);
|
|
16
|
+
};
|
|
13
17
|
export class Log10Node {
|
|
14
18
|
id;
|
|
15
19
|
child;
|
|
@@ -33,7 +37,14 @@ export class Log10Node {
|
|
|
33
37
|
return `log_{10}(${this.child.toMathString()})`;
|
|
34
38
|
}
|
|
35
39
|
toSimplificationTex() {
|
|
36
|
-
|
|
40
|
+
const simplified = this.simplify();
|
|
41
|
+
const thisTex = this.toTex();
|
|
42
|
+
const simpTex = simplified.toTex();
|
|
43
|
+
const isSimplified = thisTex === simpTex;
|
|
44
|
+
if (isSimplified)
|
|
45
|
+
return thisTex;
|
|
46
|
+
else
|
|
47
|
+
return `${thisTex} = ${simpTex}`;
|
|
37
48
|
}
|
|
38
49
|
toTex() {
|
|
39
50
|
const tex = this.child.toTex();
|
|
@@ -2,6 +2,7 @@ import { Node, NodeIds, NodeOptions, NodeType } from "../node.js";
|
|
|
2
2
|
import { FunctionNode, FunctionsIds } from "./functionNode.js";
|
|
3
3
|
import { AlgebraicNode, SimplifyOptions } from "../algebraicNode.js";
|
|
4
4
|
export declare function isLogNode(a: Node): a is LogNode;
|
|
5
|
+
export declare const logn: (a: AlgebraicNode | number | string) => LogNode;
|
|
5
6
|
export declare class LogNode implements FunctionNode {
|
|
6
7
|
id: FunctionsIds;
|
|
7
8
|
child: AlgebraicNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/functions/logNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC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AAE,aAAa,GAAG,OAAO;IAGpC,oBAAoB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC;IAGxD,UAAU,IAAI,aAAa;CAG5B"}
|
|
@@ -11,6 +11,10 @@ import { frac } from "../operators/fractionNode.js";
|
|
|
11
11
|
export function isLogNode(a) {
|
|
12
12
|
return isFunctionNode(a) && a.id === FunctionsIds.log;
|
|
13
13
|
}
|
|
14
|
+
export const logn = (a) => {
|
|
15
|
+
const nodeA = typeof a === "number" ? a.toTree() : typeof a === "string" ? a.toTree() : a;
|
|
16
|
+
return new LogNode(nodeA);
|
|
17
|
+
};
|
|
14
18
|
export class LogNode {
|
|
15
19
|
id;
|
|
16
20
|
child;
|
|
@@ -34,7 +38,14 @@ export class LogNode {
|
|
|
34
38
|
return `log(${this.child.toMathString()})`;
|
|
35
39
|
}
|
|
36
40
|
toSimplificationTex() {
|
|
37
|
-
|
|
41
|
+
const simplified = this.simplify();
|
|
42
|
+
const thisTex = this.toTex();
|
|
43
|
+
const simpTex = simplified.toTex();
|
|
44
|
+
const isSimplified = thisTex === simpTex;
|
|
45
|
+
if (isSimplified)
|
|
46
|
+
return thisTex;
|
|
47
|
+
else
|
|
48
|
+
return `${thisTex} = ${simpTex}`;
|
|
38
49
|
}
|
|
39
50
|
toTex() {
|
|
40
51
|
const tex = this.child.toTex();
|