pimath 0.0.133 → 0.1.0
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/pimath.js +2888 -3590
- package/package.json +38 -20
- package/types/algebra/equation.d.ts +102 -0
- package/types/algebra/equation.d.ts.map +1 -0
- package/types/algebra/equationSolver.d.ts +10 -0
- package/types/algebra/equationSolver.d.ts.map +1 -0
- package/types/algebra/factor.d.ts +46 -0
- package/types/algebra/factor.d.ts.map +1 -0
- package/types/algebra/linearSystem.d.ts +37 -0
- package/types/algebra/linearSystem.d.ts.map +1 -0
- package/{dist/maths → types}/algebra/monom.d.ts +95 -133
- package/types/algebra/monom.d.ts.map +1 -0
- package/types/algebra/polyFactor.d.ts +43 -0
- package/types/algebra/polyFactor.d.ts.map +1 -0
- package/types/algebra/polynom.d.ts +107 -0
- package/types/algebra/polynom.d.ts.map +1 -0
- package/types/algebra/rational.d.ts +41 -0
- package/types/algebra/rational.d.ts.map +1 -0
- package/{dist/maths → types}/coefficients/fraction.d.ts +69 -67
- package/types/coefficients/fraction.d.ts.map +1 -0
- package/{dist/maths → types}/coefficients/nthRoot.d.ts +4 -7
- package/types/coefficients/nthRoot.d.ts.map +1 -0
- package/{dist/maths → types}/geometry/circle.d.ts +14 -21
- package/types/geometry/circle.d.ts.map +1 -0
- package/types/geometry/geomMath.d.ts +9 -0
- package/types/geometry/geomMath.d.ts.map +1 -0
- package/types/geometry/line.d.ts +83 -0
- package/types/geometry/line.d.ts.map +1 -0
- package/types/geometry/line3.d.ts +58 -0
- package/types/geometry/line3.d.ts.map +1 -0
- package/types/geometry/matrix.d.ts +12 -0
- package/types/geometry/matrix.d.ts.map +1 -0
- package/types/geometry/plane3.d.ts +36 -0
- package/types/geometry/plane3.d.ts.map +1 -0
- package/types/geometry/point.d.ts +12 -0
- package/types/geometry/point.d.ts.map +1 -0
- package/{dist/maths → types}/geometry/triangle.d.ts +11 -34
- package/types/geometry/triangle.d.ts.map +1 -0
- package/types/geometry/vector.d.ts +55 -0
- package/types/geometry/vector.d.ts.map +1 -0
- package/types/geometry/vector3d.d.ts +37 -0
- package/types/geometry/vector3d.d.ts.map +1 -0
- package/types/helpers.d.ts +3 -0
- package/types/helpers.d.ts.map +1 -0
- package/types/index.d.ts +59 -0
- package/types/index.d.ts.map +1 -0
- package/types/numeric.d.ts +39 -0
- package/types/pimath.interface.d.ts +57 -0
- package/types/pimath.interface.d.ts.map +1 -0
- package/types/randomization/algebra/rndEquation.d.ts +4 -0
- package/types/randomization/algebra/rndEquation.d.ts.map +1 -0
- package/types/randomization/algebra/rndMonom.d.ts +4 -0
- package/types/randomization/algebra/rndMonom.d.ts.map +1 -0
- package/types/randomization/algebra/rndPolynom.d.ts +5 -0
- package/types/randomization/algebra/rndPolynom.d.ts.map +1 -0
- package/types/randomization/coefficient/rndFraction.d.ts +4 -0
- package/types/randomization/coefficient/rndFraction.d.ts.map +1 -0
- package/types/randomization/geometry/rndCircle.d.ts +4 -0
- package/types/randomization/geometry/rndCircle.d.ts.map +1 -0
- package/types/randomization/geometry/rndLine.d.ts +4 -0
- package/types/randomization/geometry/rndLine.d.ts.map +1 -0
- package/types/randomization/geometry/rndLine3.d.ts +4 -0
- package/types/randomization/geometry/rndLine3.d.ts.map +1 -0
- package/types/randomization/geometry/rndPoint.d.ts +4 -0
- package/types/randomization/geometry/rndPoint.d.ts.map +1 -0
- package/types/randomization/random.d.ts +20 -0
- package/types/randomization/random.d.ts.map +1 -0
- package/types/randomization/rndHelpers.d.ts +21 -0
- package/types/randomization/rndTypes.d.ts +64 -0
- package/types/randomization/rndTypes.d.ts.map +1 -0
- package/dist/main.d.ts +0 -39
- package/dist/maths/algebra/equation.d.ts +0 -120
- package/dist/maths/algebra/linearSystem.d.ts +0 -40
- package/dist/maths/algebra/logicalset.d.ts +0 -28
- package/dist/maths/algebra/polynom.d.ts +0 -155
- package/dist/maths/algebra/rational.d.ts +0 -44
- package/dist/maths/algebra/study/rationalStudy.d.ts +0 -14
- package/dist/maths/algebra/study.d.ts +0 -140
- package/dist/maths/geometry/line.d.ts +0 -102
- package/dist/maths/geometry/point.d.ts +0 -36
- package/dist/maths/geometry/vector.d.ts +0 -38
- package/dist/maths/numeric.d.ts +0 -28
- package/dist/maths/numexp.d.ts +0 -19
- package/dist/maths/randomization/random.d.ts +0 -26
- package/dist/maths/randomization/randomCore.d.ts +0 -7
- package/dist/maths/randomization/rndFraction.d.ts +0 -13
- package/dist/maths/randomization/rndGeometryCircle.d.ts +0 -13
- package/dist/maths/randomization/rndGeometryLine.d.ts +0 -13
- package/dist/maths/randomization/rndGeometryPoint.d.ts +0 -13
- package/dist/maths/randomization/rndHelpers.d.ts +0 -23
- package/dist/maths/randomization/rndMonom.d.ts +0 -13
- package/dist/maths/randomization/rndPolynom.d.ts +0 -14
- package/dist/maths/randomization/rndTypes.d.ts +0 -40
- package/dist/maths/shutingyard.d.ts +0 -59
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { Point } from './point';
|
|
2
|
-
import { Fraction } from '../coefficients/fraction';
|
|
3
|
-
|
|
4
|
-
export declare class Vector {
|
|
5
|
-
private _x;
|
|
6
|
-
private _y;
|
|
7
|
-
constructor(...values: unknown[]);
|
|
8
|
-
get x(): Fraction;
|
|
9
|
-
set x(value: Fraction | number | string);
|
|
10
|
-
get y(): Fraction;
|
|
11
|
-
set y(value: Fraction | number | string);
|
|
12
|
-
get normSquare(): Fraction;
|
|
13
|
-
get norm(): number;
|
|
14
|
-
get tex(): string;
|
|
15
|
-
get asPoint(): Point;
|
|
16
|
-
get isNull(): boolean;
|
|
17
|
-
static scalarProduct: (v1: Vector, v2: Vector) => Fraction;
|
|
18
|
-
static determinant: (v1: Vector, v2: Vector) => Fraction;
|
|
19
|
-
parse: (...values: any) => Vector;
|
|
20
|
-
clone: () => Vector;
|
|
21
|
-
reset: () => Vector;
|
|
22
|
-
zero: () => Vector;
|
|
23
|
-
one: () => Vector;
|
|
24
|
-
opposed: () => Vector;
|
|
25
|
-
add: (V: Vector) => Vector;
|
|
26
|
-
subtract: (V: Vector) => Vector;
|
|
27
|
-
scalarProductWithVector: (V: Vector) => Fraction;
|
|
28
|
-
determinantWithVector: (V: Vector) => Fraction;
|
|
29
|
-
normal: () => Vector;
|
|
30
|
-
isColinearTo: (v: Vector) => boolean;
|
|
31
|
-
isNormalTo: (v: Vector) => boolean;
|
|
32
|
-
multiplyByScalar: (k: any) => Vector;
|
|
33
|
-
divideByScalar: (k: any) => Vector;
|
|
34
|
-
simplify: () => Vector;
|
|
35
|
-
simplifyDirection: () => Vector;
|
|
36
|
-
angleWith: (V: Vector, sharp?: Boolean, radian?: Boolean) => number;
|
|
37
|
-
private _parseString;
|
|
38
|
-
}
|
package/dist/maths/numeric.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export declare class Numeric {
|
|
2
|
-
static round(value: number, decimals?: number): number;
|
|
3
|
-
/**
|
|
4
|
-
* Get the list of the nth first prime numbers.
|
|
5
|
-
* @param nb : number of primes to choose from
|
|
6
|
-
*/
|
|
7
|
-
static primes(nb?: number): number[];
|
|
8
|
-
/**
|
|
9
|
-
* Get the list of all dividers of a number.
|
|
10
|
-
* @param value
|
|
11
|
-
*/
|
|
12
|
-
static dividers(value: number): number[];
|
|
13
|
-
/**
|
|
14
|
-
* Great Common Divisor
|
|
15
|
-
* @param values : number values
|
|
16
|
-
*/
|
|
17
|
-
static gcd(...values: number[]): number;
|
|
18
|
-
static divideNumbersByGCD(...values: number[]): number[];
|
|
19
|
-
/**
|
|
20
|
-
* Least Common Multiple
|
|
21
|
-
* @param values: list of numbers
|
|
22
|
-
*/
|
|
23
|
-
static lcm(...values: number[]): number;
|
|
24
|
-
static pythagoricianTripletsWithTarget(target: number, targetIsSquare?: boolean): number[][];
|
|
25
|
-
static numberCorrection(value: number, epsilonDigit?: number, epsilonNumberOfDigits?: number, number_of_digits?: number): number;
|
|
26
|
-
static periodic(value: number): number;
|
|
27
|
-
static decompose(value: number): number[][];
|
|
28
|
-
}
|
package/dist/maths/numexp.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export declare class NumExp {
|
|
2
|
-
private _rpn;
|
|
3
|
-
private _expression;
|
|
4
|
-
private _isValid;
|
|
5
|
-
constructor(value: string, uniformize?: boolean);
|
|
6
|
-
get rpn(): {
|
|
7
|
-
token: string;
|
|
8
|
-
tokenType: string;
|
|
9
|
-
}[];
|
|
10
|
-
get isValid(): boolean;
|
|
11
|
-
set isValid(value: boolean);
|
|
12
|
-
get expression(): string;
|
|
13
|
-
evaluate(values?: {
|
|
14
|
-
[Key: string]: number;
|
|
15
|
-
}): number;
|
|
16
|
-
private _extractDecimalPart;
|
|
17
|
-
private _numberCorrection;
|
|
18
|
-
private _addToStack;
|
|
19
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { Circle } from '../geometry/circle';
|
|
2
|
-
import { Point } from '../geometry/point';
|
|
3
|
-
import { Line } from '../geometry/line';
|
|
4
|
-
import { Fraction } from '../coefficients/fraction';
|
|
5
|
-
import { Monom } from '../algebra/monom';
|
|
6
|
-
import { Polynom } from '../algebra/polynom';
|
|
7
|
-
import { randomCoefficientConfig, randomGeometryCircleConfig, randomGeometryLineConfig, randomGeometryPointConfig, randomMonomConfig, randomPolynomConfig } from './rndTypes';
|
|
8
|
-
|
|
9
|
-
export * from './rndTypes';
|
|
10
|
-
export declare namespace Random {
|
|
11
|
-
function polynom(config?: randomPolynomConfig): Polynom;
|
|
12
|
-
function monom(config?: randomMonomConfig): Monom;
|
|
13
|
-
function fraction(config?: randomCoefficientConfig): Fraction;
|
|
14
|
-
function number(from: number, to: number, exclude?: number[]): number;
|
|
15
|
-
function numberSym(max: number, allowZero?: boolean): number;
|
|
16
|
-
function prime(max: number): number;
|
|
17
|
-
function bool(percent?: number): boolean;
|
|
18
|
-
function array(arr: any[], number?: number): any[];
|
|
19
|
-
function item(arr: any[]): any;
|
|
20
|
-
function shuffle(arr: any[]): any[];
|
|
21
|
-
namespace Geometry {
|
|
22
|
-
function line(config?: randomGeometryLineConfig): Line;
|
|
23
|
-
function point(config?: randomGeometryPointConfig): Point;
|
|
24
|
-
function circle(config?: randomGeometryCircleConfig): Circle;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Fraction } from '../coefficients/fraction';
|
|
2
|
-
import { randomCoefficientConfig } from './rndTypes';
|
|
3
|
-
import { randomCore } from './randomCore';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Create a random monom based on a based configuration
|
|
7
|
-
*/
|
|
8
|
-
export declare class rndFraction extends randomCore {
|
|
9
|
-
protected _config: randomCoefficientConfig;
|
|
10
|
-
protected _defaultConfig: randomCoefficientConfig;
|
|
11
|
-
constructor(userConfig?: randomCoefficientConfig);
|
|
12
|
-
generate: () => Fraction;
|
|
13
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Circle } from '../geometry/circle';
|
|
2
|
-
import { randomGeometryCircleConfig } from './random';
|
|
3
|
-
import { randomCore } from './randomCore';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Create a random monom based on a based configuration
|
|
7
|
-
*/
|
|
8
|
-
export declare class rndGeometryCircle extends randomCore {
|
|
9
|
-
protected _config: randomGeometryCircleConfig;
|
|
10
|
-
protected _defaultConfig: randomGeometryCircleConfig;
|
|
11
|
-
generate: () => Circle;
|
|
12
|
-
constructor(userConfig?: randomGeometryCircleConfig);
|
|
13
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Line } from '../geometry/line';
|
|
2
|
-
import { randomGeometryLineConfig } from './random';
|
|
3
|
-
import { randomCore } from './randomCore';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Create a random monom based on a based configuration
|
|
7
|
-
*/
|
|
8
|
-
export declare class rndGeometryLine extends randomCore {
|
|
9
|
-
protected _config: randomGeometryLineConfig;
|
|
10
|
-
protected _defaultConfig: randomGeometryLineConfig;
|
|
11
|
-
constructor(userConfig?: randomGeometryLineConfig);
|
|
12
|
-
generate: () => Line;
|
|
13
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Point } from '../geometry/point';
|
|
2
|
-
import { randomGeometryPointConfig } from './random';
|
|
3
|
-
import { randomCore } from './randomCore';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Create a random monom based on a based configuration
|
|
7
|
-
*/
|
|
8
|
-
export declare class rndGeometryPoint extends randomCore {
|
|
9
|
-
protected _config: randomGeometryPointConfig;
|
|
10
|
-
protected _defaultConfig: randomGeometryPointConfig;
|
|
11
|
-
constructor(userConfig?: randomGeometryPointConfig);
|
|
12
|
-
generate: () => Point;
|
|
13
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export declare class rndHelpers {
|
|
2
|
-
/**
|
|
3
|
-
* Random boolean with a percent ratio
|
|
4
|
-
* @param percent
|
|
5
|
-
*/
|
|
6
|
-
static randomBool(percent?: number): boolean;
|
|
7
|
-
/**
|
|
8
|
-
* Random integer between two values.
|
|
9
|
-
* @param a (number) : From this value to the second value. If the second is ommited, this value is the max value.
|
|
10
|
-
* @param b (number) : To this value. If this is ommited.
|
|
11
|
-
*/
|
|
12
|
-
static randomInt(a: number, b?: number, exclude?: number[]): number;
|
|
13
|
-
/**
|
|
14
|
-
* Random integer between -max and max value.
|
|
15
|
-
* @param max (number) : determine the limits.
|
|
16
|
-
* @param zero (bool) : determine if zero is allowed or not.
|
|
17
|
-
*/
|
|
18
|
-
static randomIntSym(max: number, zero?: boolean): number;
|
|
19
|
-
static randomPrime(max: number): number;
|
|
20
|
-
static randomArray(arr: any[], number?: number): any[];
|
|
21
|
-
static randomItem(arr: any[]): any;
|
|
22
|
-
static shuffleArray(arr: any[]): any[];
|
|
23
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Monom } from '../algebra/monom';
|
|
2
|
-
import { randomMonomConfig } from './rndTypes';
|
|
3
|
-
import { randomCore } from './randomCore';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Create a random monom based on a based configuration
|
|
7
|
-
*/
|
|
8
|
-
export declare class rndMonom extends randomCore {
|
|
9
|
-
protected _config: randomMonomConfig;
|
|
10
|
-
protected _defaultConfig: randomMonomConfig;
|
|
11
|
-
generate: () => Monom;
|
|
12
|
-
constructor(userConfig?: randomMonomConfig);
|
|
13
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Polynom } from '../algebra/polynom';
|
|
2
|
-
import { randomPolynomConfig } from './rndTypes';
|
|
3
|
-
import { randomCore } from './randomCore';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Random polynoms
|
|
7
|
-
*/
|
|
8
|
-
export declare class rndPolynom extends randomCore {
|
|
9
|
-
protected _config: randomPolynomConfig;
|
|
10
|
-
protected _defaultConfig: randomPolynomConfig;
|
|
11
|
-
generate: () => Polynom;
|
|
12
|
-
constructor(userConfig?: randomPolynomConfig);
|
|
13
|
-
factorable: () => Polynom;
|
|
14
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { Fraction } from '../coefficients/fraction';
|
|
2
|
-
|
|
3
|
-
export type randomCoefficientConfig = {
|
|
4
|
-
negative?: boolean;
|
|
5
|
-
max?: number;
|
|
6
|
-
reduced?: boolean;
|
|
7
|
-
zero?: boolean;
|
|
8
|
-
natural?: boolean;
|
|
9
|
-
};
|
|
10
|
-
export type randomMonomConfig = {
|
|
11
|
-
letters?: string;
|
|
12
|
-
degree?: number;
|
|
13
|
-
fraction?: boolean | randomCoefficientConfig;
|
|
14
|
-
zero?: boolean;
|
|
15
|
-
};
|
|
16
|
-
export type randomPolynomConfig = randomMonomConfig & {
|
|
17
|
-
unit?: boolean;
|
|
18
|
-
factorable?: boolean;
|
|
19
|
-
allowNullMonom?: boolean;
|
|
20
|
-
numberOfMonoms?: number;
|
|
21
|
-
positive?: boolean;
|
|
22
|
-
};
|
|
23
|
-
export type randomGeometryLineConfig = {
|
|
24
|
-
A: {
|
|
25
|
-
x: number | Fraction;
|
|
26
|
-
y: number | Fraction;
|
|
27
|
-
};
|
|
28
|
-
slope?: Fraction | string | number;
|
|
29
|
-
};
|
|
30
|
-
export type randomGeometryPointConfig = {
|
|
31
|
-
quadrant?: number;
|
|
32
|
-
axis?: string | boolean;
|
|
33
|
-
fraction?: boolean;
|
|
34
|
-
max?: number;
|
|
35
|
-
};
|
|
36
|
-
export type randomGeometryCircleConfig = {
|
|
37
|
-
center?: randomGeometryPointConfig;
|
|
38
|
-
radius?: number;
|
|
39
|
-
pointsOnCircle?: number;
|
|
40
|
-
};
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
export type tokenType = {
|
|
2
|
-
[key: string]: {
|
|
3
|
-
precedence: number;
|
|
4
|
-
associative: string;
|
|
5
|
-
type: string;
|
|
6
|
-
};
|
|
7
|
-
};
|
|
8
|
-
export declare const tokenConstant: {
|
|
9
|
-
[Key: string]: number;
|
|
10
|
-
};
|
|
11
|
-
export declare enum ShutingyardType {
|
|
12
|
-
VARIABLE = "variable",
|
|
13
|
-
COEFFICIENT = "coefficient",
|
|
14
|
-
OPERATION = "operation",
|
|
15
|
-
CONSTANT = "constant",
|
|
16
|
-
FUNCTION = "function",
|
|
17
|
-
MONOM = "monom"
|
|
18
|
-
}
|
|
19
|
-
export declare enum ShutingyardMode {
|
|
20
|
-
EXPRESSION = "expression",
|
|
21
|
-
POLYNOM = "polynom",
|
|
22
|
-
SET = "set",
|
|
23
|
-
NUMERIC = "numeric"
|
|
24
|
-
}
|
|
25
|
-
export type Token = {
|
|
26
|
-
token: string;
|
|
27
|
-
tokenType: string;
|
|
28
|
-
};
|
|
29
|
-
export declare class Shutingyard {
|
|
30
|
-
readonly _mode: ShutingyardMode;
|
|
31
|
-
private _rpn;
|
|
32
|
-
private _tokenConfig;
|
|
33
|
-
private _tokenConstant;
|
|
34
|
-
private _tokenKeys;
|
|
35
|
-
private _uniformize;
|
|
36
|
-
constructor(mode?: ShutingyardMode);
|
|
37
|
-
get rpn(): Token[];
|
|
38
|
-
get rpnToken(): string[];
|
|
39
|
-
/**
|
|
40
|
-
* Determin if the token is a defined operation
|
|
41
|
-
* Defined operations: + - * / ^ sin cos tan
|
|
42
|
-
* @param token
|
|
43
|
-
*/
|
|
44
|
-
tokenConfigInitialization(): tokenType;
|
|
45
|
-
/**
|
|
46
|
-
* Get the next token to analyse.
|
|
47
|
-
* @param expr (string) Expression to analyse
|
|
48
|
-
* @param start (number) CUrrent position in the expr string.
|
|
49
|
-
*/
|
|
50
|
-
NextToken(expr: string, start: number): [string, number, string];
|
|
51
|
-
normalize(expr: string): string;
|
|
52
|
-
/**
|
|
53
|
-
* Parse an expression using the shutting yard tree algorithms
|
|
54
|
-
* @param expr (string) Expression to analyse
|
|
55
|
-
* Returns a RPN list of items.
|
|
56
|
-
* @param uniformize
|
|
57
|
-
*/
|
|
58
|
-
parse(expr: string, uniformize?: boolean): Shutingyard;
|
|
59
|
-
}
|