pimath 0.0.23 → 0.0.27

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 (127) hide show
  1. package/dev/demo.css +3 -0
  2. package/dev/index.html +217 -53
  3. package/dev/pi.js +581 -220
  4. package/dev/pi.js.map +1 -1
  5. package/dist/pi.js +1 -1
  6. package/dist/pi.js.map +1 -1
  7. package/docs/assets/search.js +1 -1
  8. package/docs/classes/algebra.Equation.html +11 -13
  9. package/docs/classes/algebra.LinearSystem.html +1 -1
  10. package/docs/classes/algebra.Logicalset.html +3 -3
  11. package/docs/classes/algebra.Monom.html +50 -49
  12. package/docs/classes/algebra.Polynom.html +12 -25
  13. package/docs/classes/algebra.Rational.html +3 -3
  14. package/docs/classes/coefficients.Fraction.html +10 -6
  15. package/docs/classes/coefficients.Nthroot.html +3 -1
  16. package/docs/classes/geometry.Circle.html +3 -1
  17. package/docs/classes/geometry.Line.html +3 -1
  18. package/docs/classes/geometry.Point.html +1 -1
  19. package/docs/classes/geometry.Triangle.html +6 -6
  20. package/docs/classes/geometry.Vector.html +1 -1
  21. package/docs/classes/numeric.Numeric.html +5 -5
  22. package/docs/classes/shutingyard.Shutingyard.html +5 -5
  23. package/docs/index.html +1 -1
  24. package/docs/interfaces/geometry.remarquableLines.html +1 -1
  25. package/docs/modules/algebra.html +1 -1
  26. package/docs/modules/coefficients.html +1 -1
  27. package/docs/modules/geometry.html +1 -1
  28. package/docs/modules/numeric.html +1 -1
  29. package/docs/modules/random.Random.html +1 -1
  30. package/docs/modules/random.html +1 -1
  31. package/docs/modules/shutingyard.html +1 -1
  32. package/docs/modules.html +1 -1
  33. package/esm/main.js +2 -0
  34. package/esm/main.js.map +1 -1
  35. package/esm/maths/algebra/equation.d.ts +11 -5
  36. package/esm/maths/algebra/equation.js +159 -52
  37. package/esm/maths/algebra/equation.js.map +1 -1
  38. package/esm/maths/algebra/linearSystem.d.ts +3 -4
  39. package/esm/maths/algebra/linearSystem.js +2 -5
  40. package/esm/maths/algebra/linearSystem.js.map +1 -1
  41. package/esm/maths/algebra/logicalset.d.ts +2 -2
  42. package/esm/maths/algebra/logicalset.js +1 -1
  43. package/esm/maths/algebra/logicalset.js.map +1 -1
  44. package/esm/maths/algebra/monom.d.ts +5 -3
  45. package/esm/maths/algebra/monom.js +29 -2
  46. package/esm/maths/algebra/monom.js.map +1 -1
  47. package/esm/maths/algebra/polynom.d.ts +6 -6
  48. package/esm/maths/algebra/polynom.js +4 -4
  49. package/esm/maths/algebra/polynom.js.map +1 -1
  50. package/esm/maths/algebra/rational.d.ts +1 -1
  51. package/esm/maths/algebra/rational.js +2 -2
  52. package/esm/maths/algebra/rational.js.map +1 -1
  53. package/esm/maths/coefficients/fraction.d.ts +2 -2
  54. package/esm/maths/coefficients/fraction.js +1 -1
  55. package/esm/maths/coefficients/fraction.js.map +1 -1
  56. package/esm/maths/coefficients/nthroot.d.ts +1 -1
  57. package/esm/maths/coefficients/nthroot.js +4 -1
  58. package/esm/maths/coefficients/nthroot.js.map +1 -1
  59. package/esm/maths/geometry/circle.d.ts +12 -3
  60. package/esm/maths/geometry/circle.js +125 -39
  61. package/esm/maths/geometry/circle.js.map +1 -1
  62. package/esm/maths/geometry/line.d.ts +1 -2
  63. package/esm/maths/geometry/line.js +1 -4
  64. package/esm/maths/geometry/line.js.map +1 -1
  65. package/esm/maths/geometry/point.d.ts +3 -4
  66. package/esm/maths/geometry/point.js +18 -15
  67. package/esm/maths/geometry/point.js.map +1 -1
  68. package/esm/maths/geometry/triangle.d.ts +0 -1
  69. package/esm/maths/geometry/triangle.js +3 -4
  70. package/esm/maths/geometry/triangle.js.map +1 -1
  71. package/esm/maths/geometry/vector.js +2 -1
  72. package/esm/maths/geometry/vector.js.map +1 -1
  73. package/esm/maths/numexp.d.ts +11 -0
  74. package/esm/maths/numexp.js +107 -0
  75. package/esm/maths/numexp.js.map +1 -0
  76. package/esm/maths/random/rndFraction.js +4 -3
  77. package/esm/maths/random/rndFraction.js.map +1 -1
  78. package/esm/maths/random/rndMonom.d.ts +1 -1
  79. package/esm/maths/random/rndMonom.js +12 -7
  80. package/esm/maths/random/rndMonom.js.map +1 -1
  81. package/esm/maths/random/rndPolynom.js +8 -2
  82. package/esm/maths/random/rndPolynom.js.map +1 -1
  83. package/esm/maths/random/rndTypes.d.ts +3 -1
  84. package/esm/maths/shutingyard.d.ts +21 -4
  85. package/esm/maths/shutingyard.js +72 -74
  86. package/esm/maths/shutingyard.js.map +1 -1
  87. package/package.json +3 -5
  88. package/src/main.ts +2 -0
  89. package/src/maths/algebra/equation.ts +183 -73
  90. package/src/maths/algebra/linearSystem.ts +262 -265
  91. package/src/maths/algebra/logicalset.ts +3 -3
  92. package/src/maths/algebra/monom.ts +54 -35
  93. package/src/maths/algebra/polynom.ts +10 -10
  94. package/src/maths/algebra/rational.ts +1 -1
  95. package/src/maths/coefficients/fraction.ts +11 -7
  96. package/src/maths/coefficients/nthroot.ts +8 -1
  97. package/src/maths/geometry/circle.ts +160 -45
  98. package/src/maths/geometry/line.ts +4 -8
  99. package/src/maths/geometry/point.ts +25 -18
  100. package/src/maths/geometry/triangle.ts +3 -5
  101. package/src/maths/geometry/vector.ts +4 -3
  102. package/src/maths/numexp.ts +127 -0
  103. package/src/maths/random/rndFraction.ts +4 -3
  104. package/src/maths/random/rndMonom.ts +39 -35
  105. package/src/maths/random/rndPolynom.ts +13 -3
  106. package/src/maths/random/rndTypes.ts +4 -2
  107. package/src/maths/shutingyard.ts +144 -94
  108. package/tests/algebra/monom.test.ts +18 -4
  109. package/tests/algebra/polynom.test.ts +19 -4
  110. package/tests/geometry/circle.test.ts +28 -0
  111. package/tests/shutingyard.test.ts +3 -3
  112. package/tsconfig.json +4 -1
  113. package/typedoc.katex.js +11 -0
  114. package/docs/classes/algebra.Algebra.Equation.html +0 -26
  115. package/docs/classes/algebra.Algebra.LinearSystem.html +0 -1
  116. package/docs/classes/algebra.Algebra.LogicalSet.html +0 -3
  117. package/docs/classes/algebra.Algebra.Monom.html +0 -111
  118. package/docs/classes/algebra.Algebra.Polynom.html +0 -36
  119. package/docs/classes/algebra.Algebra.Rational.html +0 -2
  120. package/docs/classes/geometry.Geometry.Circle.html +0 -1
  121. package/docs/classes/geometry.Geometry.Line.html +0 -1
  122. package/docs/classes/geometry.Geometry.Point.html +0 -1
  123. package/docs/classes/geometry.Geometry.Triangle.html +0 -9
  124. package/docs/classes/geometry.Geometry.Vector.html +0 -1
  125. package/docs/modules/algebra.Algebra.html +0 -1
  126. package/docs/modules/geometry.Geometry.html +0 -1
  127. package/src/maths/algebra/monom_bck.backup +0 -746
