pimath 0.0.122 → 0.0.123

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.
@@ -1,107 +0,0 @@
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
@@ -1,4 +0,0 @@
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>