pimath 0.0.19 → 0.0.23
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/dev/index.html +44 -37
- package/dev/pi.js +30 -11
- package/dev/pi.js.map +1 -1
- package/dist/pi.js +1 -1
- package/dist/pi.js.map +1 -1
- package/esm/maths/algebra/polynom.js +2 -2
- package/esm/maths/algebra/polynom.js.map +1 -1
- package/esm/maths/geometry/line.d.ts +3 -2
- package/esm/maths/geometry/line.js +17 -4
- package/esm/maths/geometry/line.js.map +1 -1
- package/esm/maths/random/index.js +18 -6
- package/esm/maths/random/index.js.map +1 -1
- package/esm/maths/random/rndFraction.js +8 -2
- package/esm/maths/random/rndFraction.js.map +1 -1
- package/esm/maths/random/rndMonom.js +2 -1
- package/esm/maths/random/rndMonom.js.map +1 -1
- package/esm/maths/random/rndTypes.d.ts +1 -0
- package/package.json +1 -1
- package/src/maths/algebra/polynom.ts +4 -3
- package/src/maths/geometry/line.ts +29 -6
- package/src/maths/random/index.ts +24 -6
- package/src/maths/random/rndFraction.ts +7 -2
- package/src/maths/random/rndMonom.ts +2 -1
- package/src/maths/random/rndTypes.ts +2 -1
package/dev/index.html
CHANGED
|
@@ -18,43 +18,50 @@
|
|
|
18
18
|
|
|
19
19
|
<script>
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
T
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
console.log(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
console.log(
|
|
49
|
-
|
|
50
|
-
let
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
)
|
|
54
|
-
|
|
55
|
-
console.log(
|
|
56
|
-
|
|
57
|
-
|
|
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))
|
|
58
65
|
</script>
|
|
59
66
|
</body>
|
|
60
67
|
</html>
|
package/dev/pi.js
CHANGED
|
@@ -1984,9 +1984,9 @@ class Polynom {
|
|
|
1984
1984
|
resultPolynom.add(m.clone());
|
|
1985
1985
|
}
|
|
1986
1986
|
else {
|
|
1987
|
-
pow =
|
|
1987
|
+
pow = m.literal[letter].clone();
|
|
1988
1988
|
delete m.literal[letter];
|
|
1989
|
-
resultPolynom.add(P.clone().pow(pow).multiply(m));
|
|
1989
|
+
resultPolynom.add(P.clone().pow(Math.abs(pow.numerator)).multiply(m));
|
|
1990
1990
|
}
|
|
1991
1991
|
}
|
|
1992
1992
|
this._monoms = resultPolynom.reduce().reorder().monoms;
|
|
@@ -4041,17 +4041,29 @@ var Random;
|
|
|
4041
4041
|
return (new rndFraction_1.rndFraction(config)).generate();
|
|
4042
4042
|
}
|
|
4043
4043
|
Random.fraction = fraction;
|
|
4044
|
-
function number(from, to) {
|
|
4044
|
+
function number(from, to) {
|
|
4045
|
+
return rndHelpers_1.rndHelpers.randomInt(from, to);
|
|
4046
|
+
}
|
|
4045
4047
|
Random.number = number;
|
|
4046
|
-
function numberSym(max, allowZero) {
|
|
4048
|
+
function numberSym(max, allowZero) {
|
|
4049
|
+
return rndHelpers_1.rndHelpers.randomIntSym(max, allowZero);
|
|
4050
|
+
}
|
|
4047
4051
|
Random.numberSym = numberSym;
|
|
4048
|
-
function bool(percent) {
|
|
4052
|
+
function bool(percent) {
|
|
4053
|
+
return rndHelpers_1.rndHelpers.randomBool(percent);
|
|
4054
|
+
}
|
|
4049
4055
|
Random.bool = bool;
|
|
4050
|
-
function array(arr, number) {
|
|
4056
|
+
function array(arr, number) {
|
|
4057
|
+
return rndHelpers_1.rndHelpers.randomArray(arr, number);
|
|
4058
|
+
}
|
|
4051
4059
|
Random.array = array;
|
|
4052
|
-
function item(arr) {
|
|
4060
|
+
function item(arr) {
|
|
4061
|
+
return rndHelpers_1.rndHelpers.randomItem(arr);
|
|
4062
|
+
}
|
|
4053
4063
|
Random.item = item;
|
|
4054
|
-
function shuffle(arr) {
|
|
4064
|
+
function shuffle(arr) {
|
|
4065
|
+
rndHelpers_1.rndHelpers.shuffleArray(arr);
|
|
4066
|
+
}
|
|
4055
4067
|
Random.shuffle = shuffle;
|
|
4056
4068
|
})(Random = exports.Random || (exports.Random = {}));
|
|
4057
4069
|
|
|
@@ -4107,7 +4119,8 @@ class rndFraction extends randomCore_1.randomCore {
|
|
|
4107
4119
|
this._defaultConfig = {
|
|
4108
4120
|
negative: true,
|
|
4109
4121
|
reduced: true,
|
|
4110
|
-
zero: true
|
|
4122
|
+
zero: true,
|
|
4123
|
+
natural: false
|
|
4111
4124
|
};
|
|
4112
4125
|
this._config = this.mergeConfig(userConfig, this._defaultConfig);
|
|
4113
4126
|
}
|
|
@@ -4119,7 +4132,12 @@ class rndFraction extends randomCore_1.randomCore {
|
|
|
4119
4132
|
else {
|
|
4120
4133
|
Q.numerator = index_1.Random.number(this._config.zero ? 0 : 1, 10);
|
|
4121
4134
|
}
|
|
4122
|
-
|
|
4135
|
+
if (this._config.natural) {
|
|
4136
|
+
Q.denominator = 1;
|
|
4137
|
+
}
|
|
4138
|
+
else {
|
|
4139
|
+
Q.denominator = index_1.Random.number(1, 10);
|
|
4140
|
+
}
|
|
4123
4141
|
return this._config.reduced ? Q.reduce() : Q;
|
|
4124
4142
|
};
|
|
4125
4143
|
}
|
|
@@ -4213,7 +4231,8 @@ class rndMonom extends randomCore_1.randomCore {
|
|
|
4213
4231
|
let M = new monom_1.Monom();
|
|
4214
4232
|
M.coefficient = index_1.Random.fraction({
|
|
4215
4233
|
zero: this._config.zero,
|
|
4216
|
-
reduced: true
|
|
4234
|
+
reduced: true,
|
|
4235
|
+
natural: !this._config.fraction
|
|
4217
4236
|
});
|
|
4218
4237
|
if (this._config.letters.length > 1) {
|
|
4219
4238
|
for (let L of this._config.letters.split('')) {
|