pimath 0.0.97 → 0.0.99
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 +35 -23
- 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/polynom.js +1 -1
- package/esm/maths/algebra/polynom.js.map +1 -1
- package/esm/maths/algebra/rational.d.ts +2 -1
- package/esm/maths/algebra/rational.js +2 -2
- package/esm/maths/algebra/rational.js.map +1 -1
- package/esm/maths/algebra/study/rationalStudy.d.ts +1 -1
- package/esm/maths/algebra/study/rationalStudy.js.map +1 -1
- package/esm/maths/algebra/study.d.ts +6 -2
- package/esm/maths/algebra/study.js +32 -20
- package/esm/maths/algebra/study.js.map +1 -1
- package/package.json +1 -1
- package/src/maths/algebra/polynom.ts +1 -1
- package/src/maths/algebra/rational.ts +3 -2
- package/src/maths/algebra/study/rationalStudy.ts +1 -1
- package/src/maths/algebra/study.ts +38 -22
- package/tests/algebra/polynom.test.ts +24 -0
- package/tests/algebra/study.test.ts +15 -2
package/dist/pi.js
CHANGED
|
@@ -2554,7 +2554,7 @@ class Polynom {
|
|
|
2554
2554
|
this.isFactorized = (polynomString) => {
|
|
2555
2555
|
let P;
|
|
2556
2556
|
// Check if polynom is complete...
|
|
2557
|
-
if (polynomString.
|
|
2557
|
+
if (polynomString.split('(').length !== polynomString.split(')').length) {
|
|
2558
2558
|
return false;
|
|
2559
2559
|
}
|
|
2560
2560
|
// Try to build the polynom
|
|
@@ -3542,8 +3542,8 @@ class Rational {
|
|
|
3542
3542
|
this.evaluateAsNumeric = (values) => {
|
|
3543
3543
|
return this._numerator.evaluateAsNumeric(values) / this._denominator.evaluateAsNumeric(values);
|
|
3544
3544
|
};
|
|
3545
|
-
this.study = () => {
|
|
3546
|
-
return new rationalStudy_1.RationalStudy(this);
|
|
3545
|
+
this.study = (config) => {
|
|
3546
|
+
return new rationalStudy_1.RationalStudy(this, config);
|
|
3547
3547
|
};
|
|
3548
3548
|
if (numerator instanceof polynom_1.Polynom) {
|
|
3549
3549
|
this._numerator = numerator.clone();
|
|
@@ -3649,20 +3649,20 @@ class Study {
|
|
|
3649
3649
|
constructor(fx, config) {
|
|
3650
3650
|
this.makeStudy = () => {
|
|
3651
3651
|
this._zeroes = this.makeZeroes();
|
|
3652
|
-
if (this.
|
|
3652
|
+
if (this._config.signs)
|
|
3653
3653
|
this._signs = this.makeSigns();
|
|
3654
|
-
if (this.
|
|
3654
|
+
if (this._config.asymptotes)
|
|
3655
3655
|
this._asymptotes = this.makeAsymptotes();
|
|
3656
|
-
if (this.
|
|
3656
|
+
if (this._config.derivative)
|
|
3657
3657
|
this._derivative = this.makeDerivative();
|
|
3658
|
-
if (this.
|
|
3658
|
+
if (this._config.variations)
|
|
3659
3659
|
this._variations = this.makeVariation();
|
|
3660
3660
|
// Table of signs / derivative / variation
|
|
3661
|
-
if (this.
|
|
3661
|
+
if (this._config.signs)
|
|
3662
3662
|
this._signs.tex = this.texSigns;
|
|
3663
|
-
if (this.
|
|
3663
|
+
if (this._config.derivative)
|
|
3664
3664
|
this._derivative.tex = this.texGrows;
|
|
3665
|
-
if (this.
|
|
3665
|
+
if (this._config.variations)
|
|
3666
3666
|
this._variations.tex = this.texVariations;
|
|
3667
3667
|
};
|
|
3668
3668
|
this.indexOfZero = (zeroes, zero) => {
|
|
@@ -3828,13 +3828,13 @@ class Study {
|
|
|
3828
3828
|
return code;
|
|
3829
3829
|
};
|
|
3830
3830
|
this._makeTexFromTableOfSigns = (tos) => {
|
|
3831
|
-
let factors = tos.factors.map(x => `\\(${x.tex}\\)/1`), factorsFx = `\\(${this.
|
|
3831
|
+
let factors = tos.factors.map(x => `\\(${x.tex}\\)/1`), factorsFx = `\\(${this._name}(x)\\)/1.2`, zeroes = tos.zeroes;
|
|
3832
3832
|
// Add the last lines "label"
|
|
3833
3833
|
if (tos.type === TABLE_OF_SIGNS.GROWS) {
|
|
3834
|
-
factorsFx = `\\(${this.
|
|
3834
|
+
factorsFx = `\\(${this._name}'(x)\\)/1.2,\\(f(x)\\)/2`;
|
|
3835
3835
|
}
|
|
3836
3836
|
else if (tos.type === TABLE_OF_SIGNS.VARIATIONS) {
|
|
3837
|
-
factorsFx = `\\(${this.
|
|
3837
|
+
factorsFx = `\\(${this._name}''(x)\\)/1.2,\\(f(x)\\)/2`;
|
|
3838
3838
|
}
|
|
3839
3839
|
// Create the tikzPicture header
|
|
3840
3840
|
let tex = `\\begin{tikzpicture}
|
|
@@ -3857,7 +3857,7 @@ class Study {
|
|
|
3857
3857
|
return tex;
|
|
3858
3858
|
};
|
|
3859
3859
|
this.fx = fx;
|
|
3860
|
-
this.
|
|
3860
|
+
this._config = {
|
|
3861
3861
|
name: 'f',
|
|
3862
3862
|
domain: true,
|
|
3863
3863
|
asymptotes: true,
|
|
@@ -3868,25 +3868,37 @@ class Study {
|
|
|
3868
3868
|
if (config) {
|
|
3869
3869
|
if (typeof config === 'string') {
|
|
3870
3870
|
const d = config.split(',');
|
|
3871
|
-
this.
|
|
3871
|
+
this._config = {};
|
|
3872
3872
|
let n = d.filter(x => x.includes('(x)'));
|
|
3873
3873
|
if (n.length === 1) {
|
|
3874
|
-
this.
|
|
3874
|
+
this._config.name = n[0].split('(x)')[0];
|
|
3875
3875
|
}
|
|
3876
|
-
this.
|
|
3877
|
-
this.
|
|
3878
|
-
this.
|
|
3879
|
-
this.
|
|
3880
|
-
this.
|
|
3876
|
+
this._config.domain = d.includes('d');
|
|
3877
|
+
this._config.asymptotes = d.includes('a');
|
|
3878
|
+
this._config.signs = d.includes('signs');
|
|
3879
|
+
this._config.derivative = d.includes('dx');
|
|
3880
|
+
this._config.variations = d.includes('ddx');
|
|
3881
3881
|
}
|
|
3882
3882
|
else {
|
|
3883
|
-
this.
|
|
3883
|
+
this._config = config;
|
|
3884
3884
|
}
|
|
3885
3885
|
}
|
|
3886
|
-
this.
|
|
3886
|
+
this._name = this._config?.name ?? 'f';
|
|
3887
3887
|
this.makeStudy();
|
|
3888
3888
|
return this;
|
|
3889
3889
|
}
|
|
3890
|
+
get name() {
|
|
3891
|
+
return this._name;
|
|
3892
|
+
}
|
|
3893
|
+
set name(value) {
|
|
3894
|
+
this._name = value;
|
|
3895
|
+
}
|
|
3896
|
+
get config() {
|
|
3897
|
+
return this._config;
|
|
3898
|
+
}
|
|
3899
|
+
set config(value) {
|
|
3900
|
+
this._config = value;
|
|
3901
|
+
}
|
|
3890
3902
|
get zeroes() {
|
|
3891
3903
|
return this._zeroes;
|
|
3892
3904
|
}
|