pimath 0.0.20 → 0.0.21

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 CHANGED
@@ -18,43 +18,50 @@
18
18
 
19
19
  <script>
20
20
 
21
- let C1 = new Pi.Geometry.Point(-5, 4),
22
- r1 = 36,
23
- C2 = new Pi.Geometry.Point(7, -2),
24
- T = new Pi.Geometry.Point(2, 3)
25
-
26
- let G1 = new Pi.Geometry.Circle(C1, r1, true),
27
- G2 = new Pi.Geometry.Circle(C2, T)
28
-
29
- console.log('G1', G1.tex)
30
- console.log('G2', G2.tex)
31
-
32
- let t = new Pi.Geometry.Line(
33
- new Pi.Geometry.Vector(C2, T),
34
- T
35
- )
36
-
37
- console.log(t.tex.canonical)
38
- console.log(G1.relativePosition(t))
39
-
40
- let d = new Pi.Geometry.Line(G1.center, G2.center)
41
- console.log(d.tex.canonical)
42
-
43
- let M = new Pi.Geometry.Point(
44
- G1.center.x.clone().add(G2.center.x).divide(2),
45
- G1.center.y.clone().add(G2.center.y).divide(2),
46
- )
47
-
48
- console.log(M.display)
49
-
50
- let k = new Pi.Geometry.Line().parseByPointAndLine(
51
- M, d,
52
- Pi.Geometry.Line.PERPENDICULAR
53
- )
54
-
55
- console.log(k.tex.canonical)
56
-
57
- console.log(G1.lineIntersection(d))
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
@@ -4107,7 +4107,8 @@ class rndFraction extends randomCore_1.randomCore {
4107
4107
  this._defaultConfig = {
4108
4108
  negative: true,
4109
4109
  reduced: true,
4110
- zero: true
4110
+ zero: true,
4111
+ natural: false
4111
4112
  };
4112
4113
  this._config = this.mergeConfig(userConfig, this._defaultConfig);
4113
4114
  }
@@ -4119,7 +4120,12 @@ class rndFraction extends randomCore_1.randomCore {
4119
4120
  else {
4120
4121
  Q.numerator = index_1.Random.number(this._config.zero ? 0 : 1, 10);
4121
4122
  }
4122
- Q.denominator = index_1.Random.number(1, 10);
4123
+ if (this._config.natural) {
4124
+ Q.denominator = 1;
4125
+ }
4126
+ else {
4127
+ Q.denominator = index_1.Random.number(1, 10);
4128
+ }
4123
4129
  return this._config.reduced ? Q.reduce() : Q;
4124
4130
  };
4125
4131
  }
@@ -4213,7 +4219,8 @@ class rndMonom extends randomCore_1.randomCore {
4213
4219
  let M = new monom_1.Monom();
4214
4220
  M.coefficient = index_1.Random.fraction({
4215
4221
  zero: this._config.zero,
4216
- reduced: true
4222
+ reduced: true,
4223
+ natural: !this._config.fraction
4217
4224
  });
4218
4225
  if (this._config.letters.length > 1) {
4219
4226
  for (let L of this._config.letters.split('')) {