pimath 0.0.61 → 0.0.62

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 (54) hide show
  1. package/.eslintrc.js +23 -23
  2. package/.idea/misc.xml +5 -0
  3. package/.idea/php.xml +1 -1
  4. package/.idea/shelf/Uncommitted_changes_before_Update_at_17_04_2022_12_40_[Changes]/shelved.patch +21 -0
  5. package/.idea/shelf/Uncommitted_changes_before_Update_at_17_04_2022_12_40__Changes_.xml +4 -0
  6. package/dist/pi.js +14 -102
  7. package/dist/pi.js.map +1 -1
  8. package/dist/pi.min.js +1 -1
  9. package/dist/pi.min.js.map +1 -1
  10. package/docs/assets/highlight.css +78 -78
  11. package/docs/assets/main.js +52 -52
  12. package/docs/assets/style.css +1413 -1413
  13. package/docs/classes/Logicalset.Logicalset-1.html +4 -4
  14. package/docs/classes/Polynom.Rational.html +3 -3
  15. package/docs/classes/algebra_equation.Equation.html +25 -25
  16. package/docs/classes/algebra_monom.Monom.html +113 -113
  17. package/docs/classes/algebra_polynom.Polynom.html +29 -29
  18. package/docs/classes/coefficients_fraction.Fraction.html +18 -18
  19. package/docs/classes/coefficients_nthroot.NthRoot.html +2 -2
  20. package/docs/classes/geometry_circle.Circle.html +2 -2
  21. package/docs/classes/geometry_line.Line.html +2 -2
  22. package/docs/classes/geometry_triangle.Triangle.html +16 -16
  23. package/docs/classes/numeric.Numeric.html +13 -13
  24. package/docs/classes/shutingyard.Shutingyard.html +17 -17
  25. package/docs/index.html +10 -10
  26. package/docs/interfaces/algebra_equation.ISolution.html +2 -2
  27. package/docs/modules/Logicalset.html +2 -2
  28. package/docs/modules/Polynom.html +2 -2
  29. package/docs/modules/Vector.html +2 -2
  30. package/esm/maths/algebra/linearSystem.js +0 -1
  31. package/esm/maths/algebra/linearSystem.js.map +1 -1
  32. package/esm/maths/algebra/monom.js +3 -0
  33. package/esm/maths/algebra/monom.js.map +1 -1
  34. package/esm/maths/algebra/polynom.d.ts +25 -19
  35. package/esm/maths/algebra/polynom.js +7 -6
  36. package/esm/maths/algebra/polynom.js.map +1 -1
  37. package/esm/maths/algebra/rational.d.ts +15 -15
  38. package/esm/maths/algebra/rational.js +8 -99
  39. package/esm/maths/algebra/rational.js.map +1 -1
  40. package/esm/maths/algebra/study/rationalStudy.d.ts +33 -0
  41. package/esm/maths/algebra/study/rationalStudy.js +183 -0
  42. package/esm/maths/algebra/study/rationalStudy.js.map +1 -0
  43. package/esm/maths/algebra/study.d.ts +140 -0
  44. package/esm/maths/algebra/study.js +290 -0
  45. package/esm/maths/algebra/study.js.map +1 -0
  46. package/package.json +1 -1
  47. package/src/maths/algebra/linearSystem.ts +0 -1
  48. package/src/maths/algebra/monom.ts +3 -0
  49. package/src/maths/algebra/polynom.ts +33 -36
  50. package/src/maths/algebra/rational.ts +20 -132
  51. package/src/maths/algebra/study/rationalStudy.ts +208 -0
  52. package/src/maths/algebra/study.ts +384 -0
  53. package/tests/algebra/rationnal.test.ts +0 -43
  54. package/tests/algebra/study.test.ts +18 -0
