pimath 0.0.121 → 0.0.122
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/shelf/Uncommitted_changes_before_Update_at_24_07_2023_15_31_[Default_Changelist]/shelved.patch +90 -0
- package/.idea/shelf/Uncommitted_changes_before_Update_at_24_07_2023_15_31_[Default_Changelist]1/shelved.patch +107 -0
- package/.idea/shelf/Uncommitted_changes_before_Update_at_24_07_2023_15_31__Default_Changelist_.xml +4 -0
- package/.idea/shelf/Uncommitted_changes_before_Update_at_24_07_2023_15_31__Default_Changelist_1.xml +4 -0
- package/LICENSE.md +1 -1
- package/dev/pimath.js +7924 -7924
- package/dist/pimath.js +10 -9
- package/dist/pimath.js.map +1 -1
- package/dist/pimath.min.js +1 -1
- package/dist/pimath.min.js.map +1 -1
- package/docs/assets/main.js +58 -58
- package/docs/assets/style.css +1367 -1367
- package/docs/classes/Logicalset.Logicalset.html +220 -220
- package/docs/classes/Polynom.Rational.html +390 -390
- package/docs/classes/Vector-1.Vector.html +493 -493
- package/docs/classes/Vector.Point.html +340 -340
- package/docs/classes/algebra_equation.Equation.html +795 -795
- package/docs/classes/algebra_linearSystem.LinearSystem.html +407 -407
- package/docs/classes/algebra_monom.Monom.html +966 -966
- package/docs/classes/algebra_polynom.Polynom.html +1280 -1280
- package/docs/classes/coefficients_fraction.Fraction.html +938 -938
- package/docs/classes/geometry_circle.Circle.html +475 -475
- package/docs/classes/geometry_line.Line.html +778 -778
- package/docs/classes/geometry_triangle.Triangle.html +428 -428
- package/docs/classes/numeric.Numeric.html +268 -268
- package/docs/classes/shutingyard.Shutingyard.html +258 -258
- package/docs/enums/algebra_equation.PARTICULAR_SOLUTION.html +88 -88
- package/docs/enums/geometry_line.LinePropriety.html +101 -101
- package/docs/enums/shutingyard.ShutingyardMode.html +105 -105
- package/docs/enums/shutingyard.ShutingyardType.html +119 -119
- package/docs/index.html +62 -62
- package/docs/interfaces/algebra_equation.ISolution.html +110 -110
- package/docs/interfaces/algebra_polynom.IEuclidian.html +92 -92
- package/docs/interfaces/geometry_triangle.remarquableLines.html +149 -149
- package/docs/modules/Logicalset.html +68 -68
- package/docs/modules/Polynom.html +68 -68
- package/docs/modules/Vector-1.html +68 -68
- package/docs/modules/Vector.html +68 -68
- package/docs/modules/algebra_equation.html +74 -74
- package/docs/modules/algebra_linearSystem.html +64 -64
- package/docs/modules/algebra_monom.html +69 -69
- package/docs/modules/algebra_polynom.html +74 -74
- package/docs/modules/coefficients_fraction.html +69 -69
- package/docs/modules/geometry_circle.html +64 -64
- package/docs/modules/geometry_line.html +69 -69
- package/docs/modules/geometry_triangle.html +69 -69
- package/docs/modules/numeric.html +64 -64
- package/docs/modules/shutingyard.html +83 -83
- package/docs/types/algebra_monom.literalType.html +65 -65
- package/docs/types/algebra_polynom.PolynomParsingType.html +61 -61
- package/docs/types/coefficients_fraction.FractionParsingType.html +60 -60
- package/docs/types/shutingyard.Token.html +71 -71
- package/docs/types/shutingyard.tokenType.html +76 -76
- package/docs/variables/shutingyard.tokenConstant.html +69 -69
- package/esm/index.js +1 -1
- package/esm/index.js.map +1 -1
- package/esm/maths/algebra/study.d.ts +1 -0
- package/esm/maths/algebra/study.js +9 -8
- package/esm/maths/algebra/study.js.map +1 -1
- package/package.json +5 -5
- package/src/index.ts +1 -1
- package/src/maths/algebra/study.ts +11 -9
- package/tests/numexp.test.ts +12 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pimath",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.122",
|
|
4
4
|
"description": "A math library for teacher :)",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "mocha -r ts-node/register 'tests/**/*.test.ts'",
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@types/chai": "*",
|
|
19
19
|
"@types/mocha": "*",
|
|
20
|
-
"@types/node": "^20.4.
|
|
21
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
|
22
|
-
"@typescript-eslint/parser": "^6.
|
|
20
|
+
"@types/node": "^20.4.4",
|
|
21
|
+
"@typescript-eslint/eslint-plugin": "^6.1.0",
|
|
22
|
+
"@typescript-eslint/parser": "^6.1.0",
|
|
23
23
|
"chai": "*",
|
|
24
24
|
"mocha": "*",
|
|
25
25
|
"eslint": "^8.45.0",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"ts-node": "^10.9.1",
|
|
28
28
|
"typedoc": "^0.24.8",
|
|
29
29
|
"typescript": "^5.1.6",
|
|
30
|
-
"webpack": "^5.88.
|
|
30
|
+
"webpack": "^5.88.2",
|
|
31
31
|
"webpack-bundle-analyzer": "^4.9.0",
|
|
32
32
|
"webpack-cli": "^5.1.4"
|
|
33
33
|
}
|
package/src/index.ts
CHANGED
|
@@ -91,6 +91,7 @@ export interface StudyConfig {
|
|
|
91
91
|
derivative?: boolean,
|
|
92
92
|
domain?: boolean,
|
|
93
93
|
name?: string,
|
|
94
|
+
variable?: string,
|
|
94
95
|
signs?: boolean,
|
|
95
96
|
variations?: boolean
|
|
96
97
|
}
|
|
@@ -125,6 +126,7 @@ export class Study {
|
|
|
125
126
|
|
|
126
127
|
this._config = {
|
|
127
128
|
name :'f',
|
|
129
|
+
variable: 'x',
|
|
128
130
|
domain :true,
|
|
129
131
|
asymptotes :true,
|
|
130
132
|
signs :true,
|
|
@@ -136,9 +138,11 @@ export class Study {
|
|
|
136
138
|
if (typeof config === 'string') {
|
|
137
139
|
const d = config.split(',')
|
|
138
140
|
this._config = {}
|
|
139
|
-
let n = d.filter(x=>x.includes('(x)'))
|
|
141
|
+
let n = d.filter(x=>x.includes('(') && x.includes(')'))
|
|
142
|
+
|
|
140
143
|
if(n.length===1){
|
|
141
|
-
this._config.name = n[0].split('(
|
|
144
|
+
this._config.name = n[0].split('(')[0]
|
|
145
|
+
this._config.variable = n[0].split('(')[1].split(')')[0]
|
|
142
146
|
}
|
|
143
147
|
this._config.domain = d.includes('d')
|
|
144
148
|
this._config.asymptotes = d.includes('a')
|
|
@@ -150,18 +154,16 @@ export class Study {
|
|
|
150
154
|
}
|
|
151
155
|
}
|
|
152
156
|
|
|
153
|
-
this._name = this._config?.name ?? 'f'
|
|
154
|
-
|
|
155
157
|
this.makeStudy()
|
|
156
158
|
return this
|
|
157
159
|
}
|
|
158
160
|
|
|
159
161
|
get name(): string {
|
|
160
|
-
return this.
|
|
162
|
+
return this._config.name;
|
|
161
163
|
}
|
|
162
164
|
|
|
163
165
|
set name(value: string) {
|
|
164
|
-
this.
|
|
166
|
+
this._config.name = value;
|
|
165
167
|
}
|
|
166
168
|
|
|
167
169
|
get config(): StudyConfig {
|
|
@@ -468,14 +470,14 @@ export class Study {
|
|
|
468
470
|
|
|
469
471
|
private _makeTexFromTableOfSigns = (tos: ITableOfSigns): string => {
|
|
470
472
|
let factors = tos.factors.map(x => `\\(${x.tex}\\)/1`),
|
|
471
|
-
factorsFx = `\\(${this.
|
|
473
|
+
factorsFx = `\\(${this._config.name}(${this._config.variable})\\)/1.2`,
|
|
472
474
|
zeroes = tos.zeroes
|
|
473
475
|
|
|
474
476
|
// Add the last lines "label"
|
|
475
477
|
if (tos.type === TABLE_OF_SIGNS.GROWS) {
|
|
476
|
-
factorsFx = `\\(${this.
|
|
478
|
+
factorsFx = `\\(${this._config.name}'(${this._config.variable})\\)/1.2,\\(f(x${this._config.variable})\\)/2`
|
|
477
479
|
} else if (tos.type === TABLE_OF_SIGNS.VARIATIONS) {
|
|
478
|
-
factorsFx = `\\(${this.
|
|
480
|
+
factorsFx = `\\(${this._config.name}''(${this._config.variable})\\)/1.2,\\(f(${this._config.variable})\\)/2`
|
|
479
481
|
}
|
|
480
482
|
|
|
481
483
|
// Create the tikzPicture header
|
package/tests/numexp.test.ts
CHANGED
|
@@ -61,4 +61,16 @@ describe('Numerical expression', () => { // the tests container
|
|
|
61
61
|
expect(p.evaluate({x: 16})).to.be.equal(2)
|
|
62
62
|
expect(p.evaluate({x: -16})).to.be.NaN
|
|
63
63
|
})
|
|
64
|
+
|
|
65
|
+
it('should work with constant', function () {
|
|
66
|
+
|
|
67
|
+
let k = new NumExp('2pi*x')
|
|
68
|
+
expect(k.evaluate({x: 1})).to.be.equal(6.283186)
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it('should work with constant but without variables', function () {
|
|
72
|
+
|
|
73
|
+
let k = new NumExp('2pi')
|
|
74
|
+
expect(k.evaluate()).to.be.equal(6.283186)
|
|
75
|
+
});
|
|
64
76
|
});
|