pimath 0.0.119 → 0.0.121
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/.eslintrc.js +23 -23
- package/.idea/PI.iml +7 -1
- package/dev/pimath.js +7929 -0
- package/dev/pimath.js.map +1 -0
- package/dist/{pi.js → pimath.js} +7612 -7829
- package/dist/pimath.js.map +1 -0
- package/dist/pimath.min.js +2 -0
- package/dist/pimath.min.js.map +1 -0
- package/docs/assets/main.js +3 -3
- package/docs/assets/search.js +1 -1
- package/docs/assets/style.css +450 -363
- package/docs/classes/Logicalset.Logicalset.html +119 -110
- package/docs/classes/Polynom.Rational.html +230 -227
- package/docs/classes/Vector-1.Vector.html +319 -273
- package/docs/classes/Vector.Point.html +189 -190
- package/docs/classes/algebra_equation.Equation.html +489 -446
- package/docs/classes/algebra_linearSystem.LinearSystem.html +228 -217
- package/docs/classes/algebra_monom.Monom.html +564 -507
- package/docs/classes/algebra_polynom.Polynom.html +774 -753
- package/docs/classes/coefficients_fraction.Fraction.html +573 -565
- package/docs/classes/geometry_circle.Circle.html +299 -299
- package/docs/classes/geometry_line.Line.html +511 -451
- package/docs/classes/geometry_triangle.Triangle.html +273 -264
- package/docs/classes/numeric.Numeric.html +138 -132
- package/docs/classes/shutingyard.Shutingyard.html +144 -133
- package/docs/enums/algebra_equation.PARTICULAR_SOLUTION.html +47 -46
- package/docs/enums/geometry_line.LinePropriety.html +58 -58
- package/docs/enums/shutingyard.ShutingyardMode.html +62 -58
- package/docs/enums/shutingyard.ShutingyardType.html +74 -70
- package/docs/index.html +31 -33
- package/docs/interfaces/algebra_equation.ISolution.html +61 -59
- package/docs/interfaces/algebra_polynom.IEuclidian.html +47 -46
- package/docs/interfaces/geometry_triangle.remarquableLines.html +74 -74
- package/docs/modules/Logicalset.html +33 -38
- package/docs/modules/Polynom.html +33 -38
- package/docs/modules/Vector-1.html +33 -38
- package/docs/modules/Vector.html +33 -38
- package/docs/modules/algebra_equation.html +35 -41
- package/docs/modules/algebra_linearSystem.html +31 -37
- package/docs/modules/algebra_monom.html +33 -39
- package/docs/modules/algebra_polynom.html +35 -41
- package/docs/modules/coefficients_fraction.html +33 -39
- package/docs/modules/geometry_circle.html +31 -37
- package/docs/modules/geometry_line.html +33 -39
- package/docs/modules/geometry_triangle.html +33 -39
- package/docs/modules/numeric.html +31 -37
- package/docs/modules/shutingyard.html +41 -47
- package/docs/types/algebra_monom.literalType.html +33 -37
- package/docs/types/algebra_polynom.PolynomParsingType.html +33 -37
- package/docs/types/coefficients_fraction.FractionParsingType.html +32 -36
- package/docs/types/shutingyard.Token.html +38 -42
- package/docs/types/shutingyard.tokenType.html +40 -44
- package/docs/variables/shutingyard.tokenConstant.html +37 -41
- package/esm/index.d.ts +38 -41
- package/esm/index.js +43 -46
- package/esm/index.js.map +1 -1
- package/esm/maths/algebra/equation.d.ts +119 -117
- package/esm/maths/algebra/equation.js +796 -785
- package/esm/maths/algebra/equation.js.map +1 -1
- package/esm/maths/algebra/linearSystem.d.ts +39 -38
- package/esm/maths/algebra/linearSystem.js +278 -262
- package/esm/maths/algebra/linearSystem.js.map +1 -1
- package/esm/maths/algebra/logicalset.d.ts +28 -28
- package/esm/maths/algebra/logicalset.js +157 -157
- package/esm/maths/algebra/monom.d.ts +206 -206
- package/esm/maths/algebra/monom.js +908 -908
- package/esm/maths/algebra/monom.js.map +1 -1
- package/esm/maths/algebra/polynom.d.ts +157 -157
- package/esm/maths/algebra/polynom.js +1277 -1277
- package/esm/maths/algebra/rational.d.ts +45 -45
- package/esm/maths/algebra/rational.js +183 -183
- package/esm/maths/algebra/study/rationalStudy.d.ts +28 -28
- package/esm/maths/algebra/study/rationalStudy.js +243 -243
- package/esm/maths/algebra/study.d.ts +142 -142
- package/esm/maths/algebra/study.js +377 -377
- package/esm/maths/algebra/study.js.map +1 -1
- package/esm/maths/coefficients/fraction.d.ts +90 -90
- package/esm/maths/coefficients/fraction.js +516 -516
- package/esm/maths/coefficients/fraction.js.map +1 -1
- package/esm/maths/coefficients/nthRoot.d.ts +23 -23
- package/esm/maths/coefficients/nthRoot.js +136 -136
- package/esm/maths/geometry/circle.d.ts +45 -45
- package/esm/maths/geometry/circle.js +323 -323
- package/esm/maths/geometry/line.d.ts +99 -99
- package/esm/maths/geometry/line.js +481 -481
- package/esm/maths/geometry/line.js.map +1 -1
- package/esm/maths/geometry/point.d.ts +34 -34
- package/esm/maths/geometry/point.js +166 -166
- package/esm/maths/geometry/point.js.map +1 -1
- package/esm/maths/geometry/triangle.d.ts +85 -85
- package/esm/maths/geometry/triangle.js +268 -268
- package/esm/maths/geometry/vector.d.ts +41 -41
- package/esm/maths/geometry/vector.js +197 -197
- package/esm/maths/geometry/vector.js.map +1 -1
- package/esm/maths/numeric.d.ts +28 -28
- package/esm/maths/numeric.js +180 -169
- package/esm/maths/numeric.js.map +1 -1
- package/esm/maths/numexp.d.ts +19 -0
- package/esm/maths/numexp.js +186 -0
- package/esm/maths/numexp.js.map +1 -0
- package/esm/maths/randomization/random.d.ts +23 -23
- package/esm/maths/randomization/random.js +78 -78
- package/esm/maths/randomization/random.js.map +1 -1
- package/esm/maths/randomization/randomCore.d.ts +7 -7
- package/esm/maths/randomization/randomCore.js +21 -21
- package/esm/maths/randomization/rndFraction.d.ts +12 -12
- package/esm/maths/randomization/rndFraction.js +43 -43
- package/esm/maths/randomization/rndGeometryLine.d.ts +12 -12
- package/esm/maths/randomization/rndGeometryLine.js +45 -45
- package/esm/maths/randomization/rndGeometryPoint.d.ts +12 -12
- package/esm/maths/randomization/rndGeometryPoint.js +60 -60
- package/esm/maths/randomization/rndHelpers.d.ts +23 -23
- package/esm/maths/randomization/rndHelpers.js +76 -76
- package/esm/maths/randomization/rndMonom.d.ts +12 -12
- package/esm/maths/randomization/rndMonom.js +52 -52
- package/esm/maths/randomization/rndPolynom.d.ts +13 -13
- package/esm/maths/randomization/rndPolynom.js +74 -74
- package/esm/maths/randomization/rndTypes.d.ts +34 -34
- package/esm/maths/randomization/rndTypes.js +2 -2
- package/esm/maths/shutingyard.d.ts +59 -59
- package/esm/maths/shutingyard.js +442 -442
- package/esm/maths/shutingyard.js.map +1 -1
- package/package.json +11 -11
- package/public/index.html +50 -81
- package/public/playground.html +7 -8
- package/src/index.ts +2 -5
- package/src/maths/algebra/equation.ts +16 -0
- package/src/maths/algebra/linearSystem.ts +20 -0
- package/src/maths/algebra/study.ts +1 -1
- package/src/maths/numeric.ts +49 -48
- package/src/maths/{expressions/numexp.ts → numexp.ts} +2 -2
- package/tests/algebra/equation.test.ts +19 -5
- package/tests/algebra/linear.test.ts +3 -11
- package/tests/algebra/polynom.test.ts +7 -8
- package/tests/algebra/rationnal.test.ts +1 -1
- package/tests/algebra/study.test.ts +2 -9
- package/tests/coefficients/fraction.test.ts +8 -8
- package/tests/custom.test.ts +33 -37
- package/tests/numeric.test.ts +1 -2
- package/tests/numexp.test.ts +1 -5
- package/tests/shutingyard.test.ts +3 -3
- package/webpack-production-min.config.js +1 -1
- package/webpack-production.config.js +1 -1
- package/webpack.config.js +1 -1
- package/dist/pi.js.map +0 -1
- package/dist/pi.min.js +0 -2
- package/dist/pi.min.js.map +0 -1
- package/docs/classes/expressions_numexp.NumExp.html +0 -236
- package/docs/classes/expressions_polynomexp.PolynomExpFactor.html +0 -317
- package/docs/classes/expressions_polynomexp.PolynomExpProduct.html +0 -285
- package/docs/modules/expressions_numexp.html +0 -71
- package/docs/modules/expressions_polynomexp.html +0 -73
- package/docs/modules.html +0 -76
- package/graph.svg +0 -1033
- package/src/maths/expressions/ExpressionTree.ts +0 -172
- package/src/maths/expressions/expression.ts +0 -286
- package/src/maths/expressions/expressionFactor.ts +0 -190
- package/src/maths/expressions/expressionMember.ts +0 -233
- package/src/maths/expressions/expressionOperators.ts +0 -49
- package/src/maths/expressions/expressionParser.ts +0 -295
- package/src/maths/expressions/factors/ExpFactor.ts +0 -39
- package/src/maths/expressions/factors/ExpFactorConstant.ts +0 -60
- package/src/maths/expressions/factors/ExpFactorExponential.ts +0 -26
- package/src/maths/expressions/factors/ExpFactorNumber.ts +0 -72
- package/src/maths/expressions/factors/ExpFactorPower.ts +0 -42
- package/src/maths/expressions/factors/ExpFactorTrigo.ts +0 -53
- package/src/maths/expressions/factors/ExpFactorVariable.ts +0 -45
- package/src/maths/expressions/internals.ts +0 -14
- package/src/maths/expressions/polynomexp.bkp.ts +0 -221
- package/src/maths/expressions/polynomexp.ts +0 -310
- package/tests/expressions/expressions.test.ts +0 -145
- package/tests/expressions/expressiontree.test.ts +0 -11
- package/tests/polynomexp.test.ts +0 -12
|
@@ -2,7 +2,7 @@ import {describe} from "mocha";
|
|
|
2
2
|
import {expect} from "chai";
|
|
3
3
|
import {LinearSystem} from "../../src/maths/algebra/linearSystem";
|
|
4
4
|
import {Polynom} from "../../src/maths/algebra/polynom";
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
|
|
7
7
|
describe('Linear systems tests', () => {
|
|
8
8
|
it('should solve a 2x2 equations', () => {
|
|
@@ -22,7 +22,7 @@ describe('Linear systems tests', () => {
|
|
|
22
22
|
)
|
|
23
23
|
|
|
24
24
|
LS.solve()
|
|
25
|
-
|
|
25
|
+
expect(LS.solutionAsDisplay).to.be.equal("(1;0;5)")
|
|
26
26
|
})
|
|
27
27
|
|
|
28
28
|
it('should solve a 3x3 equations II ', () => {
|
|
@@ -33,22 +33,14 @@ describe('Linear systems tests', () => {
|
|
|
33
33
|
)
|
|
34
34
|
|
|
35
35
|
LS.solve()
|
|
36
|
-
console.log(LS.solution)
|
|
37
36
|
})
|
|
38
37
|
|
|
39
38
|
it('should calculate the reduction', function () {
|
|
40
39
|
let E1 = new Polynom('6x+21y-3z'),
|
|
41
40
|
E2 = new Polynom('-6x+21y-3z')
|
|
42
41
|
|
|
43
|
-
// Start from hre
|
|
44
|
-
console.log('------------')
|
|
45
|
-
console.log(E1.tex, E2.tex)
|
|
46
|
-
|
|
47
|
-
console.log(E1.monoms.map(x => x.tex))
|
|
48
|
-
console.log(E2.monoms.map(x => x.tex))
|
|
49
42
|
E1.add(E2);
|
|
50
|
-
|
|
51
|
-
console.log(E1.tex)
|
|
43
|
+
expect(E1.display).to.be.equal('42y-6z')
|
|
52
44
|
});
|
|
53
45
|
|
|
54
46
|
it('should use a reduced linear reducation', function () {
|
|
@@ -3,7 +3,6 @@ import {Random} from "../../src/maths/randomization/random";
|
|
|
3
3
|
import {describe} from "mocha";
|
|
4
4
|
import {Polynom} from "../../src/maths/algebra/polynom";
|
|
5
5
|
import {Fraction} from "../../src/maths/coefficients/fraction";
|
|
6
|
-
import exp = require("constants");
|
|
7
6
|
|
|
8
7
|
|
|
9
8
|
describe('Polynom tests', () => {
|
|
@@ -153,17 +152,17 @@ describe('Polynom tests', () => {
|
|
|
153
152
|
describe('Polynom parsing with rational power', () => {
|
|
154
153
|
it('should parse with rational powers', () => {
|
|
155
154
|
const P = new Polynom('3x^(2/3)-5x+5/3');
|
|
156
|
-
expect(P.tex).to.be.equal('3x^{\\tfrac{ 2 }{ 3 }}
|
|
155
|
+
expect(P.tex).to.be.equal('-5x+3x^{\\tfrac{ 2 }{ 3 }}+\\frac{ 5 }{ 3 }')
|
|
157
156
|
})
|
|
158
157
|
})
|
|
159
158
|
|
|
160
159
|
|
|
161
|
-
describe("test simple", ()=>{
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
})
|
|
160
|
+
// describe("test simple", ()=>{
|
|
161
|
+
// it('should parce this one correctly', ()=>{
|
|
162
|
+
// const P = new Polynom('-(x+2)(x-1)(x-1)(5x+4)')
|
|
163
|
+
// const Q = new Polynom('(2+x)^2(1-x)^3')
|
|
164
|
+
// })
|
|
165
|
+
// })
|
|
167
166
|
|
|
168
167
|
// TODO: working with roots !
|
|
169
168
|
// describe('WIP : working with roots', ()=>{
|
|
@@ -41,14 +41,7 @@ describe('Study tests', () => {
|
|
|
41
41
|
const R = new Rational('x-3', 'x^2-4')
|
|
42
42
|
const study = R.study('\\delta(x),d,signs')
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
console.log('DOMAIN')
|
|
47
|
-
console.log(study.domain)
|
|
48
|
-
console.log('SIGNS')
|
|
49
|
-
console.log(Object.keys(study.signs))
|
|
50
|
-
|
|
51
|
-
console.log(study.signs.tex)
|
|
52
|
-
console.log(study.signs.signs)
|
|
44
|
+
expect(study.domain).to.be.equal('\\mathbb{R}\\setminus\\left\\{-2;2\\right\\}')
|
|
45
|
+
expect(study.signs.signs[0]).to.have.all.members(['', '-', 't', '-', 't', '-', 'z', '+', ''])
|
|
53
46
|
});
|
|
54
47
|
})
|
|
@@ -2,7 +2,7 @@ import {expect} from "chai";
|
|
|
2
2
|
import {Fraction} from "../../src/maths/coefficients/fraction";
|
|
3
3
|
import {describe} from "mocha";
|
|
4
4
|
import {Random} from "../../src/maths/randomization/random";
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
|
|
7
7
|
describe('Fraction tests', () => { // the tests container
|
|
8
8
|
|
|
@@ -39,14 +39,16 @@ describe('Fraction tests', () => { // the tests container
|
|
|
39
39
|
|
|
40
40
|
it('Should parse a number with lots of decimals', ()=>{
|
|
41
41
|
let A = 3.45,
|
|
42
|
-
B = 3.
|
|
42
|
+
B = 3.3333333333333,
|
|
43
43
|
C = 5.314171717171717
|
|
44
44
|
|
|
45
45
|
let FA = new Fraction(A),
|
|
46
|
-
FB = new Fraction(B),
|
|
47
|
-
FC = new Fraction(C)
|
|
46
|
+
FB = new Fraction(B, 1),
|
|
47
|
+
FC = new Fraction(C, 2)
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
expect(FA.display).to.be.equal('69/20')
|
|
50
|
+
expect(FB.display).to.be.equal('10/3')
|
|
51
|
+
expect(FC.display).to.be.equal('526103/99000')
|
|
50
52
|
})
|
|
51
53
|
})
|
|
52
54
|
|
|
@@ -96,7 +98,7 @@ describe("Fraction static functions", ()=>{
|
|
|
96
98
|
3
|
|
97
99
|
]
|
|
98
100
|
|
|
99
|
-
|
|
101
|
+
expect(new Fraction().xMultiply(...list).display).to.be.equal("60/12")
|
|
100
102
|
});
|
|
101
103
|
})
|
|
102
104
|
|
|
@@ -107,8 +109,6 @@ describe("Evaluate fraction", () => {
|
|
|
107
109
|
expect(F.isApproximative()).to.be.true
|
|
108
110
|
expect(F.isExact()).to.be.false
|
|
109
111
|
|
|
110
|
-
console.log(F.tex, F.value)
|
|
111
|
-
|
|
112
112
|
let G = new Fraction('1/7')
|
|
113
113
|
expect(G.isApproximative()).to.be.false
|
|
114
114
|
expect(G.isExact()).to.be.true
|
package/tests/custom.test.ts
CHANGED
|
@@ -1,37 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
A: {x: 3, y: 7}
|
|
35
|
-
})
|
|
36
|
-
});
|
|
37
|
-
});
|
|
1
|
+
// describe('Custom test', () => { // the tests container
|
|
2
|
+
// it('Build sqrt value', () => {
|
|
3
|
+
//
|
|
4
|
+
// let a = 1, b = 27, c = 50
|
|
5
|
+
//
|
|
6
|
+
// a = Random.number(2,20)
|
|
7
|
+
// b = Random.number(2,20)
|
|
8
|
+
// c = Random.number(2,20)
|
|
9
|
+
//
|
|
10
|
+
// let nthB = new NthRoot(b).reduce(),
|
|
11
|
+
// nthC = new NthRoot(c).reduce(),
|
|
12
|
+
// nthD = new NthRoot(nthB.radical * nthC.radical).reduce(),
|
|
13
|
+
// F = new Fraction(a*nthB.coefficient*nthD.coefficient, nthC.radical*nthC.coefficient).reduce(),
|
|
14
|
+
// answer = ''
|
|
15
|
+
//
|
|
16
|
+
// if(F.numerator>1){
|
|
17
|
+
// answer = `${F.numerator}`
|
|
18
|
+
// }
|
|
19
|
+
// if(nthD.radical>1){
|
|
20
|
+
// answer = `${answer}sqrt${nthD.radical}`
|
|
21
|
+
// }
|
|
22
|
+
// if(F.denominator>1){
|
|
23
|
+
// answer = `${answer}/${F.denominator}`
|
|
24
|
+
// }
|
|
25
|
+
// console.log(`${a}sqrt${b}/sqrt${c}`, answer)
|
|
26
|
+
// })
|
|
27
|
+
//
|
|
28
|
+
// it('should generate a line', function () {
|
|
29
|
+
// let L = Random.Geometry.line({
|
|
30
|
+
// A: {x: 3, y: 7}
|
|
31
|
+
// })
|
|
32
|
+
// });
|
|
33
|
+
// });
|
package/tests/numeric.test.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {Numeric} from "../src/maths/numeric";
|
|
2
2
|
import {expect} from "chai";
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
|
|
5
5
|
describe('Numeric', () => { // the tests container
|
|
6
6
|
it('Correct number', () => {
|
|
@@ -21,7 +21,6 @@ describe('Numeric', () => { // the tests container
|
|
|
21
21
|
})
|
|
22
22
|
|
|
23
23
|
it('should decompose a number in two factors', function () {
|
|
24
|
-
console.log(Numeric.decompose(6))
|
|
25
24
|
expect(Numeric.decompose(25).map(x=>x.join(','))).to.have.all.members(['1,25', '5,5'])
|
|
26
25
|
expect(Numeric.decompose(6).map(x=>x.join(','))).to.have.all.members(['1,6', '2,3'])
|
|
27
26
|
});
|
package/tests/numexp.test.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import {expect} from 'chai';
|
|
2
|
-
import {NumExp} from "../src/maths/
|
|
3
|
-
import {Numeric} from "../src/maths/numeric";
|
|
2
|
+
import {NumExp} from "../src/maths/numexp";
|
|
4
3
|
|
|
5
4
|
describe('Numerical expression', () => { // the tests container
|
|
6
5
|
it('RPN for numerical expression', () => {
|
|
@@ -54,9 +53,6 @@ describe('Numerical expression', () => { // the tests container
|
|
|
54
53
|
});
|
|
55
54
|
|
|
56
55
|
it('should calculate sqrt from exp', function(){
|
|
57
|
-
// let a = new NumExp('x^(1/3)')
|
|
58
|
-
// console.log(a.evaluate({x: 8}))
|
|
59
|
-
|
|
60
56
|
let k = new NumExp('nthrt(x,3)')
|
|
61
57
|
expect(k.evaluate({x: -8})).to.be.equal(-2)
|
|
62
58
|
expect(k.evaluate({x: 27})).to.be.equal(3)
|
|
@@ -51,8 +51,8 @@ describe('Shuting yard', () => { // the tests container
|
|
|
51
51
|
// '-'
|
|
52
52
|
// ])
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
expect(new Shutingyard(ShutingyardMode.EXPRESSION).normalize('3x(x-5)^(2(x+7))')).to.be.equal("3*x*(x-5)^(2*(x+7))")
|
|
55
|
+
expect(new Shutingyard(ShutingyardMode.EXPRESSION).normalize('sin(cos(3pi-5))+sqrt(e-sin(3pi/2))')).to.be.equal("sin(cos(3*pi-5))+sqrt(e-sin(3*pi/2))")
|
|
56
|
+
expect(new Shutingyard(ShutingyardMode.EXPRESSION).normalize('sin(cos(3picos(3pi)-5))+sqrt(e-sin(3pi/2))')).to.be.equal("sin(cos(3*pi*cos(3*pi)-5))+sqrt(e-sin(3*pi/2))")
|
|
57
57
|
})
|
|
58
58
|
});
|