package/.eslintrc.js CHANGED
@@ -1,24 +1,24 @@
1
- module.exports = {
2
- "env": {
3
- "browser": true,
4
- "es6": true
5
- },
6
- "extends": [
7
- "eslint:recommended",
8
- "plugin:@typescript-eslint/eslint-recommended"
9
- ],
10
- "globals": {
11
- "Atomics": "readonly",
12
- "SharedArrayBuffer": "readonly"
13
- },
14
- "parser": "@typescript-eslint/parser",
15
- "parserOptions": {
16
- "ecmaVersion": 2018,
17
- "sourceType": "module"
18
- },
19
- "plugins": [
20
- "@typescript-eslint"
21
- ],
22
- "rules": {
23
- }
1
+ module.exports = {
2
+ "env": {
3
+ "browser": true,
4
+ "es6": true
5
+ },
6
+ "extends": [
7
+ "eslint:recommended",
8
+ "plugin:@typescript-eslint/eslint-recommended"
9
+ ],
10
+ "globals": {
11
+ "Atomics": "readonly",
12
+ "SharedArrayBuffer": "readonly"
13
+ },
14
+ "parser": "@typescript-eslint/parser",
15
+ "parserOptions": {
16
+ "ecmaVersion": 2018,
17
+ "sourceType": "module"
18
+ },
19
+ "plugins": [
20
+ "@typescript-eslint"
21
+ ],
22
+ "rules": {
23
+ }
24
24
  };
package/.idea/misc.xml CHANGED
@@ -3,4 +3,9 @@
3
3
  <component name="JavaScriptSettings">
4
4
  <option name="languageLevel" value="ES6" />
5
5
  </component>
6
+ <component name="SwUserDefinedSpecifications">
7
+ <option name="specTypeByUrl">
8
+ <map />
9
+ </option>
10
+ </component>
6
11
  </project>
package/.idea/php.xml CHANGED
@@ -1,4 +1,4 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <project version="4">
3
- <component name="PhpProjectSharedConfiguration" php_language_level="8.0" />
3
+ <component name="PhpProjectSharedConfiguration" php_language_level="8.1" />
4
4
  </project>
@@ -0,0 +1,21 @@
1
+ Index: .idea/misc.xml
2
+ IDEA additional info:
3
+ Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP
4
+ <+><?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<project version=\"4\">\r\n <component name=\"JavaScriptSettings\">\r\n <option name=\"languageLevel\" value=\"ES6\" />\r\n </component>\r\n</project>
5
+ Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
6
+ <+>UTF-8
7
+ ===================================================================
8
+ diff --git a/.idea/misc.xml b/.idea/misc.xml
9
+ --- a/.idea/misc.xml (revision 086de26cdf0bc1b6bbd0062eb9ca7bf11d946bae)
10
+ +++ b/.idea/misc.xml (date 1650192033467)
11
+ @@ -3,4 +3,9 @@
12
+ <component name="JavaScriptSettings">
13
+ <option name="languageLevel" value="ES6" />
14
+ </component>
15
+ + <component name="SwUserDefinedSpecifications">
16
+ + <option name="specTypeByUrl">
17
+ + <map />
18
+ + </option>
19
+ + </component>
20
+ </project>
21
+
@@ -0,0 +1,4 @@
1
+ <changelist name="Uncommitted_changes_before_Update_at_17_04_2022_12_40_[Changes]" date="1650192056419" recycled="true" deleted="true">
2
+ <option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Uncommitted_changes_before_Update_at_17_04_2022_12_40_[Changes]/shelved.patch" />
3
+ <option name="DESCRIPTION" value="Uncommitted changes before Update at 17.04.2022 12:40 [Changes]" />
4
+ </changelist>
package/dist/pi.js CHANGED
@@ -932,7 +932,6 @@ class LinearSystem {
932
932
  this.log = () => {
933
933
  let str = '';
934
934
  for (let E of this._equations) {
935
- console.log(E.tex);
936
935
  str += `${E.tex}\\n}`;
937
936
  }
938
937
  return str;
@@ -1673,6 +1672,9 @@ class Monom {
1673
1672
  return this.evaluate(tmpValues);
1674
1673
  }
1675
1674
  if (typeof values === 'object') {
1675
+ if (this.variables.length === 0) {
1676
+ return this.coefficient;
1677
+ }
1676
1678
  for (let L in this._literal) {
1677
1679
  if (values[L] === undefined) {
1678
1680
  return new fraction_1.Fraction().zero();
@@ -2720,10 +2722,10 @@ class Polynom {
2720
2722
  allDividers.shift();
2721
2723
  }
2722
2724
  else {
2723
- // Add the factor
2724
- factors.push(div);
2725
2725
  // It's dividable - so make the division
2726
2726
  let result = P.euclidian(div);
2727
+ // Add the factor
2728
+ factors.push(div);
2727
2729
  // As it's dividable, get the quotient.
2728
2730
  P = result.quotient.clone();
2729
2731
  // filter all dividers that are no more suitable.
@@ -2748,11 +2750,11 @@ class Polynom {
2748
2750
  factors.push(P.clone());
2749
2751
  }
2750
2752
  // Save the factors
2751
- this.factors = factors;
2753
+ this._factors = factors;
2752
2754
  // The factors list is no more dirty
2753
2755
  this.dirty_factors = false;
2754
2756
  }
2755
- return this.factors;
2757
+ return this._factors;
2756
2758
  };
2757
2759
  this.isDividableBy = (div) => {
2758
2760
  // Quick evaluation.
@@ -3125,7 +3127,7 @@ class Polynom {
3125
3127
  return this.getZeroes();
3126
3128
  }
3127
3129
  get factors() {
3128
- return this._factors;
3130
+ return this.factorize();
3129
3131
  }
3130
3132
  set factors(value) {
3131
3133
  this.mark_as_dirty();
@@ -3273,9 +3275,7 @@ class Rational {
3273
3275
  */
3274
3276
  constructor(numerator, denominator) {
3275
3277
  this.clone = () => {
3276
- this._numerator = this._numerator.clone();
3277
- this._denominator = this._denominator.clone();
3278
- return this;
3278
+ return new Rational(this._numerator.clone(), this._denominator.clone());
3279
3279
  };
3280
3280
  this.domain = () => {
3281
3281
  let zeroes = this._denominator.getZeroes();
@@ -3340,6 +3340,10 @@ class Rational {
3340
3340
  this.subtract = (R) => {
3341
3341
  return this.add(R.clone().opposed());
3342
3342
  };
3343
+ this.euclidian = () => {
3344
+ return this._numerator.euclidian(this._denominator);
3345
+ };
3346
+ // TODO : where and how is used limits ?
3343
3347
  this.limits = (value, offset, letter) => {
3344
3348
  if (value === Infinity || value === -Infinity) {
3345
3349
  let { quotient, reminder } = this._numerator.clone().euclidian(this._denominator);
@@ -3380,101 +3384,9 @@ class Rational {
3380
3384
  }
3381
3385
  }
3382
3386
  };
3383
- this.makeTableOfSigns = () => {
3384
- // Factorize the numerator and the denominator
3385
- this._numerator.factorize();
3386
- this._denominator.factorize();
3387
- let zeroes = equation_1.Equation.makeSolutionsUnique([...this._numerator.getZeroes(), ...this._denominator.getZeroes()], true).filter(x => !isNaN(x.value)), NFactors = this._numerator.factors, DFactors = this._denominator.factors;
3388
- let tableOfSigns = [], result = [];
3389
- NFactors.forEach(factor => {
3390
- tableOfSigns.push(this._makeOneLineOfTableOfSigns(factor, zeroes, 'z'));
3391
- });
3392
- DFactors.forEach(factor => {
3393
- tableOfSigns.push(this._makeOneLineOfTableOfSigns(factor, zeroes, 'd'));
3394
- });
3395
- // Empty line
3396
- tableOfSigns.push([]);
3397
- // Add the final row as cumulative
3398
- let resultLine = tableOfSigns[0].map((x, index) => {
3399
- if (index === 0) {
3400
- return '';
3401
- }
3402
- if (index === tableOfSigns[0].length - 1) {
3403
- return '';
3404
- }
3405
- if (index % 2 === 0) {
3406
- return 't';
3407
- }
3408
- return '+';
3409
- });
3410
- for (let current of tableOfSigns) {
3411
- for (let i = 0; i < current.length; i++) {
3412
- if (i % 2 === 0) {
3413
- // t, z or d
3414
- if (resultLine[i] === 'd') {
3415
- continue;
3416
- }
3417
- if (current[i] !== 't') {
3418
- resultLine[i] = current[i];
3419
- }
3420
- }
3421
- else {
3422
- // + or -
3423
- if (current[i] === '-') {
3424
- resultLine[i] = resultLine[i] === '+' ? '-' : '+';
3425
- }
3426
- }
3427
- }
3428
- }
3429
- // Add the variation line.
3430
- // TODO: add the variation line.
3431
- tableOfSigns.push(resultLine);
3432
- let tos = {
3433
- factors: [...NFactors, ...DFactors],
3434
- zeroes: zeroes,
3435
- signs: tableOfSigns,
3436
- tex: ''
3437
- };
3438
- this._makeTexFromTableOfSigns(tos);
3439
- return tos;
3440
- };
3441
- this._makeTexFromTableOfSigns = (tos) => {
3442
- let tex = `\\begin{tikzpicture}
3443
- \\tkzTabInit[lgt=3,espcl=2,deltacl=0]{/1.2,\\(${tos.factors.map(x => x.tex).join('\\)/1,\\(')}\\)/1,/.1,\\(f(x)\\)/1.2}{{\\scriptsize \\hspace{1cm} \\(-\\infty\\)},\\(${tos.zeroes.map(x => x.tex).join('\\),\\(')}\\),{\\scriptsize \\hspace{-1cm} \\(+\\infty\\)}}`;
3444
- tos.signs.forEach(list => {
3445
- tex += (`\n\\tkzTabLine{${list.join(',')}}`);
3446
- });
3447
- tex += `\n\\end{tikzpicture}`;
3448
- tos.tex = tex;
3449
- return tex;
3450
- };
3451
- this._makeOneLineOfTableOfSigns = (factor, zeroes, zeroSign) => {
3452
- let oneLine = [], currentZero = factor.getZeroes().map(x => x.tex);
3453
- // First +/- sign, before the first zero
3454
- oneLine.push('');
3455
- if (factor.degree().isZero()) {
3456
- oneLine.push(factor.monoms[0].coefficient.sign() === 1 ? '+' : '-');
3457
- }
3458
- else {
3459
- oneLine.push(factor.evaluate(zeroes[0].value - 1).sign() === 1 ? '+' : '-');
3460
- }
3461
- for (let i = 0; i < zeroes.length; i++) {
3462
- // Add the zero if it's the current one
3463
- oneLine.push(currentZero.includes(zeroes[i].tex) ? zeroSign : 't');
3464
- // + / - sign after the current zero
3465
- if (i < zeroes.length - 1) {
3466
- oneLine.push(factor.evaluate((zeroes[i].value + zeroes[i + 1].value) / 2).sign() === 1 ? '+' : '-');
3467
- }
3468
- else if (i === zeroes.length - 1) {
3469
- oneLine.push(factor.evaluate(zeroes[i].value + 1).sign() === 1 ? '+' : '-');
3470
- }
3471
- }
3472
- oneLine.push('');
3473
- return oneLine;
3474
- };
3475
3387
  this.evaluate = (values) => {
3476
3388
  const r = new fraction_1.Fraction().zero();
3477
- let N = this._numerator.evaluate(values), D = this._numerator.evaluate(values);
3389
+ let N = this._numerator.evaluate(values), D = this._denominator.evaluate(values);
3478
3390
  return N.divide(D);
3479
3391
  };
3480
3392
  if (numerator instanceof polynom_1.Polynom) {