package/dev/demo.css ADDED
@@ -0,0 +1,3 @@
1
+ .katex-left > .katex-display > .katex,.katex-left > span > .katex-display > .katex {
2
+ text-align: left !important;
3
+ }
package/dev/index.html CHANGED
@@ -1,67 +1,231 @@
1
- <html>
1
+ <!DOCTYPE html>
2
+ <html lang="fr">
2
3
  <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
3
6
  <title>Getting Started</title>
7
+
4
8
  <script src="pi.js"></script>
9
+
10
+ <!-- Alpine -->
11
+ <script src="//unpkg.com/alpinejs" defer></script>
12
+
13
+
14
+ <!-- KaTeX -->
15
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/katex.min.css"
16
+ integrity="sha384-R4558gYOUz8mP9YWpZJjofhk+zx0AS11p36HnD2ZKj/6JR5z27gSSULCNHIRReVs" crossorigin="anonymous">
17
+
18
+ <!-- The loading of KaTeX is deferred to speed up page rendering -->
19
+ <script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/katex.min.js"
20
+ integrity="sha384-z1fJDqw8ZApjGO3/unPWUPsIymfsJmyrDVWC8Tv/a1HeOtGmkwNd/7xUS0Xcnvsx"
21
+ crossorigin="anonymous"></script>
22
+
23
+ <!-- To automatically render math in text elements, include the auto-render extension: -->
24
+ <script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/contrib/auto-render.min.js"
25
+ integrity="sha384-+XBljXPPiv+OzfbB3cVmLHf4hdUFHlWNZN5spNQ7rmHTXpd7WvJum6fIACpNNfIR" crossorigin="anonymous"
26
+ onload="renderMathInElement(document.body);"></script>
27
+
28
+ <link href="demo.css" rel="stylesheet">
5
29
  </head>
