pimath 0.0.126 → 0.0.128
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.
- package/.idea/jsLibraryMappings.xml +6 -0
- package/{public/index.html → dist/demo/exercises.html} +2 -2
- package/dist/demo/matrices.html +39 -0
- package/dist/demo/playground.html +20 -0
- package/dist/demo.css +3 -0
- package/dist/pimath.js +4239 -7819
- package/dist/pimath.umd.cjs +15 -0
- package/index.html +15 -0
- package/package.json +16 -8
- package/public/demo/exercises.html +283 -0
- package/public/demo/matrices.html +39 -0
- package/public/demo/playground.html +20 -0
- package/src/demo/exercises.ts +0 -0
- package/src/demo/matrices.ts +61 -0
- package/src/demo/playground.ts +153 -0
- package/src/{index.ts → main.ts} +1 -1
- package/src/maths/algebra/polynom.ts +9 -16
- package/src/maths/algebra/rational.ts +8 -4
- package/src/maths/geometry/line.ts +22 -25
- package/src/maths/geometry/point.ts +43 -29
- package/src/maths/randomization/random.ts +7 -0
- package/src/maths/randomization/rndGeometryCircle.ts +50 -0
- package/src/maths/randomization/rndTypes.ts +10 -4
- package/tests/algebra/polynom.test.ts +10 -0
- package/tests/geometry/circle.test.ts +222 -1
- package/tests/numeric.test.ts +19 -3
- package/tsconfig.json +15 -4
- package/vite.config.js +23 -0
- package/webpack-production.config.js +22 -22
- package/webpack.config.js +22 -22
- package/dev/pimath.js +0 -7945
- package/dev/pimath.js.map +0 -1
- package/dist/pimath.js.map +0 -1
- package/dist/pimath.min.js +0 -2
- package/dist/pimath.min.js.map +0 -1
- package/esm/index.d.ts +0 -38
- package/esm/index.js +0 -44
- package/esm/index.js.map +0 -1
- package/esm/maths/algebra/equation.d.ts +0 -119
- package/esm/maths/algebra/equation.js +0 -797
- package/esm/maths/algebra/equation.js.map +0 -1
- package/esm/maths/algebra/linearSystem.d.ts +0 -39
- package/esm/maths/algebra/linearSystem.js +0 -279
- package/esm/maths/algebra/linearSystem.js.map +0 -1
- package/esm/maths/algebra/logicalset.d.ts +0 -28
- package/esm/maths/algebra/logicalset.js +0 -158
- package/esm/maths/algebra/logicalset.js.map +0 -1
- package/esm/maths/algebra/monom.d.ts +0 -206
- package/esm/maths/algebra/monom.js +0 -909
- package/esm/maths/algebra/monom.js.map +0 -1
- package/esm/maths/algebra/polynom.d.ts +0 -157
- package/esm/maths/algebra/polynom.js +0 -1305
- package/esm/maths/algebra/polynom.js.map +0 -1
- package/esm/maths/algebra/rational.d.ts +0 -46
- package/esm/maths/algebra/rational.js +0 -195
- package/esm/maths/algebra/rational.js.map +0 -1
- package/esm/maths/algebra/study/rationalStudy.d.ts +0 -28
- package/esm/maths/algebra/study/rationalStudy.js +0 -244
- package/esm/maths/algebra/study/rationalStudy.js.map +0 -1
- package/esm/maths/algebra/study.d.ts +0 -143
- package/esm/maths/algebra/study.js +0 -380
- package/esm/maths/algebra/study.js.map +0 -1
- package/esm/maths/coefficients/fraction.d.ts +0 -90
- package/esm/maths/coefficients/fraction.js +0 -517
- package/esm/maths/coefficients/fraction.js.map +0 -1
- package/esm/maths/coefficients/nthRoot.d.ts +0 -23
- package/esm/maths/coefficients/nthRoot.js +0 -137
- package/esm/maths/coefficients/nthRoot.js.map +0 -1
- package/esm/maths/geometry/circle.d.ts +0 -45
- package/esm/maths/geometry/circle.js +0 -324
- package/esm/maths/geometry/circle.js.map +0 -1
- package/esm/maths/geometry/line.d.ts +0 -99
- package/esm/maths/geometry/line.js +0 -485
- package/esm/maths/geometry/line.js.map +0 -1
- package/esm/maths/geometry/point.d.ts +0 -34
- package/esm/maths/geometry/point.js +0 -167
- package/esm/maths/geometry/point.js.map +0 -1
- package/esm/maths/geometry/triangle.d.ts +0 -91
- package/esm/maths/geometry/triangle.js +0 -276
- package/esm/maths/geometry/triangle.js.map +0 -1
- package/esm/maths/geometry/vector.d.ts +0 -41
- package/esm/maths/geometry/vector.js +0 -198
- package/esm/maths/geometry/vector.js.map +0 -1
- package/esm/maths/numeric.d.ts +0 -28
- package/esm/maths/numeric.js +0 -136
- package/esm/maths/numeric.js.map +0 -1
- package/esm/maths/numexp.d.ts +0 -19
- package/esm/maths/numexp.js +0 -186
- package/esm/maths/numexp.js.map +0 -1
- package/esm/maths/randomization/random.d.ts +0 -23
- package/esm/maths/randomization/random.js +0 -79
- package/esm/maths/randomization/random.js.map +0 -1
- package/esm/maths/randomization/randomCore.d.ts +0 -7
- package/esm/maths/randomization/randomCore.js +0 -22
- package/esm/maths/randomization/randomCore.js.map +0 -1
- package/esm/maths/randomization/rndFraction.d.ts +0 -12
- package/esm/maths/randomization/rndFraction.js +0 -44
- package/esm/maths/randomization/rndFraction.js.map +0 -1
- package/esm/maths/randomization/rndGeometryLine.d.ts +0 -12
- package/esm/maths/randomization/rndGeometryLine.js +0 -46
- package/esm/maths/randomization/rndGeometryLine.js.map +0 -1
- package/esm/maths/randomization/rndGeometryPoint.d.ts +0 -12
- package/esm/maths/randomization/rndGeometryPoint.js +0 -61
- package/esm/maths/randomization/rndGeometryPoint.js.map +0 -1
- package/esm/maths/randomization/rndHelpers.d.ts +0 -23
- package/esm/maths/randomization/rndHelpers.js +0 -98
- package/esm/maths/randomization/rndHelpers.js.map +0 -1
- package/esm/maths/randomization/rndMonom.d.ts +0 -12
- package/esm/maths/randomization/rndMonom.js +0 -53
- package/esm/maths/randomization/rndMonom.js.map +0 -1
- package/esm/maths/randomization/rndPolynom.d.ts +0 -13
- package/esm/maths/randomization/rndPolynom.js +0 -75
- package/esm/maths/randomization/rndPolynom.js.map +0 -1
- package/esm/maths/randomization/rndTypes.d.ts +0 -34
- package/esm/maths/randomization/rndTypes.js +0 -3
- package/esm/maths/randomization/rndTypes.js.map +0 -1
- package/esm/maths/shutingyard.d.ts +0 -59
- package/esm/maths/shutingyard.js +0 -443
- package/esm/maths/shutingyard.js.map +0 -1
- package/public/matrices.html +0 -100
- package/public/playground.html +0 -168
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import {randomCore} from "./randomCore";
|
|
2
|
+
import {Random, randomGeometryCircleConfig} from "./random";
|
|
3
|
+
import {Circle} from "../geometry/circle";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Create a random monom based on a based configuration
|
|
7
|
+
*/
|
|
8
|
+
export class rndGeometryCircle extends randomCore {
|
|
9
|
+
declare protected _config: randomGeometryCircleConfig
|
|
10
|
+
declare protected _defaultConfig: randomGeometryCircleConfig
|
|
11
|
+
|
|
12
|
+
generate = (): Circle => {
|
|
13
|
+
const center = Random.Geometry.point(this._config.center)
|
|
14
|
+
|
|
15
|
+
let rv, r
|
|
16
|
+
if (this._config.pointsOnCircle === 8) {
|
|
17
|
+
rv = Random.number(1, 3),
|
|
18
|
+
r = rv ** 2 + (rv + 1) ** 2
|
|
19
|
+
} else {
|
|
20
|
+
r = Random.number(1, 20)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const c = new Circle(center, r, true)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
// let pts = c.getPointsOnCircle(true)
|
|
27
|
+
//
|
|
28
|
+
// pts = Random.shuffle(pts)
|
|
29
|
+
// let ptt = pts.shift(),
|
|
30
|
+
// pt1 = pts.shift(),
|
|
31
|
+
// pt2
|
|
32
|
+
//
|
|
33
|
+
// for (let pt of pts) {
|
|
34
|
+
// if (!pt1.x.isEqual(pt.x) && !pt1.y.isEqual(pt.y) && !A.isEqual(new Point().middleOf(pt1, pt))) {
|
|
35
|
+
// pt2 = pt.clone()
|
|
36
|
+
// break
|
|
37
|
+
// }
|
|
38
|
+
// }
|
|
39
|
+
|
|
40
|
+
return c
|
|
41
|
+
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
constructor(userConfig?: randomGeometryCircleConfig) {
|
|
45
|
+
super();
|
|
46
|
+
|
|
47
|
+
this._defaultConfig = {}
|
|
48
|
+
this._config = this.mergeConfig(userConfig, this._defaultConfig)
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -4,14 +4,14 @@ export type randomCoefficientConfig = {
|
|
|
4
4
|
negative?: boolean,
|
|
5
5
|
max?: number,
|
|
6
6
|
reduced?: boolean,
|
|
7
|
-
zero?:boolean,
|
|
8
|
-
natural?:boolean
|
|
7
|
+
zero?: boolean,
|
|
8
|
+
natural?: boolean
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export type randomMonomConfig = {
|
|
12
12
|
letters?: string,
|
|
13
13
|
degree?: number,
|
|
14
|
-
fraction?: boolean|randomCoefficientConfig,
|
|
14
|
+
fraction?: boolean | randomCoefficientConfig,
|
|
15
15
|
zero?: boolean
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -29,9 +29,15 @@ export type randomGeometryLineConfig = {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
export type randomGeometryPointConfig
|
|
32
|
+
export type randomGeometryPointConfig = {
|
|
33
33
|
quadrant?: number,
|
|
34
34
|
axis?: string | boolean,
|
|
35
35
|
fraction?: boolean,
|
|
36
36
|
max?: number
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export type randomGeometryCircleConfig = {
|
|
40
|
+
center?: randomGeometryPointConfig,
|
|
41
|
+
radius?: number,
|
|
42
|
+
pointsOnCircle?: number
|
|
37
43
|
}
|
|
@@ -67,6 +67,16 @@ describe('Polynom tests', () => {
|
|
|
67
67
|
expect(euclidian.reminder.tex).to.be.equal('12')
|
|
68
68
|
});
|
|
69
69
|
|
|
70
|
+
it('should calculate the quotient and reminder with similar polynom', () => {
|
|
71
|
+
let P = new Polynom('6x^5+12x^4+3x^3+x^2-7x+6'),
|
|
72
|
+
D = new Polynom('x^3+2x^2-2x-4')
|
|
73
|
+
|
|
74
|
+
let euclidian = P.euclidian(D);
|
|
75
|
+
|
|
76
|
+
expect(euclidian.quotient.display).to.be.equal('6x^(2)+15')
|
|
77
|
+
expect(euclidian.reminder.display).to.be.equal('-5x^(2)+23x+66')
|
|
78
|
+
})
|
|
79
|
+
|
|
70
80
|
it('should reduce', () => {
|
|
71
81
|
let P = new Polynom('15x-19x+24+4x-12')
|
|
72
82
|
P.reduce()
|
|
@@ -4,6 +4,8 @@ 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 {Vector} from "../../src/maths/geometry/vector";
|
|
7
9
|
|
|
8
10
|
describe('Circle', function () {
|
|
9
11
|
it('should calculate the intersection of a circle and a line', function () {
|
|
@@ -67,7 +69,226 @@ describe('Circle', function () {
|
|
|
67
69
|
// console.log(circle.tex)
|
|
68
70
|
})
|
|
69
71
|
|
|
70
|
-
|
|
72
|
+
it('tangentes pt ext', () => {
|
|
73
|
+
function makeCircle(): { circle: Circle, point: Point, tangents: Line[] } {
|
|
74
|
+
let A = Random.Geometry.point({axis: false}),
|
|
75
|
+
rv = Random.number(1, 3),
|
|
76
|
+
r = rv ** 2 + (rv + 1) ** 2
|
|
77
|
+
let c = new Circle(A, r, true)
|
|
78
|
+
let pts = c.getPointsOnCircle(true)
|
|
79
|
+
|
|
80
|
+
pts = Random.shuffle(pts)
|
|
81
|
+
let pt1: Point, pt2: Point, t1: Line, t2: Line, I: Point, n: Vector
|
|
82
|
+
|
|
83
|
+
pt1 = pts.shift()
|
|
84
|
+
for (let pt of pts) {
|
|
85
|
+
// Pas vertical / horizontal
|
|
86
|
+
n = new Vector(A, pt)
|
|
87
|
+
|
|
88
|
+
if (!n.x.isZero() && !n.y.isZero() && // pas vertical / horizontal
|
|
89
|
+
!pt1.x.isEqual(pt.x) && !pt1.y.isEqual(pt.y) && // pas le même point
|
|
90
|
+
!A.isEqual(new Point().middleOf(pt1, pt)) // pas l'un en face de l'autre
|
|
91
|
+
) {
|
|
92
|
+
pt2 = pt.clone()
|
|
93
|
+
|
|
94
|
+
t1 = c.tangents(pt1)[0]
|
|
95
|
+
t2 = c.tangents(pt2)[0]
|
|
96
|
+
const intersection = t1.intersection(t2)
|
|
97
|
+
|
|
98
|
+
if (intersection.hasIntersection && intersection.point.x.isRelative()) {
|
|
99
|
+
I = intersection.point
|
|
100
|
+
break
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
return {
|
|
107
|
+
circle: c,
|
|
108
|
+
tangents: [t1, t2],
|
|
109
|
+
point: I
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
for (let i = 0; i < 30; i++) {
|
|
114
|
+
let {circle, tangents, point} = makeCircle()
|
|
115
|
+
console.log(`\\textbf{(exercice ${i + 1})}
|
|
116
|
+
|
|
117
|
+
Calculer l'équation cartésiennes des tangentes au cercle \\( (\\Gamma): ${circle.tex} \\) passant par le point \\(P=${point.tex} \\)
|
|
118
|
+
\\iftoggle{master}{
|
|
119
|
+
(I) \\( ${tangents[0].tex.canonical} \\quad ${tangents[1].tex.canonical} \\)
|
|
120
|
+
}{}
|
|
121
|
+
\\vfill
|
|
122
|
+
${i % 2 === 1 ? '\\newpage' : ''}
|
|
123
|
+
`)
|
|
124
|
+
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
const C = new PiMath.Geometry.Circle(circle.value),
|
|
128
|
+
pts = C.getPointsOnCircle()
|
|
129
|
+
|
|
130
|
+
code.value = `C(${C.center.x.value},${C.center.y.value})
|
|
131
|
+
c=circ C,${C.radius.value}`
|
|
132
|
+
|
|
133
|
+
let tangents = []
|
|
134
|
+
pts.forEach((pt, index) => {
|
|
135
|
+
let tg = C.tangents(pt)[0]
|
|
136
|
+
tangents.push(tg)
|
|
137
|
+
code.value += `\nT${index + 1}(${pt.x.value},${pt.y.value})->tex:T_${index + 1}=@`
|
|
138
|
+
code.value += `\nt${index + 1}=line ${tg.tex.canonical}`
|
|
139
|
+
|
|
140
|
+
tangentPerPoints.value.push(`T_${index+1}(${pt.x.tex};${pt.y.tex})\\implies ${tg.tex.canonical}`)
|
|
141
|
+
})
|
|
142
|
+
|
|
143
|
+
for (let i = 0; i < tangents.length; i++) {
|
|
144
|
+
for (let j = i + 1; j < tangents.length; j++) {
|
|
145
|
+
let intersection = tangents[i].intersection(tangents[j])
|
|
146
|
+
|
|
147
|
+
if (intersection.hasIntersection) {
|
|
148
|
+
if (!intersection.point.isInListOfPoints(pts)) {
|
|
149
|
+
intersection.point.name=`I_{${i + 1}-${j + 1}}`
|
|
150
|
+
intersectionPoints.value.push({
|
|
151
|
+
point: `I_{${i+1}-${j+1}}${intersection.point.tex}`,
|
|
152
|
+
tangent1: tangents[i].tex.canonical,
|
|
153
|
+
tangent2: tangents[j].tex.canonical
|
|
154
|
+
})
|
|
155
|
+
code.value += `\nI_${i + 1}_${j + 1}(${intersection.point.x.value},${intersection.point.y.value})->tex:I_{${i+1}-${i+2}}=@`
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
*/
|
|
161
|
+
})
|
|
162
|
+
it('tangentes temp tests', () => {
|
|
163
|
+
function makeCircle(): { circle: Circle, point: Point, tangent: Line, symetric: Line } {
|
|
164
|
+
let A = Random.Geometry.point({axis: false}),
|
|
165
|
+
rv = Random.number(1, 3),
|
|
166
|
+
r = rv ** 2 + (rv + 1) ** 2
|
|
167
|
+
let c = new Circle(A, r, true)
|
|
168
|
+
let pts = c.getPointsOnCircle(true)
|
|
169
|
+
|
|
170
|
+
pts = Random.shuffle(pts)
|
|
171
|
+
let pt: Point, n: Vector
|
|
172
|
+
for (let p of pts) {
|
|
173
|
+
n = new Vector(A, p)
|
|
174
|
+
if (!n.x.isZero() && !n.y.isZero()) {
|
|
175
|
+
pt = p
|
|
176
|
+
break
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
const p2 = new Point(A.x.clone(), A.y.clone()).translate({x: n.x.opposed(), y: n.y.opposed()})
|
|
181
|
+
const t = new Line(n, pt)
|
|
182
|
+
const s = new Line(n, p2)
|
|
183
|
+
return {
|
|
184
|
+
circle: c,
|
|
185
|
+
point: pt,
|
|
186
|
+
tangent: t,
|
|
187
|
+
symetric: s
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
for (let i = 0; i < 30; i++) {
|
|
192
|
+
|
|
193
|
+
const data1 = makeCircle()
|
|
194
|
+
const item1 = `Calculer l'équation de la tangente au cercle d'équation \\( (\\Gamma_1): ${data1.circle.tex} \\) un cercle passant par le point \\( T=${data1.point.tex} \\).`
|
|
195
|
+
|
|
196
|
+
const data2 = makeCircle()
|
|
197
|
+
const item2 = `Calculer l'équation des tangentes au cercle d'équation \\( (\\Gamma_2): ${data2.circle.cartesian.tex} \\) de pente \\( \\displaystyle ${data2.tangent.slope.tex} \\).`
|
|
198
|
+
|
|
199
|
+
console.log(`\\textbf{(exercice ${i + 1})}
|
|
200
|
+
|
|
201
|
+
\\begin{enumerate}[(I),itemsep=10em]
|
|
202
|
+
\\item ${item1}
|
|
203
|
+
\\item ${item2}
|
|
204
|
+
\\end{enumerate}
|
|
205
|
+
\\iftoggle{master}{
|
|
206
|
+
(I) \\( ${data1.tangent.tex.canonical} \\)
|
|
207
|
+
|
|
208
|
+
(II) \\( (\\Gamma_2): ${data2.circle.tex} \\) \\\\ \\( (t_1): ${data2.tangent.tex.canonical} \\) et \\( (t_2): ${data2.symetric.tex.canonical} \\)
|
|
209
|
+
|
|
210
|
+
}{}
|
|
211
|
+
\\vfill
|
|
212
|
+
${i % 2 === 1 ? '\\newpage' : ''}
|
|
213
|
+
`)
|
|
214
|
+
|
|
215
|
+
}
|
|
216
|
+
})
|
|
217
|
+
// it('intersection temp tests', () => {
|
|
218
|
+
// for (let i = 0; i < 30; i++) {
|
|
219
|
+
// let A = Random.Geometry.point({axis: false}),
|
|
220
|
+
// rv = Random.number(1, 3),
|
|
221
|
+
// r = rv ** 2 + (rv + 1) ** 2
|
|
222
|
+
//
|
|
223
|
+
// let c = new Circle(A, r, true)
|
|
224
|
+
// let pts = c.getPointsOnCircle(true)
|
|
225
|
+
// // console.log(r, pts.length)
|
|
226
|
+
//
|
|
227
|
+
// // console.log(c.tex)
|
|
228
|
+
// // console.log(pts.map(pt => pt.display))
|
|
229
|
+
// pts = Random.shuffle(pts)
|
|
230
|
+
// let ptt = pts.shift(),
|
|
231
|
+
// pt1 = pts.shift(),
|
|
232
|
+
// pt2
|
|
233
|
+
//
|
|
234
|
+
// for (let pt of pts) {
|
|
235
|
+
// if (!pt1.x.isEqual(pt.x) && !pt1.y.isEqual(pt.y) && !A.isEqual(new Point().middleOf(pt1, pt))) {
|
|
236
|
+
// pt2 = pt.clone()
|
|
237
|
+
// break
|
|
238
|
+
// }
|
|
239
|
+
// }
|
|
240
|
+
//
|
|
241
|
+
// // console.log('Pt de tangence')
|
|
242
|
+
// // console.log(ptt.display)
|
|
243
|
+
// let t = c.tangents(ptt)[0]
|
|
244
|
+
// // console.log(t.tex.canonical)
|
|
245
|
+
//
|
|
246
|
+
// // console.log('intersection en deux points')
|
|
247
|
+
// // console.log(pt1.display, pt2.display)
|
|
248
|
+
// let d = new Line(pt1, pt2)
|
|
249
|
+
// // console.log(d.tex.canonical)
|
|
250
|
+
//
|
|
251
|
+
// let P = Random.Geometry.point()
|
|
252
|
+
// while (P.x.isEqual(c.center.x) || P.y.isEqual(c.center.y)) {
|
|
253
|
+
// P = Random.Geometry.point()
|
|
254
|
+
// }
|
|
255
|
+
// // Le point P n'est pas sur le centre.
|
|
256
|
+
// let v = new Vector(c.center, P)
|
|
257
|
+
// while (P.distanceTo(A).value <= Math.sqrt(r)) {
|
|
258
|
+
// P.x.add(v.x)
|
|
259
|
+
// P.y.add(v.y)
|
|
260
|
+
// }
|
|
261
|
+
// let p = new Line(P, v, LinePropriety.Perpendicular)
|
|
262
|
+
// // console.log(P.display)
|
|
263
|
+
// // console.log(p.display.canonical)
|
|
264
|
+
//
|
|
265
|
+
// let lignes = Random.shuffle([t, d, p])
|
|
266
|
+
//
|
|
267
|
+
// // console.log(`A${A.display}
|
|
268
|
+
// // c=circ A,${Math.sqrt(r)}
|
|
269
|
+
// // T${ptt.display}
|
|
270
|
+
// // P${pt1.display}
|
|
271
|
+
// // Q${pt2.display}
|
|
272
|
+
// // t=line ${t.display.canonical}
|
|
273
|
+
// // d=line ${d.display.canonical}
|
|
274
|
+
// // p=line ${p.display.canonical}`)
|
|
275
|
+
// console.log(`(exercice ${i + 1}): Soit \\(\\Gamma\\) un cercle et \\(d_1\\), \\(d_2\\) et \\(d_3\\) trois droites.
|
|
276
|
+
// \\mathleft
|
|
277
|
+
// \\[(\\Gamma): ${c.tex}\\]
|
|
278
|
+
// \\[(d_1): ${lignes[0].tex.canonical} \\qquad (d_2): ${lignes[1].tex.canonical} \\qquad (d_3): ${lignes[2].tex.canonical}\\]
|
|
279
|
+
//
|
|
280
|
+
// \\begin{enumerate}[label=\\Alph*]
|
|
281
|
+
// \\item déterminer les positions relatives de \\(d_1\\), \\(d_2\\) et \\(d_3\\) par rapport à \\(\\Gamma\\)
|
|
282
|
+
// \\item calculer les coordonnées du ou des points d'intersection entre le cercle et une des droites qui le coupe (au choix).
|
|
283
|
+
// \\end{enumerate}
|
|
284
|
+
// \\iftoggle{master}{\\(${t.tex.canonical}\\implies ${ptt.tex}\\) \\\\ \\(${d.tex.canonical}\\implies ${pt1.tex},\\ ${pt2.tex}\\) \\\\}{}
|
|
285
|
+
// \\vfill
|
|
286
|
+
// ${i % 2 === 1 ? '\\newpage' : ''}
|
|
287
|
+
// `)
|
|
288
|
+
//
|
|
289
|
+
// }
|
|
290
|
+
//
|
|
291
|
+
// })
|
|
71
292
|
// it('temp tests', () => {
|
|
72
293
|
// for (let i = 0; i < 30; i++) {
|
|
73
294
|
// let A = Random.Geometry.point({axis: false}),
|
package/tests/numeric.test.ts
CHANGED
|
@@ -8,7 +8,7 @@ describe('Numeric', () => { // the tests container
|
|
|
8
8
|
expect(Numeric.numberCorrection(a)).to.be.equal(0.3)
|
|
9
9
|
const b = Math.pow(10, -5)
|
|
10
10
|
|
|
11
|
-
expect(Numeric.numberCorrection(b, 1,12)).to.be.equal(0.00001)
|
|
11
|
+
expect(Numeric.numberCorrection(b, 1, 12)).to.be.equal(0.00001)
|
|
12
12
|
})
|
|
13
13
|
|
|
14
14
|
|
|
@@ -21,7 +21,23 @@ describe('Numeric', () => { // the tests container
|
|
|
21
21
|
})
|
|
22
22
|
|
|
23
23
|
it('should decompose a number in two factors', function () {
|
|
24
|
-
expect(Numeric.decompose(25).map(x=>x.join(','))).to.have.all.members(['1,25', '5,5'])
|
|
25
|
-
expect(Numeric.decompose(6).map(x=>x.join(','))).to.have.all.members(['1,6', '2,3'])
|
|
24
|
+
expect(Numeric.decompose(25).map(x => x.join(','))).to.have.all.members(['1,25', '5,5'])
|
|
25
|
+
expect(Numeric.decompose(6).map(x => x.join(','))).to.have.all.members(['1,6', '2,3'])
|
|
26
26
|
});
|
|
27
|
+
|
|
28
|
+
it('algo perso', () => {
|
|
29
|
+
for (let n = 1000; n < 10000; n++) {
|
|
30
|
+
const a = Math.trunc(n / 1000)
|
|
31
|
+
const b = Math.trunc((n - 1000 * a) / 100)
|
|
32
|
+
const c = Math.trunc((n - 1000 * a - 100 * b) / 10)
|
|
33
|
+
const d = Math.trunc(n - 1000 * a - 100 * b - 10 * c)
|
|
34
|
+
|
|
35
|
+
const p = a + b + c + d
|
|
36
|
+
const p2 = a ** 2 + b ** 2 + c ** 2 + d ** 2
|
|
37
|
+
|
|
38
|
+
if (n === p * p2 ** 2) {
|
|
39
|
+
console.log(n)
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
})
|
|
27
43
|
});
|
package/tsconfig.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"src/maths/geometry/triangle.ts",
|
|
18
18
|
"src/maths/geometry/vector.ts",
|
|
19
19
|
"src/maths/numeric.ts",
|
|
20
|
-
"src/maths/shutingyard.ts"
|
|
20
|
+
"src/maths/shutingyard.ts"
|
|
21
21
|
],
|
|
22
22
|
"plugin": [
|
|
23
23
|
"./typedoc.katex.js"
|
|
@@ -25,13 +25,24 @@
|
|
|
25
25
|
"out": "docs"
|
|
26
26
|
},
|
|
27
27
|
"compilerOptions": {
|
|
28
|
+
"target": "es2021",
|
|
29
|
+
"useDefineForClassFields": true,
|
|
30
|
+
"module": "ESNext",
|
|
31
|
+
"lib": [
|
|
32
|
+
"ES2021",
|
|
33
|
+
"DOM",
|
|
34
|
+
"DOM.Iterable"
|
|
35
|
+
],
|
|
36
|
+
"skipLibCheck": true,
|
|
37
|
+
"moduleResolution": "bundler",
|
|
38
|
+
"allowImportingTsExtensions": true,
|
|
39
|
+
"resolveJsonModule": true,
|
|
40
|
+
"isolatedModules": true,
|
|
41
|
+
"noEmit": true,
|
|
28
42
|
"outDir": "./esm/",
|
|
29
43
|
"noImplicitAny": true,
|
|
30
|
-
"module": "commonjs",
|
|
31
|
-
"target": "es2021",
|
|
32
44
|
"allowJs": true,
|
|
33
45
|
"sourceMap": true,
|
|
34
|
-
"moduleResolution": "node",
|
|
35
46
|
"declaration": true,
|
|
36
47
|
"removeComments": false
|
|
37
48
|
},
|
package/vite.config.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {defineConfig} from "vite";
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
build: {
|
|
5
|
+
lib: {
|
|
6
|
+
entry: "src/main.ts",
|
|
7
|
+
name: "PiMath",
|
|
8
|
+
fileName: "pimath"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
rollupOptions: {
|
|
12
|
+
external: ["vue"],
|
|
13
|
+
output: {
|
|
14
|
+
globals: {
|
|
15
|
+
vue: "Vue"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
// input: {
|
|
19
|
+
// main: resolve(__dirname, "src/index.html"),
|
|
20
|
+
// playground: "src/demo/playground.html"
|
|
21
|
+
// }
|
|
22
|
+
}
|
|
23
|
+
})
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
|
|
3
3
|
module.exports = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
4
|
+
mode: 'production',
|
|
5
|
+
entry: './src/main.ts',
|
|
6
|
+
devtool: 'source-map',
|
|
7
|
+
module: {
|
|
8
|
+
rules: [
|
|
9
|
+
{
|
|
10
|
+
test: /\.tsx?$/,
|
|
11
|
+
use: 'ts-loader',
|
|
12
|
+
exclude: /node_module/,
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
},
|
|
16
|
+
resolve: {
|
|
17
|
+
extensions: ['.tsx', '.ts', '.js'],
|
|
18
|
+
},
|
|
19
|
+
output: {
|
|
20
|
+
filename: 'pimath.js',
|
|
21
|
+
path: path.resolve(__dirname, 'dist'),
|
|
22
|
+
},
|
|
23
|
+
optimization: {
|
|
24
|
+
minimize: false
|
|
25
|
+
}
|
|
26
26
|
};
|
package/webpack.config.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
|
|
3
3
|
module.exports = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
4
|
+
mode: 'development',
|
|
5
|
+
entry: './src/main.ts',
|
|
6
|
+
devtool: 'source-map',
|
|
7
|
+
module: {
|
|
8
|
+
rules: [
|
|
9
|
+
{
|
|
10
|
+
test: /\.tsx?$/,
|
|
11
|
+
use: 'ts-loader',
|
|
12
|
+
exclude: /node_module/,
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
},
|
|
16
|
+
resolve: {
|
|
17
|
+
extensions: ['.tsx', '.ts', '.js'],
|
|
18
|
+
},
|
|
19
|
+
output: {
|
|
20
|
+
filename: 'pimath.js',
|
|
21
|
+
path: path.resolve(__dirname, 'dev'),
|
|
22
|
+
},
|
|
23
|
+
optimization: {
|
|
24
|
+
minimize: false
|
|
25
|
+
}
|
|
26
26
|
};
|