pimath 0.0.21 → 0.0.25

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