pimath 0.0.125 → 0.0.126

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 (78) hide show
  1. package/.idea/inspectionProfiles/Project_Default.xml +5 -5
  2. package/.idea/shelf/Uncommitted_changes_before_Checkout_at_07_11_2023_08_30_[Default_Changelist]/shelved.patch +192 -192
  3. package/.idea/shelf/Uncommitted_changes_before_Checkout_at_09_11_2023_10_43_[Default_Changelist]/shelved.patch +2404 -2404
  4. package/.idea/shelf/Uncommitted_changes_before_Checkout_at_09_11_2023_11_01_[Default_Changelist]/shelved.patch +1362 -1362
  5. package/dev/pimath.js +7945 -0
  6. package/dev/pimath.js.map +1 -0
  7. package/dist/pimath.js +192 -221
  8. package/dist/pimath.js.map +1 -1
  9. package/dist/pimath.min.js +1 -1
  10. package/dist/pimath.min.js.map +1 -1
  11. package/docs/.nojekyll +1 -0
  12. package/docs/assets/highlight.css +78 -0
  13. package/docs/assets/main.js +59 -0
  14. package/docs/assets/navigation.js +1 -0
  15. package/docs/assets/search.js +1 -0
  16. package/docs/assets/style.css +1383 -0
  17. package/docs/classes/Logicalset.Logicalset.html +217 -0
  18. package/docs/classes/Polynom.Rational.html +397 -0
  19. package/docs/classes/Vector-1.Vector.html +490 -0
  20. package/docs/classes/Vector.Point.html +337 -0
  21. package/docs/classes/algebra_equation.Equation.html +790 -0
  22. package/docs/classes/algebra_linearSystem.LinearSystem.html +404 -0
  23. package/docs/classes/algebra_monom.Monom.html +962 -0
  24. package/docs/classes/algebra_polynom.Polynom.html +1275 -0
  25. package/docs/classes/coefficients_fraction.Fraction.html +934 -0
  26. package/docs/classes/geometry_circle.Circle.html +472 -0
  27. package/docs/classes/geometry_line.Line.html +774 -0
  28. package/docs/classes/geometry_triangle.Triangle.html +429 -0
  29. package/docs/classes/numeric.Numeric.html +265 -0
  30. package/docs/classes/shutingyard.Shutingyard.html +250 -0
  31. package/docs/enums/algebra_equation.PARTICULAR_SOLUTION.html +83 -0
  32. package/docs/enums/geometry_line.LinePropriety.html +97 -0
  33. package/docs/enums/shutingyard.ShutingyardMode.html +97 -0
  34. package/docs/enums/shutingyard.ShutingyardType.html +111 -0
  35. package/docs/index.html +63 -0
  36. package/docs/interfaces/algebra_equation.ISolution.html +105 -0
  37. package/docs/interfaces/algebra_polynom.IEuclidian.html +87 -0
  38. package/docs/interfaces/geometry_triangle.remarquableLines.html +163 -0
  39. package/docs/modules/Logicalset.html +65 -0
  40. package/docs/modules/Polynom.html +65 -0
  41. package/docs/modules/Vector-1.html +65 -0
  42. package/docs/modules/Vector.html +65 -0
  43. package/docs/modules/algebra_equation.html +69 -0
  44. package/docs/modules/algebra_linearSystem.html +61 -0
  45. package/docs/modules/algebra_monom.html +65 -0
  46. package/docs/modules/algebra_polynom.html +69 -0
  47. package/docs/modules/coefficients_fraction.html +65 -0
  48. package/docs/modules/geometry_circle.html +61 -0
  49. package/docs/modules/geometry_line.html +65 -0
  50. package/docs/modules/geometry_triangle.html +65 -0
  51. package/docs/modules/numeric.html +61 -0
  52. package/docs/modules/shutingyard.html +75 -0
  53. package/docs/types/algebra_monom.literalType.html +61 -0
  54. package/docs/types/algebra_polynom.PolynomParsingType.html +56 -0
  55. package/docs/types/coefficients_fraction.FractionParsingType.html +56 -0
  56. package/docs/types/shutingyard.Token.html +63 -0
  57. package/docs/types/shutingyard.tokenType.html +68 -0
  58. package/docs/variables/shutingyard.tokenConstant.html +61 -0
  59. package/esm/index.js +1 -1
  60. package/esm/index.js.map +1 -1
  61. package/esm/maths/algebra/monom.d.ts +19 -19
  62. package/esm/maths/algebra/monom.js +66 -66
  63. package/esm/maths/algebra/monom.js.map +1 -1
  64. package/esm/maths/algebra/polynom.d.ts +14 -14
  65. package/esm/maths/algebra/polynom.js +72 -50
  66. package/esm/maths/algebra/polynom.js.map +1 -1
  67. package/esm/maths/numeric.js +3 -48
  68. package/esm/maths/numeric.js.map +1 -1
  69. package/package.json +1 -1
  70. package/src/index.ts +1 -1
  71. package/src/maths/algebra/monom.ts +138 -130
  72. package/src/maths/algebra/polynom.ts +107 -85
  73. package/src/maths/numeric.ts +61 -90
  74. package/tests/algebra/linear.test.ts +1 -1
  75. package/tests/algebra/polynom.test.ts +152 -1
  76. package/tests/algebra/study.test.ts +1 -0
  77. package/tests/geometry/circle.test.ts +114 -130
  78. package/tests/geometry/line.test.ts +8 -17
