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.
Files changed (64) hide show
  1. package/.eslintrc.js +23 -23
  2. package/.idea/shelf/Uncommitted_changes_before_Update_at_24_07_2023_15_31_[Default_Changelist]/shelved.patch +90 -0
  3. package/.idea/shelf/Uncommitted_changes_before_Update_at_24_07_2023_15_31_[Default_Changelist]1/shelved.patch +107 -0
  4. package/.idea/shelf/Uncommitted_changes_before_Update_at_24_07_2023_15_31__Default_Changelist_.xml +4 -0
  5. package/.idea/shelf/Uncommitted_changes_before_Update_at_24_07_2023_15_31__Default_Changelist_1.xml +4 -0
  6. package/LICENSE.md +1 -1
  7. package/dev/pimath.js +7924 -7924
  8. package/dist/pimath.js +10 -9
  9. package/dist/pimath.js.map +1 -1
  10. package/dist/pimath.min.js +1 -1
  11. package/dist/pimath.min.js.map +1 -1
  12. package/docs/assets/main.js +58 -58
  13. package/docs/assets/style.css +1367 -1367
  14. package/docs/classes/Logicalset.Logicalset.html +220 -220
  15. package/docs/classes/Polynom.Rational.html +390 -390
  16. package/docs/classes/Vector-1.Vector.html +493 -493
  17. package/docs/classes/Vector.Point.html +340 -340
  18. package/docs/classes/algebra_equation.Equation.html +795 -795
  19. package/docs/classes/algebra_linearSystem.LinearSystem.html +407 -407
  20. package/docs/classes/algebra_monom.Monom.html +966 -966
  21. package/docs/classes/algebra_polynom.Polynom.html +1280 -1280
  22. package/docs/classes/coefficients_fraction.Fraction.html +938 -938
  23. package/docs/classes/geometry_circle.Circle.html +475 -475
  24. package/docs/classes/geometry_line.Line.html +778 -778
  25. package/docs/classes/geometry_triangle.Triangle.html +428 -428
  26. package/docs/classes/numeric.Numeric.html +268 -268
  27. package/docs/classes/shutingyard.Shutingyard.html +258 -258
  28. package/docs/enums/algebra_equation.PARTICULAR_SOLUTION.html +88 -88
  29. package/docs/enums/geometry_line.LinePropriety.html +101 -101
  30. package/docs/enums/shutingyard.ShutingyardMode.html +105 -105
  31. package/docs/enums/shutingyard.ShutingyardType.html +119 -119
  32. package/docs/index.html +62 -62
  33. package/docs/interfaces/algebra_equation.ISolution.html +110 -110
  34. package/docs/interfaces/algebra_polynom.IEuclidian.html +92 -92
  35. package/docs/interfaces/geometry_triangle.remarquableLines.html +149 -149
  36. package/docs/modules/Logicalset.html +68 -68
  37. package/docs/modules/Polynom.html +68 -68
  38. package/docs/modules/Vector-1.html +68 -68
  39. package/docs/modules/Vector.html +68 -68
  40. package/docs/modules/algebra_equation.html +74 -74
  41. package/docs/modules/algebra_linearSystem.html +64 -64
  42. package/docs/modules/algebra_monom.html +69 -69
  43. package/docs/modules/algebra_polynom.html +74 -74
  44. package/docs/modules/coefficients_fraction.html +69 -69
  45. package/docs/modules/geometry_circle.html +64 -64
  46. package/docs/modules/geometry_line.html +69 -69
  47. package/docs/modules/geometry_triangle.html +69 -69
  48. package/docs/modules/numeric.html +64 -64
  49. package/docs/modules/shutingyard.html +83 -83
  50. package/docs/types/algebra_monom.literalType.html +65 -65
  51. package/docs/types/algebra_polynom.PolynomParsingType.html +61 -61
  52. package/docs/types/coefficients_fraction.FractionParsingType.html +60 -60
  53. package/docs/types/shutingyard.Token.html +71 -71
  54. package/docs/types/shutingyard.tokenType.html +76 -76
  55. package/docs/variables/shutingyard.tokenConstant.html +69 -69
  56. package/esm/index.js +1 -1
  57. package/esm/index.js.map +1 -1
  58. package/esm/maths/algebra/study.d.ts +1 -0
  59. package/esm/maths/algebra/study.js +9 -8
  60. package/esm/maths/algebra/study.js.map +1 -1
  61. package/package.json +5 -5
  62. package/src/index.ts +1 -1
  63. package/src/maths/algebra/study.ts +11 -9
  64. 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.121",
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.2",
21
- "@typescript-eslint/eslint-plugin": "^6.0.0",
22
- "@typescript-eslint/parser": "^6.0.0",
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.1",
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
@@ -39,4 +39,4 @@ export const PiMath = {
39
39
  }
40
40
  };
41
41
 
42
- (<any>window).PiMath = PiMath
42
+ (<any>window).Pi = PiMath
@@ -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('(x)')[0]
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._name;
162
+ return this._config.name;
161
163
  }
162
164
 
163
165
  set name(value: string) {
164
- this._name = value;
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._name}(x)\\)/1.2`,
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._name}'(x)\\)/1.2,\\(f(x)\\)/2`
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._name}''(x)\\)/1.2,\\(f(x)\\)/2`
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
@@ -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
  });