pimath 0.0.96 → 0.0.98
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/.eslintrc.js +23 -23
- package/dist/pi.js +77 -42
- package/dist/pi.js.map +1 -1
- package/dist/pi.min.js +1 -1
- package/dist/pi.min.js.map +1 -1
- package/docs/assets/main.js +52 -52
- package/docs/classes/Logicalset.Logicalset-1.html +4 -4
- package/docs/classes/Polynom.Rational.html +3 -3
- package/docs/classes/algebra_equation.Equation.html +25 -25
- package/docs/classes/algebra_monom.Monom.html +113 -113
- package/docs/classes/algebra_polynom.Polynom.html +29 -29
- package/docs/classes/coefficients_fraction.Fraction.html +18 -18
- package/docs/classes/coefficients_nthroot.NthRoot.html +2 -2
- package/docs/classes/geometry_circle.Circle.html +2 -2
- package/docs/classes/geometry_line.Line.html +2 -2
- package/docs/classes/geometry_triangle.Triangle.html +16 -16
- package/docs/classes/numeric.Numeric.html +13 -13
- package/docs/classes/shutingyard.Shutingyard.html +17 -17
- package/docs/index.html +10 -10
- package/docs/interfaces/algebra_equation.ISolution.html +2 -2
- package/esm/maths/algebra/equation.d.ts +3 -5
- package/esm/maths/algebra/equation.js +67 -69
- package/esm/maths/algebra/monom.d.ts +2 -5
- package/esm/maths/algebra/polynom.d.ts +4 -7
- package/esm/maths/algebra/rational.d.ts +6 -7
- 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 +3 -11
- package/esm/maths/algebra/study/rationalStudy.js +33 -35
- package/esm/maths/algebra/study/rationalStudy.js.map +1 -1
- package/esm/maths/algebra/study.d.ts +21 -14
- package/esm/maths/algebra/study.js +74 -39
- package/esm/maths/algebra/study.js.map +1 -1
- package/esm/maths/coefficients/nthRoot.js +16 -8
- package/package.json +7 -7
- package/src/maths/algebra/rational.ts +3 -2
- package/src/maths/algebra/study/rationalStudy.ts +3 -3
- package/src/maths/algebra/study.ts +93 -51
package/.eslintrc.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
"env": {
|
|
3
|
-
"browser": true,
|
|
4
|
-
"es6": true
|
|
5
|
-
},
|
|
6
|
-
"extends": [
|
|
7
|
-
"eslint:recommended",
|
|
8
|
-
"plugin:@typescript-eslint/eslint-recommended"
|
|
9
|
-
],
|
|
10
|
-
"globals": {
|
|
11
|
-
"Atomics": "readonly",
|
|
12
|
-
"SharedArrayBuffer": "readonly"
|
|
13
|
-
},
|
|
14
|
-
"parser": "@typescript-eslint/parser",
|
|
15
|
-
"parserOptions": {
|
|
16
|
-
"ecmaVersion": 2018,
|
|
17
|
-
"sourceType": "module"
|
|
18
|
-
},
|
|
19
|
-
"plugins": [
|
|
20
|
-
"@typescript-eslint"
|
|
21
|
-
],
|
|
22
|
-
"rules": {
|
|
23
|
-
}
|
|
1
|
+
module.exports = {
|
|
2
|
+
"env": {
|
|
3
|
+
"browser": true,
|
|
4
|
+
"es6": true
|
|
5
|
+
},
|
|
6
|
+
"extends": [
|
|
7
|
+
"eslint:recommended",
|
|
8
|
+
"plugin:@typescript-eslint/eslint-recommended"
|
|
9
|
+
],
|
|
10
|
+
"globals": {
|
|
11
|
+
"Atomics": "readonly",
|
|
12
|
+
"SharedArrayBuffer": "readonly"
|
|
13
|
+
},
|
|
14
|
+
"parser": "@typescript-eslint/parser",
|
|
15
|
+
"parserOptions": {
|
|
16
|
+
"ecmaVersion": 2018,
|
|
17
|
+
"sourceType": "module"
|
|
18
|
+
},
|
|
19
|
+
"plugins": [
|
|
20
|
+
"@typescript-eslint"
|
|
21
|
+
],
|
|
22
|
+
"rules": {
|
|
23
|
+
}
|
|
24
24
|
};
|
package/dist/pi.js
CHANGED
|
@@ -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();
|
|
@@ -3628,7 +3628,7 @@ var TABLE_OF_SIGNS;
|
|
|
3628
3628
|
(function (TABLE_OF_SIGNS) {
|
|
3629
3629
|
TABLE_OF_SIGNS["SIGNS"] = "signs";
|
|
3630
3630
|
TABLE_OF_SIGNS["GROWS"] = "grows";
|
|
3631
|
-
TABLE_OF_SIGNS["VARIATIONS"] = "
|
|
3631
|
+
TABLE_OF_SIGNS["VARIATIONS"] = "variatins";
|
|
3632
3632
|
})(TABLE_OF_SIGNS = exports.TABLE_OF_SIGNS || (exports.TABLE_OF_SIGNS = {}));
|
|
3633
3633
|
/**
|
|
3634
3634
|
* The study class is a "function study" class that will get:
|
|
@@ -3646,16 +3646,24 @@ var TABLE_OF_SIGNS;
|
|
|
3646
3646
|
* variations : variation table + tex output using tkz-tab
|
|
3647
3647
|
*/
|
|
3648
3648
|
class Study {
|
|
3649
|
-
constructor(fx) {
|
|
3649
|
+
constructor(fx, config) {
|
|
3650
3650
|
this.makeStudy = () => {
|
|
3651
3651
|
this._zeroes = this.makeZeroes();
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
this.
|
|
3657
|
-
|
|
3658
|
-
this.
|
|
3652
|
+
if (this.config.signs)
|
|
3653
|
+
this._signs = this.makeSigns();
|
|
3654
|
+
if (this.config.asymptotes)
|
|
3655
|
+
this._asymptotes = this.makeAsymptotes();
|
|
3656
|
+
if (this.config.derivative)
|
|
3657
|
+
this._derivative = this.makeDerivative();
|
|
3658
|
+
if (this.config.variations)
|
|
3659
|
+
this._variations = this.makeVariation();
|
|
3660
|
+
// Table of signs / derivative / variation
|
|
3661
|
+
if (this.config.signs)
|
|
3662
|
+
this._signs.tex = this.texSigns;
|
|
3663
|
+
if (this.config.derivative)
|
|
3664
|
+
this._derivative.tex = this.texGrows;
|
|
3665
|
+
if (this.config.variations)
|
|
3666
|
+
this._variations.tex = this.texVariations;
|
|
3659
3667
|
};
|
|
3660
3668
|
this.indexOfZero = (zeroes, zero) => {
|
|
3661
3669
|
for (let i = 0; i < zeroes.length; i++) {
|
|
@@ -3786,35 +3794,6 @@ class Study {
|
|
|
3786
3794
|
let extremes = {}, varsLine = [];
|
|
3787
3795
|
return { varsLine, extremes };
|
|
3788
3796
|
};
|
|
3789
|
-
this._makeTexFromTableOfSigns = (tos) => {
|
|
3790
|
-
let factors = tos.factors.map(x => `\\(${x.tex}\\)/1`), factorsFx = "\\(fx\\)/1.2", zeroes = tos.zeroes;
|
|
3791
|
-
// Add the last lines "label"
|
|
3792
|
-
if (tos.type === TABLE_OF_SIGNS.GROWS) {
|
|
3793
|
-
factorsFx = "\\(f'(x)\\)/1.2,\\(f(x)\\)/2";
|
|
3794
|
-
}
|
|
3795
|
-
else if (tos.type === TABLE_OF_SIGNS.VARIATIONS) {
|
|
3796
|
-
factorsFx = "\\(f''(x)\\)/1.2,\\(f(x)\\)/2";
|
|
3797
|
-
}
|
|
3798
|
-
// Create the tikzPicture header
|
|
3799
|
-
let tex = `\\begin{tikzpicture}
|
|
3800
|
-
\\tkzTabInit[lgt=3,espcl=2,deltacl=0]{/1.2,${factors.join(',')},/.1,${factorsFx} }{{\\scriptsize \\hspace{1cm} \\(-\\infty\\)},\\(${zeroes.map(x => x.tex).join('\\),\\(')}\\),{\\scriptsize \\hspace{-1cm} \\(+\\infty\\)}}`;
|
|
3801
|
-
let pos;
|
|
3802
|
-
for (pos = 0; pos < tos.factors.length; pos++) {
|
|
3803
|
-
tex += (`\n\\tkzTabLine{${tos.signs[pos].join(',')}}`);
|
|
3804
|
-
}
|
|
3805
|
-
// Add the result line
|
|
3806
|
-
tex += (`\n\\tkzTabLine{${tos.signs[pos].join(',')}}`);
|
|
3807
|
-
// Add the grows / vars line
|
|
3808
|
-
if (tos.type === TABLE_OF_SIGNS.GROWS) {
|
|
3809
|
-
tex += (`\n\\tkzTabVar{${tos.signs[pos + 1].join(',')}}`);
|
|
3810
|
-
}
|
|
3811
|
-
else if (tos.type === TABLE_OF_SIGNS.VARIATIONS) {
|
|
3812
|
-
// TODO: Check variations table for as tex
|
|
3813
|
-
tex += (`\n\\tkzTabVar{${tos.signs[pos + 1].join(',')}}`);
|
|
3814
|
-
}
|
|
3815
|
-
tex += `\n\\end{tikzpicture}`;
|
|
3816
|
-
return tex;
|
|
3817
|
-
};
|
|
3818
3797
|
this.drawCode = () => {
|
|
3819
3798
|
// Function as string
|
|
3820
3799
|
let code = `f(x)=${this.fx.plotFunction}`;
|
|
@@ -3848,7 +3827,63 @@ class Study {
|
|
|
3848
3827
|
});
|
|
3849
3828
|
return code;
|
|
3850
3829
|
};
|
|
3830
|
+
this._makeTexFromTableOfSigns = (tos) => {
|
|
3831
|
+
let factors = tos.factors.map(x => `\\(${x.tex}\\)/1`), factorsFx = `\\(${this.name}(x)\\)/1.2`, zeroes = tos.zeroes;
|
|
3832
|
+
// Add the last lines "label"
|
|
3833
|
+
if (tos.type === TABLE_OF_SIGNS.GROWS) {
|
|
3834
|
+
factorsFx = `\\(${this.name}'(x)\\)/1.2,\\(f(x)\\)/2`;
|
|
3835
|
+
}
|
|
3836
|
+
else if (tos.type === TABLE_OF_SIGNS.VARIATIONS) {
|
|
3837
|
+
factorsFx = `\\(${this.name}''(x)\\)/1.2,\\(f(x)\\)/2`;
|
|
3838
|
+
}
|
|
3839
|
+
// Create the tikzPicture header
|
|
3840
|
+
let tex = `\\begin{tikzpicture}
|
|
3841
|
+
\\tkzTabInit[lgt=3,espcl=2,deltacl=0]{/1.2,${factors.join(',')},/.1,${factorsFx} }{{\\scriptsize \\hspace{1cm} \\(-\\infty\\)},\\(${zeroes.map(x => x.tex).join('\\),\\(')}\\),{\\scriptsize \\hspace{-1cm} \\(+\\infty\\)}}`;
|
|
3842
|
+
let pos;
|
|
3843
|
+
for (pos = 0; pos < tos.factors.length; pos++) {
|
|
3844
|
+
tex += (`\n\\tkzTabLine{${tos.signs[pos].join(',')}}`);
|
|
3845
|
+
}
|
|
3846
|
+
// Add the result line
|
|
3847
|
+
tex += (`\n\\tkzTabLine{${tos.signs[pos].join(',')}}`);
|
|
3848
|
+
// Add the grows / vars line
|
|
3849
|
+
if (tos.type === TABLE_OF_SIGNS.GROWS) {
|
|
3850
|
+
tex += (`\n\\tkzTabVar{${tos.signs[pos + 1].join(',')}}`);
|
|
3851
|
+
}
|
|
3852
|
+
else if (tos.type === TABLE_OF_SIGNS.VARIATIONS) {
|
|
3853
|
+
// TODO: Check variations table for as tex
|
|
3854
|
+
tex += (`\n\\tkzTabVar{${tos.signs[pos + 1].join(',')}}`);
|
|
3855
|
+
}
|
|
3856
|
+
tex += `\n\\end{tikzpicture}`;
|
|
3857
|
+
return tex;
|
|
3858
|
+
};
|
|
3851
3859
|
this.fx = fx;
|
|
3860
|
+
this.config = {
|
|
3861
|
+
name: 'f',
|
|
3862
|
+
domain: true,
|
|
3863
|
+
asymptotes: true,
|
|
3864
|
+
signs: true,
|
|
3865
|
+
derivative: true,
|
|
3866
|
+
variations: true,
|
|
3867
|
+
};
|
|
3868
|
+
if (config) {
|
|
3869
|
+
if (typeof config === 'string') {
|
|
3870
|
+
const d = config.split(',');
|
|
3871
|
+
this.config = {};
|
|
3872
|
+
let n = d.filter(x => x.includes('(x)'));
|
|
3873
|
+
if (n.length === 1) {
|
|
3874
|
+
this.config.name = n[0].split('(x)')[0];
|
|
3875
|
+
}
|
|
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
|
+
}
|
|
3882
|
+
else {
|
|
3883
|
+
this.config = config;
|
|
3884
|
+
}
|
|
3885
|
+
}
|
|
3886
|
+
this.name = this.config?.name ?? 'f';
|
|
3852
3887
|
this.makeStudy();
|
|
3853
3888
|
return this;
|
|
3854
3889
|
}
|
|
@@ -3949,8 +3984,8 @@ const rational_1 = __webpack_require__(107);
|
|
|
3949
3984
|
const fraction_1 = __webpack_require__(506);
|
|
3950
3985
|
const polynom_1 = __webpack_require__(38);
|
|
3951
3986
|
class RationalStudy extends study_1.Study {
|
|
3952
|
-
constructor(fx) {
|
|
3953
|
-
super(fx);
|
|
3987
|
+
constructor(fx, config) {
|
|
3988
|
+
super(fx, config);
|
|
3954
3989
|
return this;
|
|
3955
3990
|
}
|
|
3956
3991
|
makeZeroes() {
|