pimath 0.0.120 → 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 (175) hide show
  1. package/.idea/PI.iml +7 -1
  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 +7929 -0
  8. package/dev/pimath.js.map +1 -0
  9. package/dist/{pi.js → pimath.js} +7613 -7840
  10. package/dist/pimath.js.map +1 -0
  11. package/dist/pimath.min.js +2 -0
  12. package/dist/pimath.min.js.map +1 -0
  13. package/docs/assets/main.js +58 -58
  14. package/docs/assets/search.js +1 -1
  15. package/docs/assets/style.css +1367 -1280
  16. package/docs/classes/Logicalset.Logicalset.html +221 -212
  17. package/docs/classes/Polynom.Rational.html +391 -388
  18. package/docs/classes/Vector-1.Vector.html +494 -448
  19. package/docs/classes/Vector.Point.html +341 -342
  20. package/docs/classes/algebra_equation.Equation.html +796 -753
  21. package/docs/classes/algebra_linearSystem.LinearSystem.html +408 -397
  22. package/docs/classes/algebra_monom.Monom.html +967 -910
  23. package/docs/classes/algebra_polynom.Polynom.html +1281 -1260
  24. package/docs/classes/coefficients_fraction.Fraction.html +939 -931
  25. package/docs/classes/geometry_circle.Circle.html +476 -476
  26. package/docs/classes/geometry_line.Line.html +779 -719
  27. package/docs/classes/geometry_triangle.Triangle.html +429 -420
  28. package/docs/classes/numeric.Numeric.html +269 -263
  29. package/docs/classes/shutingyard.Shutingyard.html +259 -248
  30. package/docs/enums/algebra_equation.PARTICULAR_SOLUTION.html +89 -88
  31. package/docs/enums/geometry_line.LinePropriety.html +102 -102
  32. package/docs/enums/shutingyard.ShutingyardMode.html +106 -102
  33. package/docs/enums/shutingyard.ShutingyardType.html +120 -116
  34. package/docs/index.html +63 -65
  35. package/docs/interfaces/algebra_equation.ISolution.html +111 -109
  36. package/docs/interfaces/algebra_polynom.IEuclidian.html +93 -92
  37. package/docs/interfaces/geometry_triangle.remarquableLines.html +150 -150
  38. package/docs/modules/Logicalset.html +69 -74
  39. package/docs/modules/Polynom.html +69 -74
  40. package/docs/modules/Vector-1.html +69 -74
  41. package/docs/modules/Vector.html +69 -74
  42. package/docs/modules/algebra_equation.html +75 -81
  43. package/docs/modules/algebra_linearSystem.html +65 -71
  44. package/docs/modules/algebra_monom.html +70 -76
  45. package/docs/modules/algebra_polynom.html +75 -81
  46. package/docs/modules/coefficients_fraction.html +70 -76
  47. package/docs/modules/geometry_circle.html +65 -71
  48. package/docs/modules/geometry_line.html +70 -76
  49. package/docs/modules/geometry_triangle.html +70 -76
  50. package/docs/modules/numeric.html +65 -71
  51. package/docs/modules/shutingyard.html +84 -90
  52. package/docs/types/algebra_monom.literalType.html +66 -70
  53. package/docs/types/algebra_polynom.PolynomParsingType.html +62 -66
  54. package/docs/types/coefficients_fraction.FractionParsingType.html +61 -65
  55. package/docs/types/shutingyard.Token.html +72 -76
  56. package/docs/types/shutingyard.tokenType.html +77 -81
  57. package/docs/variables/shutingyard.tokenConstant.html +70 -74
  58. package/esm/index.d.ts +38 -41
  59. package/esm/index.js +43 -46
  60. package/esm/index.js.map +1 -1
  61. package/esm/maths/algebra/equation.d.ts +119 -117
  62. package/esm/maths/algebra/equation.js +796 -785
  63. package/esm/maths/algebra/equation.js.map +1 -1
  64. package/esm/maths/algebra/linearSystem.d.ts +39 -38
  65. package/esm/maths/algebra/linearSystem.js +278 -262
  66. package/esm/maths/algebra/linearSystem.js.map +1 -1
  67. package/esm/maths/algebra/logicalset.d.ts +28 -28
  68. package/esm/maths/algebra/logicalset.js +157 -157
  69. package/esm/maths/algebra/monom.d.ts +206 -206
  70. package/esm/maths/algebra/monom.js +908 -908
  71. package/esm/maths/algebra/monom.js.map +1 -1
  72. package/esm/maths/algebra/polynom.d.ts +157 -157
  73. package/esm/maths/algebra/polynom.js +1277 -1277
  74. package/esm/maths/algebra/rational.d.ts +45 -45
  75. package/esm/maths/algebra/rational.js +183 -183
  76. package/esm/maths/algebra/study/rationalStudy.d.ts +28 -28
  77. package/esm/maths/algebra/study/rationalStudy.js +243 -243
  78. package/esm/maths/algebra/study.d.ts +143 -142
  79. package/esm/maths/algebra/study.js +378 -377
  80. package/esm/maths/algebra/study.js.map +1 -1
  81. package/esm/maths/coefficients/fraction.d.ts +90 -90
  82. package/esm/maths/coefficients/fraction.js +516 -516
  83. package/esm/maths/coefficients/fraction.js.map +1 -1
  84. package/esm/maths/coefficients/nthRoot.d.ts +23 -23
  85. package/esm/maths/coefficients/nthRoot.js +136 -136
  86. package/esm/maths/geometry/circle.d.ts +45 -45
  87. package/esm/maths/geometry/circle.js +323 -323
  88. package/esm/maths/geometry/line.d.ts +99 -99
  89. package/esm/maths/geometry/line.js +481 -481
  90. package/esm/maths/geometry/line.js.map +1 -1
  91. package/esm/maths/geometry/point.d.ts +34 -34
  92. package/esm/maths/geometry/point.js +166 -166
  93. package/esm/maths/geometry/point.js.map +1 -1
  94. package/esm/maths/geometry/triangle.d.ts +85 -85
  95. package/esm/maths/geometry/triangle.js +268 -268
  96. package/esm/maths/geometry/vector.d.ts +41 -41
  97. package/esm/maths/geometry/vector.js +197 -197
  98. package/esm/maths/geometry/vector.js.map +1 -1
  99. package/esm/maths/numeric.d.ts +28 -28
  100. package/esm/maths/numeric.js +180 -180
  101. package/esm/maths/numexp.d.ts +19 -0
  102. package/esm/maths/numexp.js +186 -0
  103. package/esm/maths/numexp.js.map +1 -0
  104. package/esm/maths/randomization/random.d.ts +23 -23
  105. package/esm/maths/randomization/random.js +78 -78
  106. package/esm/maths/randomization/random.js.map +1 -1
  107. package/esm/maths/randomization/randomCore.d.ts +7 -7
  108. package/esm/maths/randomization/randomCore.js +21 -21
  109. package/esm/maths/randomization/rndFraction.d.ts +12 -12
  110. package/esm/maths/randomization/rndFraction.js +43 -43
  111. package/esm/maths/randomization/rndGeometryLine.d.ts +12 -12
  112. package/esm/maths/randomization/rndGeometryLine.js +45 -45
  113. package/esm/maths/randomization/rndGeometryPoint.d.ts +12 -12
  114. package/esm/maths/randomization/rndGeometryPoint.js +60 -60
  115. package/esm/maths/randomization/rndHelpers.d.ts +23 -23
  116. package/esm/maths/randomization/rndHelpers.js +76 -76
  117. package/esm/maths/randomization/rndMonom.d.ts +12 -12
  118. package/esm/maths/randomization/rndMonom.js +52 -52
  119. package/esm/maths/randomization/rndPolynom.d.ts +13 -13
  120. package/esm/maths/randomization/rndPolynom.js +74 -74
  121. package/esm/maths/randomization/rndTypes.d.ts +34 -34
  122. package/esm/maths/randomization/rndTypes.js +2 -2
  123. package/esm/maths/shutingyard.d.ts +59 -59
  124. package/esm/maths/shutingyard.js +442 -442
  125. package/esm/maths/shutingyard.js.map +1 -1
  126. package/package.json +11 -11
  127. package/public/index.html +50 -81
  128. package/public/playground.html +7 -8
  129. package/src/index.ts +1 -4
  130. package/src/maths/algebra/equation.ts +16 -0
  131. package/src/maths/algebra/linearSystem.ts +20 -0
  132. package/src/maths/algebra/study.ts +12 -10
  133. package/src/maths/{expressions/numexp.ts → numexp.ts} +2 -2
  134. package/tests/algebra/equation.test.ts +19 -5
  135. package/tests/algebra/linear.test.ts +3 -11
  136. package/tests/algebra/polynom.test.ts +7 -8
  137. package/tests/algebra/rationnal.test.ts +1 -1
  138. package/tests/algebra/study.test.ts +2 -9
  139. package/tests/coefficients/fraction.test.ts +8 -8
  140. package/tests/custom.test.ts +33 -37
  141. package/tests/numeric.test.ts +1 -2
  142. package/tests/numexp.test.ts +13 -5
  143. package/tests/shutingyard.test.ts +3 -3
  144. package/webpack-production-min.config.js +1 -1
  145. package/webpack-production.config.js +1 -1
  146. package/webpack.config.js +1 -1
  147. package/dist/pi.js.map +0 -1
  148. package/dist/pi.min.js +0 -2
  149. package/dist/pi.min.js.map +0 -1
  150. package/docs/classes/expressions_numexp.NumExp.html +0 -236
  151. package/docs/classes/expressions_polynomexp.PolynomExpFactor.html +0 -317
  152. package/docs/classes/expressions_polynomexp.PolynomExpProduct.html +0 -285
  153. package/docs/modules/expressions_numexp.html +0 -71
  154. package/docs/modules/expressions_polynomexp.html +0 -73
  155. package/docs/modules.html +0 -76
  156. package/graph.svg +0 -1033
  157. package/src/maths/expressions/ExpressionTree.ts +0 -172
  158. package/src/maths/expressions/expression.ts +0 -286
  159. package/src/maths/expressions/expressionFactor.ts +0 -190
  160. package/src/maths/expressions/expressionMember.ts +0 -233
  161. package/src/maths/expressions/expressionOperators.ts +0 -49
  162. package/src/maths/expressions/expressionParser.ts +0 -295
  163. package/src/maths/expressions/factors/ExpFactor.ts +0 -39
  164. package/src/maths/expressions/factors/ExpFactorConstant.ts +0 -60
  165. package/src/maths/expressions/factors/ExpFactorExponential.ts +0 -26
  166. package/src/maths/expressions/factors/ExpFactorNumber.ts +0 -72
  167. package/src/maths/expressions/factors/ExpFactorPower.ts +0 -42
  168. package/src/maths/expressions/factors/ExpFactorTrigo.ts +0 -53
  169. package/src/maths/expressions/factors/ExpFactorVariable.ts +0 -45
  170. package/src/maths/expressions/internals.ts +0 -14
  171. package/src/maths/expressions/polynomexp.bkp.ts +0 -221
  172. package/src/maths/expressions/polynomexp.ts +0 -310
  173. package/tests/expressions/expressions.test.ts +0 -145
  174. package/tests/expressions/expressiontree.test.ts +0 -11
  175. package/tests/polynomexp.test.ts +0 -12
