math-exercises 1.3.47 → 1.3.52
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/calculLitteral/equation/equationSimpleSquare.d.ts.map +1 -1
- package/lib/exercises/calculLitteral/equation/equationSimpleSquare.js +21 -21
- package/lib/exercises/calculLitteral/equation/equationType1Exercise.d.ts.map +1 -1
- package/lib/exercises/calculLitteral/equation/equationType1Exercise.js +13 -11
- package/lib/exercises/calculLitteral/equation/equationType2Exercise.d.ts.map +1 -1
- package/lib/exercises/calculLitteral/equation/equationType2Exercise.js +4 -7
- package/lib/exercises/calculLitteral/equation/firstDegreeEquation.d.ts.map +1 -1
- package/lib/exercises/calculLitteral/equation/firstDegreeEquation.js +10 -4
- package/lib/exercises/complex/addComplex.d.ts +4 -0
- package/lib/exercises/complex/addComplex.d.ts.map +1 -0
- package/lib/exercises/complex/addComplex.js +70 -0
- package/lib/exercises/complex/conjugateComplex.ts.d.ts +4 -0
- package/lib/exercises/complex/conjugateComplex.ts.d.ts.map +1 -0
- package/lib/exercises/complex/conjugateComplex.ts.js +73 -0
- package/lib/exercises/complex/conjugateDivideComplex.d.ts +4 -0
- package/lib/exercises/complex/conjugateDivideComplex.d.ts.map +1 -0
- package/lib/exercises/complex/conjugateDivideComplex.js +65 -0
- package/lib/exercises/complex/conjugateMultiplyComplex.d.ts +4 -0
- package/lib/exercises/complex/conjugateMultiplyComplex.d.ts.map +1 -0
- package/lib/exercises/complex/conjugateMultiplyComplex.js +69 -0
- package/lib/exercises/complex/divideComplex.d.ts +4 -0
- package/lib/exercises/complex/divideComplex.d.ts.map +1 -0
- package/lib/exercises/complex/divideComplex.js +61 -0
- package/lib/exercises/complex/inverseComplex.d.ts +4 -0
- package/lib/exercises/complex/inverseComplex.d.ts.map +1 -0
- package/lib/exercises/complex/inverseComplex.js +73 -0
- package/lib/exercises/complex/linearCombinaisonComplex.d.ts +4 -0
- package/lib/exercises/complex/linearCombinaisonComplex.d.ts.map +1 -0
- package/lib/exercises/complex/linearCombinaisonComplex.js +67 -0
- package/lib/exercises/complex/mutiplyComplex.d.ts +4 -0
- package/lib/exercises/complex/mutiplyComplex.d.ts.map +1 -0
- package/lib/exercises/complex/mutiplyComplex.js +67 -0
- package/lib/exercises/complex/reAndIm.d.ts +4 -0
- package/lib/exercises/complex/reAndIm.d.ts.map +1 -0
- package/lib/exercises/complex/reAndIm.js +79 -0
- package/lib/exercises/exercise.d.ts +3 -2
- package/lib/exercises/exercise.d.ts.map +1 -1
- package/lib/exercises/exercises.d.ts.map +1 -1
- package/lib/exercises/exercises.js +39 -8
- package/lib/exercises/functions/affines/template.d.ts +4 -0
- package/lib/exercises/functions/affines/template.d.ts.map +1 -0
- package/lib/exercises/functions/affines/template.js +51 -0
- package/lib/exercises/functions/basics/inverseImageFunctionGeogebra.js +2 -2
- package/lib/exercises/functions/trinoms/alphaBetaFromDevForm.d.ts +4 -0
- package/lib/exercises/functions/trinoms/alphaBetaFromDevForm.d.ts.map +1 -0
- package/lib/exercises/functions/trinoms/alphaBetaFromDevForm.js +63 -0
- package/lib/exercises/functions/trinoms/alphaBetaInCanonicalForm.d.ts +4 -0
- package/lib/exercises/functions/trinoms/alphaBetaInCanonicalForm.d.ts.map +1 -0
- package/lib/exercises/functions/trinoms/alphaBetaInCanonicalForm.js +91 -0
- package/lib/exercises/functions/trinoms/canonicalFromDevForm.d.ts +4 -0
- package/lib/exercises/functions/trinoms/canonicalFromDevForm.d.ts.map +1 -0
- package/lib/exercises/functions/trinoms/canonicalFromDevForm.js +58 -0
- package/lib/exercises/functions/trinoms/extremumFromCanonicalForm.d.ts +4 -0
- package/lib/exercises/functions/trinoms/extremumFromCanonicalForm.d.ts.map +1 -0
- package/lib/exercises/functions/trinoms/extremumFromCanonicalForm.js +84 -0
- package/lib/exercises/functions/trinoms/extremumTypeFromAlgebricForm.d.ts +4 -0
- package/lib/exercises/functions/trinoms/extremumTypeFromAlgebricForm.d.ts.map +1 -0
- package/lib/exercises/functions/trinoms/extremumTypeFromAlgebricForm.js +59 -0
- package/lib/exercises/functions/trinoms/variationsFromAlgebricForm.d.ts +4 -0
- package/lib/exercises/functions/trinoms/variationsFromAlgebricForm.d.ts.map +1 -0
- package/lib/exercises/functions/trinoms/variationsFromAlgebricForm.js +59 -0
- package/lib/exercises/probaStat/averageWithTable.d.ts +4 -0
- package/lib/exercises/probaStat/averageWithTable.d.ts.map +1 -0
- package/lib/exercises/probaStat/averageWithTable.js +76 -0
- package/lib/exercises/probaStat/median.d.ts +2 -2
- package/lib/exercises/probaStat/median.d.ts.map +1 -1
- package/lib/exercises/probaStat/median.js +7 -7
- package/lib/exercises/probaStat/medianList.d.ts +2 -2
- package/lib/exercises/probaStat/medianList.d.ts.map +1 -1
- package/lib/exercises/probaStat/medianList.js +7 -7
- package/lib/exercises/probaStat/probabilityTree.js +6 -6
- package/lib/exercises/probaStat/quartiles.js +1 -1
- package/lib/exercises/sequences/arithmetic/arithmeticSum.d.ts +1 -0
- package/lib/exercises/sequences/arithmetic/arithmeticSum.d.ts.map +1 -0
- package/lib/exercises/sequences/arithmetic/arithmeticSum.js +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/math/complex/complex.d.ts +19 -0
- package/lib/math/complex/complex.d.ts.map +1 -0
- package/lib/math/complex/complex.js +63 -0
- package/lib/math/polynomials/trinom.d.ts +24 -0
- package/lib/math/polynomials/trinom.d.ts.map +1 -0
- package/lib/math/polynomials/trinom.js +67 -0
- package/lib/tree/nodes/complex/complexNode.d.ts +15 -0
- package/lib/tree/nodes/complex/complexNode.d.ts.map +1 -0
- package/lib/tree/nodes/complex/complexNode.js +43 -0
- package/lib/tree/nodes/expression/expressionNode.d.ts +1 -0
- package/lib/tree/nodes/expression/expressionNode.d.ts.map +1 -0
- package/lib/tree/nodes/expression/expressionNode.js +1 -0
- package/lib/tree/nodes/functions/cosNode.d.ts +1 -0
- package/lib/tree/nodes/functions/cosNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/cosNode.js +4 -0
- package/lib/tree/nodes/functions/expNode.d.ts +1 -0
- package/lib/tree/nodes/functions/expNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/expNode.js +4 -0
- package/lib/tree/nodes/functions/logNode.d.ts +1 -0
- package/lib/tree/nodes/functions/logNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/logNode.js +4 -0
- package/lib/tree/nodes/functions/oppositeNode.d.ts +1 -0
- package/lib/tree/nodes/functions/oppositeNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/oppositeNode.js +4 -0
- package/lib/tree/nodes/functions/sinNode.d.ts +1 -0
- package/lib/tree/nodes/functions/sinNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/sinNode.js +4 -0
- package/lib/tree/nodes/functions/sqrtNode.d.ts +1 -0
- package/lib/tree/nodes/functions/sqrtNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/sqrtNode.js +4 -0
- package/lib/tree/nodes/node.d.ts +1 -0
- package/lib/tree/nodes/node.d.ts.map +1 -1
- package/lib/tree/nodes/numbers/constantNode.d.ts +1 -0
- package/lib/tree/nodes/numbers/constantNode.d.ts.map +1 -1
- package/lib/tree/nodes/numbers/constantNode.js +4 -0
- package/lib/tree/nodes/numbers/numberNode.d.ts +1 -0
- package/lib/tree/nodes/numbers/numberNode.d.ts.map +1 -1
- package/lib/tree/nodes/numbers/numberNode.js +3 -0
- package/lib/tree/nodes/operators/addNode.d.ts +1 -0
- package/lib/tree/nodes/operators/addNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/addNode.js +4 -0
- package/lib/tree/nodes/operators/divideNode.d.ts +1 -0
- package/lib/tree/nodes/operators/divideNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/divideNode.js +4 -0
- package/lib/tree/nodes/operators/equalNode.d.ts +1 -0
- package/lib/tree/nodes/operators/equalNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/equalNode.js +4 -0
- package/lib/tree/nodes/operators/fractionNode.d.ts +1 -0
- package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/fractionNode.js +4 -0
- package/lib/tree/nodes/operators/multiplyNode.d.ts +1 -0
- package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/multiplyNode.js +9 -0
- package/lib/tree/nodes/operators/powerNode.d.ts +1 -0
- package/lib/tree/nodes/operators/powerNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/powerNode.js +4 -0
- package/lib/tree/nodes/operators/substractNode.d.ts +1 -0
- package/lib/tree/nodes/operators/substractNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/substractNode.js +4 -0
- package/lib/tree/nodes/variables/variableNode.d.ts +1 -0
- package/lib/tree/nodes/variables/variableNode.d.ts.map +1 -1
- package/lib/tree/nodes/variables/variableNode.js +3 -2
- package/lib/tree/parsers/simplify.d.ts +1 -0
- package/lib/tree/parsers/simplify.d.ts.map +1 -1
- package/lib/tree/parsers/simplify.js +10 -1
- package/lib/utils/diceFlip.d.ts +2 -0
- package/lib/utils/diceFlip.d.ts.map +1 -0
- package/lib/utils/diceFlip.js +12 -0
- package/package.json +1 -1
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Complex = exports.ComplexConstructor = void 0;
|
|
4
|
+
const complexNode_1 = require("../../tree/nodes/complex/complexNode");
|
|
5
|
+
const addNode_1 = require("../../tree/nodes/operators/addNode");
|
|
6
|
+
const multiplyNode_1 = require("../../tree/nodes/operators/multiplyNode");
|
|
7
|
+
const variableNode_1 = require("../../tree/nodes/variables/variableNode");
|
|
8
|
+
const rational_1 = require("../numbers/rationals/rational");
|
|
9
|
+
const randint_1 = require("../utils/random/randint");
|
|
10
|
+
class ComplexConstructor {
|
|
11
|
+
static random() {
|
|
12
|
+
const re = (0, randint_1.randint)(-10, 11);
|
|
13
|
+
let im = 0;
|
|
14
|
+
do {
|
|
15
|
+
im = (0, randint_1.randint)(-10, 11);
|
|
16
|
+
} while (re === 0 && im === 0);
|
|
17
|
+
return new Complex(re, im);
|
|
18
|
+
}
|
|
19
|
+
static randomNotReal() {
|
|
20
|
+
const re = (0, randint_1.randint)(-10, 11);
|
|
21
|
+
let im = 0;
|
|
22
|
+
do {
|
|
23
|
+
im = (0, randint_1.randint)(-10, 11, [0]);
|
|
24
|
+
} while (re === 0 && im === 0);
|
|
25
|
+
return new Complex(re, im);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.ComplexConstructor = ComplexConstructor;
|
|
29
|
+
class Complex {
|
|
30
|
+
constructor(re, im) {
|
|
31
|
+
this.re = re;
|
|
32
|
+
this.im = im;
|
|
33
|
+
}
|
|
34
|
+
moduleSquared() {
|
|
35
|
+
return this.re ** 2 + this.im ** 2;
|
|
36
|
+
}
|
|
37
|
+
inverseNode() {
|
|
38
|
+
const moduleSq = this.moduleSquared();
|
|
39
|
+
const conj = this.conjugate();
|
|
40
|
+
const invRe = new rational_1.Rational(conj.re, moduleSq).simplify().toTree();
|
|
41
|
+
const invIm = new rational_1.Rational(conj.im, moduleSq).simplify().toTree();
|
|
42
|
+
return new addNode_1.AddNode(invRe, new multiplyNode_1.MultiplyNode(invIm, new variableNode_1.VariableNode('i')));
|
|
43
|
+
}
|
|
44
|
+
divideNode(z) {
|
|
45
|
+
const moduleSq = z.moduleSquared();
|
|
46
|
+
const newRe = new rational_1.Rational(this.re * z.re + this.im * z.im, moduleSq).simplify().toTree();
|
|
47
|
+
const newIm = new rational_1.Rational(this.im * z.re - z.im * this.re, moduleSq).simplify().toTree();
|
|
48
|
+
return new addNode_1.AddNode(newRe, new multiplyNode_1.MultiplyNode(newIm, new variableNode_1.VariableNode('i')));
|
|
49
|
+
}
|
|
50
|
+
multiply(z) {
|
|
51
|
+
return new Complex(this.re * z.re - this.im * z.im, this.re * z.im + this.im * z.re);
|
|
52
|
+
}
|
|
53
|
+
opposite() {
|
|
54
|
+
return new Complex(-this.re, -this.im);
|
|
55
|
+
}
|
|
56
|
+
conjugate() {
|
|
57
|
+
return new Complex(this.re, -this.im);
|
|
58
|
+
}
|
|
59
|
+
toTree() {
|
|
60
|
+
return new complexNode_1.ComplexNode(this.re, this.im);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.Complex = Complex;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Node } from '../../tree/nodes/node';
|
|
2
|
+
import { NumberNode } from '../../tree/nodes/numbers/numberNode';
|
|
3
|
+
import { MathSet } from '../sets/mathSet';
|
|
4
|
+
import { Polynomial } from './polynomial';
|
|
5
|
+
export declare abstract class TrinomConstructor {
|
|
6
|
+
static random(domainA?: MathSet, domainB?: MathSet, domainC?: MathSet): Trinom;
|
|
7
|
+
static randomCanonical(domainA?: MathSet, domainAlpha?: MathSet, domainBeta?: MathSet): Trinom;
|
|
8
|
+
}
|
|
9
|
+
export declare class Trinom extends Polynomial {
|
|
10
|
+
a: number;
|
|
11
|
+
b: number;
|
|
12
|
+
c: number;
|
|
13
|
+
variable: string;
|
|
14
|
+
constructor(a: number, b: number, c: number, variable?: string);
|
|
15
|
+
getDelta(): number;
|
|
16
|
+
getDeltaNode(): NumberNode;
|
|
17
|
+
getAlpha(): number;
|
|
18
|
+
getAlphaNode(): Node;
|
|
19
|
+
getBeta(): number;
|
|
20
|
+
getBetaNode(): Node;
|
|
21
|
+
getCanonicalForm(): Node;
|
|
22
|
+
getSommet(): string;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=trinom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trinom.d.ts","sourceRoot":"","sources":["../../../src/math/polynomials/trinom.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AAajE,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,8BAAsB,iBAAiB;IACrC,MAAM,CAAC,MAAM,CACX,OAAO,GAAE,OAAmF,EAC5F,OAAO,GAAE,OAAqC,EAC9C,OAAO,GAAE,OAAqC,GAC7C,MAAM;IAOT,MAAM,CAAC,eAAe,CACpB,OAAO,GAAE,OAAmF,EAC5F,WAAW,GAAE,OAAqC,EAClD,UAAU,GAAE,OAAqC,GAChD,MAAM;CAQV;AAED,qBAAa,MAAO,SAAQ,UAAU;IACpC,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,QAAQ,EAAE,MAAM,CAAC;gBACL,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAY;IAQnE,QAAQ;IAGR,YAAY,IAAI,UAAU;IAI1B,QAAQ;IAGR,YAAY,IAAI,IAAI;IAIpB,OAAO;IAIP,WAAW,IAAI,IAAI;IAInB,gBAAgB,IAAI,IAAI;IAYxB,SAAS;CAGV"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Trinom = exports.TrinomConstructor = void 0;
|
|
4
|
+
const numberNode_1 = require("../../tree/nodes/numbers/numberNode");
|
|
5
|
+
const addNode_1 = require("../../tree/nodes/operators/addNode");
|
|
6
|
+
const fractionNode_1 = require("../../tree/nodes/operators/fractionNode");
|
|
7
|
+
const multiplyNode_1 = require("../../tree/nodes/operators/multiplyNode");
|
|
8
|
+
const powerNode_1 = require("../../tree/nodes/operators/powerNode");
|
|
9
|
+
const substractNode_1 = require("../../tree/nodes/operators/substractNode");
|
|
10
|
+
const variableNode_1 = require("../../tree/nodes/variables/variableNode");
|
|
11
|
+
const simplify_1 = require("../../tree/parsers/simplify");
|
|
12
|
+
const point_1 = require("../geometry/point");
|
|
13
|
+
const integer_1 = require("../numbers/integer/integer");
|
|
14
|
+
const discreteSet_1 = require("../sets/discreteSet");
|
|
15
|
+
const intervals_1 = require("../sets/intervals/intervals");
|
|
16
|
+
const polynomial_1 = require("./polynomial");
|
|
17
|
+
class TrinomConstructor {
|
|
18
|
+
static random(domainA = new intervals_1.Interval('[[-10; 10]]').difference(new discreteSet_1.DiscreteSet([new integer_1.Integer(0)])), domainB = new intervals_1.Interval('[[-10; 10]]'), domainC = new intervals_1.Interval('[[-10; 10]]')) {
|
|
19
|
+
const a = domainA.getRandomElement();
|
|
20
|
+
const b = domainB.getRandomElement();
|
|
21
|
+
const c = domainC.getRandomElement();
|
|
22
|
+
return new Trinom(a.value, b.value, c.value);
|
|
23
|
+
}
|
|
24
|
+
static randomCanonical(domainA = new intervals_1.Interval('[[-10; 10]]').difference(new discreteSet_1.DiscreteSet([new integer_1.Integer(0)])), domainAlpha = new intervals_1.Interval('[[-10; 10]]'), domainBeta = new intervals_1.Interval('[[-10; 10]]')) {
|
|
25
|
+
const a = domainA.getRandomElement();
|
|
26
|
+
const alpha = domainAlpha.getRandomElement();
|
|
27
|
+
const beta = domainBeta.getRandomElement();
|
|
28
|
+
const b = -2 * a.value * alpha.value;
|
|
29
|
+
const c = a.value * alpha.value ** 2 + beta.value;
|
|
30
|
+
return new Trinom(a.value, b, c);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.TrinomConstructor = TrinomConstructor;
|
|
34
|
+
class Trinom extends polynomial_1.Polynomial {
|
|
35
|
+
constructor(a, b, c, variable = 'x') {
|
|
36
|
+
super([c, b, a], variable);
|
|
37
|
+
this.a = a;
|
|
38
|
+
this.b = b;
|
|
39
|
+
this.c = c;
|
|
40
|
+
this.variable = variable;
|
|
41
|
+
}
|
|
42
|
+
getDelta() {
|
|
43
|
+
return this.b ** 2 - 4 * this.a * this.c;
|
|
44
|
+
}
|
|
45
|
+
getDeltaNode() {
|
|
46
|
+
return new numberNode_1.NumberNode(this.getDelta());
|
|
47
|
+
}
|
|
48
|
+
getAlpha() {
|
|
49
|
+
return -this.b / (2 * this.a);
|
|
50
|
+
}
|
|
51
|
+
getAlphaNode() {
|
|
52
|
+
return (0, simplify_1.simplifyNode)(new fractionNode_1.FractionNode(new numberNode_1.NumberNode(-this.b), new numberNode_1.NumberNode(2 * this.a)));
|
|
53
|
+
}
|
|
54
|
+
getBeta() {
|
|
55
|
+
return -this.getDelta() / (4 * this.a);
|
|
56
|
+
}
|
|
57
|
+
getBetaNode() {
|
|
58
|
+
return (0, simplify_1.simplifyNode)(new fractionNode_1.FractionNode(new numberNode_1.NumberNode(-this.getDelta()), new numberNode_1.NumberNode(4 * this.a)));
|
|
59
|
+
}
|
|
60
|
+
getCanonicalForm() {
|
|
61
|
+
return (0, simplify_1.simplifyNode)(new addNode_1.AddNode(new multiplyNode_1.MultiplyNode(new numberNode_1.NumberNode(this.a), new powerNode_1.PowerNode(new substractNode_1.SubstractNode(new variableNode_1.VariableNode(this.variable), this.getAlphaNode()), new numberNode_1.NumberNode(2))), new numberNode_1.NumberNode(this.getBeta())));
|
|
62
|
+
}
|
|
63
|
+
getSommet() {
|
|
64
|
+
return new point_1.Point('S', this.getAlphaNode(), this.getBetaNode()).toTexWithCoords();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
exports.Trinom = Trinom;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Node, NodeType } from '../node';
|
|
2
|
+
import { Complex } from '../../../math/complex/complex';
|
|
3
|
+
export declare class ComplexNode implements Node {
|
|
4
|
+
tex: string;
|
|
5
|
+
mathString: string;
|
|
6
|
+
re: number;
|
|
7
|
+
im: number;
|
|
8
|
+
type: NodeType;
|
|
9
|
+
constructor(re: number, im: number, tex?: string, mathString?: string);
|
|
10
|
+
toMathString(): string;
|
|
11
|
+
toTex(): string;
|
|
12
|
+
toMathjs(): import("mathjs").Complex;
|
|
13
|
+
toComplex(): Complex;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=complexNode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"complexNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/complex/complexNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAErD,qBAAa,WAAY,YAAW,IAAI;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,QAAQ,CAAmB;gBAErB,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM;IAyBrE,YAAY,IAAI,MAAM;IAGtB,KAAK,IAAI,MAAM;IAGf,QAAQ;IAGR,SAAS;CAGV"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ComplexNode = void 0;
|
|
4
|
+
const mathjs_1 = require("mathjs");
|
|
5
|
+
const node_1 = require("../node");
|
|
6
|
+
const complex_1 = require("../../../math/complex/complex");
|
|
7
|
+
class ComplexNode {
|
|
8
|
+
constructor(re, im, tex, mathString) {
|
|
9
|
+
this.type = node_1.NodeType.number;
|
|
10
|
+
this.re = re;
|
|
11
|
+
this.im = im;
|
|
12
|
+
const reTex = re === 0 ? '' : re.toString();
|
|
13
|
+
const imTex = im === 0
|
|
14
|
+
? ''
|
|
15
|
+
: im === 1
|
|
16
|
+
? re === 0
|
|
17
|
+
? 'i'
|
|
18
|
+
: '+i'
|
|
19
|
+
: im === -1
|
|
20
|
+
? '-i'
|
|
21
|
+
: im > 0
|
|
22
|
+
? re === 0
|
|
23
|
+
? `${im}i`
|
|
24
|
+
: `+${im}i`
|
|
25
|
+
: `${im}i`;
|
|
26
|
+
const formatedTex = re === 0 && im === 0 ? '0' : `${reTex}${imTex}`;
|
|
27
|
+
this.tex = tex || formatedTex;
|
|
28
|
+
this.mathString = mathString || this.tex;
|
|
29
|
+
}
|
|
30
|
+
toMathString() {
|
|
31
|
+
return `${this.mathString ? this.mathString : this.tex}`;
|
|
32
|
+
}
|
|
33
|
+
toTex() {
|
|
34
|
+
return `${this.tex}`;
|
|
35
|
+
}
|
|
36
|
+
toMathjs() {
|
|
37
|
+
return (0, mathjs_1.complex)(this.re, this.im);
|
|
38
|
+
}
|
|
39
|
+
toComplex() {
|
|
40
|
+
return new complex_1.Complex(this.re, this.im);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.ComplexNode = ComplexNode;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=expressionNode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expressionNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/expression/expressionNode.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cosNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/functions/cosNode.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cosNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/functions/cosNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,YAAY,EAAgB,MAAM,gBAAgB,CAAC;AAE5D,qBAAa,OAAQ,SAAQ,YAAa,YAAW,IAAI;IACvD,IAAI,EAAE,QAAQ,CAAqB;gBAEvB,KAAK,EAAE,IAAI;IAIvB,YAAY,IAAI,MAAM;IAItB,KAAK,IAAI,MAAM;IAIf,QAAQ;IAIR,QAAQ,IAAI,IAAI;CAGjB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CosNode = void 0;
|
|
4
|
+
const mathjs_1 = require("mathjs");
|
|
4
5
|
const node_1 = require("../node");
|
|
5
6
|
const functionNode_1 = require("./functionNode");
|
|
6
7
|
class CosNode extends functionNode_1.FunctionNode {
|
|
@@ -14,6 +15,9 @@ class CosNode extends functionNode_1.FunctionNode {
|
|
|
14
15
|
toTex() {
|
|
15
16
|
return `\\cos\\left(${this.child.toTex()}\\right)`;
|
|
16
17
|
}
|
|
18
|
+
toMathjs() {
|
|
19
|
+
return (0, mathjs_1.cos)(this.child.toMathjs());
|
|
20
|
+
}
|
|
17
21
|
simplify() {
|
|
18
22
|
return this;
|
|
19
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/functions/expNode.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"expNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/functions/expNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,YAAY,EAAgB,MAAM,gBAAgB,CAAC;AAE5D,qBAAa,OAAQ,SAAQ,YAAa,YAAW,IAAI;IACvD,IAAI,EAAE,QAAQ,CAAqB;gBAEvB,KAAK,EAAE,IAAI;IAIvB,YAAY,IAAI,MAAM;IAItB,KAAK,IAAI,MAAM;IAGf,QAAQ;IAIR,QAAQ,IAAI,IAAI;CAGjB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ExpNode = void 0;
|
|
4
|
+
const mathjs_1 = require("mathjs");
|
|
4
5
|
const node_1 = require("../node");
|
|
5
6
|
const functionNode_1 = require("./functionNode");
|
|
6
7
|
class ExpNode extends functionNode_1.FunctionNode {
|
|
@@ -14,6 +15,9 @@ class ExpNode extends functionNode_1.FunctionNode {
|
|
|
14
15
|
toTex() {
|
|
15
16
|
return `e^{${this.child.toTex()}}`;
|
|
16
17
|
}
|
|
18
|
+
toMathjs() {
|
|
19
|
+
return (0, mathjs_1.exp)(this.child.toMathjs());
|
|
20
|
+
}
|
|
17
21
|
simplify() {
|
|
18
22
|
return this;
|
|
19
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/functions/logNode.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"logNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/functions/logNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,YAAY,EAAgB,MAAM,gBAAgB,CAAC;AAE5D,qBAAa,OAAQ,SAAQ,YAAa,YAAW,IAAI;IACvD,IAAI,EAAE,QAAQ,CAAqB;gBAEvB,KAAK,EAAE,IAAI;IAIvB,YAAY,IAAI,MAAM;IAItB,KAAK,IAAI,MAAM;IAGf,QAAQ;IAGR,QAAQ,IAAI,IAAI;CAGjB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LogNode = void 0;
|
|
4
|
+
const mathjs_1 = require("mathjs");
|
|
4
5
|
const node_1 = require("../node");
|
|
5
6
|
const functionNode_1 = require("./functionNode");
|
|
6
7
|
class LogNode extends functionNode_1.FunctionNode {
|
|
@@ -14,6 +15,9 @@ class LogNode extends functionNode_1.FunctionNode {
|
|
|
14
15
|
toTex() {
|
|
15
16
|
return `\\ln\\left(${this.child.toTex()}\\right)`;
|
|
16
17
|
}
|
|
18
|
+
toMathjs() {
|
|
19
|
+
return (0, mathjs_1.log)(this.child.toMathjs());
|
|
20
|
+
}
|
|
17
21
|
simplify() {
|
|
18
22
|
return this;
|
|
19
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oppositeNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/functions/oppositeNode.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"oppositeNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/functions/oppositeNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAY,MAAM,SAAS,CAAC;AAEzC,OAAO,EAAE,YAAY,EAAgB,MAAM,gBAAgB,CAAC;AAE5D,qBAAa,YAAa,SAAQ,YAAa,YAAW,IAAI;gBAChD,KAAK,EAAE,IAAI;IAGvB,YAAY,IAAI,MAAM;IAGtB,KAAK,IAAI,MAAM;IAWf,QAAQ;CAGT"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OppositeNode = void 0;
|
|
4
|
+
const mathjs_1 = require("mathjs");
|
|
4
5
|
const node_1 = require("../node");
|
|
5
6
|
const operatorNode_1 = require("../operators/operatorNode");
|
|
6
7
|
const functionNode_1 = require("./functionNode");
|
|
@@ -22,5 +23,8 @@ class OppositeNode extends functionNode_1.FunctionNode {
|
|
|
22
23
|
childTex = `(${childTex})`;
|
|
23
24
|
return `-${childTex}`;
|
|
24
25
|
}
|
|
26
|
+
toMathjs() {
|
|
27
|
+
return (0, mathjs_1.unaryMinus)(this.child.toMathjs());
|
|
28
|
+
}
|
|
25
29
|
}
|
|
26
30
|
exports.OppositeNode = OppositeNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sinNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/functions/sinNode.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sinNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/functions/sinNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,YAAY,EAAgB,MAAM,gBAAgB,CAAC;AAE5D,qBAAa,OAAQ,SAAQ,YAAa,YAAW,IAAI;IACvD,IAAI,EAAE,QAAQ,CAAqB;gBAEvB,KAAK,EAAE,IAAI;IAIvB,YAAY,IAAI,MAAM;IAItB,KAAK,IAAI,MAAM;IAGf,QAAQ;IAGR,QAAQ,IAAI,IAAI;CAGjB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SinNode = void 0;
|
|
4
|
+
const mathjs_1 = require("mathjs");
|
|
4
5
|
const node_1 = require("../node");
|
|
5
6
|
const functionNode_1 = require("./functionNode");
|
|
6
7
|
class SinNode extends functionNode_1.FunctionNode {
|
|
@@ -14,6 +15,9 @@ class SinNode extends functionNode_1.FunctionNode {
|
|
|
14
15
|
toTex() {
|
|
15
16
|
return `\\sin\\left(${this.child.toTex()}\\right)`;
|
|
16
17
|
}
|
|
18
|
+
toMathjs() {
|
|
19
|
+
return (0, mathjs_1.sin)(this.child.toMathjs());
|
|
20
|
+
}
|
|
17
21
|
simplify() {
|
|
18
22
|
return this;
|
|
19
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqrtNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/functions/sqrtNode.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sqrtNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/functions/sqrtNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,YAAY,EAAgB,MAAM,gBAAgB,CAAC;AAE5D,qBAAa,QAAS,SAAQ,YAAa,YAAW,IAAI;IACxD,IAAI,EAAE,QAAQ,CAAqB;gBACvB,KAAK,EAAE,IAAI;IAGvB,YAAY,IAAI,MAAM;IAGtB,QAAQ;IAGR,KAAK,IAAI,MAAM;CAGhB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SqrtNode = void 0;
|
|
4
|
+
const mathjs_1 = require("mathjs");
|
|
4
5
|
const node_1 = require("../node");
|
|
5
6
|
const functionNode_1 = require("./functionNode");
|
|
6
7
|
class SqrtNode extends functionNode_1.FunctionNode {
|
|
@@ -11,6 +12,9 @@ class SqrtNode extends functionNode_1.FunctionNode {
|
|
|
11
12
|
toMathString() {
|
|
12
13
|
return `sqrt(${this.child.toMathString()})`;
|
|
13
14
|
}
|
|
15
|
+
toMathjs() {
|
|
16
|
+
return (0, mathjs_1.sqrt)(this.child.toMathjs());
|
|
17
|
+
}
|
|
14
18
|
toTex() {
|
|
15
19
|
return `\\sqrt{${this.child.toTex()}}`;
|
|
16
20
|
}
|
package/lib/tree/nodes/node.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../src/tree/nodes/node.ts"],"names":[],"mappings":"AAAA,oBAAY,QAAQ;IAClB,MAAM,IAAA;IACN,QAAQ,IAAA;IACR,QAAQ,IAAA;IACR,QAAQ,IAAA;IACR,QAAQ,IAAA;CACT;AAED,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,QAAQ,CAAC;IACf,YAAY,EAAE,MAAM,MAAM,CAAC;IAC3B,KAAK,EAAE,MAAM,MAAM,CAAC;CAErB"}
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../src/tree/nodes/node.ts"],"names":[],"mappings":"AAAA,oBAAY,QAAQ;IAClB,MAAM,IAAA;IACN,QAAQ,IAAA;IACR,QAAQ,IAAA;IACR,QAAQ,IAAA;IACR,QAAQ,IAAA;CACT;AAED,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,QAAQ,CAAC;IACf,YAAY,EAAE,MAAM,MAAM,CAAC;IAC3B,KAAK,EAAE,MAAM,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,GAAG,CAAC;CAErB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constantNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/numbers/constantNode.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"constantNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/numbers/constantNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEzC,qBAAa,YAAa,YAAW,IAAI;IACvC,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,QAAQ,CAAqB;gBAEvB,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;IAK3C,YAAY,IAAI,MAAM;IAGtB,KAAK,IAAI,MAAM;IAGf,QAAQ;CAGT"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ConstantNode = void 0;
|
|
4
|
+
const mathjs_1 = require("mathjs");
|
|
4
5
|
const node_1 = require("../node");
|
|
5
6
|
class ConstantNode {
|
|
6
7
|
constructor(tex, mathString) {
|
|
@@ -14,5 +15,8 @@ class ConstantNode {
|
|
|
14
15
|
toTex() {
|
|
15
16
|
return `${this.tex}`;
|
|
16
17
|
}
|
|
18
|
+
toMathjs() {
|
|
19
|
+
return (0, mathjs_1.parse)(this.mathString);
|
|
20
|
+
}
|
|
17
21
|
}
|
|
18
22
|
exports.ConstantNode = ConstantNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"numberNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/numbers/numberNode.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"numberNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/numbers/numberNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEzC,qBAAa,UAAW,YAAW,IAAI;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,QAAQ,CAAmB;gBAErB,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM;IAM5D,YAAY,IAAI,MAAM;IAGtB,KAAK,IAAI,MAAM;IAGf,QAAQ;CAMT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/addNode.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"addNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/addNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAY,MAAM,SAAS,CAAC;AACzC,OAAO,EAAe,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE3D,qBAAa,OAAQ,SAAQ,YAAa,YAAW,IAAI;gBAC3C,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI;IAK7C,YAAY,IAAI,MAAM;IAItB,KAAK,IAAI,MAAM;IAIf,QAAQ;CAGT"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AddNode = void 0;
|
|
4
|
+
const mathjs_1 = require("mathjs");
|
|
4
5
|
const operatorNode_1 = require("./operatorNode");
|
|
5
6
|
class AddNode extends operatorNode_1.OperatorNode {
|
|
6
7
|
constructor(leftChild, rightChild) {
|
|
@@ -15,5 +16,8 @@ class AddNode extends operatorNode_1.OperatorNode {
|
|
|
15
16
|
const rightTex = this.rightChild.toTex();
|
|
16
17
|
return `${this.leftChild.toTex()} ${rightTex[0] === '-' ? '' : '+ '}${rightTex}`;
|
|
17
18
|
}
|
|
19
|
+
toMathjs() {
|
|
20
|
+
return (0, mathjs_1.add)(this.leftChild.toMathjs(), this.rightChild.toMathjs());
|
|
21
|
+
}
|
|
18
22
|
}
|
|
19
23
|
exports.AddNode = AddNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"divideNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/divideNode.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"divideNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/divideNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAY,MAAM,SAAS,CAAC;AACzC,OAAO,EAAe,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE3D,qBAAa,UAAW,SAAQ,YAAa,YAAW,IAAI;IAC1D;;;OAGG;gBACS,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI;IAI7C,YAAY,IAAI,MAAM;IAItB,KAAK,IAAI,MAAM;IAqBf,QAAQ;CAGT"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DivideNode = void 0;
|
|
4
|
+
const mathjs_1 = require("mathjs");
|
|
4
5
|
const node_1 = require("../node");
|
|
5
6
|
const operatorNode_1 = require("./operatorNode");
|
|
6
7
|
class DivideNode extends operatorNode_1.OperatorNode {
|
|
@@ -30,5 +31,8 @@ class DivideNode extends operatorNode_1.OperatorNode {
|
|
|
30
31
|
rightTex = `(${rightTex})`;
|
|
31
32
|
return `${leftTex} \\div ${rightTex}`;
|
|
32
33
|
}
|
|
34
|
+
toMathjs() {
|
|
35
|
+
return (0, mathjs_1.divide)(this.leftChild.toMathjs(), this.rightChild.toMathjs());
|
|
36
|
+
}
|
|
33
37
|
}
|
|
34
38
|
exports.DivideNode = DivideNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"equalNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/equalNode.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"equalNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/equalNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAY,MAAM,SAAS,CAAC;AACzC,OAAO,EAAe,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE3D,qBAAa,SAAU,SAAQ,YAAa,YAAW,IAAI;gBAC7C,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI;IAG7C,YAAY,IAAI,MAAM;IAGtB,KAAK,IAAI,MAAM;IAIf,QAAQ;CAGT"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.EqualNode = void 0;
|
|
4
|
+
const mathjs_1 = require("mathjs");
|
|
4
5
|
const operatorNode_1 = require("./operatorNode");
|
|
5
6
|
class EqualNode extends operatorNode_1.OperatorNode {
|
|
6
7
|
constructor(leftChild, rightChild) {
|
|
@@ -12,5 +13,8 @@ class EqualNode extends operatorNode_1.OperatorNode {
|
|
|
12
13
|
toTex() {
|
|
13
14
|
return `${this.leftChild.toTex()} = ${this.rightChild.toTex()}`;
|
|
14
15
|
}
|
|
16
|
+
toMathjs() {
|
|
17
|
+
return (0, mathjs_1.equal)(this.leftChild.toMathjs(), this.rightChild.toMathjs());
|
|
18
|
+
}
|
|
15
19
|
}
|
|
16
20
|
exports.EqualNode = EqualNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fractionNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/fractionNode.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fractionNode.d.ts","sourceRoot":"","sources":["../../../../src/tree/nodes/operators/fractionNode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAY,MAAM,SAAS,CAAC;AACzC,OAAO,EAAe,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE3D,qBAAa,YAAa,SAAQ,YAAa,YAAW,IAAI;IAC5D;;;OAGG;gBACS,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI;IAI7C,YAAY,IAAI,MAAM;IAGtB,KAAK,IAAI,MAAM;IAIf,QAAQ;CAGT"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FractionNode = void 0;
|
|
4
|
+
const mathjs_1 = require("mathjs");
|
|
4
5
|
const operatorNode_1 = require("./operatorNode");
|
|
5
6
|
class FractionNode extends operatorNode_1.OperatorNode {
|
|
6
7
|
/**
|
|
@@ -16,5 +17,8 @@ class FractionNode extends operatorNode_1.OperatorNode {
|
|
|
16
17
|
toTex() {
|
|
17
18
|
return `\\frac{${this.leftChild.toTex()}}{${this.rightChild.toTex()}}`;
|
|
18
19
|
}
|
|
20
|
+
toMathjs() {
|
|
21
|
+
return (0, mathjs_1.fraction)(this.leftChild.toMathjs(), this.rightChild.toMathjs());
|
|
22
|
+
}
|
|
19
23
|
}
|
|
20
24
|
exports.FractionNode = FractionNode;
|