@@ -67,6 +67,13 @@ describe('Polynom tests', () => {
67
67
  expect(euclidian.reminder.tex).to.be.equal('12')
68
68
  });
69
69
 
70
+ it('should reduce', () => {
71
+ let P = new Polynom('15x-19x+24+4x-12')
72
+ P.reduce()
73
+ expect(P.tex).to.be.equal('12')
74
+
75
+ })
76
+
70
77
  it('should factorize the polynom', () => {
71
78
  let P = new Polynom('x^2-5x+6')
72
79
 
@@ -99,7 +106,7 @@ describe('Polynom tests', () => {
99
106
  expect(P2.texFactors).to.be.equal('-2x\\left( x+3 \\right)\\left( x-3 \\right)')
100
107
  });
101
108
 
102
- it('should detect if a polynom is factorized', function (){
109
+ it('should detect if a polynom is factorized', function () {
103
110
  let P = new Polynom('x-1')
104
111
  expect(P.isFactorized('x-1')).to.be.true
105
112
  expect(P.isFactorized('x-2')).to.be.false
@@ -164,6 +171,12 @@ describe('Polynom parsing with rational power', () => {
164
171
  })
165
172
  })
166
173
 
174
+ describe("Polynom with multiple variables", () => {
175
+ it('should parse with multiple variables', () => {
176
+ const P = new Polynom('ax')
177
+ expect(P.display).to.be.equal('ax')
178
+ })
179
+ })
167
180
 
168
181
  // describe("test simple", ()=>{
169
182
  // it('should parce this one correctly', ()=>{
@@ -180,3 +193,141 @@ describe('Polynom parsing with rational power', () => {
180
193
  // expect(P.degree().value).to.be.equal(0.5)
181
194
  // })
182
195
  // })
196
+ //
197
+ // describe('Polynom used as complex number', () => {
198
+ // let P = new Polynom('4+3i')
199
+ //
200
+ // P.pow(2)
201
+ //
202
+ // P.monoms.forEach(m => {
203
+ // const d = m.degree('i').value
204
+ // if (d >= 2) {
205
+ // if (d % 2 === 0) {
206
+ // m.coefficient = m.coefficient.multiply((-1) ** (d / 2))
207
+ // m.setLetter('i', 0)
208
+ // } else {
209
+ // m.coefficient = m.coefficient.multiply((-1) ** ((d - 1) / 2))
210
+ // m.setLetter('i', 1)
211
+ // }
212
+ // }
213
+ // })
214
+ // // console.log(P.reduce().tex)
215
+ //
216
+ // })
217
+ //
218
+ // describe("making my test", () => {
219
+ // let models = [
220
+ // {
221
+ // question: 'B \\cdot A^{K}=C',
222
+ // answer: {
223
+ // log: (a: number, b: number, c: number, d: number, e: number) => new Fraction(c, b),
224
+ // poly: (k: Polynom, p: Polynom) => k.clone()
225
+ // }
226
+ // },
227
+ // {
228
+ // question: 'B \\cdot A^{K}=C',
229
+ // answer: {
230
+ // log: (a: number, b: number, c: number, d: number, e: number) => new Fraction(c, b),
231
+ // poly: (k: Polynom, p: Polynom) => k.clone()
232
+ // }
233
+ // },
234
+ // {
235
+ // question: 'A^{K}=B \\cdot A^{P}',
236
+ // answer: {
237
+ // log: (a: number, b: number, c: number, d: number, e: number) => new Fraction(b),
238
+ // poly: (k: Polynom, p: Polynom) => k.clone().subtract(p)
239
+ // }
240
+ // },
241
+ // {
242
+ // question: 'A^{K}=B \\cdot A^{P}',
243
+ // answer: {
244
+ // log: (a: number, b: number, c: number, d: number, e: number) => new Fraction(b),
245
+ // poly: (k: Polynom, p: Polynom) => k.clone().subtract(p)
246
+ // }
247
+ // },
248
+ // {
249
+ // question: 'B \\cdot A^{K} = C \\cdot A^{P}',
250
+ // answer: {
251
+ // log: (a: number, b: number, c: number, d: number, e: number) => new Fraction(c, b),
252
+ // poly: (k: Polynom, p: Polynom) => k.clone().subtract(p)
253
+ // }
254
+ // },
255
+ // {
256
+ // question: 'B \\cdot A^{K} = \\frac{ C }{ A^{P} }',
257
+ // answer: {
258
+ // log: (a: number, b: number, c: number, d: number, e: number) => new Fraction(c, b),
259
+ // poly: (k: Polynom, p: Polynom) => k.clone().add(p)
260
+ // }
261
+ // },
262
+ // {
263
+ // question: 'C \\cdot A^{K} - B = D',
264
+ // answer: {
265
+ // log: (a: number, b: number, c: number, d: number, e: number) => new Fraction(d + b, c),
266
+ // poly: (k: Polynom, p: Polynom) => k.clone()
267
+ // }
268
+ // },
269
+ // {
270
+ // question: 'C \\cdot A^{K} - B = D \\cdot A^{P} ',
271
+ // answer: {
272
+ // log: (a: number, b: number, c: number, d: number, e: number) => new Fraction(b, c - e),
273
+ // poly: (k: Polynom, p: Polynom) => k.clone()
274
+ // }
275
+ // },
276
+ // ]
277
+ //
278
+ //
279
+ // for (let i = 0; i < 15; i++) {
280
+ // console.log(`{\\centering \\huge équations logarithmiques \\\\ }\n\nRésoudre les équations suivantes. Donner la réponse sous forme exacte et avec 4 décimales.`)
281
+ //
282
+ // console.log(`\\begin{enumerate}[(i),itemsep=4em]\n`)
283
+ //
284
+ // for (let m of models) {
285
+ // let a = PiMath.Random.number(2, 9),
286
+ // b = PiMath.Random.number(2, 9),
287
+ // c = PiMath.Random.number(2, 9),
288
+ // d = PiMath.Random.number(1, 9),
289
+ // e = PiMath.Random.number(1, c - 1),
290
+ // k = PiMath.Random.polynom({degree: 1}),
291
+ // p = PiMath.Random.polynom({degree: 1})
292
+ //
293
+ // if (k.monomByDegree(1).coefficient.isNegative()) {
294
+ // k.opposed()
295
+ // }
296
+ // if (p.monomByDegree(1).coefficient.isNegative()) {
297
+ // p.opposed()
298
+ // }
299
+ //
300
+ // let poly = m.answer.poly(k, p),
301
+ // pa = poly.monomByDegree(1).coefficient,
302
+ // pb = poly.monomByDegree(0).coefficient
303
+ //
304
+ // if (pa.isZero()) {
305
+ // k = k.add('x')
306
+ // poly = m.answer.poly(k, p),
307
+ // pa = poly.monomByDegree(1).coefficient,
308
+ // pb = poly.monomByDegree(0).coefficient
309
+ // }
310
+ //
311
+ // const question = m.question
312
+ // .replaceAll('A', a.toString())
313
+ // .replaceAll('B', b.toString())
314
+ // .replaceAll('C', c.toString())
315
+ // .replaceAll('D', d.toString())
316
+ // .replaceAll('K', k.tex)
317
+ // .replaceAll('P', p.tex)
318
+ //
319
+ //
320
+ // const log = m.answer.log(a, b, c, d, e).reduce()
321
+ // let answer = `\\log_{ ${a} }\\left( ${log.tex} \\right)`
322
+ // if (!pb.isZero()) answer = `${answer}${pb.clone().opposed().texWithSign}`
323
+ // if (!pa.isOne()) answer = `\\frac{ ${answer} }{ ${pa.tex} }`
324
+ //
325
+ // let value = ((Math.log10(log.value) / Math.log10(a) - pb.value) / pa.value).toFixed(4)
326
+ //
327
+ // console.log(`\\item \\(\\displaystyle ${question}\\) \\hfill \\( \\trou{ ${answer}=${value} } \\)`)
328
+ // }
329
+ //
330
+ // console.log(`\\end{enumerate}\n\\newpage`)
331
+ // }
332
+ //
333
+ // })
@@ -5,6 +5,7 @@ import {expect} from "chai";
5
5
  import {ASYMPTOTE} from "../../src/maths/algebra/study";
6
6
 
7
7
  describe('Study tests', () => {
8
+
8
9
  it('should get the zeroes', function () {
9
10
  const study = new RationalStudy(
10
11
  // new Rational('x^2-4x-4', 'x+7')
@@ -4,8 +4,6 @@ import {Circle} from "../../src/maths/geometry/circle";
4
4
  import {Line} from "../../src/maths/geometry/line";
5
5
  import {Point} from "../../src/maths/geometry/point";
6
6
  import {Fraction} from "../../src/maths/coefficients/fraction";
7
- import {Random} from "../../src/maths/randomization/random";
8
- import {Numeric} from "../../src/maths/numeric";
9
7
 
10
8
  describe('Circle', function () {
11
9
  it('should calculate the intersection of a circle and a line', function () {
@@ -66,134 +64,120 @@ describe('Circle', function () {
66
64
  it('should calculate the circle from center and radius', function () {
67
65
  let circle = new Circle("x^2+6x+y^2-8y+12=0")
68
66
 
69
- console.log(circle.tex)
67
+ // console.log(circle.tex)
70
68
  })
71
69
 
72
- it('should parse a line', function () {
73
- let a1 = 133.33333333333331,
74
- b1 = 700,
75
- a2 = 134.33333333333331,
76
- b2 = 700.75
77
-
78
- let A = new Point(a1, a2),
79
- B = new Point(b1, b2)
80
-
81
- console.log(A.tex, B.tex)
82
-
83
- let L = new Line(A, B)
84
- console.log(L.tex.canonical)
85
- });
86
-
87
- it('temp tests', () => {
88
- for (let i = 0; i < 30; i++) {
89
- let A = Random.Geometry.point({axis: false}),
90
- B = Random.Geometry.point({axis: false})
91
-
92
- if (Random.bool()) {
93
- B.x = new Fraction().zero()
94
- } else {
95
- B.y = new Fraction().zero()
96
- }
97
-
98
- const c1 = new Circle(A, Random.number(1, 10)),
99
- c2 = new Circle(B, Random.number(1, 10))
100
-
101
- console.log(`(exercice ${i + 1}): déterminer la forme \\textbf{centre-rayon} des équations cartésiennes suivantes. En déduire le centre et le rayon du cercle.
102
- \\begin{enumerate}[label=\\Alph*]
103
- \\item \\( (\\Gamma_1): ${c1.developed}\\) \\iftoggle{master}{\\(${c1.tex}\\)}{}
104
- \\item \\( (\\Gamma_2): ${c2.developed}\\) \\iftoggle{master}{\\(${c2.tex}\\)}{}
105
- \\end{enumerate}
106
- \\vfill
107
- ${i % 2 === 1 ? '\\newpage' : ''}
108
- `)
109
- }
110
- })
111
-
112
- it('temp tests 2', () => {
113
- const q = `(I): Soit \\(\\Gamma_1\\) et \\(\\Gamma_2\\) deux cercles. Déterminer leur position relative à l'aide des informations ci-dessous.
114
-
115
- \\[(\\Gamma_1): @G1 \\qquad (\\Gamma_2): @G2 \\]
116
- \\[\\trou{@R1} \\]
117
-
118
- \\vspace{3cm}
119
- (II): Soit \\((\\Gamma_3): @G3\\) un cercle. Déterminer l'équation cartésienne, sous sa forme centre-sommet, des cercles \\(\\Gamma_4\\) de rayon \\(@RAYON\\) qui sont tangents à \\(\\Gamma_3\\) en sachant que les deux centres ont la même @AXE.\\\\
120
- Préciser la position relative entre \\(\\Gamma_3\\) et \\(\\Gamma_4\\)
121
- \\[ \\trou{@R2a} \\]
122
- \\[ \\trou{@R2b} \\]
123
- `
124
-
125
- for (let i = 0; i < 30; i++) {
126
- let A = Random.Geometry.point({axis: false}),
127
- triplet = Random.item(Numeric.pythagoricianTripletsWithTarget(
128
- Random.item([5, 13, 17, 25, 29, 37, 41])
129
- ).filter(tr => {
130
- // remove all items with zero values.
131
- return tr.every(x => x !== 0)
132
- })),
133
- B = new Point(
134
- A.x.value + triplet[0],
135
- A.y.value + triplet[1]
136
- ),
137
- delta = Random.number(2, triplet[2] - 1),
138
- positionRelative = ['extérieure', 'intérieure', 'sécante', 'disjointe'][i % 4],
139
- // positionRelative = Random.item(['extérieure', 'intérieure', 'sécante', 'disjointe']),
140
- c1: Circle, c2: Circle
141
-
142
- if (positionRelative === 'extérieure') {
143
- c1 = new Circle(A, triplet[2] - delta)
144
- c2 = new Circle(B, delta)
145
- } else if (positionRelative === 'intérieure') {
146
- c1 = new Circle(A, triplet[2] + delta)
147
- c2 = new Circle(B, delta)
148
- } else if (positionRelative === 'sécante') {
149
- c1 = new Circle(A, triplet[2] + delta - Random.number(1, delta - 1))
150
- c2 = new Circle(B, delta)
151
- } else if (positionRelative === 'disjointe') {
152
- c1 = new Circle(A, triplet[2] + delta + 1)
153
- c2 = new Circle(B, delta)
154
- }
155
-
156
- const R1 = `\\delta(O_1;O_2)=${A.distanceTo(B).value}\\qquad r_1=${c1.radius.value} \\qquad ${c2.radius.value} \\qquad \\implies \\text{${positionRelative}} `
157
-
158
-
159
- let C = Random.Geometry.point({axis: false}),
160
- r1 = Random.number(2, 10),
161
- c3 = new Circle(C, r1),
162
- // Get a random number from 2 to 10 that is not equal to r1
163
- r2 = Random.number(2, 10, [r1]),
164
- axis = Random.item(['abscisse', 'ordonnée']),
165
- centers: Point[] = []
166
-
167
- const c3x = c3.center.x.value,
168
- c3y = c3.center.y.value
169
- if (axis === 'abscisse') {
170
-
171
- centers = [
172
- new Point(c3x, c3y - (r1 + r2)),
173
- new Point(c3x, c3y - (r2 - r1)),
174
- new Point(c3x, c3y - (r1 - r2)),
175
- new Point(c3x, c3y + (r1 + r2))
176
- ]
177
- } else {
178
- centers = [
179
- new Point(c3x - (r1 + r2), c3y),
180
- new Point(c3x - (r2 - r1), c3y),
181
- new Point(c3x - (r1 - r2), c3y),
182
- new Point(c3x + (r1 + r2), c3y)
183
- ]
184
- }
185
-
186
- console.log(`(exercice ${i + 1}): ` + q
187
- .replaceAll('@G1', c1.tex)
188
- .replaceAll('@R1', R1)
189
- .replaceAll('@G2', c2.tex)
190
- .replaceAll('@G3', c3.developed)
191
- .replaceAll('@RAYON', r2.toString())
192
- .replaceAll('@AXE', axis)
193
- .replaceAll('@R2a', centers.slice(0, 2).map(x => new Circle(x, r2).tex).join(' \\qquad '))
194
- .replaceAll('@R2b', centers.slice(2, 4).map(x => new Circle(x, r2).tex).join(' \\qquad '))
195
- + '\\vfill' + (i % 2 === 1 ? '\\newpage' : '')
196
- )
197
- }
198
- })
70
+
71
+ // it('temp tests', () => {
72
+ // for (let i = 0; i < 30; i++) {
73
+ // let A = Random.Geometry.point({axis: false}),
74
+ // B = Random.Geometry.point({axis: false})
75
+ //
76
+ // if (Random.bool()) {
77
+ // B.x = new Fraction().zero()
78
+ // } else {
79
+ // B.y = new Fraction().zero()
80
+ // }
81
+ //
82
+ // const c1 = new Circle(A, Random.number(1, 10)),
83
+ // c2 = new Circle(B, Random.number(1, 10))
84
+ //
85
+ // console.log(`(exercice ${i + 1}): déterminer la forme \\textbf{centre-rayon} des équations cartésiennes suivantes. En déduire le centre et le rayon du cercle.
86
+ // \\begin{enumerate}[label=\\Alph*]
87
+ // \\item \\( (\\Gamma_1): ${c1.developed}\\) \\iftoggle{master}{\\(${c1.tex}\\)}{}
88
+ // \\item \\( (\\Gamma_2): ${c2.developed}\\) \\iftoggle{master}{\\(${c2.tex}\\)}{}
89
+ // \\end{enumerate}
90
+ // \\vfill
91
+ // ${i % 2 === 1 ? '\\newpage' : ''}
92
+ // `)
93
+ // }
94
+ // })
95
+ //
96
+ // it('temp tests 2', () => {
97
+ // const q = `(I): Soit \\(\\Gamma_1\\) et \\(\\Gamma_2\\) deux cercles. Déterminer leur position relative à l'aide des informations ci-dessous.
98
+ //
99
+ // \\[(\\Gamma_1): @G1 \\qquad (\\Gamma_2): @G2 \\]
100
+ // \\[\\trou{@R1} \\]
101
+ //
102
+ // \\vspace{3cm}
103
+ // (II): Soit \\((\\Gamma_3): @G3\\) un cercle. Déterminer l'équation cartésienne, sous sa forme centre-sommet, des cercles \\(\\Gamma_4\\) de rayon \\(@RAYON\\) qui sont tangents à \\(\\Gamma_3\\) en sachant que les deux centres ont la même @AXE.\\\\
104
+ // Préciser la position relative entre \\(\\Gamma_3\\) et \\(\\Gamma_4\\)
105
+ // \\[ \\trou{@R2a} \\]
106
+ // \\[ \\trou{@R2b} \\]
107
+ // `
108
+ //
109
+ // for (let i = 0; i < 30; i++) {
110
+ // let A = Random.Geometry.point({axis: false}),
111
+ // triplet = Random.item(Numeric.pythagoricianTripletsWithTarget(
112
+ // Random.item([5, 13, 17, 25, 29, 37, 41])
113
+ // ).filter(tr => {
114
+ // // remove all items with zero values.
115
+ // return tr.every(x => x !== 0)
116
+ // })),
117
+ // B = new Point(
118
+ // A.x.value + triplet[0],
119
+ // A.y.value + triplet[1]
120
+ // ),
121
+ // delta = Random.number(2, triplet[2] - 1),
122
+ // positionRelative = ['extérieure', 'intérieure', 'sécante', 'disjointe'][i % 4],
123
+ // // positionRelative = Random.item(['extérieure', 'intérieure', 'sécante', 'disjointe']),
124
+ // c1: Circle, c2: Circle
125
+ //
126
+ // if (positionRelative === 'extérieure') {
127
+ // c1 = new Circle(A, triplet[2] - delta)
128
+ // c2 = new Circle(B, delta)
129
+ // } else if (positionRelative === 'intérieure') {
130
+ // c1 = new Circle(A, triplet[2] + delta)
131
+ // c2 = new Circle(B, delta)
132
+ // } else if (positionRelative === 'sécante') {
133
+ // c1 = new Circle(A, triplet[2] + delta - Random.number(1, delta - 1))
134
+ // c2 = new Circle(B, delta)
135
+ // } else if (positionRelative === 'disjointe') {
136
+ // c1 = new Circle(A, triplet[2] + delta + 1)
137
+ // c2 = new Circle(B, delta)
138
+ // }
139
+ //
140
+ // const R1 = `\\delta(O_1;O_2)=${A.distanceTo(B).value}\\qquad r_1=${c1.radius.value} \\qquad ${c2.radius.value} \\qquad \\implies \\text{${positionRelative}} `
141
+ //
142
+ //
143
+ // let C = Random.Geometry.point({axis: false}),
144
+ // r1 = Random.number(2, 10),
145
+ // c3 = new Circle(C, r1),
146
+ // // Get a random number from 2 to 10 that is not equal to r1
147
+ // r2 = Random.number(2, 10, [r1]),
148
+ // axis = Random.item(['abscisse', 'ordonnée']),
149
+ // centers: Point[] = []
150
+ //
151
+ // const c3x = c3.center.x.value,
152
+ // c3y = c3.center.y.value
153
+ // if (axis === 'abscisse') {
154
+ //
155
+ // centers = [
156
+ // new Point(c3x, c3y - (r1 + r2)),
157
+ // new Point(c3x, c3y - (r2 - r1)),
158
+ // new Point(c3x, c3y - (r1 - r2)),
159
+ // new Point(c3x, c3y + (r1 + r2))
160
+ // ]
161
+ // } else {
162
+ // centers = [
163
+ // new Point(c3x - (r1 + r2), c3y),
164
+ // new Point(c3x - (r2 - r1), c3y),
165
+ // new Point(c3x - (r1 - r2), c3y),
166
+ // new Point(c3x + (r1 + r2), c3y)
167
+ // ]
168
+ // }
169
+ //
170
+ // console.log(`(exercice ${i + 1}): ` + q
171
+ // .replaceAll('@G1', c1.tex)
172
+ // .replaceAll('@R1', R1)
173
+ // .replaceAll('@G2', c2.tex)
174
+ // .replaceAll('@G3', c3.developed)
175
+ // .replaceAll('@RAYON', r2.toString())
176
+ // .replaceAll('@AXE', axis)
177
+ // .replaceAll('@R2a', centers.slice(0, 2).map(x => new Circle(x, r2).tex).join(' \\qquad '))
178
+ // .replaceAll('@R2b', centers.slice(2, 4).map(x => new Circle(x, r2).tex).join(' \\qquad '))
179
+ // + '\\vfill' + (i % 2 === 1 ? '\\newpage' : '')
180
+ // )
181
+ // }
182
+ // })
199
183
  });
@@ -2,44 +2,35 @@ import {describe} from "mocha";
2
2
  import {Line} from "../../src/maths/geometry/line";
3
3
  import {Point} from "../../src/maths/geometry/point";
4
4
  import {expect} from "chai";
5
- import {Equation} from "../../src/maths/algebra/equation";
6
- import {Polynom} from "../../src/maths/algebra/polynom";
7
- import {Monom} from "../../src/maths/algebra/monom";
8
5
 
9
6
  describe('Geometry Line', function () {
10
7
  it('should evaluate coordinates', function () {
11
8
  let L = new Line('3x-4y+5=0')
12
9
 
13
10
  let y = L.getValueAtX(0)
14
- console.log(y.tex)
11
+ expect(y.display).to.be.equal('5/4')
15
12
  });
16
13
 
17
14
  it('should output nice Tex', function () {
18
15
  let L = new Line('9x-8y-96=0'),
19
16
  tex = L.tex
20
17
 
21
- console.log(tex.canonical)
22
- console.log(tex.equation)
23
- console.log(tex.mxh)
24
- console.log(tex.parametric)
25
-
26
- console.log(tex.system)
18
+ expect(tex.canonical).to.be.equal('9x-8y-96=0')
19
+ expect(tex.equation).to.be.equal('9x-8y=96')
20
+ expect(tex.mxh).to.be.equal('y=\\frac{ 9 }{ 8 }x-12')
21
+ expect(tex.parametric).to.be.equal('\\begin{pmatrix} x \\\\ y \\end{pmatrix} = \\begin{pmatrix} 0 \\\\ -96 \\end{pmatrix} + k\\cdot \\begin{pmatrix} -8 \\\\ -9 \\end{pmatrix}')
22
+ // console.log(tex.system)
27
23
  });
28
24
 
29
25
  it('should parse line from canonical coefficient', function () {
26
+ // parse by canonical coefficients ax+by+c=0
27
+ // a=3, b=2, c=1
30
28
  let L = new Line(3, 2, 1)
31
29
 
32
30
  let P1 = new Point(-2, 3),
33
31
  P2 = new Point(-3, 4)
34
32
  expect(L.isOnLine(P1)).to.be.false
35
33
  expect(L.isOnLine(P2)).to.be.true
36
-
37
- console.log(
38
- (new Polynom(L.OA.y)
39
- .add(new Monom(L.d.y).multiply(new Monom('k'))))
40
- .reorder('k', true)
41
- .tex
42
- )
43
34
  })
44
35
 
45
36
  });