pimath 0.0.54 → 0.0.55
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/dist/pi.js +12 -5
- package/dist/pi.js.map +1 -1
- package/dist/pi.min.js +1 -1
- package/dist/pi.min.js.map +1 -1
- package/esm/maths/algebra/monom.d.ts +0 -3
- package/esm/maths/algebra/monom.js +1 -2
- package/esm/maths/algebra/polynom.d.ts +0 -2
- package/esm/maths/algebra/polynom.js +11 -5
- package/esm/maths/algebra/polynom.js.map +1 -1
- package/package.json +1 -1
- package/src/maths/algebra/polynom.ts +12 -6
- package/tests/algebra/polynom.test.ts +5 -1
package/dist/pi.js
CHANGED
|
@@ -2161,7 +2161,6 @@ class Polynom {
|
|
|
2161
2161
|
stack.push(stack.pop().opposed());
|
|
2162
2162
|
}
|
|
2163
2163
|
else {
|
|
2164
|
-
console.error('While parsing, cannot apply ', element.token, 'to', stack[0].tex);
|
|
2165
2164
|
throw "Error parsing the polynom " + this._rawString;
|
|
2166
2165
|
}
|
|
2167
2166
|
}
|
|
@@ -2368,9 +2367,13 @@ class Polynom {
|
|
|
2368
2367
|
const letter = P.variables[0];
|
|
2369
2368
|
const quotient = new Polynom().zero();
|
|
2370
2369
|
const reminder = this.clone().reorder(letter);
|
|
2371
|
-
// There is no variable
|
|
2370
|
+
// There is no variable - means it's a number
|
|
2372
2371
|
if (P.variables.length === 0) {
|
|
2373
|
-
|
|
2372
|
+
let q = this.clone().divide(P);
|
|
2373
|
+
return {
|
|
2374
|
+
quotient: this.clone().divide(P),
|
|
2375
|
+
reminder: new Polynom().zero()
|
|
2376
|
+
};
|
|
2374
2377
|
}
|
|
2375
2378
|
// Get at least a letter
|
|
2376
2379
|
const maxMP = P.monomByDegree(undefined, letter);
|
|
@@ -2400,6 +2403,11 @@ class Polynom {
|
|
|
2400
2403
|
else if (typeof value === 'number' && Number.isSafeInteger(value)) {
|
|
2401
2404
|
return this.divideByInteger(value);
|
|
2402
2405
|
}
|
|
2406
|
+
else if (value instanceof Polynom) {
|
|
2407
|
+
if (value.monoms.length === 1 && value.variables.length === 0) {
|
|
2408
|
+
return this.divideByFraction(value.monoms[0].coefficient);
|
|
2409
|
+
}
|
|
2410
|
+
}
|
|
2403
2411
|
};
|
|
2404
2412
|
this.pow = (nb) => {
|
|
2405
2413
|
if (!Number.isSafeInteger(nb)) {
|
|
@@ -2666,8 +2674,7 @@ class Polynom {
|
|
|
2666
2674
|
let P = this.clone().reorder(), M = P.commonMonom(), tempPolynom;
|
|
2667
2675
|
// It has a common monom.
|
|
2668
2676
|
if (!M.isOne()) {
|
|
2669
|
-
tempPolynom = new Polynom();
|
|
2670
|
-
tempPolynom.monoms = [M];
|
|
2677
|
+
tempPolynom = new Polynom(M);
|
|
2671
2678
|
factors = [tempPolynom.clone()];
|
|
2672
2679
|
P = P.euclidian(tempPolynom).quotient;
|
|
2673
2680
|
}
|