6
30
  <body>
7
31
 
8
- <h1>Output</h1>
9
- <div id="math-output"></div>
10
- <div id="math-output-2"></div>
32
+ <!--<div x-data="dev()">-->
33
+ <!-- <template x-for="(item, index) of output" :key="index">-->
34
+ <!-- <div class="katex-left" x-html="`\\[${item}\\]`"></div>-->
35
+ <!-- </template>-->
36
+ <!--</div>-->
11
37
 
12
- <h1>Fractions</h1>
13
- <div id="fraction"></div>
38
+ <script>
39
+ let ne = new Pi.NumExp('x^2-2*x+3*y-8')
14
40
 
15
- <h1>Equations</h1>
16
- <div id="equation"></div>
41
+ console.log(ne.evaluate({x: 5, y: 3}))
17
42
 
43
+ function dev () {
44
+ let output = []
18
45
 
19
- <script>
46
+ ex1()
47
+ // ex1()
48
+ // console.log(ex1())
49
+ output = [
50
+ '\\text{exercice 1}',
51
+ ...ex1(),
52
+ '--------------',
53
+ '\\text{exercice 2}',
54
+ ...ex2(),
55
+ '--------------',
56
+ '\\text{exercice 3}',
57
+ ...ex3(),
58
+ '--------------',
59
+ '\\text{exercice 4}',
60
+ ...ex4()]
61
+
62
+ // console.log(ex1())
63
+ return {
64
+ output
65
+ }
66
+ }
67
+
68
+ function ex1 () {
69
+ // EXERCICE 1
70
+ let cart = [
71
+ 'A',
72
+ 'x^2-10x+y^2-8y+37=0',
73
+ 'x^2-4x+y^2+6y+20=0',
74
+ '3x^2+3y^2+18y+3=0',
75
+ '4x^2-16x+8y^2-16y-10=0',
76
+ 'B',
77
+ 'x^2+10x+y^2-8y+32=0',
78
+ '5x^2+5y^2+80y+45=0',
79
+ '3x^2-9x+5y^2-10y+45=0',
80
+ 'x^2-8x+y^2+4x+36=0'
81
+ ], C, texData = []
82
+
83
+ for (let equ of cart) {
84
+ if (equ.length === 1) {
85
+ texData.push(`\\text{série ${equ}}`)
86
+ continue
87
+ }
88
+ C = new Pi.Geometry.Circle(equ)
89
+ if (C.exists) {
90
+ texData.push(equ + '\\implies ' + C.tex + '\\implies C' + C.center.tex + ',\\ r=' + C.radius.tex)
91
+ } else {
92
+ texData.push(equ + '\\implies' + '\\text{pas un cercle}')
93
+ }
94
+ }
95
+
96
+ return texData
97
+ }
98
+
99
+ function ex2 () {
100
+ let Center1 = new Pi.Geometry.Point(4, -2),
101
+ C1 = new Pi.Geometry.Circle(Center1, 10, true),
102
+ droites1 = [
103
+ 'x+3y-8=0',
104
+ 'x-6y+6=0',
105
+ '2x+y-1=0',
106
+ '3x-4y-36=0'
107
+ ],
108
+ Center2 = new Pi.Geometry.Point(8, 6),
109
+ C2 = new Pi.Geometry.Circle(
110
+ Center2,
111
+ 40,
112
+ true),
113
+ droites2 = [
114
+ 'x-3y+30=0',
115
+ '4x+11y-22=0',
116
+ '3x-y+8=0',
117
+ '2x+y-32=0'
118
+ ],
119
+ d, pr, out = []
120
+
121
+ out.push('\\text{série A}')
122
+ out.push('(\\Gamma_1):' + C1.tex)
123
+ for (let equ of droites1) {
124
+ d = new Pi.Geometry.Line(equ)
125
+ pr = C1.relativePosition(d)
126
+
127
+ if (pr === 0) {
128
+ out.push(d.tex.canonical + '\\implies \\delta = ' + d.distanceTo(C1.center).tex + '\\implies \\text{externe}\\ ')
129
+ } else if (pr === 1) {
130
+ out.push(d.tex.canonical + '\\implies \\text{tangent: }' + C1.lineIntersection(d)[0].tex)
131
+ } else {
132
+ out.push(d.tex.canonical + '\\implies \\delta = ' + d.distanceTo(C1.center).tex + '\\implies \\text{sécant:}\\ ' + C1.lineIntersection(d).map(x => x.tex).join('\\quad'))
133
+ }
134
+ }
135
+
136
+ out.push('\\text{série B}')
137
+ out.push('(\\Gamma_2):' + C2.tex)
138
+ for (let equ of droites2) {
139
+ d = new Pi.Geometry.Line(equ)
140
+ pr = C2.relativePosition(d)
141
+ if (pr === 0) {
142
+ out.push(d.tex.canonical + '\\implies \\delta = ' + d.distanceTo(C2.center).tex + '\\implies \\text{externe}')
143
+ } else if (pr === 1) {
144
+ out.push(d.tex.canonical + '\\implies \\text{tangent: }' + C2.lineIntersection(d)[0].tex)
145
+ } else {
146
+ out.push(d.tex.canonical + '\\implies \\delta = ' + d.distanceTo(C2.center).tex + '\\implies \\text{sécant:} ' + C2.lineIntersection(d).map(x => x.tex).join('\\quad'))
147
+ }
148
+ }
149
+
150
+ return out
151
+ }
152
+
153
+ function ex3 () {
154
+ let C = new Pi.Geometry.Circle(
155
+ new Pi.Geometry.Point(-14, 18),
156
+ new Pi.Geometry.Point(-2, 14),
157
+ new Pi.Geometry.Point(-10, 22)
158
+ ), T1 = new Pi.Geometry.Triangle(new Pi.Geometry.Point(-14, 18),
159
+ new Pi.Geometry.Point(-2, 14),
160
+ new Pi.Geometry.Point(-10, 22))
161
+
162
+ let E = new Pi.Geometry.Circle(
163
+ new Pi.Geometry.Point(4, 10),
164
+ new Pi.Geometry.Point(5, 5),
165
+ new Pi.Geometry.Point(9, 11)
166
+ ), T2 = new Pi.Geometry.Triangle(
167
+ new Pi.Geometry.Point(4, 10),
168
+ new Pi.Geometry.Point(5, 5),
169
+ new Pi.Geometry.Point(9, 11)
170
+ )
171
+
172
+ return [
173
+ '\\text{2 milieux, 2 normales, 2 médiatrices, 2 intersection, 1 rayon, 1 équation}',
174
+ '\\text{série A}',
175
+ (new Pi.Geometry.Point().middleOf(T2.A, T2.B)).tex + '\\quad (m_{AB}):\\ ' + T2.remarquables.mediators.AB.tex.canonical,
176
+ (new Pi.Geometry.Point().middleOf(T2.A, T2.C)).tex + '\\quad (m_{AC}):\\ ' + T2.remarquables.mediators.AC.tex.canonical,
177
+ (new Pi.Geometry.Point().middleOf(T2.C, T2.B)).tex + '\\quad (m_{BC}):\\ ' + T2.remarquables.mediators.BC.tex.canonical,
178
+ E.tex,
179
+ '\\text{série B}',
180
+ (new Pi.Geometry.Point().middleOf(T1.A, T1.B)).tex + '\\quad (m_{AB}):\\ ' + T1.remarquables.mediators.AB.tex.canonical,
181
+ (new Pi.Geometry.Point().middleOf(T1.A, T1.C)).tex + '\\quad (m_{AC}):\\ ' + T1.remarquables.mediators.AC.tex.canonical,
182
+ (new Pi.Geometry.Point().middleOf(T1.C, T1.B)).tex + '\\quad (m_{BC}):\\ ' + T1.remarquables.mediators.BC.tex.canonical,
183
+ C.tex,
184
+
185
+ ]
186
+ }
187
+
188
+ function ex4 () {
189
+ // A
190
+ let A = new Pi.Geometry.Point(-6, -9),
191
+ C = new Pi.Geometry.Circle('(x+3)^2+(y+5)^2=25'),
192
+ Oy = C.cartesian.clone().replaceBy('x', new Pi.Polynom().zero()),
193
+ Ox = C.cartesian.clone().replaceBy('y', new Pi.Polynom().zero()),
194
+ t = new Pi.Geometry.Line(
195
+ A,
196
+ new Pi.Geometry.Vector(A, C.center),
197
+ Pi.Geometry.Line.PERPENDICULAR
198
+ )
199
+
200
+ Oy.solve()
201
+ Ox.solve()
202
+
203
+ // B
204
+ let A1 = new Pi.Geometry.Point(-4, -14),
205
+ C1 = new Pi.Geometry.Circle('(x-10)^2+(y+6)^2=100'),
206
+ Oy1 = C1.cartesian.clone().replaceBy('x', new Pi.Polynom().zero()),
207
+ Ox1 = C1.cartesian.clone().replaceBy('y', new Pi.Polynom().zero()),
208
+ t1 = new Pi.Geometry.Line(
209
+ A1,
210
+ new Pi.Geometry.Vector(A1, C1.center),
211
+ Pi.Geometry.Line.PERPENDICULAR
212
+ )
213
+
214
+ Oy1.solve()
215
+ Ox1.solve()
216
+
217
+ return [
218
+ '\\text{série A}',
219
+ '(Ox):\\ ' + Ox.solutions.map(y => `(${y.value};0)`),
220
+ '(Oy):\\ ' + Oy.solutions.map(x => `(0;${x.value})`),
221
+ '(t):\\ ' + t.tex.canonical,
222
+ '\\text{série B}',
223
+ '(Ox):\\ ' + Ox1.solutions.map(y => `(${y.value};0)`),
224
+ '(Oy):\\ ' + Oy1.solutions.map(x => `(0;${x.value})`),
225
+ '(t):\\ ' + t1.tex.canonical
226
+ ]
227
+ }
20
228
 
