pimath 0.1.24 → 0.1.25

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/README.md CHANGED
@@ -1,18 +1,15 @@
1
1
  PI - javascript math in your hands
2
2
  =============
3
3
 
4
- PI is a script designed to create and generate mathematical exercises.
5
- Each class has a tex output, designed to be used in any LaTeX document.
4
+ PiMath is a script designed to create and generate mathematical exercises.
6
5
 
7
- Fraction will create... fraction !
8
6
 
9
7
  ```
10
- let A = new Pi.Fraction('2/3');
8
+ let A = new PiMath.Fraction('2/3');
11
9
  console.log(A.tex) // -> \frac{ 2 }{ 3 }
12
10
 
13
11
  // Add another fraction
14
- let B = new Pi.Fraction('2/5');
12
+ let B = new PiMath.Fraction('2/5');
15
13
  A.add(B);
16
14
  console.log(A.frac) // -> \frac{ 16 }{ 15 }
17
- ```
18
- New version today
15
+ ```
@@ -1,11 +1,12 @@
1
- import { IAlgebra, IExpression, InputAlgebra, InputValue, IPiMathObject, ISolution, literalType, TABLE_OF_SIGNS } from '../pimath.interface';
1
+ import { IAlgebra, IExpression, InputAlgebra, InputValue, IPiMathObject, literalType, TABLE_OF_SIGNS } from '../pimath.interface';
2
2
  import { Fraction } from '../coefficients/fraction';
3
3
  import { Polynom } from './polynom';
4
4
  export declare class Factor implements IPiMathObject<Factor>, IExpression<Factor>, IAlgebra<Factor> {
5
5
  #private;
6
- constructor(value: InputAlgebra<Polynom> | Factor, power?: InputValue<Fraction>);
6
+ constructor(value?: InputAlgebra<Polynom> | Factor, power?: InputValue<Fraction>);
7
7
  parse(): Factor;
8
8
  clone(): Factor;
9
+ fromPolynom(polynom: InputValue<Polynom>): this;
9
10
  get tex(): string;
10
11
  get display(): string;
11
12
  add(): Factor;
@@ -34,7 +35,7 @@ export declare class Factor implements IPiMathObject<Factor>, IExpression<Factor
34
35
  root(value: number): this;
35
36
  sqrt(): this;
36
37
  subtract(): Factor;
37
- tableOfSigns(roots?: ISolution[]): TABLE_OF_SIGNS;
38
+ tableOfSigns(): TABLE_OF_SIGNS;
38
39
  get variables(): string[];
39
40
  get withPower(): this;
40
41
  get withRoot(): this;
@@ -101,7 +101,6 @@ export declare class Monom implements IPiMathObject<Monom>, IExpression<Monom>,
101
101
  set literal(L: literalType<Fraction>);
102
102
  /**
103
103
  * Get the literal square roots of the Monom.
104
- * TODO: remove this getter ? Is it used and is it correct ?
105
104
  * @returns {literalType<Fraction>}
106
105
  */
107
106
  get literalSqrt(): literalType<Fraction>;
@@ -4,8 +4,8 @@ import { Factor } from './factor';
4
4
  import { Polynom } from './polynom';
5
5
  export declare class PolyFactor implements IPiMathObject<PolyFactor>, IExpression<PolyFactor>, IAlgebra<PolyFactor> {
6
6
  #private;
7
- constructor(...values: (Factor | InputAlgebra<Polynom> | PolyFactor)[]);
8
- parse(...values: (Factor | InputAlgebra<Polynom> | PolyFactor)[]): this;
7
+ constructor(...values: (Factor | PolyFactor)[]);
8
+ parse(...values: (Factor | PolyFactor)[]): this;
9
9
  clone(): PolyFactor;
10
10
  get tex(): string;
11
11
  get display(): string;
@@ -38,7 +38,13 @@ export declare class PolyFactor implements IPiMathObject<PolyFactor>, IExpressio
38
38
  primitive(): PolyFactor;
39
39
  reduce(): this;
40
40
  root(value: number): this;
41
- sort(): this;
41
+ /**
42
+ * Reoarder the factors using :
43
+ * 1. number of monoms
44
+ * 2. degree of polynom
45
+ * 3. power of polyfactor
46
+ */
47
+ sort(letter?: string): this;
42
48
  sqrt(): this;
43
49
  subtract(...values: PolyFactor[]): this;
44
50
  tableOfSigns(): POLYFACTOR_TABLE_OF_SIGNS;
@@ -1,5 +1,5 @@
1
1
  import { IAlgebra, IAnalyse, IExpression, InputAlgebra, InputValue, IPiMathObject, ISolution, literalType, TABLE_OF_SIGNS } from '../pimath.interface';
2
- import { Fraction } from '../coefficients/fraction';
2
+ import { Fraction } from '../coefficients';
3
3
  import { Monom } from './monom';
4
4
  export type PolynomParsingType = InputValue<Polynom> | Monom;
5
5
  export interface IEuclidean {
@@ -30,11 +30,12 @@ export declare class Polynom implements IPiMathObject<Polynom>, IExpression<Poly
30
30
  * Clone the polynom
31
31
  */
32
32
  clone: () => Polynom;
33
+ get tex(): string;
34
+ get display(): string;
33
35
  add: (...values: InputAlgebra<Polynom>[]) => Polynom;
34
36
  commonMonom: () => Monom;
35
37
  degree: (letter?: string) => Fraction;
36
38
  derivative: (letter?: string) => Polynom;
37
- get display(): string;
38
39
  divide: (value: InputAlgebra<Polynom>) => Polynom;
39
40
  empty: () => this;
40
41
  /**
@@ -49,8 +50,10 @@ export declare class Polynom implements IPiMathObject<Polynom>, IExpression<Poly
49
50
  * @param letter
50
51
  */
51
52
  factorize: (letter?: string) => Polynom[];
53
+ fromCoefficients(...values: InputValue<Fraction>[]): this;
52
54
  gcdDenominator: () => number;
53
55
  gcdNumerator: () => number;
56
+ getCoefficients(): Fraction[];
54
57
  getDenominators: () => number[];
55
58
  getNumerators: () => number[];
56
59
  getZeroes: () => ISolution[];
@@ -97,8 +100,7 @@ export declare class Polynom implements IPiMathObject<Polynom>, IExpression<Poly
97
100
  set roots(value: ISolution[]);
98
101
  sqrt(): Polynom;
99
102
  subtract: (...values: InputAlgebra<Polynom>[]) => Polynom;
100
- tableOfSigns(rootsArray?: ISolution[]): TABLE_OF_SIGNS;
101
- get tex(): string;
103
+ tableOfSigns(): TABLE_OF_SIGNS;
102
104
  get variables(): string[];
103
105
  /**
104
106
  * Set the polynom to zero.
@@ -27,7 +27,6 @@ export declare class Triangle {
27
27
  * Parse values to a triangle. Supported formats:
28
28
  * Vector2D, Vector2D, Vector2D
29
29
  * x1, y1, x2, y2, x3, y3
30
- * TODO: Something else ?
31
30
  * @param values
32
31
  */
33
32
  parse: (...values: unknown[]) => Triangle;
@@ -1,9 +1,6 @@
1
- import { Fraction } from './coefficients/fraction';
2
- import { NthRoot } from './coefficients/nthRoot';
3
- import { Monom } from './algebra/monom';
4
- import { Factor } from './algebra/factor';
1
+ import { Fraction, NthRoot } from './coefficients';
2
+ import { Monom, Factor, Equation } from './algebra';
5
3
  import { Line, Point, Vector } from './geometry';
6
- import { Equation } from './algebra';
7
4
  export type InputValue<T> = T | string | number | Fraction | NthRoot;
8
5
  export type InputAlgebra<T> = InputValue<T> | Monom;
9
6
  export type literalType<T> = Record<string, T>;