pimath 0.0.128 → 0.0.129
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/main.d.ts +39 -0
- package/dist/maths/algebra/equation.d.ts +120 -0
- package/dist/maths/algebra/linearSystem.d.ts +40 -0
- package/dist/maths/algebra/logicalset.d.ts +28 -0
- package/dist/maths/algebra/monom.d.ts +207 -0
- package/dist/maths/algebra/polynom.d.ts +155 -0
- package/dist/maths/algebra/rational.d.ts +44 -0
- package/dist/maths/algebra/study/rationalStudy.d.ts +14 -0
- package/dist/maths/algebra/study.d.ts +140 -0
- package/dist/maths/coefficients/fraction.d.ts +90 -0
- package/dist/maths/coefficients/nthRoot.d.ts +23 -0
- package/dist/maths/geometry/circle.d.ts +46 -0
- package/dist/maths/geometry/line.d.ts +102 -0
- package/dist/maths/geometry/point.d.ts +36 -0
- package/dist/maths/geometry/triangle.d.ts +92 -0
- package/dist/maths/geometry/vector.d.ts +38 -0
- package/dist/maths/numeric.d.ts +28 -0
- package/dist/maths/numexp.d.ts +19 -0
- package/dist/maths/randomization/random.d.ts +26 -0
- package/dist/maths/randomization/randomCore.d.ts +7 -0
- package/dist/maths/randomization/rndFraction.d.ts +13 -0
- package/dist/maths/randomization/rndGeometryCircle.d.ts +13 -0
- package/dist/maths/randomization/rndGeometryLine.d.ts +13 -0
- package/dist/maths/randomization/rndGeometryPoint.d.ts +13 -0
- package/dist/maths/randomization/rndHelpers.d.ts +23 -0
- package/dist/maths/randomization/rndMonom.d.ts +13 -0
- package/dist/maths/randomization/rndPolynom.d.ts +14 -0
- package/dist/maths/randomization/rndTypes.d.ts +40 -0
- package/dist/maths/shutingyard.d.ts +59 -0
- package/dist/pimath.js +85 -85
- package/package.json +10 -12
- package/.eslintrc.js +0 -24
- package/.idea/$CACHE_FILE$ +0 -6
- package/.idea/PI.iml +0 -14
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/inspectionProfiles/Project_Default.xml +0 -6
- package/.idea/jsLibraryMappings.xml +0 -6
- package/.idea/misc.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/php.xml +0 -19
- package/.idea/shelf/Uncommitted_changes_before_Checkout_at_07_11_2023_08_30_[Default_Changelist]/shelved.patch +0 -192
- package/.idea/shelf/Uncommitted_changes_before_Checkout_at_07_11_2023_08_30_[Default_Changelist]1/shelved.patch +0 -0
- package/.idea/shelf/Uncommitted_changes_before_Checkout_at_07_11_2023_08_30__Default_Changelist_.xml +0 -4
- package/.idea/shelf/Uncommitted_changes_before_Checkout_at_09_11_2023_10_43_[Default_Changelist]/shelved.patch +0 -2404
- package/.idea/shelf/Uncommitted_changes_before_Checkout_at_09_11_2023_10_43__Default_Changelist_.xml +0 -4
- package/.idea/shelf/Uncommitted_changes_before_Checkout_at_09_11_2023_11_01_[Default_Changelist]/shelved.patch +0 -1362
- package/.idea/shelf/Uncommitted_changes_before_Checkout_at_09_11_2023_11_01__Default_Changelist_.xml +0 -4
- package/.idea/shelf/Uncommitted_changes_before_Update_at_24_07_2023_15_31_[Default_Changelist]/shelved.patch +0 -90
- package/.idea/shelf/Uncommitted_changes_before_Update_at_24_07_2023_15_31__Default_Changelist_.xml +0 -4
- package/.idea/vcs.xml +0 -6
- package/dist/demo/exercises.html +0 -283
- package/dist/demo/matrices.html +0 -39
- package/dist/demo/playground.html +0 -20
- package/dist/demo.css +0 -3
- package/dist/pimath.umd.cjs +0 -15
- package/docs/.nojekyll +0 -1
- package/docs/assets/highlight.css +0 -78
- package/docs/assets/main.js +0 -59
- package/docs/assets/navigation.js +0 -1
- package/docs/assets/search.js +0 -1
- package/docs/assets/style.css +0 -1383
- package/docs/classes/Logicalset.Logicalset.html +0 -217
- package/docs/classes/Polynom.Rational.html +0 -397
- package/docs/classes/Vector-1.Vector.html +0 -490
- package/docs/classes/Vector.Point.html +0 -337
- package/docs/classes/algebra_equation.Equation.html +0 -790
- package/docs/classes/algebra_linearSystem.LinearSystem.html +0 -404
- package/docs/classes/algebra_monom.Monom.html +0 -962
- package/docs/classes/algebra_polynom.Polynom.html +0 -1275
- package/docs/classes/coefficients_fraction.Fraction.html +0 -934
- package/docs/classes/geometry_circle.Circle.html +0 -472
- package/docs/classes/geometry_line.Line.html +0 -774
- package/docs/classes/geometry_triangle.Triangle.html +0 -429
- package/docs/classes/numeric.Numeric.html +0 -265
- package/docs/classes/shutingyard.Shutingyard.html +0 -250
- package/docs/enums/algebra_equation.PARTICULAR_SOLUTION.html +0 -83
- package/docs/enums/geometry_line.LinePropriety.html +0 -97
- package/docs/enums/shutingyard.ShutingyardMode.html +0 -97
- package/docs/enums/shutingyard.ShutingyardType.html +0 -111
- package/docs/index.html +0 -63
- package/docs/interfaces/algebra_equation.ISolution.html +0 -105
- package/docs/interfaces/algebra_polynom.IEuclidian.html +0 -87
- package/docs/interfaces/geometry_triangle.remarquableLines.html +0 -163
- package/docs/modules/Logicalset.html +0 -65
- package/docs/modules/Polynom.html +0 -65
- package/docs/modules/Vector-1.html +0 -65
- package/docs/modules/Vector.html +0 -65
- package/docs/modules/algebra_equation.html +0 -69
- package/docs/modules/algebra_linearSystem.html +0 -61
- package/docs/modules/algebra_monom.html +0 -65
- package/docs/modules/algebra_polynom.html +0 -69
- package/docs/modules/coefficients_fraction.html +0 -65
- package/docs/modules/geometry_circle.html +0 -61
- package/docs/modules/geometry_line.html +0 -65
- package/docs/modules/geometry_triangle.html +0 -65
- package/docs/modules/numeric.html +0 -61
- package/docs/modules/shutingyard.html +0 -75
- package/docs/types/algebra_monom.literalType.html +0 -61
- package/docs/types/algebra_polynom.PolynomParsingType.html +0 -56
- package/docs/types/coefficients_fraction.FractionParsingType.html +0 -56
- package/docs/types/shutingyard.Token.html +0 -63
- package/docs/types/shutingyard.tokenType.html +0 -68
- package/docs/variables/shutingyard.tokenConstant.html +0 -61
- package/index.html +0 -15
- package/public/demo/exercises.html +0 -283
- package/public/demo/matrices.html +0 -39
- package/public/demo/playground.html +0 -20
- package/public/demo.css +0 -3
- package/src/demo/exercises.ts +0 -0
- package/src/demo/matrices.ts +0 -61
- package/src/demo/playground.ts +0 -153
- package/src/main.ts +0 -42
- package/src/maths/algebra/equation.ts +0 -897
- package/src/maths/algebra/linearSystem.ts +0 -370
- package/src/maths/algebra/logicalset.ts +0 -183
- package/src/maths/algebra/monom.ts +0 -1028
- package/src/maths/algebra/polynom.ts +0 -1537
- package/src/maths/algebra/rational.ts +0 -244
- package/src/maths/algebra/study/rationalStudy.ts +0 -287
- package/src/maths/algebra/study.ts +0 -506
- package/src/maths/coefficients/fraction.ts +0 -593
- package/src/maths/coefficients/nthRoot.ts +0 -148
- package/src/maths/geometry/circle.ts +0 -382
- package/src/maths/geometry/line.ts +0 -604
- package/src/maths/geometry/point.ts +0 -215
- package/src/maths/geometry/triangle.ts +0 -368
- package/src/maths/geometry/vector.ts +0 -242
- package/src/maths/numeric.ts +0 -162
- package/src/maths/numexp.ts +0 -184
- package/src/maths/randomization/random.ts +0 -80
- package/src/maths/randomization/randomCore.ts +0 -19
- package/src/maths/randomization/rndFraction.ts +0 -47
- package/src/maths/randomization/rndGeometryCircle.ts +0 -50
- package/src/maths/randomization/rndGeometryLine.ts +0 -53
- package/src/maths/randomization/rndGeometryPoint.ts +0 -69
- package/src/maths/randomization/rndHelpers.ts +0 -107
- package/src/maths/randomization/rndMonom.ts +0 -57
- package/src/maths/randomization/rndPolynom.ts +0 -90
- package/src/maths/randomization/rndTypes.ts +0 -43
- package/src/maths/shutingyard.ts +0 -496
- package/tests/algebra/equation.test.ts +0 -64
- package/tests/algebra/linear.test.ts +0 -58
- package/tests/algebra/monom.test.ts +0 -78
- package/tests/algebra/polynom.test.ts +0 -343
- package/tests/algebra/rationnal.test.ts +0 -64
- package/tests/algebra/study.test.ts +0 -48
- package/tests/coefficients/fraction.test.ts +0 -131
- package/tests/custom.test.ts +0 -33
- package/tests/geometry/circle.test.ts +0 -404
- package/tests/geometry/line.test.ts +0 -36
- package/tests/numeric.test.ts +0 -43
- package/tests/numexp.test.ts +0 -89
- package/tests/shutingyard.test.ts +0 -58
- package/tsconfig.json +0 -52
- package/tsconfig.testing.json +0 -28
- package/typedoc.katex.js +0 -11
- package/vite.config.js +0 -23
- package/webpack-production-min.config.js +0 -26
- package/webpack-production.config.js +0 -26
- package/webpack.config.js +0 -26
package/dist/main.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Point } from './maths/geometry/point.ts';
|
|
2
|
+
import { Circle } from './maths/geometry/circle.ts';
|
|
3
|
+
import { Triangle } from './maths/geometry/triangle.ts';
|
|
4
|
+
import { Line } from './maths/geometry/line.ts';
|
|
5
|
+
import { Vector } from './maths/geometry/vector.ts';
|
|
6
|
+
import { Logicalset } from './maths/algebra/logicalset.ts';
|
|
7
|
+
import { Rational } from './maths/algebra/rational.ts';
|
|
8
|
+
import { LinearSystem } from './maths/algebra/linearSystem.ts';
|
|
9
|
+
import { Equation } from './maths/algebra/equation.ts';
|
|
10
|
+
import { Polynom } from './maths/algebra/polynom.ts';
|
|
11
|
+
import { Monom } from './maths/algebra/monom.ts';
|
|
12
|
+
import { NthRoot } from './maths/coefficients/nthRoot.ts';
|
|
13
|
+
import { Fraction } from './maths/coefficients/fraction.ts';
|
|
14
|
+
import { Random } from './maths/randomization/random.ts';
|
|
15
|
+
import { Shutingyard } from './maths/shutingyard.ts';
|
|
16
|
+
import { NumExp } from './maths/numexp.ts';
|
|
17
|
+
import { Numeric } from './maths/numeric.ts';
|
|
18
|
+
|
|
19
|
+
export declare const PiMath: {
|
|
20
|
+
ShutingYard: typeof Shutingyard;
|
|
21
|
+
Numeric: typeof Numeric;
|
|
22
|
+
NumExp: typeof NumExp;
|
|
23
|
+
Fraction: typeof Fraction;
|
|
24
|
+
Root: typeof NthRoot;
|
|
25
|
+
Monom: typeof Monom;
|
|
26
|
+
Polynom: typeof Polynom;
|
|
27
|
+
Equation: typeof Equation;
|
|
28
|
+
LinearSystem: typeof LinearSystem;
|
|
29
|
+
Rational: typeof Rational;
|
|
30
|
+
Logicalset: typeof Logicalset;
|
|
31
|
+
Random: typeof Random;
|
|
32
|
+
Geometry: {
|
|
33
|
+
Vector: typeof Vector;
|
|
34
|
+
Point: typeof Point;
|
|
35
|
+
Line: typeof Line;
|
|
36
|
+
Triangle: typeof Triangle;
|
|
37
|
+
Circle: typeof Circle;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { Fraction } from '../coefficients/fraction';
|
|
2
|
+
import { literalType } from './monom';
|
|
3
|
+
import { Polynom } from './polynom';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Equation is a class to manage equations...
|
|
7
|
+
*/
|
|
8
|
+
export interface ISolution {
|
|
9
|
+
tex: string;
|
|
10
|
+
display: string;
|
|
11
|
+
value: number;
|
|
12
|
+
exact: unknown;
|
|
13
|
+
}
|
|
14
|
+
export declare enum PARTICULAR_SOLUTION {
|
|
15
|
+
real = "\\mathbb{R}",
|
|
16
|
+
varnothing = "\\varnothing"
|
|
17
|
+
}
|
|
18
|
+
export declare class Equation {
|
|
19
|
+
private _polynom;
|
|
20
|
+
private _varnothing;
|
|
21
|
+
private _real;
|
|
22
|
+
private _left;
|
|
23
|
+
private _right;
|
|
24
|
+
private _sign;
|
|
25
|
+
private _solutions;
|
|
26
|
+
private _randomizeDefaults;
|
|
27
|
+
/**
|
|
28
|
+
* Create an Equation using two polynoms.
|
|
29
|
+
* Markdown *support* is cool
|
|
30
|
+
* @param equations
|
|
31
|
+
*/
|
|
32
|
+
constructor(...equations: unknown[]);
|
|
33
|
+
get left(): Polynom;
|
|
34
|
+
set left(value: Polynom);
|
|
35
|
+
get right(): Polynom;
|
|
36
|
+
set right(value: Polynom);
|
|
37
|
+
get sign(): string;
|
|
38
|
+
set sign(value: string);
|
|
39
|
+
get solutions(): ISolution[];
|
|
40
|
+
get isEquation(): boolean;
|
|
41
|
+
get solution(): string;
|
|
42
|
+
get isReal(): boolean;
|
|
43
|
+
get isVarnothing(): boolean;
|
|
44
|
+
get signAsTex(): string;
|
|
45
|
+
get tex(): string;
|
|
46
|
+
get display(): string;
|
|
47
|
+
get raw(): string;
|
|
48
|
+
get variables(): string[];
|
|
49
|
+
get numberOfVars(): number;
|
|
50
|
+
get randomizeDefaults(): {
|
|
51
|
+
[key: string]: number | string | boolean;
|
|
52
|
+
};
|
|
53
|
+
set randomizeDefaults(value: {
|
|
54
|
+
[key: string]: number | string | boolean;
|
|
55
|
+
});
|
|
56
|
+
static makeSolutionsUnique(solutions: ISolution[], sorted?: boolean): ISolution[];
|
|
57
|
+
hasVariable: (letter: string) => boolean;
|
|
58
|
+
parse: (equationString: string) => Equation;
|
|
59
|
+
create: (left: Polynom, right: Polynom, sign?: string) => Equation;
|
|
60
|
+
clone: () => Equation;
|
|
61
|
+
randomize: (opts?: {}, sign?: string) => Equation;
|
|
62
|
+
/**
|
|
63
|
+
* Reorder will move all monoms containing a letter on the left, all the other on the right.
|
|
64
|
+
*/
|
|
65
|
+
moveLeft: () => Equation;
|
|
66
|
+
reorder: (allLeft?: boolean) => Equation;
|
|
67
|
+
/**
|
|
68
|
+
* Multiply by the lcm denominator and divide by the gcm numerators.
|
|
69
|
+
*/
|
|
70
|
+
simplify: () => Equation;
|
|
71
|
+
/**
|
|
72
|
+
* Reorder the polynom to have only one letter on the left, the rest on the right.
|
|
73
|
+
* @param letter
|
|
74
|
+
*/
|
|
75
|
+
isolate: (letter?: string) => Equation | false;
|
|
76
|
+
replaceBy: (letter: string, P: Polynom) => Equation;
|
|
77
|
+
/**
|
|
78
|
+
* Multiple an equation by a fraction value.
|
|
79
|
+
* @param value
|
|
80
|
+
*/
|
|
81
|
+
multiply: (value: unknown) => Equation;
|
|
82
|
+
/**
|
|
83
|
+
* divide an equation by a given value (transformed as a fraction)
|
|
84
|
+
*
|
|
85
|
+
* ```
|
|
86
|
+
* 8x+10=6x \vert 2
|
|
87
|
+
* 4x+5=3x
|
|
88
|
+
* ```
|
|
89
|
+
*
|
|
90
|
+
* |>Alternatively with $3x-4$ maybe it's working ?
|
|
91
|
+
* $$\frac{3x}{5}$$
|
|
92
|
+
*
|
|
93
|
+
* @param value
|
|
94
|
+
* @returns {Equation}
|
|
95
|
+
*/
|
|
96
|
+
divide: (value: unknown) => Equation;
|
|
97
|
+
/**
|
|
98
|
+
* Get the degree of the equation
|
|
99
|
+
* @param letter
|
|
100
|
+
*/
|
|
101
|
+
degree: (letter?: string) => Fraction;
|
|
102
|
+
/**
|
|
103
|
+
* Determine if the equation contains more than one letter/variable.
|
|
104
|
+
*/
|
|
105
|
+
isMultiVariable: () => boolean;
|
|
106
|
+
letters: () => string[];
|
|
107
|
+
solve: () => Equation;
|
|
108
|
+
test: (values: literalType) => Boolean;
|
|
109
|
+
isSameAs: (equ: Equation) => Boolean;
|
|
110
|
+
isLinearTo: (equ: Equation) => Boolean;
|
|
111
|
+
private _findSign;
|
|
112
|
+
private _formatSign;
|
|
113
|
+
private _reverseSign;
|
|
114
|
+
private isGreater;
|
|
115
|
+
private isStrictEqual;
|
|
116
|
+
private isAlsoEqual;
|
|
117
|
+
private _solveDegree1;
|
|
118
|
+
private _solveDegree2;
|
|
119
|
+
private _solveDegree3plus;
|
|
120
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Fraction } from '../coefficients/fraction';
|
|
2
|
+
import { Equation } from './equation';
|
|
3
|
+
|
|
4
|
+
export declare class LinearSystem {
|
|
5
|
+
private _equations;
|
|
6
|
+
private _letters;
|
|
7
|
+
private _resolutionSteps;
|
|
8
|
+
private _solutions;
|
|
9
|
+
constructor(...equationStrings: (string | Equation)[]);
|
|
10
|
+
get equations(): Equation[];
|
|
11
|
+
set equations(value: Equation[]);
|
|
12
|
+
get letters(): string;
|
|
13
|
+
set letters(value: string);
|
|
14
|
+
get isSolvable(): boolean;
|
|
15
|
+
get variables(): string[];
|
|
16
|
+
get tex(): string;
|
|
17
|
+
get solution(): string;
|
|
18
|
+
get solutionAsDisplay(): string;
|
|
19
|
+
get resolutionSteps(): {
|
|
20
|
+
[p: string]: {
|
|
21
|
+
equations: Equation[];
|
|
22
|
+
operations: string[][];
|
|
23
|
+
}[];
|
|
24
|
+
};
|
|
25
|
+
buildTex: (equations: Equation[], operators?: (string[])[]) => string;
|
|
26
|
+
stepTex: (letter: string) => string;
|
|
27
|
+
parse: (...equations: (string | Equation)[]) => LinearSystem;
|
|
28
|
+
clone: () => LinearSystem;
|
|
29
|
+
reorder: () => LinearSystem;
|
|
30
|
+
solve: (withResolution?: boolean) => LinearSystem;
|
|
31
|
+
mergeEquations: (eq1: Equation, eq2: Equation, factor1: Fraction, factor2: Fraction) => Equation;
|
|
32
|
+
private _findLetters;
|
|
33
|
+
private _linearReduction;
|
|
34
|
+
/**
|
|
35
|
+
* Linear reduction of the equations to have only one letter
|
|
36
|
+
* @param letter letter to isolate
|
|
37
|
+
* @private
|
|
38
|
+
*/
|
|
39
|
+
private _solveOneLetter;
|
|
40
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Polynom module contains everything necessary to handle polynoms.
|
|
3
|
+
* @module Logicalset
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Polynom class can handle polynoms, reorder, resolve, ...
|
|
7
|
+
*/
|
|
8
|
+
export declare class Logicalset {
|
|
9
|
+
private _rawString;
|
|
10
|
+
private _rpn;
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
* @param {string} value (optional) Default polynom to parse on class creation
|
|
14
|
+
*/
|
|
15
|
+
constructor(value: string);
|
|
16
|
+
get isLogicalset(): boolean;
|
|
17
|
+
get rpn(): {
|
|
18
|
+
token: string;
|
|
19
|
+
tokenType: string;
|
|
20
|
+
}[];
|
|
21
|
+
get tex(): string;
|
|
22
|
+
evaluate(tokenSets: {
|
|
23
|
+
[key: string]: unknown[];
|
|
24
|
+
}, reference?: unknown[]): unknown[];
|
|
25
|
+
vennAB(): any[];
|
|
26
|
+
vennABC(): any[];
|
|
27
|
+
private parse;
|
|
28
|
+
}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { Fraction } from '../coefficients/fraction';
|
|
2
|
+
import { Token } from '../shutingyard.ts';
|
|
3
|
+
|
|
4
|
+
export type literalType = {
|
|
5
|
+
[Key: string]: Fraction;
|
|
6
|
+
};
|
|
7
|
+
export declare class Monom {
|
|
8
|
+
private _coefficient;
|
|
9
|
+
private _literal;
|
|
10
|
+
/**
|
|
11
|
+
* Create a Monom
|
|
12
|
+
* Defined as \\(k \\cdot x^{n}\\), where \\( k,n \in \\mathbb{Q}\\).
|
|
13
|
+
* Examples: \\(3x^2\\) or \\(3/5x^2\\)
|
|
14
|
+
* @param value (optional) string The value that should be parse. Can be a Monom, a Fraction, a string or a number. If nothing is provided, it will return the trivial monom (0).
|
|
15
|
+
*/
|
|
16
|
+
constructor(value?: unknown);
|
|
17
|
+
/**
|
|
18
|
+
* Get the coefficient \\(k\\) of the Monom \\(k\\cdot x^{n}\\)
|
|
19
|
+
* @returns {Fraction}
|
|
20
|
+
*/
|
|
21
|
+
get coefficient(): Fraction;
|
|
22
|
+
/**
|
|
23
|
+
* Set the coefficient \\(k\\) value of the monom
|
|
24
|
+
* @param {Fraction | number | string} F
|
|
25
|
+
*/
|
|
26
|
+
set coefficient(F: Fraction | number | string);
|
|
27
|
+
/**
|
|
28
|
+
* Get the literal part of \\(x^{n_1}y^{n_2}\\) as dictionary \\[\\begin{array}{ll}x&=n_1\\\\y&=n_2\\end{array}\\]
|
|
29
|
+
* @returns {literalType}
|
|
30
|
+
*/
|
|
31
|
+
get literal(): literalType;
|
|
32
|
+
/**
|
|
33
|
+
* Set the literal part of the monom. Must be a dictionary {x: Fraction, y: Fraction, ...}
|
|
34
|
+
* @param {literalType} L
|
|
35
|
+
*/
|
|
36
|
+
set literal(L: literalType);
|
|
37
|
+
/**
|
|
38
|
+
* Get the literal square roots of the Monom.
|
|
39
|
+
* TODO: remove this getter ? Is it used and is it correct ?
|
|
40
|
+
* @returns {literalType}
|
|
41
|
+
*/
|
|
42
|
+
get literalSqrt(): literalType;
|
|
43
|
+
/**
|
|
44
|
+
* Set the literal part of the monom from a string
|
|
45
|
+
* @param inputStr String like x^2y^3
|
|
46
|
+
*/
|
|
47
|
+
set literalStr(inputStr: string);
|
|
48
|
+
/**
|
|
49
|
+
* Get the variables letters
|
|
50
|
+
*/
|
|
51
|
+
get variables(): string[];
|
|
52
|
+
/**
|
|
53
|
+
* This display getter is to be used in the polynom display getter
|
|
54
|
+
*/
|
|
55
|
+
get display(): string;
|
|
56
|
+
get dividers(): Monom[];
|
|
57
|
+
/**
|
|
58
|
+
* Display the monom, forcing the '+' sign to appear
|
|
59
|
+
*/
|
|
60
|
+
get displayWithSign(): string;
|
|
61
|
+
get texWithSign(): string;
|
|
62
|
+
get plotFunction(): string;
|
|
63
|
+
/**
|
|
64
|
+
* Get the tex output of the monom
|
|
65
|
+
*/
|
|
66
|
+
get tex(): string;
|
|
67
|
+
/**
|
|
68
|
+
* Get the least common multiple of monoms
|
|
69
|
+
* @param monoms Array of monoms
|
|
70
|
+
*/
|
|
71
|
+
static lcm: (...monoms: Monom[]) => Monom;
|
|
72
|
+
/**
|
|
73
|
+
* Multiply two monoms and return a NEW monom.
|
|
74
|
+
* @param monoms
|
|
75
|
+
*/
|
|
76
|
+
static xmultiply: (...monoms: Monom[]) => Monom;
|
|
77
|
+
/**
|
|
78
|
+
* Parse a string to a monom. The string may include fraction.
|
|
79
|
+
* @param inputStr
|
|
80
|
+
*/
|
|
81
|
+
parse: (inputStr: unknown) => Monom;
|
|
82
|
+
addToken: (stack: Monom[], element: Token) => void;
|
|
83
|
+
/**
|
|
84
|
+
* Clone the current Monom.
|
|
85
|
+
*/
|
|
86
|
+
clone: () => Monom;
|
|
87
|
+
copyLiterals: (literal: literalType) => literalType;
|
|
88
|
+
makeSame: (M: Monom) => Monom;
|
|
89
|
+
/**
|
|
90
|
+
* Create a zero value monom
|
|
91
|
+
*/
|
|
92
|
+
zero: () => Monom;
|
|
93
|
+
/**
|
|
94
|
+
* Create a one value monom
|
|
95
|
+
*/
|
|
96
|
+
one: () => Monom;
|
|
97
|
+
/**
|
|
98
|
+
* Clean the monom by removing each letters with a power of zero.
|
|
99
|
+
*/
|
|
100
|
+
clean: () => Monom;
|
|
101
|
+
reduce: () => Monom;
|
|
102
|
+
/**
|
|
103
|
+
* Get the opposed
|
|
104
|
+
* Returns a monom.
|
|
105
|
+
*/
|
|
106
|
+
opposed: () => Monom;
|
|
107
|
+
/**
|
|
108
|
+
* Add all similar monoms. If they aren't similar, they are simply skipped.
|
|
109
|
+
* @param M (Monom[]) The monoms to add.
|
|
110
|
+
*/
|
|
111
|
+
add: (...M: Monom[]) => Monom;
|
|
112
|
+
/**
|
|
113
|
+
* Subtract multiple monoms
|
|
114
|
+
* @param M (Monom[]) The monoms to subtract
|
|
115
|
+
*/
|
|
116
|
+
subtract: (...M: Monom[]) => Monom;
|
|
117
|
+
/**
|
|
118
|
+
* Multiple multiple monoms to the current monom
|
|
119
|
+
* @param M (Monom[]) The monoms to multiply to.
|
|
120
|
+
*/
|
|
121
|
+
multiply: (...M: Monom[]) => Monom;
|
|
122
|
+
multiplyByNumber: (F: Fraction | number) => Monom;
|
|
123
|
+
/**
|
|
124
|
+
* Divide the current monoms by multiple monoms
|
|
125
|
+
* @param M (Monom[])
|
|
126
|
+
*/
|
|
127
|
+
divide: (...M: Monom[]) => Monom;
|
|
128
|
+
/**
|
|
129
|
+
* Get the pow of a monom.
|
|
130
|
+
* @param nb (number) : Mathematical pow
|
|
131
|
+
*/
|
|
132
|
+
pow: (nb: number | Fraction) => Monom;
|
|
133
|
+
/**
|
|
134
|
+
* Get the nth-root of the monom
|
|
135
|
+
* @param p
|
|
136
|
+
*/
|
|
137
|
+
root: (p: number) => Monom;
|
|
138
|
+
/**
|
|
139
|
+
* Return the square root of a monom
|
|
140
|
+
*/
|
|
141
|
+
sqrt: () => Monom;
|
|
142
|
+
compare: (M: Monom, sign?: string) => boolean;
|
|
143
|
+
/**
|
|
144
|
+
* Determine if the monom is null
|
|
145
|
+
*/
|
|
146
|
+
isZero(): boolean;
|
|
147
|
+
/**
|
|
148
|
+
* Determine if the monom is one
|
|
149
|
+
*/
|
|
150
|
+
isOne(): boolean;
|
|
151
|
+
/**
|
|
152
|
+
* Determine if two monoms are equals
|
|
153
|
+
* @param M
|
|
154
|
+
*/
|
|
155
|
+
isEqual: (M: Monom) => boolean;
|
|
156
|
+
/**
|
|
157
|
+
* Determine if two monoms are similar
|
|
158
|
+
* @param M
|
|
159
|
+
*/
|
|
160
|
+
isSameAs: (M: Monom) => boolean;
|
|
161
|
+
isSquare: () => boolean;
|
|
162
|
+
isLiteralSquare: () => boolean;
|
|
163
|
+
hasFractionCoefficient: () => boolean;
|
|
164
|
+
/**
|
|
165
|
+
* Determine if a monom contains a setLetter in it's literal part
|
|
166
|
+
* @param letter
|
|
167
|
+
*/
|
|
168
|
+
hasLetter: (letter?: string) => boolean;
|
|
169
|
+
/**
|
|
170
|
+
* Set the power of a particular setLetter
|
|
171
|
+
* @param letter (string) Letter to change
|
|
172
|
+
* @param pow (number) Power of the setLetter (must be positive integer.
|
|
173
|
+
*/
|
|
174
|
+
setLetter: (letter: string, pow: Fraction | number) => void;
|
|
175
|
+
/**
|
|
176
|
+
* Get the degree of a monom. If no setLetter is given, the result will be the global degree.
|
|
177
|
+
* @param letter (string) Letter to get to degree (power)
|
|
178
|
+
*/
|
|
179
|
+
degree: (letter?: string) => Fraction;
|
|
180
|
+
/**
|
|
181
|
+
* Evaluate a monom. Each setLetter must be assigned to a Fraction.
|
|
182
|
+
* @param values Dictionary of <setLetter: Fraction>
|
|
183
|
+
*/
|
|
184
|
+
evaluate: (values: literalType | Fraction | number) => Fraction;
|
|
185
|
+
evaluateAsNumeric: (values: number | {
|
|
186
|
+
[Key: string]: number;
|
|
187
|
+
}) => number;
|
|
188
|
+
/**
|
|
189
|
+
* Derivative the monom
|
|
190
|
+
* @param letter
|
|
191
|
+
*/
|
|
192
|
+
derivative: (letter?: string) => Monom;
|
|
193
|
+
primitive: (letter?: string) => Monom;
|
|
194
|
+
/**
|
|
195
|
+
* Determine if multiple monoms are similar
|
|
196
|
+
* @param M
|
|
197
|
+
*/
|
|
198
|
+
areSameAs: (...M: Monom[]) => boolean;
|
|
199
|
+
/**
|
|
200
|
+
* Determine if multiple monoms are equals
|
|
201
|
+
* @param M
|
|
202
|
+
*/
|
|
203
|
+
areEquals: (...M: Monom[]) => boolean;
|
|
204
|
+
isDivisible: (div: Monom) => boolean;
|
|
205
|
+
private _getLiteralDividers;
|
|
206
|
+
private _shutingYardToReducedMonom;
|
|
207
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { ISolution } from './equation';
|
|
2
|
+
import { Fraction } from '../coefficients/fraction';
|
|
3
|
+
import { Token } from '../shutingyard.ts';
|
|
4
|
+
import { literalType, Monom } from './monom';
|
|
5
|
+
|
|
6
|
+
export type PolynomParsingType = string | Polynom | number | Fraction | Monom;
|
|
7
|
+
export interface IEuclidian {
|
|
8
|
+
quotient: Polynom;
|
|
9
|
+
reminder: Polynom;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Polynom class can handle polynoms, reorder, resolve, ...
|
|
13
|
+
* ```
|
|
14
|
+
* let P = new Polynom('3x-4')
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare class Polynom {
|
|
18
|
+
private _rawString;
|
|
19
|
+
private _dirty_factors;
|
|
20
|
+
private _dirty_zeroes;
|
|
21
|
+
private _euclidianCache;
|
|
22
|
+
private _factors;
|
|
23
|
+
private _monoms;
|
|
24
|
+
private _texString;
|
|
25
|
+
private _zeroes;
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
* @param {string} polynomString (optional) Default polynom to parse on class creation
|
|
29
|
+
* @param values
|
|
30
|
+
*/
|
|
31
|
+
constructor(polynomString?: PolynomParsingType, ...values: unknown[]);
|
|
32
|
+
get dirty_factors(): boolean;
|
|
33
|
+
set dirty_factors(value: boolean);
|
|
34
|
+
get dirty_zeroes(): boolean;
|
|
35
|
+
set dirty_zeroes(value: boolean);
|
|
36
|
+
get euclidianCache(): {
|
|
37
|
+
[p: string]: IEuclidian;
|
|
38
|
+
};
|
|
39
|
+
set euclidianCache(value: {
|
|
40
|
+
[p: string]: IEuclidian;
|
|
41
|
+
});
|
|
42
|
+
get factors(): Polynom[];
|
|
43
|
+
set factors(value: Polynom[]);
|
|
44
|
+
get monoms(): Monom[];
|
|
45
|
+
set monoms(M: Monom[]);
|
|
46
|
+
get texString(): string;
|
|
47
|
+
get zeroes(): ISolution[];
|
|
48
|
+
get texFactors(): string;
|
|
49
|
+
get displayFactors(): string;
|
|
50
|
+
get length(): number;
|
|
51
|
+
get display(): string;
|
|
52
|
+
get raw(): string;
|
|
53
|
+
get tex(): string;
|
|
54
|
+
get isMultiVariable(): boolean;
|
|
55
|
+
get variables(): string[];
|
|
56
|
+
get numberOfVars(): number;
|
|
57
|
+
get plotFunction(): string;
|
|
58
|
+
mark_as_dirty: () => void;
|
|
59
|
+
addToken: (stack: Polynom[], element: Token) => void;
|
|
60
|
+
/**
|
|
61
|
+
* Parse a string to a polynom.
|
|
62
|
+
* @param inputStr
|
|
63
|
+
* @param values: as string, numbers or fractions
|
|
64
|
+
*/
|
|
65
|
+
parse: (inputStr: PolynomParsingType, ...values: unknown[]) => Polynom;
|
|
66
|
+
/**
|
|
67
|
+
* Clone the polynom
|
|
68
|
+
*/
|
|
69
|
+
clone: () => Polynom;
|
|
70
|
+
/**
|
|
71
|
+
* Set the polynom to zero.
|
|
72
|
+
* @returns {this}
|
|
73
|
+
*/
|
|
74
|
+
zero: () => Polynom;
|
|
75
|
+
one: () => Polynom;
|
|
76
|
+
empty: () => Polynom;
|
|
77
|
+
opposed: () => Polynom;
|
|
78
|
+
add: (...values: unknown[]) => Polynom;
|
|
79
|
+
subtract: (...values: unknown[]) => Polynom;
|
|
80
|
+
multiply: (value: unknown) => Polynom;
|
|
81
|
+
/**
|
|
82
|
+
* Divide the current polynom by another polynom.
|
|
83
|
+
* @param P
|
|
84
|
+
* returns {quotient: Polynom, reminder: Polynom}
|
|
85
|
+
*/
|
|
86
|
+
euclidian: (P: Polynom) => IEuclidian;
|
|
87
|
+
divide: (value: unknown) => Polynom;
|
|
88
|
+
pow: (nb: number) => Polynom;
|
|
89
|
+
/**
|
|
90
|
+
* Compare the current coefficient with another coefficient
|
|
91
|
+
* @param P
|
|
92
|
+
* @param sign (string| default is =): authorized values: =, <, <=, >, >= with some variations.
|
|
93
|
+
*/
|
|
94
|
+
compare: (P: Polynom, sign?: string) => boolean;
|
|
95
|
+
isZero(): boolean;
|
|
96
|
+
isOne(): boolean;
|
|
97
|
+
isEqual: (P: Polynom) => boolean;
|
|
98
|
+
isSameAs: (P: Polynom) => boolean;
|
|
99
|
+
isOpposedAt: (P: Polynom) => boolean;
|
|
100
|
+
isFactorized: (polynomString: string, soft?: boolean) => boolean;
|
|
101
|
+
isReduced: (polynomString: string) => Boolean;
|
|
102
|
+
isDeveloped: (polynomString: string) => Boolean;
|
|
103
|
+
reduce: () => Polynom;
|
|
104
|
+
reorder: (letter?: string, revert?: boolean) => Polynom;
|
|
105
|
+
degree: (letter?: string) => Fraction;
|
|
106
|
+
letters: () => string[];
|
|
107
|
+
/**
|
|
108
|
+
* Replace a variable (letter) by a polynom.
|
|
109
|
+
* @param letter
|
|
110
|
+
* @param P
|
|
111
|
+
*/
|
|
112
|
+
replaceBy: (letter: string, P: Polynom) => Polynom;
|
|
113
|
+
evaluate: (values: literalType | Fraction | number) => Fraction;
|
|
114
|
+
evaluateAsNumeric: (values: number | {
|
|
115
|
+
[Key: string]: number;
|
|
116
|
+
}) => number;
|
|
117
|
+
derivative: (letter?: string) => Polynom;
|
|
118
|
+
primitive: (letter?: string) => Polynom;
|
|
119
|
+
integrate: (a: Fraction | number, b: Fraction | number, letter?: string) => Fraction;
|
|
120
|
+
/**
|
|
121
|
+
* Factorize a polynom and store the best results in factors.
|
|
122
|
+
* @param maxValue Defines the greatest value to search to (default is 20).
|
|
123
|
+
*/
|
|
124
|
+
factorize: (letter?: string) => Polynom[];
|
|
125
|
+
isDividableBy: (div: Polynom) => boolean;
|
|
126
|
+
getZeroes: () => ISolution[];
|
|
127
|
+
monomByDegree: (degree?: Fraction | number, letter?: string) => Monom;
|
|
128
|
+
monomsByDegree: (degree?: number | Fraction, letter?: string) => Monom[];
|
|
129
|
+
monomByLetter: (letter: string) => Monom;
|
|
130
|
+
getDenominators: () => number[];
|
|
131
|
+
getNumerators: () => number[];
|
|
132
|
+
lcmDenominator: () => number;
|
|
133
|
+
gcdDenominator: () => number;
|
|
134
|
+
lcmNumerator: () => number;
|
|
135
|
+
gcdNumerator: () => number;
|
|
136
|
+
commonMonom: () => Monom;
|
|
137
|
+
limitToInfinity: (letter?: string) => Fraction;
|
|
138
|
+
limitToNegativeInfinity: (letter?: string) => Fraction;
|
|
139
|
+
private _getAllPotentialFactors;
|
|
140
|
+
private _parseString;
|
|
141
|
+
private genDisplay;
|
|
142
|
+
/**
|
|
143
|
+
* Main parse using a shutting yard class
|
|
144
|
+
* @param inputStr
|
|
145
|
+
*/
|
|
146
|
+
private shutingYardToReducedPolynom;
|
|
147
|
+
private multiplyByPolynom;
|
|
148
|
+
private multiplyByFraction;
|
|
149
|
+
private multiplyByInteger;
|
|
150
|
+
private multiplyByMonom;
|
|
151
|
+
private divideByInteger;
|
|
152
|
+
private divideByFraction;
|
|
153
|
+
private _factorize2ndDegree;
|
|
154
|
+
private _factorizeByGroups;
|
|
155
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { StudyConfig } from './study';
|
|
2
|
+
import { RationalStudy } from './study/rationalStudy';
|
|
3
|
+
import { literalType } from './monom';
|
|
4
|
+
import { Fraction } from '../coefficients/fraction';
|
|
5
|
+
import { IEuclidian, Polynom } from './polynom';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Rational class can handle rational polynoms
|
|
9
|
+
*/
|
|
10
|
+
export declare class Rational {
|
|
11
|
+
private _denominator;
|
|
12
|
+
private _numerator;
|
|
13
|
+
private _rawString;
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
* @param numerator
|
|
17
|
+
* @param denominator
|
|
18
|
+
*/
|
|
19
|
+
constructor(numerator?: Polynom | string, denominator?: Polynom | string);
|
|
20
|
+
get numerator(): Polynom;
|
|
21
|
+
get denominator(): Polynom;
|
|
22
|
+
get tex(): string;
|
|
23
|
+
get display(): string;
|
|
24
|
+
get texFactors(): string;
|
|
25
|
+
get displayFactors(): string;
|
|
26
|
+
get plotFunction(): string;
|
|
27
|
+
clone: () => Rational;
|
|
28
|
+
domain: () => string;
|
|
29
|
+
amplify: (P: Polynom) => Rational;
|
|
30
|
+
derivative: (letter?: string) => Rational;
|
|
31
|
+
factorize: (letter?: string) => Rational;
|
|
32
|
+
simplify: (P: Polynom) => Rational;
|
|
33
|
+
reduce: () => Rational;
|
|
34
|
+
opposed: () => Rational;
|
|
35
|
+
add: (R: Rational) => Rational;
|
|
36
|
+
subtract: (R: Rational) => Rational;
|
|
37
|
+
euclidian: () => IEuclidian;
|
|
38
|
+
limits: (value: Fraction | number, offset?: string, letter?: string) => Fraction;
|
|
39
|
+
evaluate: (values: literalType | Fraction | number) => Fraction;
|
|
40
|
+
evaluateAsNumeric: (values: number | {
|
|
41
|
+
[Key: string]: number;
|
|
42
|
+
}) => number;
|
|
43
|
+
study: (config?: StudyConfig | string) => RationalStudy;
|
|
44
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Rational } from '../rational';
|
|
2
|
+
import { ASYMPTOTE_POSITION, IAsymptote, ITableOfSigns, IZero, Study, StudyableFunction, StudyConfig } from '../study';
|
|
3
|
+
|
|
4
|
+
export declare class RationalStudy extends Study {
|
|
5
|
+
constructor(fx: StudyableFunction, config?: StudyConfig | string);
|
|
6
|
+
makeZeroes(): IZero[];
|
|
7
|
+
makeSigns(): ITableOfSigns;
|
|
8
|
+
makeAsymptotes(): IAsymptote[];
|
|
9
|
+
_getHorizontalAsymptoteRelativePositon(deltaX: Rational, delta?: number): ASYMPTOTE_POSITION[];
|
|
10
|
+
makeDerivative(): ITableOfSigns;
|
|
11
|
+
makeVariation(): ITableOfSigns;
|
|
12
|
+
private _getZeroes;
|
|
13
|
+
private _getSigns;
|
|
14
|
+
}
|