21
- let P = new Pi.Random.polynom({
22
- degree: 4,
23
- fraction: false
24
- })
25
-
26
- console.log(P.display)
27
-
28
- // let C1 = new Pi.Geometry.Point(-5, 4),
29
- // r1 = 36,
30
- // C2 = new Pi.Geometry.Point(7, -2),
31
- // T = new Pi.Geometry.Point(2, 3)
32
- //
33
- // let G1 = new Pi.Geometry.Circle(C1, r1, true),
34
- // G2 = new Pi.Geometry.Circle(C2, T)
35
- //
36
- // console.log('G1', G1.tex)
37
- // console.log('G2', G2.tex)
38
- //
39
- // let t = new Pi.Geometry.Line(
40
- // new Pi.Geometry.Vector(C2, T),
41
- // T
42
- // )
43
- //
44
- // console.log(t.tex.canonical)
45
- // console.log(G1.relativePosition(t))
46
- //
47
- // let d = new Pi.Geometry.Line(G1.center, G2.center)
48
- // console.log(d.tex.canonical)
49
- //
50
- // let M = new Pi.Geometry.Point(
51
- // G1.center.x.clone().add(G2.center.x).divide(2),
52
- // G1.center.y.clone().add(G2.center.y).divide(2),
53
- // )
54
- //
55
- // console.log(M.display)
56
- //
57
- // let k = new Pi.Geometry.Line().parseByPointAndLine(
58
- // M, d,
59
- // Pi.Geometry.Line.PERPENDICULAR
60
- // )
61
- //
62
- // console.log(k.tex.canonical)
63
- //
64
- // console.log(G1.lineIntersection(d))
65
229
  </script>
66
230
  </body>
67
231
  </html>