pimath 0.0.72 → 0.0.75
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/dist/pi.js +63 -6
- package/dist/pi.js.map +1 -1
- package/dist/pi.min.js +1 -1
- package/dist/pi.min.js.map +1 -1
- package/esm/maths/algebra/polynom.js +26 -4
- package/esm/maths/algebra/polynom.js.map +1 -1
- package/esm/maths/algebra/rational.d.ts +1 -0
- package/esm/maths/algebra/rational.js +5 -0
- package/esm/maths/algebra/rational.js.map +1 -1
- package/esm/maths/expressions/numexp.js +10 -0
- package/esm/maths/expressions/numexp.js.map +1 -1
- package/esm/maths/geometry/circle.js +19 -2
- package/esm/maths/geometry/circle.js.map +1 -1
- package/esm/maths/shutingyard.js +3 -0
- package/esm/maths/shutingyard.js.map +1 -1
- package/package.json +1 -1
- package/src/maths/algebra/polynom.ts +29 -6
- package/src/maths/algebra/rational.ts +6 -0
- package/src/maths/expressions/numexp.ts +7 -0
- package/src/maths/geometry/circle.ts +16 -3
- package/src/maths/shutingyard.ts +3 -0
- package/tests/algebra/polynom.test.ts +8 -2
- package/tests/geometry/circle.test.ts +15 -0
package/src/maths/shutingyard.ts
CHANGED
|
@@ -90,6 +90,9 @@ export class Shutingyard {
|
|
|
90
90
|
'cos': {precedence: 4, associative: 'right', type: ShutingyardType.FUNCTION},
|
|
91
91
|
'tan': {precedence: 4, associative: 'right', type: ShutingyardType.FUNCTION},
|
|
92
92
|
'sqrt': {precedence: 4, associative: 'right', type: ShutingyardType.FUNCTION},
|
|
93
|
+
'nthrt': {precedence: 4, associative: 'right', type: ShutingyardType.FUNCTION},
|
|
94
|
+
'ln': {precedence: 4, associative: 'right', type: ShutingyardType.FUNCTION},
|
|
95
|
+
'log': {precedence: 4, associative: 'right', type: ShutingyardType.FUNCTION},
|
|
93
96
|
}
|
|
94
97
|
this._uniformize = false
|
|
95
98
|
} else if (this._mode === ShutingyardMode.EXPRESSION) {
|
|
@@ -3,7 +3,7 @@ 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
|
-
|
|
6
|
+
|
|
7
7
|
|
|
8
8
|
describe('Polynom tests', () => {
|
|
9
9
|
it('Parse polynom', () => {
|
|
@@ -86,7 +86,13 @@ describe('Polynom tests', () => {
|
|
|
86
86
|
let P = new Polynom('x^6-16x^5-58x^4+1592x^3-1207x^2-37576x+94864')
|
|
87
87
|
|
|
88
88
|
P.factorize()
|
|
89
|
-
expect(P.factors.map(x=>x.tex)).to.have.all.members([
|
|
89
|
+
expect(P.factors.map(x => x.tex)).to.have.all.members(['x-4', 'x-4', 'x+7', 'x+7', 'x-11', 'x-11'])
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
it('should factorize and regroupe', function () {
|
|
93
|
+
let P = new Polynom('7x(x-3)(x+5)(x^2-9)3x')
|
|
94
|
+
P.factorize()
|
|
95
|
+
expect(P.texFactors).to.be.equal('21x^{2}\\left( x+3 \\right)\\left( x-3 \\right)^{ 2 }\\left( x+5 \\right)')
|
|
90
96
|
});
|
|
91
97
|
})
|
|
92
98
|
|
|
@@ -66,4 +66,19 @@ describe('Circle', function () {
|
|
|
66
66
|
|
|
67
67
|
console.log(circle.tex)
|
|
68
68
|
})
|
|
69
|
+
|
|
70
|
+
it('should parse a line', function () {
|
|
71
|
+
let a1 = 133.33333333333331,
|
|
72
|
+
b1 = 700,
|
|
73
|
+
a2 = 134.33333333333331,
|
|
74
|
+
b2 = 700.75
|
|
75
|
+
|
|
76
|
+
let A = new Point(a1, a2),
|
|
77
|
+
B = new Point(b1, b2)
|
|
78
|
+
|
|
79
|
+
console.log(A.tex, B.tex)
|
|
80
|
+
|
|
81
|
+
let L = new Line(A, B)
|
|
82
|
+
console.log(L.tex.canonical)
|
|
83
|
+
});
|
|
69
84
|
});
|