pimath 0.0.93 → 0.0.95
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 +70 -8
- 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/equation.d.ts +6 -3
- package/esm/maths/algebra/equation.js +92 -59
- package/esm/maths/algebra/equation.js.map +1 -1
- package/esm/maths/algebra/study/rationalStudy.js +15 -3
- package/esm/maths/algebra/study/rationalStudy.js.map +1 -1
- package/esm/maths/algebra/study.d.ts +1 -0
- package/esm/maths/algebra/study.js.map +1 -1
- package/esm/maths/coefficients/nthRoot.d.ts +1 -0
- package/esm/maths/coefficients/nthRoot.js +23 -8
- package/esm/maths/coefficients/nthRoot.js.map +1 -1
- package/package.json +1 -1
- package/src/maths/algebra/equation.ts +46 -12
- package/src/maths/algebra/study/rationalStudy.ts +11 -2
- package/src/maths/algebra/study.ts +1 -0
- package/src/maths/coefficients/nthRoot.ts +22 -0
|
@@ -87,25 +87,40 @@ class NthRoot {
|
|
|
87
87
|
let C;
|
|
88
88
|
if (this._coefficient === 1) {
|
|
89
89
|
C = '';
|
|
90
|
-
}
|
|
91
|
-
else if (this._coefficient === -1) {
|
|
90
|
+
} else if (this._coefficient === -1) {
|
|
92
91
|
C = '-';
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
92
|
+
} else {
|
|
95
93
|
C = this._coefficient.toString();
|
|
96
94
|
}
|
|
97
95
|
if (this._radical === 1) {
|
|
98
96
|
return `${this._coefficient}`;
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
97
|
+
} else {
|
|
101
98
|
if (this._nth === 2) {
|
|
102
99
|
return `${C}\\sqrt{${this._radical}}`;
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
100
|
+
} else {
|
|
105
101
|
return `${C}\\sqrt[${this._nth}]{${this._radical}}`;
|
|
106
102
|
}
|
|
107
103
|
}
|
|
108
104
|
}
|
|
105
|
+
get display() {
|
|
106
|
+
let C;
|
|
107
|
+
if (this._coefficient === 1) {
|
|
108
|
+
C = '';
|
|
109
|
+
} else if (this._coefficient === -1) {
|
|
110
|
+
C = '-';
|
|
111
|
+
} else {
|
|
112
|
+
C = this._coefficient.toString();
|
|
113
|
+
}
|
|
114
|
+
if (this._radical === 1) {
|
|
115
|
+
return `${this._coefficient}`;
|
|
116
|
+
} else {
|
|
117
|
+
if (this._nth === 2) {
|
|
118
|
+
return `${C}sqrt{${this._radical}}`;
|
|
119
|
+
} else {
|
|
120
|
+
return `${C}root(${this._nth}){${this._radical}}`;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
109
124
|
get value() {
|
|
110
125
|
return this._coefficient * Math.pow(this._radical, 1 / this._nth);
|
|
111
126
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nthRoot.js","sourceRoot":"","sources":["../../../src/maths/coefficients/nthRoot.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,MAAa,OAAO;IAMhB,YAAY,GAAG,MAAgB;
|
|
1
|
+
{"version":3,"file":"nthRoot.js","sourceRoot":"","sources":["../../../src/maths/coefficients/nthRoot.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,MAAa,OAAO;IAMhB,YAAY,GAAG,MAAgB;QA4F/B,6CAA6C;QAC7C,+BAA+B;QAC/B,6CAA6C;QAC7C,UAAK,GAAG,CAAC,OAAe,EAAE,OAAgB,EAAE,WAAoB,EAAW,EAAE;YACzE,IAAI,CAAC,YAAY,GAAG,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC;YAClE,IAAI,CAAC,IAAI,GAAG,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;YAClD,IAAI,CAAC,QAAQ,GAAG,CAAC,OAAO,KAAK,SAAS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CAAC,IAAI,KAAK,IAAI,CAAC,QAAQ,GAAG,CAAA;aACpD;SACJ;IACL,CAAC;IAED,IAAI,KAAK;QACL,OAAO,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;IACtE,CAAC;CAgDJ;AAhJD,0BAgJC"}
|
package/package.json
CHANGED
|
@@ -9,6 +9,7 @@ import {NthRoot} from "../coefficients/nthRoot";
|
|
|
9
9
|
*/
|
|
10
10
|
export interface ISolution {
|
|
11
11
|
tex: string,
|
|
12
|
+
display: string,
|
|
12
13
|
value: number,
|
|
13
14
|
exact: unknown
|
|
14
15
|
}
|
|
@@ -535,7 +536,7 @@ export class Equation {
|
|
|
535
536
|
const m1 = this._polynom.monomByDegree(1, letter).coefficient,
|
|
536
537
|
m0 = this._polynom.monomByDegree(0, letter).coefficient,
|
|
537
538
|
v = m0.clone().opposed().divide(m1);
|
|
538
|
-
let s: string;
|
|
539
|
+
let s: string, d: string;
|
|
539
540
|
|
|
540
541
|
if (this.isStrictEqual()) {
|
|
541
542
|
if (m1.value === 0) {
|
|
@@ -543,12 +544,14 @@ export class Equation {
|
|
|
543
544
|
if (m0.value === 0) {
|
|
544
545
|
this._solutions = [{
|
|
545
546
|
tex: this._real,
|
|
547
|
+
display: "RR",
|
|
546
548
|
value: NaN,
|
|
547
549
|
exact: false
|
|
548
550
|
}];
|
|
549
551
|
} else {
|
|
550
552
|
this._solutions = [{
|
|
551
553
|
tex: this._varnothing,
|
|
554
|
+
display: "O/",
|
|
552
555
|
value: NaN,
|
|
553
556
|
exact: false
|
|
554
557
|
}];
|
|
@@ -556,6 +559,7 @@ export class Equation {
|
|
|
556
559
|
} else {
|
|
557
560
|
this._solutions = [{
|
|
558
561
|
tex: v.tex,
|
|
562
|
+
display: v.display,
|
|
559
563
|
value: v.value,
|
|
560
564
|
exact: v
|
|
561
565
|
}]
|
|
@@ -566,23 +570,29 @@ export class Equation {
|
|
|
566
570
|
// In this case, the coefficient of the x variable is zero.
|
|
567
571
|
if (m0.value === 0 && this.isAlsoEqual()) {
|
|
568
572
|
s = '\\mathbb{R}';
|
|
573
|
+
d = "RR"
|
|
569
574
|
} else {
|
|
570
575
|
if (m0.value > 0) {
|
|
571
576
|
s = this.isGreater() ? this._real : this._varnothing;
|
|
577
|
+
s = this.isGreater() ? "RR" : "O/";
|
|
572
578
|
} else {
|
|
573
579
|
s = !this.isGreater() ? this._real : this._varnothing;
|
|
580
|
+
s = !this.isGreater() ? "RR" : "O/";
|
|
574
581
|
}
|
|
575
582
|
}
|
|
576
583
|
} else {
|
|
577
584
|
// Must handle the case if the m1 monom is negative.
|
|
578
585
|
if ((this.isGreater() && m1.sign() === 1) || (!this.isGreater() && m1.sign() === -1)) {
|
|
579
586
|
s = `\\left${this.isAlsoEqual() ? '[' : ']'}${v.tex};+\\infty\\right[`;
|
|
587
|
+
d = `${this.isAlsoEqual() ? '[' : ']'}${v.tex};+oo[`;
|
|
580
588
|
} else {
|
|
581
589
|
s = `\\left]-\\infty;${v.tex} \\right${this.isAlsoEqual() ? ']' : '['}`;
|
|
590
|
+
d = `]-oo;${v.tex}${this.isAlsoEqual() ? ']' : '['}`;
|
|
582
591
|
}
|
|
583
592
|
}
|
|
584
593
|
this._solutions = [{
|
|
585
594
|
tex: s,
|
|
595
|
+
display: d,
|
|
586
596
|
value: NaN,
|
|
587
597
|
exact: false
|
|
588
598
|
}];
|
|
@@ -611,14 +621,19 @@ export class Equation {
|
|
|
611
621
|
|
|
612
622
|
if (delta > 1.0e5) {
|
|
613
623
|
// The delta is too big to be parsed !
|
|
624
|
+
let v1 = ((-b - Math.sqrt(delta)) / (2 * a)).toFixed(5),
|
|
625
|
+
v2 = ((-b + Math.sqrt(delta)) / (2 * a)).toFixed(5)
|
|
626
|
+
|
|
614
627
|
this._solutions = [
|
|
615
628
|
{
|
|
616
|
-
tex:
|
|
629
|
+
tex: v1,
|
|
630
|
+
display: v1,
|
|
617
631
|
value: realX1,
|
|
618
632
|
exact: false
|
|
619
633
|
},
|
|
620
634
|
{
|
|
621
|
-
tex:
|
|
635
|
+
tex: v2,
|
|
636
|
+
display: v2,
|
|
622
637
|
value: realX2,
|
|
623
638
|
exact: false
|
|
624
639
|
}
|
|
@@ -633,27 +648,35 @@ export class Equation {
|
|
|
633
648
|
am = a/gcd, bm = b/gcd
|
|
634
649
|
nthDelta.coefficient = nthDelta.coefficient / gcd;
|
|
635
650
|
|
|
636
|
-
if(a<0){
|
|
651
|
+
if (a < 0) {
|
|
637
652
|
am = -am
|
|
638
653
|
bm = -bm
|
|
639
654
|
}
|
|
640
655
|
|
|
641
|
-
let tex1 = "", tex2 = ""
|
|
656
|
+
let tex1 = "", tex2 = "", display1 = "", display2 = ""
|
|
642
657
|
|
|
643
|
-
tex1 = `${bm!==0?((-bm) + ' - '):''}${nthDelta.tex}`
|
|
644
|
-
tex2 = `${bm!==0?((-bm) + ' + '):''}${nthDelta.tex}`
|
|
658
|
+
tex1 = `${bm !== 0 ? ((-bm) + ' - ') : ''}${nthDelta.tex}`
|
|
659
|
+
tex2 = `${bm !== 0 ? ((-bm) + ' + ') : ''}${nthDelta.tex}`
|
|
660
|
+
display1 = `${bm !== 0 ? ((-bm) + ' - ') : ''}${nthDelta.display}`
|
|
661
|
+
display2 = `${bm !== 0 ? ((-bm) + ' + ') : ''}${nthDelta.display}`
|
|
645
662
|
|
|
646
|
-
if(am!==1){
|
|
647
|
-
tex1 = `\\frac{ ${tex1} }{ ${2*am} }`
|
|
648
|
-
tex2 = `\\frac{ ${tex2} }{ ${2*am} }`
|
|
663
|
+
if (am !== 1) {
|
|
664
|
+
tex1 = `\\frac{ ${tex1} }{ ${2 * am} }`
|
|
665
|
+
tex2 = `\\frac{ ${tex2} }{ ${2 * am} }`
|
|
649
666
|
}
|
|
650
667
|
|
|
651
668
|
this._solutions = [
|
|
652
669
|
{
|
|
653
|
-
tex: tex1,
|
|
670
|
+
tex: tex1,
|
|
671
|
+
display: tex1,
|
|
672
|
+
value: realX1,
|
|
673
|
+
exact: false
|
|
654
674
|
},
|
|
655
675
|
{
|
|
656
|
-
tex: tex2,
|
|
676
|
+
tex: tex2,
|
|
677
|
+
display: tex2,
|
|
678
|
+
value: realX2,
|
|
679
|
+
exact: false
|
|
657
680
|
},
|
|
658
681
|
]
|
|
659
682
|
|
|
@@ -723,11 +746,13 @@ export class Equation {
|
|
|
723
746
|
this._solutions = [
|
|
724
747
|
{
|
|
725
748
|
tex: S1.frac,
|
|
749
|
+
display: S1.display,
|
|
726
750
|
value: realX1,
|
|
727
751
|
exact: S1
|
|
728
752
|
},
|
|
729
753
|
{
|
|
730
754
|
tex: S2.frac,
|
|
755
|
+
display: S2.display,
|
|
731
756
|
value: realX2,
|
|
732
757
|
exact: S2
|
|
733
758
|
}
|
|
@@ -739,12 +764,14 @@ export class Equation {
|
|
|
739
764
|
const sol = new Fraction(-b, 2 * a).reduce()
|
|
740
765
|
this._solutions = [{
|
|
741
766
|
tex: sol.frac,
|
|
767
|
+
display: sol.display,
|
|
742
768
|
value: sol.value,
|
|
743
769
|
exact: sol
|
|
744
770
|
}];
|
|
745
771
|
} else {
|
|
746
772
|
this._solutions = [{
|
|
747
773
|
tex: this._varnothing,
|
|
774
|
+
display: "O/",
|
|
748
775
|
value: NaN,
|
|
749
776
|
exact: false
|
|
750
777
|
}];
|
|
@@ -759,6 +786,7 @@ export class Equation {
|
|
|
759
786
|
if ((this.isGreater() && aF.sign() === 1) || (!this.isGreater() && aF.sign() === -1)) {
|
|
760
787
|
this._solutions = [{
|
|
761
788
|
tex: `\\left]-\\infty ; ${sX1}\\right${this.isAlsoEqual() ? ']' : '['} \\cup \\left${this.isAlsoEqual() ? '[' : ']'}${sX2};+\\infty\\right[`,
|
|
789
|
+
display: `]-oo;${sX1}${this.isAlsoEqual() ? ']' : '['}uu${this.isAlsoEqual() ? '[' : ']'}${sX2};+oo[`,
|
|
762
790
|
value: NaN,
|
|
763
791
|
exact: false
|
|
764
792
|
}
|
|
@@ -766,6 +794,7 @@ export class Equation {
|
|
|
766
794
|
} else {
|
|
767
795
|
this._solutions = [{
|
|
768
796
|
tex: `\\left${this.isAlsoEqual() ? '[' : ']'}${sX1} ; ${sX2}\\right${this.isAlsoEqual() ? ']' : '['}`,
|
|
797
|
+
display: `${this.isAlsoEqual() ? '[' : ']'}${sX1};${sX2}${this.isAlsoEqual() ? ']' : '['}`,
|
|
769
798
|
value: NaN,
|
|
770
799
|
exact: false
|
|
771
800
|
}]
|
|
@@ -775,6 +804,7 @@ export class Equation {
|
|
|
775
804
|
if ((this.isGreater() && aF.sign() === 1) || (!this.isGreater() && aF.sign() === -1)) {
|
|
776
805
|
this._solutions = [{
|
|
777
806
|
tex: `\\left]-\\infty ; ${this._solutions[0].tex}\\right[ \\cup \\left]${this._solutions[0].tex};+\\infty\\right[`,
|
|
807
|
+
display: `]-oo;${this._solutions[0].tex}[uu]${this._solutions[0].tex};+oo[`,
|
|
778
808
|
value: NaN,
|
|
779
809
|
exact: false
|
|
780
810
|
}
|
|
@@ -782,6 +812,7 @@ export class Equation {
|
|
|
782
812
|
} else {
|
|
783
813
|
this._solutions = [{
|
|
784
814
|
tex: this._varnothing,
|
|
815
|
+
display: "O/",
|
|
785
816
|
value: NaN,
|
|
786
817
|
exact: false
|
|
787
818
|
}];
|
|
@@ -790,6 +821,7 @@ export class Equation {
|
|
|
790
821
|
if ((this.isGreater() && aF.sign() === 1) || (!this.isGreater() && aF.sign() === -1)) {
|
|
791
822
|
this._solutions = [{
|
|
792
823
|
tex: this._real,
|
|
824
|
+
display: "RR",
|
|
793
825
|
value: NaN,
|
|
794
826
|
exact: false
|
|
795
827
|
}];
|
|
@@ -801,12 +833,14 @@ export class Equation {
|
|
|
801
833
|
if (this.isGreater()) {
|
|
802
834
|
this._solutions = [{
|
|
803
835
|
tex: aF.sign() === 1 ? this._real : this._varnothing,
|
|
836
|
+
display: aF.sign() === 1 ? "RR" : "O/",
|
|
804
837
|
value: NaN,
|
|
805
838
|
exact: false
|
|
806
839
|
}];
|
|
807
840
|
} else {
|
|
808
841
|
this._solutions = [{
|
|
809
842
|
tex: aF.sign() === -1 ? this._real : this._varnothing,
|
|
843
|
+
display: aF.sign() === -1 ? "RR" : "O/",
|
|
810
844
|
value: NaN,
|
|
811
845
|
exact: false
|
|
812
846
|
}];
|
|
@@ -52,18 +52,21 @@ export class RationalStudy extends Study {
|
|
|
52
52
|
this.zeroes.filter(x => x.type === ZEROTYPE.DEFENCE).forEach(zero => {
|
|
53
53
|
// Check if it's a hole or an asymptote
|
|
54
54
|
let Ztype = ASYMPTOTE.VERTICAL,
|
|
55
|
-
tex = `x=${zero.tex}
|
|
55
|
+
tex = `x=${zero.tex}`,
|
|
56
|
+
display = `x=${zero.display}`
|
|
56
57
|
|
|
57
58
|
// Check if it's a hole: the reduced polynom should not be null
|
|
58
59
|
if (zero.exact instanceof Fraction) {
|
|
59
60
|
if (reduced.denominator.evaluate(zero.exact).isNotZero()) {
|
|
60
61
|
Ztype = ASYMPTOTE.HOLE
|
|
61
62
|
tex = `(${zero.tex};${reduced.evaluate(zero.exact).tex})`
|
|
63
|
+
display = `(${zero.display};${reduced.evaluate(zero.exact).display})`
|
|
62
64
|
}
|
|
63
65
|
} else {
|
|
64
66
|
if (reduced.denominator.evaluate(zero.value).isNotZero()) {
|
|
65
67
|
Ztype = ASYMPTOTE.HOLE
|
|
66
68
|
tex = `(${zero.tex};${reduced.evaluate(zero.value).tex})`
|
|
69
|
+
display = `(${zero.display};${reduced.evaluate(zero.value).display})`
|
|
67
70
|
}
|
|
68
71
|
}
|
|
69
72
|
|
|
@@ -103,7 +106,8 @@ export class RationalStudy extends Study {
|
|
|
103
106
|
asymptotes.push({
|
|
104
107
|
fx: null,
|
|
105
108
|
type: Ztype,
|
|
106
|
-
tex
|
|
109
|
+
tex,
|
|
110
|
+
display,
|
|
107
111
|
zero: zero,
|
|
108
112
|
limits: `\\lim_{x\\to${zero.tex} }\\ f(x) = ${pm}\\infty`,
|
|
109
113
|
deltaX: null,
|
|
@@ -127,6 +131,7 @@ export class RationalStudy extends Study {
|
|
|
127
131
|
fx: new Polynom(H),
|
|
128
132
|
type: ASYMPTOTE.HORIZONTAL,
|
|
129
133
|
tex: `y=${Htex}`,
|
|
134
|
+
display: H.display,
|
|
130
135
|
zero: null,
|
|
131
136
|
limits: `\\lim_{x\\to\\infty}\\ f(x) = ${Htex}`,
|
|
132
137
|
deltaX,
|
|
@@ -138,6 +143,7 @@ export class RationalStudy extends Study {
|
|
|
138
143
|
fx: new Polynom('0'),
|
|
139
144
|
type: ASYMPTOTE.HORIZONTAL,
|
|
140
145
|
tex: `y=0`,
|
|
146
|
+
display: `y=0`,
|
|
141
147
|
zero: null,
|
|
142
148
|
limits: `\\lim_{x\\to\\infty}\\ f(x) = ${0}`,
|
|
143
149
|
deltaX: null,
|
|
@@ -153,6 +159,7 @@ export class RationalStudy extends Study {
|
|
|
153
159
|
fx: quotient.clone(),
|
|
154
160
|
type: ASYMPTOTE.SLOPE,
|
|
155
161
|
tex: `y=${quotient.tex}`,
|
|
162
|
+
display: `y=${quotient.display}`,
|
|
156
163
|
zero: null,
|
|
157
164
|
limits: ``,
|
|
158
165
|
deltaX: new Rational(reminder, reduced.denominator),
|
|
@@ -214,6 +221,7 @@ export class RationalStudy extends Study {
|
|
|
214
221
|
// add the item
|
|
215
222
|
zeroes.push({
|
|
216
223
|
tex: z.tex,
|
|
224
|
+
display: z.display,
|
|
217
225
|
value: z.value,
|
|
218
226
|
exact: z.exact,
|
|
219
227
|
extrema: FUNCTION_EXTREMA.NOTHING,
|
|
@@ -230,6 +238,7 @@ export class RationalStudy extends Study {
|
|
|
230
238
|
// Add the item
|
|
231
239
|
zeroes.push({
|
|
232
240
|
tex: z.tex,
|
|
241
|
+
display: z.display,
|
|
233
242
|
value: z.value,
|
|
234
243
|
exact: z.exact,
|
|
235
244
|
extrema: FUNCTION_EXTREMA.NOTHING,
|
|
@@ -73,6 +73,28 @@ export class NthRoot {
|
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
+
get display(): string {
|
|
77
|
+
let C: string;
|
|
78
|
+
|
|
79
|
+
if (this._coefficient === 1) {
|
|
80
|
+
C = '';
|
|
81
|
+
} else if (this._coefficient === -1) {
|
|
82
|
+
C = '-';
|
|
83
|
+
} else {
|
|
84
|
+
C = this._coefficient.toString();
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (this._radical === 1) {
|
|
88
|
+
return `${this._coefficient}`;
|
|
89
|
+
} else {
|
|
90
|
+
if (this._nth === 2) {
|
|
91
|
+
return `${C}sqrt{${this._radical}}`
|
|
92
|
+
} else {
|
|
93
|
+
return `${C}root(${this._nth}){${this._radical}}`
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
76
98
|
get value(): number {
|
|
77
99
|
return this._coefficient * Math.pow(this._radical, 1 / this._nth);
|
|
78
100
|
}
|