package/.idea/PI.iml CHANGED
@@ -1,7 +1,13 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <module type="WEB_MODULE" version="4">
3
3
  <component name="NewModuleRootManager">
4
- <content url="file://$MODULE_DIR$" />
4
+ <content url="file://$MODULE_DIR$">
5
+ <sourceFolder url="file://$MODULE_DIR$" isTestSource="false" />
6
+ <excludeFolder url="file://$MODULE_DIR$/docs" />
7
+ <excludeFolder url="file://$MODULE_DIR$/esm" />
8
+ <excludeFolder url="file://$MODULE_DIR$/public" />
9
+ <excludeFolder url="file://$MODULE_DIR$/dev" />
10
+ </content>
5
11
  <orderEntry type="inheritedJdk" />
6
12
  <orderEntry type="sourceFolder" forTests="false" />
7
13
  </component>
@@ -0,0 +1,90 @@
1
+ Index: src/maths/expressions/numexp.ts
2
+ IDEA additional info:
3
+ Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP
4
+ <+>import {Shutingyard, ShutingyardMode, ShutingyardType, tokenConstant} from \"../shutingyard\";\r\nimport {Fraction} from \"../coefficients/fraction\";\r\n\r\nexport class NumExp {\r\n private _rpn: { token: string, tokenType: string }[]\r\n private _expression: string\r\n private _isValid: boolean\r\n\r\n constructor(value: string, uniformize?:boolean) {\r\n this._expression = value\r\n try {\r\n this._rpn = new Shutingyard(ShutingyardMode.NUMERIC).parse(value, uniformize || uniformize===undefined).rpn\r\n }catch(e){\r\n this._rpn = null\r\n this._isValid = false\r\n }\r\n }\r\n\r\n get rpn(): { token: string; tokenType: string }[] {\r\n return this._rpn;\r\n }\r\n\r\n get isValid(): boolean {\r\n if(this._isValid===undefined){\r\n try {\r\n const v = this.evaluate({x: 0})\r\n }catch{\r\n this._isValid = false\r\n }\r\n }\r\n return this._isValid\r\n }\r\n\r\n set isValid(value: boolean){\r\n this._isValid = value\r\n }\r\n\r\n get expression(): string {\r\n return this._expression;\r\n }\r\n\r\n private _extractDecimalPart(value: number): string {\r\n let decimal = value.toString()\r\n\r\n if (!decimal.includes('.')) {\r\n return ''\r\n }\r\n\r\n decimal = decimal.split('.')[1]\r\n\r\n return decimal.substring(0, decimal.length - 2)\r\n }\r\n\r\n private _numberCorrection(value: number): number {\r\n // Must modify the number if it's like:\r\n // a: 3.0000000000000003\r\n // b: 3.9999999999999994\r\n // remove the last character\r\n // check if around n last characters are either 0 or 9\r\n // if it is, 'round' the number.\r\n\r\n const epsilon = 0.00000000000001,\r\n number_of_digits = 6\r\n\r\n const decimal = this._extractDecimalPart(value)\r\n if(decimal===''){return value}\r\n\r\n const n9 = decimal.match(/9+$/g)\r\n const n0 = decimal.match(/0+$/g)\r\n\r\n if (n9 && n9[0].length >= number_of_digits) {\r\n // New tested values.\r\n const mod = this._extractDecimalPart(value + epsilon),\r\n mod0 = mod.match(/0+$/g)\r\n\r\n if(mod0 && mod0[0].length>= number_of_digits){\r\n // The value can be changed. Remove all zeros!\r\n return +((value+epsilon).toString().split(mod0[0])[0])\r\n }\r\n }\r\n\r\n if (n0 && n0[0].length >= number_of_digits) {\r\n // New tested values.\r\n const mod = this._extractDecimalPart(value - epsilon),\r\n mod9 = mod.match(/9+$/g)\r\n\r\n if(mod9 && mod9[0].length>= number_of_digits){\r\n // The value can be changed. Remove all nines!\r\n return +(value.toString().split(n0[0])[0])\r\n }\r\n }\r\n\r\n return value\r\n }\r\n\r\n private _addToStack(stack:number[], value: number): void {\r\n stack.push(this._numberCorrection(value))\r\n }\r\n\r\n evaluate(values: { [Key: string]: number }): number {\r\n const stack: number[] = []\r\n\r\n if(this._rpn===null){\r\n this._isValid = false\r\n return 0\r\n }\r\n\r\n this.isValid = true\r\n\r\n for (const element of this._rpn) {\r\n if (element.tokenType === ShutingyardType.COEFFICIENT) {\r\n // May be a numeric value or a Fraction.\r\n if (!isNaN(+element.token)) {\r\n this._addToStack(stack, +element.token)\r\n } else {\r\n this._addToStack(stack, new Fraction(element.token).value)\r\n }\r\n } else if (element.tokenType === ShutingyardType.VARIABLE) {\r\n if (values[element.token] !== undefined) {\r\n this._addToStack(stack, +values[element.token])\r\n }\r\n } else if (element.tokenType === ShutingyardType.CONSTANT) {\r\n this._addToStack(stack, tokenConstant[element.token])\r\n } else if (element.tokenType === ShutingyardType.OPERATION) {\r\n if (element.token === '*') {\r\n const b = stack.pop(),\r\n a = stack.pop()\r\n if(a === undefined || b === undefined){this.isValid = false}\r\n this._addToStack(stack, a * b)\r\n } else if (element.token === '/') {\r\n const b = stack.pop(),\r\n a = stack.pop()\r\n if(a === undefined || b === undefined){this.isValid = false}\r\n this._addToStack(stack, a / b)\r\n } else if (element.token === '+') {\r\n const b = stack.pop(),\r\n a = stack.pop()\r\n if(a === undefined || b === undefined){this.isValid = false}\r\n this._addToStack(stack, (+a) + (+b))\r\n } else if (element.token === '-') {\r\n const b = stack.pop(),\r\n a = stack.pop() || 0\r\n if(b === undefined){this.isValid = false}\r\n this._addToStack(stack, a - b)\r\n } else if (element.token === '^') {\r\n const b = stack.pop(),\r\n a = stack.pop()\r\n if(a === undefined || b === undefined){this.isValid = false}\r\n this._addToStack(stack, Math.pow(a, b))\r\n }\r\n } else if (element.tokenType === ShutingyardType.FUNCTION) {\r\n const a = stack.pop()\r\n if(a === undefined){this.isValid = false}\r\n if (element.token === 'sin') {\r\n this._addToStack(stack, Math.sin(a))\r\n } else if (element.token === 'cos') {\r\n this._addToStack(stack, Math.cos(a))\r\n } else if (element.token === 'tan') {\r\n this._addToStack(stack, Math.tan(a))\r\n } else if(element.token === 'sqrt') {\r\n this._addToStack(stack, Math.sqrt(a))\r\n }else if(element.token ==='nthrt') {\r\n // TODO: support nthrt in num. exp.\r\n let b = stack.pop()\r\n if(a%2===0 && b<0){\r\n this._addToStack(stack, NaN)\r\n }else {\r\n this._addToStack(stack, (b < 0 ? -1 : 1) * Math.pow(Math.abs(b), 1 / a))\r\n }\r\n } else if(element.token === 'ln'){\r\n this._addToStack(stack, Math.log(a))\r\n } else if(element.token === 'log') {\r\n this._addToStack(stack, Math.log10(a))\r\n }\r\n }\r\n }\r\n\r\n if (stack.length === 1) {\r\n return stack[0]\r\n } else {\r\n throw `There was a problem parsing: ${this._expression}`\r\n }\r\n }\r\n}\r\n
5
+ ===================================================================
6
+ diff --git a/src/maths/expressions/numexp.ts b/src/maths/expressions/numexp.ts
7
+ --- a/src/maths/expressions/numexp.ts
8
+ +++ b/src/maths/expressions/numexp.ts
9
+ @@ -51,46 +51,47 @@
10
+ return decimal.substring(0, decimal.length - 2)
11
+ }
12
+
13
+ - private _numberCorrection(value: number): number {
14
+ + private _numberCorrection(value: number, number_of_digits=6): number {
15
+ + return +value.toFixed(number_of_digits);
16
+ // Must modify the number if it's like:
17
+ // a: 3.0000000000000003
18
+ // b: 3.9999999999999994
19
+ // remove the last character
20
+ // check if around n last characters are either 0 or 9
21
+ // if it is, 'round' the number.
22
+ -
23
+ - const epsilon = 0.00000000000001,
24
+ - number_of_digits = 6
25
+ -
26
+ - const decimal = this._extractDecimalPart(value)
27
+ - if(decimal===''){return value}
28
+ -
29
+ - const n9 = decimal.match(/9+$/g)
30
+ - const n0 = decimal.match(/0+$/g)
31
+ -
32
+ - if (n9 && n9[0].length >= number_of_digits) {
33
+ - // New tested values.
34
+ - const mod = this._extractDecimalPart(value + epsilon),
35
+ - mod0 = mod.match(/0+$/g)
36
+ -
37
+ - if(mod0 && mod0[0].length>= number_of_digits){
38
+ - // The value can be changed. Remove all zeros!
39
+ - return +((value+epsilon).toString().split(mod0[0])[0])
40
+ - }
41
+ - }
42
+ -
43
+ - if (n0 && n0[0].length >= number_of_digits) {
44
+ - // New tested values.
45
+ - const mod = this._extractDecimalPart(value - epsilon),
46
+ - mod9 = mod.match(/9+$/g)
47
+ -
48
+ - if(mod9 && mod9[0].length>= number_of_digits){
49
+ - // The value can be changed. Remove all nines!
50
+ - return +(value.toString().split(n0[0])[0])
51
+ - }
52
+ - }
53
+ -
54
+ - return value
55
+ + //
56
+ + // const epsilon = 0.00000000000001,
57
+ + // number_of_digits = 6
58
+ + //
59
+ + // const decimal = this._extractDecimalPart(value)
60
+ + // if(decimal===''){return value}
61
+ + //
62
+ + // const n9 = decimal.match(/9+$/g)
63
+ + // const n0 = decimal.match(/0+$/g)
64
+ + //
65
+ + // if (n9 && n9[0].length >= number_of_digits) {
66
+ + // // New tested values.
67
+ + // const mod = this._extractDecimalPart(value + epsilon),
68
+ + // mod0 = mod.match(/0+$/g)
69
+ + //
70
+ + // if(mod0 && mod0[0].length>= number_of_digits){
71
+ + // // The value can be changed. Remove all zeros!
72
+ + // return +((value+epsilon).toString().split(mod0[0])[0])
73
+ + // }
74
+ + // }
75
+ + //
76
+ + // if (n0 && n0[0].length >= number_of_digits) {
77
+ + // // New tested values.
78
+ + // const mod = this._extractDecimalPart(value - epsilon),
79
+ + // mod9 = mod.match(/9+$/g)
80
+ + //
81
+ + // if(mod9 && mod9[0].length>= number_of_digits){
82
+ + // // The value can be changed. Remove all nines!
83
+ + // return +(value.toString().split(n0[0])[0])
84
+ + // }
85
+ + // }
86
+ + //
87
+ + // return value
88
+ }
89
+
90
+ private _addToStack(stack:number[], value: number): void {
@@ -0,0 +1,107 @@
1
+ Index: src/index.ts
2
+ IDEA additional info:
3
+ Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP
4
+ <+>import {Numeric} from \"./maths/numeric\";\r\nimport {NumExp} from \"./maths/expressions/numexp\";\r\nimport {Shutingyard} from \"./maths/shutingyard\";\r\nimport {Random} from \"./maths/randomization/random\";\r\nimport {Fraction} from \"./maths/coefficients/fraction\";\r\nimport {NthRoot} from \"./maths/coefficients/nthRoot\";\r\nimport {Monom} from \"./maths/algebra/monom\";\r\nimport {Polynom} from \"./maths/algebra/polynom\";\r\nimport {Equation} from \"./maths/algebra/equation\";\r\nimport {LinearSystem} from \"./maths/algebra/linearSystem\";\r\nimport {Rational} from \"./maths/algebra/rational\";\r\nimport {Logicalset} from \"./maths/algebra/logicalset\";\r\nimport {PolynomExpFactor, PolynomExpProduct} from \"./maths/expressions/polynomexp\";\r\nimport {Vector} from \"./maths/geometry/vector\";\r\nimport {Line} from \"./maths/geometry/line\";\r\nimport {Triangle} from \"./maths/geometry/triangle\";\r\nimport {Circle} from \"./maths/geometry/circle\";\r\nimport {Point} from \"./maths/geometry/point\";\r\n\r\n// Expose as global\r\nexport const PiMath = {\r\n ShutingYard: Shutingyard,\r\n Numeric: Numeric,\r\n NumExp: NumExp,\r\n Fraction: Fraction,\r\n Root: NthRoot,\r\n Monom: Monom,\r\n Polynom: Polynom,\r\n Equation: Equation,\r\n LinearSystem: LinearSystem,\r\n Rational: Rational,\r\n Logicalset: Logicalset,\r\n Random: Random,\r\n PolynomExpFactor: PolynomExpFactor,\r\n PolynomExpProduct: PolynomExpProduct,\r\n Geometry: {\r\n Vector: Vector,\r\n Point: Point,\r\n Line: Line,\r\n Triangle: Triangle,\r\n Circle: Circle\r\n }\r\n};\r\n\r\n(<any>window).Pi = PiMath\r\n
5
+ Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
6
+ <+>UTF-8
7
+ ===================================================================
8
+ diff --git a/src/index.ts b/src/index.ts
9
+ --- a/src/index.ts
10
+ +++ b/src/index.ts
11
+ @@ -42,4 +42,5 @@
12
+ }
13
+ };
14
+
15
+ -(<any>window).Pi = PiMath
16
+ +// rename window.Pi to window.PiMath
17
+ +(<any>window).PiMath = PiMath
18
+ Index: tests/numexp.test.ts
19
+ IDEA additional info:
20
+ Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP
21
+ <+>import {expect} from 'chai';\r\nimport {NumExp} from \"../src/maths/expressions/numexp\";\r\nimport {Numeric} from \"../src/maths/numeric\";\r\n\r\ndescribe('Numerical expression', () => { // the tests container\r\n it('RPN for numerical expression', () => {\r\n const RPN = new NumExp('3*x+5').rpn\r\n expect(RPN.map(x => x.token)).to.have.all.members(['3', 'x', '*', '5', '+'])\r\n\r\n const RPN2 = new NumExp('-3*x^2-5').rpn\r\n expect(RPN2.map(x => x.token)).to.have.all.members(['3', 'x', '2', '^', '*', '-', '5', '-'])\r\n })\r\n\r\n it('Evaluate for numerical expression', () => {\r\n const expr = new NumExp('3*x+5')\r\n expect(expr.evaluate({x: 5})).to.be.equal(20)\r\n\r\n const expr2 = new NumExp('-3*x^2-5')\r\n expect(expr2.evaluate({x: -2})).to.be.equal(-17)\r\n })\r\n\r\n it('Evaluation simple mathematical functions', () => {\r\n const expr = new NumExp('sqrt(x)')\r\n expect(expr.evaluate({x: 9})).to.be.equal(3)\r\n })\r\n\r\n it('should detect invalid rpn parsing', function () {\r\n const exprValid = new NumExp('3*sin(x)'),\r\n exprInvalid = new NumExp('3*sin')\r\n\r\n expect(exprValid.isValid).to.be.true\r\n expect(exprInvalid.isValid).to.be.false\r\n });\r\n\r\n it('souldd detect invalid expression withouth crahsing', function() {\r\n const exprPourrie = new NumExp('3xsi'),\r\n exprOk = new NumExp('3xsin(x)')\r\n\r\n expect(exprPourrie.isValid).to.be.false\r\n expect(exprOk.isValid).to.be.true\r\n })\r\n\r\n it('should parse without mult sign', function () {\r\n\r\n let a = 1 / 5\r\n\r\n const expr = new NumExp('3x-5', true)\r\n expect(expr.isValid).to.be.true\r\n expect(expr.evaluate({x: 2})).to.be.equal(1)\r\n\r\n const expr2 = new NumExp('3*x-5', true)\r\n expect(expr2.isValid).to.be.true\r\n expect(expr2.evaluate({x: 2})).to.be.equal(1)\r\n });\r\n\r\n it('should calculate sqrt from exp', function(){\r\n // let a = new NumExp('x^(1/3)')\r\n // console.log(a.evaluate({x: 8}))\r\n\r\n let k = new NumExp('nthrt(x,3)')\r\n expect(k.evaluate({x: -8})).to.be.equal(-2)\r\n expect(k.evaluate({x: 27})).to.be.equal(3)\r\n\r\n let p = new NumExp('nthrt(x,4)')\r\n expect(p.evaluate({x: 16})).to.be.equal(2)\r\n expect(p.evaluate({x: -16})).to.be.NaN\r\n })\r\n});\r\n
22
+ Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
23
+ <+>UTF-8
24
+ ===================================================================
25
+ diff --git a/tests/numexp.test.ts b/tests/numexp.test.ts
26
+ --- a/tests/numexp.test.ts
27
+ +++ b/tests/numexp.test.ts
28
+ @@ -65,4 +65,16 @@
29
+ expect(p.evaluate({x: 16})).to.be.equal(2)
30
+ expect(p.evaluate({x: -16})).to.be.NaN
31
+ })
32
+ +
33
+ + it('should work with constant', function () {
34
+ +
35
+ + let k = new NumExp('2pi*x')
36
+ + expect(k.evaluate({x: 1})).to.be.equal(6.283186)
37
+ + });
38
+ +
39
+ + it('should work with constant but without variables', function () {
40
+ +
41
+ + let k = new NumExp('2pi')
42
+ + expect(k.evaluate()).to.be.equal(6.283186)
43
+ + });
44
+ });
45
+ Index: tests/algebra/linear.test.ts
46
+ IDEA additional info:
47
+ Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP
48
+ <+>import {describe} from \"mocha\";\r\nimport {expect} from \"chai\";\r\nimport {LinearSystem} from \"../../src/maths/algebra/linearSystem\";\r\nimport {Polynom} from \"../../src/maths/algebra/polynom\";\r\nimport exp = require(\"constants\");\r\n\r\ndescribe('Linear systems tests', () => {\r\n it('should solve a 2x2 equations', () => {\r\n let LS = new LinearSystem(\r\n '4x+5y=11',\r\n '7y-24=3x'\r\n )\r\n LS.solve(true)\r\n\r\n expect(LS.solution).to.be.equal('\\\\left(-1;3\\\\right)')\r\n })\r\n it('should solve a 3x3 equations', () => {\r\n let LS = new LinearSystem(\r\n '2x+7y-z=-3',\r\n '-3x+2y+3z=12',\r\n '-5x-3y+2z=5'\r\n )\r\n\r\n LS.solve()\r\n console.log(LS.solution)\r\n })\r\n\r\n it('should solve a 3x3 equations II ', () => {\r\n let LS = new LinearSystem(\r\n '-x+y-z=-6',\r\n '3x+2y+z=14',\r\n '5x+y+3z=7'\r\n )\r\n\r\n LS.solve()\r\n console.log(LS.solution)\r\n })\r\n\r\n it('should calculate the reduction', function () {\r\n let E1 = new Polynom('6x+21y-3z'),\r\n E2 = new Polynom('-6x+21y-3z')\r\n\r\n // Start from hre\r\n console.log('------------')\r\n console.log(E1.tex, E2.tex)\r\n\r\n console.log(E1.monoms.map(x => x.tex))\r\n console.log(E2.monoms.map(x => x.tex))\r\n E1.add(E2);\r\n\r\n console.log(E1.tex)\r\n });\r\n\r\n it('should use a reduced linear reducation', function () {\r\n let LS = new LinearSystem(\r\n '3x-6y+3=0',\r\n 'x+12y-6=0'\r\n )\r\n LS.solve(true)\r\n\r\n const tex = LS.stepTex('x')\r\n\r\n expect(+LS.resolutionSteps['x'][0].operations[0][0]).to.be.equal(2)\r\n expect(+LS.resolutionSteps['x'][0].operations[1][0]).to.be.equal(1)\r\n });\r\n})\r\n
49
+ Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
50
+ <+>UTF-8
51
+ ===================================================================
52
+ diff --git a/tests/algebra/linear.test.ts b/tests/algebra/linear.test.ts
53
+ --- a/tests/algebra/linear.test.ts
54
+ +++ b/tests/algebra/linear.test.ts
55
+ @@ -63,4 +63,34 @@
56
+ expect(+LS.resolutionSteps['x'][0].operations[0][0]).to.be.equal(2)
57
+ expect(+LS.resolutionSteps['x'][0].operations[1][0]).to.be.equal(1)
58
+ });
59
+ +
60
+ + it('should calculate what i need', function (){
61
+ + let LS = new LinearSystem(
62
+ + '15x-8y+16=0',
63
+ + '5x+12y-24=0'
64
+ + )
65
+ + LS.solve()
66
+ + console.log(LS.solution)
67
+ +
68
+ + let LS2 = new LinearSystem(
69
+ + '15x-8y+16=0',
70
+ + '3x-4y-6=0'
71
+ + )
72
+ + LS2.solve()
73
+ + console.log(LS2.solution)
74
+ +
75
+ + let LS3 = new LinearSystem(
76
+ + '5x+12y-24=0',
77
+ + '3x-4y-6=0'
78
+ + )
79
+ + LS3.solve()
80
+ + console.log(LS3.solution)
81
+ +
82
+ + let LS4 = new LinearSystem(
83
+ + '70x+25y-50=0',
84
+ + '63x-54y-11=0'
85
+ + )
86
+ + LS4.solve()
87
+ + console.log(LS4.solution)
88
+ + })
89
+ })
90
+ Index: LICENSE.md
91
+ IDEA additional info:
92
+ Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP
93
+ <+>MIT License\r\n\r\nCopyright (c) 2020 Basil Gass\r\n\r\nPermission is hereby granted, free of charge, to any person obtaining a copy\r\nof this software and associated documentation files (the \"Software\"), to deal\r\nin the Software without restriction, including without limitation the rights\r\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\ncopies of the Software, and to permit persons to whom the Software is\r\nfurnished to do so, subject to the following conditions:\r\n\r\nThe above copyright notice and this permission notice shall be included in all\r\ncopies or substantial portions of the Software.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\nSOFTWARE.\r\n
94
+ Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
95
+ <+>UTF-8
96
+ ===================================================================
97
+ diff --git a/LICENSE.md b/LICENSE.md
98
+ --- a/LICENSE.md
99
+ +++ b/LICENSE.md
100
+ @@ -1,6 +1,6 @@
101
+ MIT License
102
+
103
+ -Copyright (c) 2020 Basil Gass
104
+ +Copyright (c) 2023 Basil Gass
105
+
106
+ Permission is hereby granted, free of charge, to any person obtaining a copy
107
+ of this software and associated documentation files (the "Software"), to deal
@@ -0,0 +1,4 @@
1
+ <changelist name="Uncommitted_changes_before_Update_at_24_07_2023_15_31_[Default_Changelist]" date="1690205520775" recycled="false" toDelete="true">
2
+ <option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Uncommitted_changes_before_Update_at_24_07_2023_15_31_[Default_Changelist]/shelved.patch" />
3
+ <option name="DESCRIPTION" value="Uncommitted changes before Update at 24.07.2023 15:31 [Default Changelist]" />
4
+ </changelist>
@@ -0,0 +1,4 @@
1
+ <changelist name="Uncommitted_changes_before_Update_at_24_07_2023_15_31_[Default_Changelist]1" date="1690205596619" recycled="true" deleted="true">
2
+ <option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Uncommitted_changes_before_Update_at_24_07_2023_15_31_[Default_Changelist]1/shelved.patch" />
3
+ <option name="DESCRIPTION" value="Uncommitted changes before Update at 24.07.2023 15:31 [Default Changelist]" />
4
+ </changelist>
package/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2020 Basil Gass
3
+ Copyright (c) 2023 Basil Gass
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal