pimath 0.0.24 → 0.0.28

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 +220 -54
  3. package/dev/pi.js +573 -216
  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 +0 -3
  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 +16 -0
  74. package/esm/maths/numexp.js +116 -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 +1 -5
  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 +136 -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,68 +1,234 @@
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('5/x*sin(x*x)')
40
+ let ne = new Pi.NumExp('x+3')
14
41
 
15
- <h1>Equations</h1>
16
- <div id="equation"></div>
42
+ console.log(5.000000000000004)
43
+ console.log(ne.evaluate({x: 5.000000000000004}))
44
+ console.log(ne.evaluate({x: 5.000000000000}))
17
45
 
46
+ function dev () {
47
+ let output = []
18
48
 
19
- <script>
49
+ ex1()
50
+ // ex1()
51
+ // console.log(ex1())
52
+ output = [
53
+ '\\text{exercice 1}',
54
+ ...ex1(),
55
+ '--------------',
56
+ '\\text{exercice 2}',
57
+ ...ex2(),
58
+ '--------------',
59
+ '\\text{exercice 3}',
60
+ ...ex3(),
61
+ '--------------',
62
+ '\\text{exercice 4}',
63
+ ...ex4()]
64
+
65
+ // console.log(ex1())
66
+ return {
67
+ output
68
+ }
69
+ }
70
+
71
+ function ex1 () {
72
+ // EXERCICE 1
73
+ let cart = [
74
+ 'A',
75
+ 'x^2-10x+y^2-8y+37=0',
76
+ 'x^2-4x+y^2+6y+20=0',
77
+ '3x^2+3y^2+18y+3=0',
78
+ '4x^2-16x+8y^2-16y-10=0',
79
+ 'B',
80
+ 'x^2+10x+y^2-8y+32=0',
81
+ '5x^2+5y^2+80y+45=0',
82
+ '3x^2-9x+5y^2-10y+45=0',
83
+ 'x^2-8x+y^2+4x+36=0'
84
+ ], C, texData = []
85
+
86
+ for (let equ of cart) {
87
+ if (equ.length === 1) {
88
+ texData.push(`\\text{série ${equ}}`)
89
+ continue
90
+ }
91
+ C = new Pi.Geometry.Circle(equ)
92
+ if (C.exists) {
93
+ texData.push(equ + '\\implies ' + C.tex + '\\implies C' + C.center.tex + ',\\ r=' + C.radius.tex)
94
+ } else {
95
+ texData.push(equ + '\\implies' + '\\text{pas un cercle}')
96
+ }
97
+ }
98
+
99
+ return texData
100
+ }
101
+
102
+ function ex2 () {
103
+ let Center1 = new Pi.Geometry.Point(4, -2),
104
+ C1 = new Pi.Geometry.Circle(Center1, 10, true),
105
+ droites1 = [
106
+ 'x+3y-8=0',
107
+ 'x-6y+6=0',
108
+ '2x+y-1=0',
109
+ '3x-4y-36=0'
110
+ ],
111
+ Center2 = new Pi.Geometry.Point(8, 6),
112
+ C2 = new Pi.Geometry.Circle(
113
+ Center2,
114
+ 40,
115
+ true),
116
+ droites2 = [
117
+ 'x-3y+30=0',
118
+ '4x+11y-22=0',
119
+ '3x-y+8=0',
120
+ '2x+y-32=0'
121
+ ],
122
+ d, pr, out = []
123
+
124
+ out.push('\\text{série A}')
125
+ out.push('(\\Gamma_1):' + C1.tex)
126
+ for (let equ of droites1) {
127
+ d = new Pi.Geometry.Line(equ)
128
+ pr = C1.relativePosition(d)
129
+
130
+ if (pr === 0) {
131
+ out.push(d.tex.canonical + '\\implies \\delta = ' + d.distanceTo(C1.center).tex + '\\implies \\text{externe}\\ ')
132
+ } else if (pr === 1) {
133
+ out.push(d.tex.canonical + '\\implies \\text{tangent: }' + C1.lineIntersection(d)[0].tex)
134
+ } else {
135
+ 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'))
136
+ }
137
+ }
138
+
139
+ out.push('\\text{série B}')
140
+ out.push('(\\Gamma_2):' + C2.tex)
141
+ for (let equ of droites2) {
142
+ d = new Pi.Geometry.Line(equ)
143
+ pr = C2.relativePosition(d)
144
+ if (pr === 0) {
145
+ out.push(d.tex.canonical + '\\implies \\delta = ' + d.distanceTo(C2.center).tex + '\\implies \\text{externe}')
146
+ } else if (pr === 1) {
147
+ out.push(d.tex.canonical + '\\implies \\text{tangent: }' + C2.lineIntersection(d)[0].tex)
148
+ } else {
149
+ 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'))
150
+ }
151
+ }
152
+
153
+ return out
154
+ }
155
+
156
+ function ex3 () {
157
+ let C = new Pi.Geometry.Circle(
158
+ new Pi.Geometry.Point(-14, 18),
159
+ new Pi.Geometry.Point(-2, 14),
160
+ new Pi.Geometry.Point(-10, 22)
161
+ ), T1 = new Pi.Geometry.Triangle(new Pi.Geometry.Point(-14, 18),
162
+ new Pi.Geometry.Point(-2, 14),
163
+ new Pi.Geometry.Point(-10, 22))
164
+
165
+ let E = new Pi.Geometry.Circle(
166
+ new Pi.Geometry.Point(4, 10),
167
+ new Pi.Geometry.Point(5, 5),
168
+ new Pi.Geometry.Point(9, 11)
169
+ ), T2 = new Pi.Geometry.Triangle(
170
+ new Pi.Geometry.Point(4, 10),
171
+ new Pi.Geometry.Point(5, 5),
172
+ new Pi.Geometry.Point(9, 11)
173
+ )
174
+
175
+ return [
176
+ '\\text{2 milieux, 2 normales, 2 médiatrices, 2 intersection, 1 rayon, 1 équation}',
177
+ '\\text{série A}',
178
+ (new Pi.Geometry.Point().middleOf(T2.A, T2.B)).tex + '\\quad (m_{AB}):\\ ' + T2.remarquables.mediators.AB.tex.canonical,
179
+ (new Pi.Geometry.Point().middleOf(T2.A, T2.C)).tex + '\\quad (m_{AC}):\\ ' + T2.remarquables.mediators.AC.tex.canonical,
180
+ (new Pi.Geometry.Point().middleOf(T2.C, T2.B)).tex + '\\quad (m_{BC}):\\ ' + T2.remarquables.mediators.BC.tex.canonical,
181
+ E.tex,
182
+ '\\text{série B}',
183
+ (new Pi.Geometry.Point().middleOf(T1.A, T1.B)).tex + '\\quad (m_{AB}):\\ ' + T1.remarquables.mediators.AB.tex.canonical,
184
+ (new Pi.Geometry.Point().middleOf(T1.A, T1.C)).tex + '\\quad (m_{AC}):\\ ' + T1.remarquables.mediators.AC.tex.canonical,
185
+ (new Pi.Geometry.Point().middleOf(T1.C, T1.B)).tex + '\\quad (m_{BC}):\\ ' + T1.remarquables.mediators.BC.tex.canonical,
186
+ C.tex,
187
+
188
+ ]
189
+ }
190
+
191
+ function ex4 () {
192
+ // A
193
+ let A = new Pi.Geometry.Point(-6, -9),
194
+ C = new Pi.Geometry.Circle('(x+3)^2+(y+5)^2=25'),
195
+ Oy = C.cartesian.clone().replaceBy('x', new Pi.Polynom().zero()),
196
+ Ox = C.cartesian.clone().replaceBy('y', new Pi.Polynom().zero()),
197
+ t = new Pi.Geometry.Line(
198
+ A,
199
+ new Pi.Geometry.Vector(A, C.center),
200
+ Pi.Geometry.Line.PERPENDICULAR
201
+ )
202
+
203
+ Oy.solve()
204
+ Ox.solve()
205
+
206
+ // B
207
+ let A1 = new Pi.Geometry.Point(-4, -14),
208
+ C1 = new Pi.Geometry.Circle('(x-10)^2+(y+6)^2=100'),
209
+ Oy1 = C1.cartesian.clone().replaceBy('x', new Pi.Polynom().zero()),
210
+ Ox1 = C1.cartesian.clone().replaceBy('y', new Pi.Polynom().zero()),
211
+ t1 = new Pi.Geometry.Line(
212
+ A1,
213
+ new Pi.Geometry.Vector(A1, C1.center),
214
+ Pi.Geometry.Line.PERPENDICULAR
215
+ )
216
+
217
+ Oy1.solve()
218
+ Ox1.solve()
219
+
220
+ return [
221
+ '\\text{série A}',
222
+ '(Ox):\\ ' + Ox.solutions.map(y => `(${y.value};0)`),
223
+ '(Oy):\\ ' + Oy.solutions.map(x => `(0;${x.value})`),
224
+ '(t):\\ ' + t.tex.canonical,
225
+ '\\text{série B}',
226
+ '(Ox):\\ ' + Ox1.solutions.map(y => `(${y.value};0)`),
227
+ '(Oy):\\ ' + Oy1.solutions.map(x => `(0;${x.value})`),
228
+ '(t):\\ ' + t1.tex.canonical
229
+ ]
230
+ }
20
231
 
21
- let L = new Pi.Geometry.Line('6x-8y+12=0')
22
-
23
- console.log(L.a.display, L.b.display, L.c.display)
24
- L.simplify()
25
- console.log(L.a.display, L.b.display, L.c.display)
26
-
27
- console.log(L.tex.canonical)
28
-
29
- // let C1 = new Pi.Geometry.Point(-5, 4),
30
- // r1 = 36,
31
- // C2 = new Pi.Geometry.Point(7, -2),
32
- // T = new Pi.Geometry.Point(2, 3)
33
- //
34
- // let G1 = new Pi.Geometry.Circle(C1, r1, true),
35
- // G2 = new Pi.Geometry.Circle(C2, T)
36
- //
37
- // console.log('G1', G1.tex)
38
- // console.log('G2', G2.tex)
39
- //
40
- // let t = new Pi.Geometry.Line(
41
- // new Pi.Geometry.Vector(C2, T),
42
- // T
43
- // )
44
- //
45
- // console.log(t.tex.canonical)
46
- // console.log(G1.relativePosition(t))
47
- //
48
- // let d = new Pi.Geometry.Line(G1.center, G2.center)
49
- // console.log(d.tex.canonical)
50
- //
51
- // let M = new Pi.Geometry.Point(
52
- // G1.center.x.clone().add(G2.center.x).divide(2),
53
- // G1.center.y.clone().add(G2.center.y).divide(2),
54
- // )
55
- //
56
- // console.log(M.display)
57
- //
58
- // let k = new Pi.Geometry.Line().parseByPointAndLine(
59
- // M, d,
60
- // Pi.Geometry.Line.PERPENDICULAR
61
- // )
62
- //
63
- // console.log(k.tex.canonical)
64
- //
65
- // console.log(G1.lineIntersection(d))
66
232
  </script>
67
233
  </body>
68
234
  </html>