pimath 0.2.8 → 0.2.10

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.
Files changed (61) hide show
  1. package/dist/pimath.js +5596 -5042
  2. package/dist/pimath.js.map +1 -1
  3. package/package.json +16 -16
  4. package/src/algebra/equation.ts +21 -22
  5. package/src/algebra/matrix.ts +45 -8
  6. package/src/algebra/polynom.ts +19 -16
  7. package/src/randomization/algebra/rndMonom.ts +16 -10
  8. package/src/randomization/geometry/rndCircle.ts +5 -5
  9. package/src/randomization/geometry/{rndVector.ts → rndPoint.ts} +6 -6
  10. package/src/randomization/random.ts +4 -4
  11. package/types/algebra/equation.d.ts +6 -58
  12. package/types/algebra/equation.d.ts.map +1 -1
  13. package/types/algebra/equationSolver.d.ts +4 -3
  14. package/types/algebra/factor.d.ts +4 -3
  15. package/types/algebra/index.d.ts +1 -0
  16. package/types/algebra/linearSystem.d.ts +6 -5
  17. package/types/algebra/logicalset.d.ts +1 -7
  18. package/types/algebra/matrix.d.ts +9 -3
  19. package/types/algebra/matrix.d.ts.map +1 -1
  20. package/types/algebra/monom.d.ts +3 -115
  21. package/types/algebra/operations.d.ts +2 -1
  22. package/types/algebra/polyFactor.d.ts +6 -14
  23. package/types/algebra/polynom.d.ts +6 -36
  24. package/types/algebra/polynom.d.ts.map +1 -1
  25. package/types/analyze/index.d.ts +3 -2
  26. package/types/analyze/solution.d.ts +4 -3
  27. package/types/analyze/tableOfSigns.d.ts +4 -3
  28. package/types/coefficients/fraction.d.ts +2 -14
  29. package/types/coefficients/index.d.ts +1 -0
  30. package/types/coefficients/root.d.ts +3 -5
  31. package/types/geometry/TupleN.d.ts +3 -2
  32. package/types/geometry/circle.d.ts +6 -15
  33. package/types/geometry/geomMath.d.ts +4 -3
  34. package/types/geometry/index.d.ts +1 -0
  35. package/types/geometry/line.d.ts +7 -16
  36. package/types/geometry/line3.d.ts +5 -9
  37. package/types/geometry/plane3.d.ts +6 -5
  38. package/types/geometry/point.d.ts +6 -5
  39. package/types/geometry/sphere3.d.ts +5 -4
  40. package/types/geometry/triangle.d.ts +6 -12
  41. package/types/geometry/vector.d.ts +5 -4
  42. package/types/helpers.d.ts +1 -0
  43. package/types/index.d.ts +22 -21
  44. package/types/numeric.d.ts +1 -16
  45. package/types/pimath.interface.d.ts +5 -4
  46. package/types/randomization/algebra/rndEquation.d.ts +3 -2
  47. package/types/randomization/algebra/rndMonom.d.ts +3 -2
  48. package/types/randomization/algebra/rndMonom.d.ts.map +1 -1
  49. package/types/randomization/algebra/rndPolynom.d.ts +3 -2
  50. package/types/randomization/coefficient/rndFraction.d.ts +3 -2
  51. package/types/randomization/geometry/rndCircle.d.ts +3 -2
  52. package/types/randomization/geometry/rndCircle.d.ts.map +1 -1
  53. package/types/randomization/geometry/rndLine.d.ts +3 -2
  54. package/types/randomization/geometry/rndLine3.d.ts +3 -2
  55. package/types/randomization/geometry/rndPoint.d.ts +4 -0
  56. package/types/randomization/geometry/rndPoint.d.ts.map +1 -0
  57. package/types/randomization/geometry/rndVector.d.ts +3 -2
  58. package/types/randomization/random.d.ts +13 -12
  59. package/types/randomization/random.d.ts.map +1 -1
  60. package/types/randomization/rndHelpers.d.ts +1 -14
  61. package/types/randomization/rndTypes.d.ts +2 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pimath",
3
- "version": "0.2.8",
3
+ "version": "0.2.10",
4
4
  "description": "A math library for teacher :)",
5
5
  "type": "module",
6
6
  "main": "dist/pimath.js",
@@ -38,22 +38,22 @@
38
38
  "url": "git+https://github.com/basilgass/PiMath.git"
39
39
  },
40
40
  "devDependencies": {
41
- "@tailwindcss/vite": "^4.1.18",
42
- "@vitejs/plugin-vue": "^6.0.4",
43
- "autoprefixer": "^10.4.24",
44
- "dependency-cruiser": "^17.3.8",
45
- "eslint": "^9.39.2",
46
- "globals": "^17.3.0",
47
- "tailwindcss": "^4.1.18",
48
- "ts-loader": "^9.5.4",
41
+ "@tailwindcss/vite": "^4.3.2",
42
+ "@types/eslint": "^9.6.1",
43
+ "@vitejs/plugin-vue": "^6.0.7",
44
+ "autoprefixer": "^10.5.2",
45
+ "dependency-cruiser": "^18.0.0",
46
+ "eslint": "^10.6.0",
47
+ "globals": "^17.7.0",
48
+ "tailwindcss": "^4.3.2",
49
+ "ts-loader": "^9.6.2",
49
50
  "ts-node": "^10.9.2",
50
- "typedoc": "^0.28.16",
51
- "typescript": "^5.9.3",
52
- "typescript-eslint": "^8.54.0",
53
- "vite": "^7.3.1",
54
- "vite-plugin-dts": "^4.5.4",
55
- "vitest": "^4.0.18",
56
- "vue-router": "^5.0.2"
51
+ "typedoc": "^0.28.20",
52
+ "typescript": "^6.0.3",
53
+ "typescript-eslint": "^8.63.0",
54
+ "vite": "^8.1.4",
55
+ "vitest": "^4.1.10",
56
+ "vue-router": "^5.1.0"
57
57
  },
58
58
  "dependencies": {
59
59
  "piexpression": "^0.1.3"
@@ -7,15 +7,14 @@ import type {
7
7
  IPiMathObject,
8
8
  literalType
9
9
  } from "../pimath.interface"
10
- import {Fraction} from "../coefficients/fraction"
10
+ import {Fraction} from "../coefficients"
11
11
  import {Numeric} from "../numeric"
12
12
  import {EquationSolver} from "./equationSolver"
13
13
  import {Monom} from "./monom"
14
14
  import {Polynom} from "./polynom"
15
- import type {Solution} from "../analyze/solution"
15
+ import type {Solution} from "../analyze"
16
16
 
17
- export class Equation implements
18
- IPiMathObject<Equation>,
17
+ export class Equation implements IPiMathObject<Equation>,
19
18
  IEquation<Equation>,
20
19
  IAlgebra<Equation> {
21
20
 
@@ -96,15 +95,15 @@ export class Equation implements
96
95
  }
97
96
 
98
97
  public static makeSolutionsUnique(solutions: Solution[], sorted?: boolean): Solution[] {
99
- const solutionAsTex: string[] = [],
100
- uniqueSolutions = solutions.filter(sol => {
101
- if (!solutionAsTex.includes(sol.tex)) {
102
- solutionAsTex.push(sol.tex)
103
- return true
104
- } else {
105
- return false
106
- }
107
- })
98
+ const solutionAsTex: string[] = []
99
+ const uniqueSolutions = solutions.filter(sol => {
100
+ if (!solutionAsTex.includes(sol.tex)) {
101
+ solutionAsTex.push(sol.tex)
102
+ return true
103
+ } else {
104
+ return false
105
+ }
106
+ })
108
107
 
109
108
  if (sorted === true) {
110
109
  uniqueSolutions.sort((a, b) => a.value - b.value)
@@ -191,13 +190,13 @@ export class Equation implements
191
190
  * @param values
192
191
  * @param asNumeric
193
192
  */
194
- public evaluate(values: InputValue<Fraction> | literalType<number | Fraction>, asNumeric?: boolean ): boolean {
193
+ public evaluate(values: InputValue<Fraction> | literalType<number | Fraction>, asNumeric: boolean): boolean {
195
194
  // Evaluate the left and right part of the equation.
196
195
  // compare the results.
197
196
 
198
197
  // Evaluate the left and right part of the equation.
199
- const left = this.#left.evaluate(values, asNumeric),
200
- right = this.#right.evaluate(values, asNumeric)
198
+ const left = this.#left.evaluate(values, asNumeric)
199
+ const right = this.#right.evaluate(values, asNumeric)
201
200
 
202
201
  // compare the results.
203
202
  if (asNumeric) {
@@ -227,8 +226,8 @@ export class Equation implements
227
226
 
228
227
  // Equations helpers
229
228
  public isEqualTo = (equ: Equation): boolean => {
230
- const p1 = equ.clone().moveLeft().left,
231
- p2 = this.clone().moveLeft().left
229
+ const p1 = equ.clone().moveLeft().left
230
+ const p2 = this.clone().moveLeft().left
232
231
 
233
232
  // They are the same.
234
233
  return p1.isEqual(p2) || p1.isOppositeAt(p2)
@@ -236,8 +235,8 @@ export class Equation implements
236
235
 
237
236
  public isLinearTo = (equ: Equation): boolean => {
238
237
  // Move all left.
239
- const p1 = equ.clone().moveLeft().simplify().left,
240
- p2 = this.clone().moveLeft().simplify().left
238
+ const p1 = equ.clone().moveLeft().simplify().left
239
+ const p2 = this.clone().moveLeft().simplify().left
241
240
 
242
241
  // They are the same.
243
242
  return p1.isEqual(p2) || p1.isOppositeAt(p2)
@@ -427,7 +426,7 @@ export class Equation implements
427
426
  // Set the sign value as formatted.
428
427
  this.#sign = this.#formatSign(value)
429
428
  }
430
-
429
+
431
430
  public get signAsTex(): string {
432
431
  if (this.#sign === '>=') {
433
432
  return '\\geq'
@@ -480,7 +479,7 @@ export class Equation implements
480
479
  }
481
480
 
482
481
  public test = (values: literalType<Fraction>): boolean => {
483
- return (this.left.evaluate(values) as Fraction).isEqual(this.right.evaluate(values))
482
+ return (this.left.evaluate(values)).isEqual(this.right.evaluate(values))
484
483
  }
485
484
 
486
485
  public get variables(): string[] {
@@ -5,10 +5,17 @@ import {operation_pow} from "./operations"
5
5
 
6
6
  export type IMatrixValues = InputAlgebra<Polynom>[][]
7
7
 
8
+ enum MATRIX_TYPE {
9
+ pmatrix,
10
+ bmatrix,
11
+ Bmatrix,
12
+ vmatrix,
13
+ Vmatrix
14
+ }
8
15
  export class Matrix implements IPiMathObject<Matrix>,
9
16
  IExpressionMultiply<Matrix> {
10
17
  #digits: number | null = null
11
- #matrix_parenthesis = true
18
+ #matrix_parenthesis: MATRIX_TYPE = MATRIX_TYPE.pmatrix
12
19
  #values: Polynom[][] = []
13
20
 
14
21
  constructor(rowCount?: number, colCount?: number) {
@@ -22,8 +29,6 @@ export class Matrix implements IPiMathObject<Matrix>,
22
29
 
23
30
  public parse(values: IMatrixValues): this {
24
31
  return this.fromValues(values)
25
-
26
- return this
27
32
  }
28
33
 
29
34
  public clone(): Matrix {
@@ -47,8 +52,7 @@ export class Matrix implements IPiMathObject<Matrix>,
47
52
  return ""
48
53
  }
49
54
 
50
- const wrapper = this.#matrix_parenthesis ? 'pmatrix' : 'bmatrix'
51
-
55
+ const wrapper = this.resolveTeXwrapper()
52
56
 
53
57
  const output = [
54
58
  `\\begin{${wrapper}}`,
@@ -65,12 +69,30 @@ export class Matrix implements IPiMathObject<Matrix>,
65
69
  return output
66
70
  }
67
71
 
72
+ resolveWrapper(): [string, string]{
73
+ if(this.#matrix_parenthesis=== MATRIX_TYPE.vmatrix) return ['|', '|']
74
+ if(this.#matrix_parenthesis=== MATRIX_TYPE.Vmatrix) return ['||', '||']
75
+ if(this.#matrix_parenthesis=== MATRIX_TYPE.bmatrix) return ['[', ']']
76
+ if(this.#matrix_parenthesis=== MATRIX_TYPE.Bmatrix) return ['{', '}']
77
+
78
+ return ['(', ')']
79
+ }
80
+
81
+ resolveTeXwrapper(): string {
82
+ if(this.#matrix_parenthesis=== MATRIX_TYPE.vmatrix) return 'vmatrix'
83
+ if(this.#matrix_parenthesis=== MATRIX_TYPE.Vmatrix) return 'Vmatrix'
84
+ if(this.#matrix_parenthesis=== MATRIX_TYPE.bmatrix) return 'bmatrix'
85
+ if(this.#matrix_parenthesis=== MATRIX_TYPE.Bmatrix) return 'Bmatrix'
86
+
87
+ return 'pmatrix'
88
+ }
89
+
68
90
  get display(): string {
69
91
  if (this.#values.length === 0) {
70
92
  return ""
71
93
  }
72
94
 
73
- const wrapper = this.#matrix_parenthesis ? ['(', ')'] : ['[', ']']
95
+ const wrapper = this.resolveWrapper()
74
96
 
75
97
  const output = wrapper[0] +
76
98
  this.map(aij => this.#digits !== null && aij.value ? +aij.value.toFixed(this.#digits): aij.display)
@@ -103,7 +125,12 @@ export class Matrix implements IPiMathObject<Matrix>,
103
125
  }
104
126
 
105
127
  get bmatrix(): this {
106
- this.#matrix_parenthesis = false
128
+ this.#matrix_parenthesis = MATRIX_TYPE.bmatrix
129
+ return this
130
+ }
131
+
132
+ get Bmatrix(): this {
133
+ this.#matrix_parenthesis = MATRIX_TYPE.Bmatrix
107
134
  return this
108
135
  }
109
136
 
@@ -409,7 +436,17 @@ export class Matrix implements IPiMathObject<Matrix>,
409
436
  }
410
437
 
411
438
  get pmatrix(): this {
412
- this.#matrix_parenthesis = true
439
+ this.#matrix_parenthesis = MATRIX_TYPE.pmatrix
440
+ return this
441
+ }
442
+
443
+ get vmatrix(): this {
444
+ this.#matrix_parenthesis = MATRIX_TYPE.vmatrix
445
+ return this
446
+ }
447
+
448
+ get Vmatrix(): this {
449
+ this.#matrix_parenthesis = MATRIX_TYPE.Vmatrix
413
450
  return this
414
451
  }
415
452
 
@@ -136,7 +136,7 @@ export class Polynom implements IPiMathObject<Polynom>,
136
136
 
137
137
  for (const value of values) {
138
138
  if (value instanceof Polynom) {
139
- this.#monoms = this.#monoms.concat(value.monoms.map(m=>m.clone()))
139
+ this.#monoms = this.#monoms.concat(value.monoms.map(m => m.clone()))
140
140
  } else if (value instanceof Monom) {
141
141
  this.#monoms.push(value.clone())
142
142
  } else if (typeof value === "number" && Number.isSafeInteger(value)) {
@@ -279,8 +279,11 @@ export class Polynom implements IPiMathObject<Polynom>,
279
279
  return {quotient, reminder}
280
280
  }
281
281
 
282
+ public evaluate(values: literalType<Fraction | number> | InputValue<Fraction>, asNumeric: true): number
283
+ public evaluate(values: literalType<Fraction | number> | InputValue<Fraction>, asNumeric?: false): Fraction
284
+ public evaluate(values: literalType<Fraction | number> | InputValue<Fraction>, asNumeric?: boolean): Fraction | number
282
285
  public evaluate(values: literalType<Fraction | number> | InputValue<Fraction>, asNumeric?: boolean): Fraction | number {
283
- // Return the numeric value, without using Fraction
286
+ // Return the numeric value without using Fraction
284
287
  if (asNumeric) {
285
288
  return this.#evaluateAsNumeric(values)
286
289
  }
@@ -304,7 +307,7 @@ export class Polynom implements IPiMathObject<Polynom>,
304
307
  this.#factors = []
305
308
 
306
309
  // There is only one monom - it's already considered as factor.
307
- if(this.monoms.length===1) return [this.clone()]
310
+ if (this.monoms.length === 1) return [this.clone()]
308
311
 
309
312
  let P = this.clone().reorder()
310
313
 
@@ -400,7 +403,7 @@ export class Polynom implements IPiMathObject<Polynom>,
400
403
  const orderedPolynom = this.clone().reorder()
401
404
 
402
405
  const length = this.degree().value + 1
403
- const coeffs = Array.from({length}, ()=>new Fraction(0))
406
+ const coeffs = Array.from({length}, () => new Fraction(0))
404
407
 
405
408
  orderedPolynom.monoms.forEach(monom => {
406
409
  const index = length - monom.degree().value - 1
@@ -445,13 +448,13 @@ export class Polynom implements IPiMathObject<Polynom>,
445
448
  public integrate(a: InputValue<Fraction>, b: InputValue<Fraction>, letter = 'x'): Fraction {
446
449
  const primitive = this.primitive(letter)
447
450
 
448
- const valuesA: literalType<Fraction> = {},
449
- valuesB: literalType<Fraction> = {}
451
+ const valuesA: literalType<Fraction> = {}
452
+ const valuesB: literalType<Fraction> = {}
450
453
 
451
454
  valuesA[letter] = new Fraction(a)
452
455
  valuesB[letter] = new Fraction(b)
453
456
 
454
- return (primitive.evaluate(valuesB) as Fraction).subtract(primitive.evaluate(valuesA))
457
+ return (primitive.evaluate(valuesB)).subtract(primitive.evaluate(valuesA))
455
458
  }
456
459
 
457
460
  public inverse(): Polynom | undefined {
@@ -494,7 +497,7 @@ export class Polynom implements IPiMathObject<Polynom>,
494
497
  const zero = div.getZeroes()[0]
495
498
 
496
499
  if (zero.exact) {
497
- return (this.evaluate(zero.fraction) as Fraction).isZero()
500
+ return (this.evaluate(zero.fraction)).isZero()
498
501
  } else {
499
502
  return false
500
503
  }
@@ -548,7 +551,7 @@ export class Polynom implements IPiMathObject<Polynom>,
548
551
  // Finite value: evaluate directly
549
552
  if (f.isFinite()) {
550
553
  const l = letter ?? this.variables[0] ?? 'x'
551
- return this.evaluate({[l]: f}) as Fraction
554
+ return this.evaluate({[l]: f})
552
555
  }
553
556
 
554
557
  const M = this.monomByDegree(undefined, letter)
@@ -747,8 +750,8 @@ export class Polynom implements IPiMathObject<Polynom>,
747
750
  public reorder(letter = 'x', revert = false): this {
748
751
  const otherLetters = this.variables.filter(x => x !== letter)
749
752
  this.#monoms.sort(function (a, b) {
750
- const da = a.degree(letter).value,
751
- db = b.degree(letter).value
753
+ const da = a.degree(letter).value
754
+ const db = b.degree(letter).value
752
755
 
753
756
  // Values are different
754
757
  if (da !== db) {
@@ -758,8 +761,8 @@ export class Polynom implements IPiMathObject<Polynom>,
758
761
  // if values are equals, check other letters - it must be reverted in that case !
759
762
  if (otherLetters.length > 0) {
760
763
  for (const L of otherLetters) {
761
- const da = a.degree(L).value,
762
- db = b.degree(L).value
764
+ const da = a.degree(L).value
765
+ const db = b.degree(L).value
763
766
 
764
767
  // Values are different
765
768
  if (da !== db) {
@@ -889,7 +892,7 @@ export class Polynom implements IPiMathObject<Polynom>,
889
892
  ]
890
893
 
891
894
  testingRoots.forEach((test, index) => {
892
- const sign = this.evaluate({[this.variables[0] ?? 'x']: test}, true) as number
895
+ const sign = this.evaluate({[this.variables[0] ?? 'x']: test}, true)
893
896
  signs[index * 2] = sign > 0 ? '+' : '-'
894
897
  })
895
898
  }
@@ -1128,8 +1131,8 @@ export class Polynom implements IPiMathObject<Polynom>,
1128
1131
 
1129
1132
  case ShutingyardType.OPERATION:
1130
1133
  if (stack.length >= 2) {
1131
- const b = stack.pop(),
1132
- a = stack.pop()
1134
+ const b = stack.pop()
1135
+ const a = stack.pop()
1133
1136
 
1134
1137
  // Check if the polynoms are not undefined.
1135
1138
  if (a === undefined || b === undefined) {
@@ -1,7 +1,7 @@
1
- import type { randomMonomConfig } from "../rndTypes"
2
- import { Monom } from "../../algebra/monom"
3
- import { rndFraction } from "../coefficient/rndFraction"
4
- import { randomItem } from "../rndHelpers"
1
+ import type {randomMonomConfig} from "../rndTypes"
2
+ import {Monom} from "../../algebra/monom"
3
+ import {rndFraction} from "../coefficient/rndFraction"
4
+ import {randomItem} from "../rndHelpers"
5
5
 
6
6
  export function rndMonom(userConfig?: randomMonomConfig): Monom {
7
7
  const config = Object.assign(
@@ -9,18 +9,24 @@ export function rndMonom(userConfig?: randomMonomConfig): Monom {
9
9
  letters: 'x',
10
10
  degree: 2,
11
11
  fraction: true,
12
- zero: false
12
+ zero: false,
13
13
  }, userConfig)
14
14
 
15
15
  // Create a monom instance
16
16
  const M = new Monom()
17
17
 
18
18
  // Generate the coefficient
19
- M.coefficient = rndFraction({
20
- zero: config.zero,
21
- reduced: true,
22
- natural: !config.fraction
23
- })
19
+ M.coefficient = rndFraction(
20
+ Object.assign(
21
+ {},
22
+ {
23
+ zero: config.zero,
24
+ reduced: true,
25
+ natural: config.fraction===false,
26
+ },
27
+ typeof config.fraction === "boolean" ? {} : config.fraction
28
+ )
29
+ )
24
30
 
25
31
  if (config.letters.length > 1) {
26
32
  // Initialise each items...
@@ -1,7 +1,7 @@
1
- import { Circle } from "../../geometry/circle"
2
- import { randomInt } from "../rndHelpers"
3
- import type { randomGeometryCircleConfig } from "../rndTypes"
4
- import { rndVector } from "./rndVector"
1
+ import {Circle} from "../../geometry/circle"
2
+ import {randomInt} from "../rndHelpers"
3
+ import type {randomGeometryCircleConfig} from "../rndTypes"
4
+ import {rndPoint} from "./rndPoint"
5
5
 
6
6
  export function rndCircle(userConfig?: randomGeometryCircleConfig): Circle {
7
7
  const config = Object.assign(
@@ -13,7 +13,7 @@ export function rndCircle(userConfig?: randomGeometryCircleConfig): Circle {
13
13
  pointsOnCircle: 8
14
14
  }, userConfig)
15
15
 
16
- const center = rndVector(config.center)
16
+ const center = rndPoint(config.center)
17
17
 
18
18
  let rv, r
19
19
  if (config.pointsOnCircle === 8) {
@@ -1,10 +1,10 @@
1
- import { Fraction } from "../../coefficients/fraction"
2
- import type { randomGeometryPointConfig } from "../rndTypes"
3
- import { rndFraction } from "../coefficient/rndFraction"
4
- import { randomIntSym } from "../rndHelpers"
5
- import { Point } from "../../geometry/point"
1
+ import {Fraction} from "../../coefficients/fraction"
2
+ import type {randomGeometryPointConfig} from "../rndTypes"
3
+ import {rndFraction} from "../coefficient/rndFraction"
4
+ import {randomIntSym} from "../rndHelpers"
5
+ import {Point} from "../../geometry/point"
6
6
 
7
- export function rndVector(userConfig?: randomGeometryPointConfig): Point {
7
+ export function rndPoint(userConfig?: randomGeometryPointConfig): Point {
8
8
  const config: {
9
9
  axis: 'x' | 'y' | 'z' | null,
10
10
  fraction: boolean,
@@ -26,8 +26,8 @@ import {rndEquation} from "./algebra/rndEquation"
26
26
  import {rndCircle} from "./geometry/rndCircle"
27
27
  import {rndLine} from "./geometry/rndLine"
28
28
  import {rndLine3} from "./geometry/rndLine3"
29
- import {rndVector} from "./geometry/rndVector"
30
- import {Point} from "../geometry"
29
+ import {rndPoint} from "./geometry/rndPoint"
30
+ import {Vector} from "../geometry"
31
31
 
32
32
  export type * from "./rndTypes"
33
33
 
@@ -89,11 +89,11 @@ export const Random = {
89
89
  },
90
90
 
91
91
  vector: (config?: randomGeometryPointConfig) => {
92
- return rndVector(config)
92
+ return new Vector(rndPoint(config))
93
93
  },
94
94
 
95
95
  point: (config?: randomGeometryPointConfig) => {
96
- return new Point(rndVector(config))
96
+ return rndPoint(config)
97
97
  },
98
98
 
99
99
  circle: (config?: randomGeometryCircleConfig) => {
@@ -1,7 +1,7 @@
1
- import { EQUATION_SIGN, IAlgebra, IEquation, InputAlgebra, InputValue, IPiMathObject, literalType } from '../pimath.interface';
2
- import { Fraction } from '../coefficients/fraction';
3
- import { Polynom } from './polynom';
4
- import { Solution } from '../analyze/solution';
1
+ import type { EQUATION_SIGN, IAlgebra, IEquation, InputAlgebra, InputValue, IPiMathObject, literalType } from "../pimath.interface";
2
+ import { Fraction } from "../coefficients";
3
+ import { Polynom } from "./polynom";
4
+ import type { Solution } from "../analyze";
5
5
  export declare class Equation implements IPiMathObject<Equation>, IEquation<Equation>, IAlgebra<Equation> {
6
6
  #private;
7
7
  constructor(equation: InputAlgebra<Polynom> | Equation);
@@ -12,71 +12,21 @@ export declare class Equation implements IPiMathObject<Equation>, IEquation<Equa
12
12
  get display(): string;
13
13
  static isEquationString(equationString: string): boolean;
14
14
  static makeSolutionsUnique(solutions: Solution[], sorted?: boolean): Solution[];
15
- /**
16
- * Add a value to the equation
17
- * if value is an equation, add the left part to the left part of the equation
18
- * and the right part to the right part of the equation
19
- * if value is a string, try to create an equation
20
- * if it fails, create a polynom and add it to the left and right part of the equation
21
- * @param value | Polynom | Monom | Fraction | string | monom
22
- */
23
15
  add(value: InputValue<Equation | Polynom>): this;
24
16
  create: (left: Polynom, right: Polynom, sign?: string) => this;
25
- /**
26
- * Get the degree of the equation
27
- * @param letter
28
- */
29
17
  degree: (letter?: string) => Fraction;
30
- /**
31
- * divide an equation by a given value (transformed as a fraction)
32
- *
33
- * ```
34
- * 8x+10=6x \vert 2
35
- * 4x+5=3x
36
- * ```
37
- *
38
- * |>Alternatively with $3x-4$ maybe it's working ?
39
- * $$\frac{3x}{5}$$
40
- *
41
- * @param value
42
- * @returns {Equation}
43
- */
44
18
  divide: (value: InputValue<Fraction>) => this;
45
- /**
46
- * Create an Equation using two polynoms.
47
- * Markdown *support* is cool
48
- * @param values
49
- * @param asNumeric
50
- */
51
- evaluate(values: InputValue<Fraction> | literalType<number | Fraction>, asNumeric?: boolean): boolean;
52
- /**
53
- * Determine if the equation contains a variable.
54
- * @param letter
55
- */
19
+ evaluate(values: InputValue<Fraction> | literalType<number | Fraction>, asNumeric: boolean): boolean;
56
20
  hasVariable: (letter: string) => boolean;
57
21
  isEqual(value: InputValue<Equation>): boolean;
58
22
  isEqualTo: (equ: Equation) => boolean;
59
23
  isLinearTo: (equ: Equation) => boolean;
60
- /**
61
- * Determine if the equation contains more than one letter/variable.
62
- */
63
24
  isMultiVariable: () => boolean;
64
- /**
65
- * Reorder the polynom to have only one letter on the left, the rest on the right.
66
- * @param letter
67
- */
68
25
  isolate: (letter?: string) => this | false;
69
26
  get left(): Polynom;
70
27
  set left(value: Polynom);
71
28
  letters: () => string[];
72
- /**
73
- * Reorder will move all monoms containing a letter on the left, all the other on the right.
74
- */
75
29
  moveLeft: () => this;
76
- /**
77
- * Multiple an equation by a fraction value.
78
- * @param value
79
- */
80
30
  multiply: (value: InputValue<Fraction>) => this;
81
31
  get numberOfVars(): number;
82
32
  opposite: () => this;
@@ -89,9 +39,6 @@ export declare class Equation implements IPiMathObject<Equation>, IEquation<Equa
89
39
  get sign(): string;
90
40
  set sign(value: string);
91
41
  get signAsTex(): string;
92
- /**
93
- * Multiply by the lcm denominator and divide by the gcm numerators.
94
- */
95
42
  simplify: () => this;
96
43
  solve: () => Solution[];
97
44
  split(): [Polynom, Polynom];
@@ -99,3 +46,4 @@ export declare class Equation implements IPiMathObject<Equation>, IEquation<Equa
99
46
  test: (values: literalType<Fraction>) => boolean;
100
47
  get variables(): string[];
101
48
  }
49
+ //# sourceMappingURL=equation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"equation.d.ts","sourceRoot":"","sources":["../../src/algebra/equation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,aAAa,EACb,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,UAAU,EACV,aAAa,EACb,WAAW,EACd,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAC,QAAQ,EAAC,MAAM,0BAA0B,CAAA;AAIjD,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAA;AACjC,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,qBAAqB,CAAA;AAEjD,qBAAa,QAAS,YAClB,aAAa,CAAC,QAAQ,CAAC,EACvB,SAAS,CAAC,QAAQ,CAAC,EACnB,QAAQ,CAAC,QAAQ,CAAC;;gBAUN,QAAQ,EAAE,YAAY,CAAC,OAAO,CAAC,GAAG,QAAQ;gBAC1C,IAAI,EAAE,YAAY,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,EAAE,aAAa;IA8BpF,KAAK,GAAI,gBAAgB,MAAM,KAAG,IAAI,CAY5C;IAEM,KAAK,QAAO,QAAQ,CAE1B;IAED,IAAW,GAAG,IAAI,MAAM,CAEvB;IAED,IAAW,OAAO,IAAI,MAAM,CAE3B;WAEa,gBAAgB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO;WAWjD,mBAAmB,CAAC,SAAS,EAAE,QAAQ,EAAE,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,QAAQ,EAAE;IA0B/E,GAAG,CAAC,KAAK,EAAE,UAAU,CAAC,QAAQ,GAAG,OAAO,CAAC,GAAG,IAAI;IAwBhD,MAAM,GAAI,MAAM,OAAO,EAAE,OAAO,OAAO,EAAE,OAAO,MAAM,KAAG,IAAI,CAKnE;IAMM,MAAM,GAAI,SAAS,MAAM,K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MAAM,EAAE,GAAG,OAAO,KAAG,IAAI,CAIpD;IAED,IAAW,KAAK,IAAI,OAAO,CAE1B;IAED,IAAW,KAAK,CAAC,KAAK,EAAE,OAAO,EAE9B;IAGD,IAAW,IAAI,IAAI,MAAM,CAExB;IAED,IAAW,IAAI,CAAC,KAAK,EAAE,MAAM,EAG5B;IAED,IAAW,SAAS,IAAI,MAAM,CAU7B;IAKM,QAAQ,QAAO,IAAI,CAIzB;IAGM,KAAK,QAAO,QAAQ,EAAE,CAG5B;IAEM,KAAK,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC;IAI3B,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC,QAAQ,GAAG,OAAO,CAAC,GAAG,IAAI;IAoBrD,IAAI,GAAI,QAAQ,WAAW,CAAC,QAAQ,CAAC,KAAG,OAAO,CAErD;IAED,IAAW,SAAS,IAAI,MAAM,EAAE,CAE/B;CAsEJ"}
@@ -1,6 +1,6 @@
1
- import { Polynom } from './polynom';
2
- import { Equation } from './equation';
3
- import { Solution } from '../analyze';
1
+ import type { Polynom } from "./polynom";
2
+ import type { Equation } from "./equation";
3
+ import { Solution } from "../analyze";
4
4
  export declare class EquationSolver {
5
5
  #private;
6
6
  _: number;
@@ -11,3 +11,4 @@ export declare class EquationSolver {
11
11
  solve(): Solution[];
12
12
  solveAsCardan(): Solution[];
13
13
  }
14
+ //# sourceMappingURL=equationSolver.d.ts.map
@@ -1,6 +1,6 @@
1
- import { IAlgebra, IExpression, InputAlgebra, InputValue, IPiMathObject, literalType, TABLE_OF_SIGNS } from '../pimath.interface';
2
- import { Fraction } from '../coefficients/fraction';
3
- import { Polynom } from './polynom';
1
+ import type { IAlgebra, IExpression, InputAlgebra, InputValue, IPiMathObject, literalType, TABLE_OF_SIGNS } from "../pimath.interface";
2
+ import { Fraction } from "../coefficients/fraction";
3
+ import { Polynom } from "./polynom";
4
4
  export declare class Factor implements IPiMathObject<Factor>, IExpression<Factor>, IAlgebra<Factor> {
5
5
  #private;
6
6
  constructor(value?: InputAlgebra<Polynom> | Factor, power?: InputValue<Fraction>);
@@ -47,3 +47,4 @@ export declare enum FACTOR_DISPLAY {
47
47
  ROOT = 0,
48
48
  POWER = 1
49
49
  }
50
+ //# sourceMappingURL=factor.d.ts.map
@@ -7,3 +7,4 @@ export * from './monom';
7
7
  export * from './polyFactor';
8
8
  export * from './polynom';
9
9
  export * from './matrix';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -1,8 +1,8 @@
1
- import { IAlgebra, IEquation, InputValue, IPiMathObject, literalType } from '../pimath.interface';
2
- import { Fraction } from '../coefficients';
3
- import { Equation } from './equation';
4
- import { Polynom } from './polynom';
5
- import { Solution } from '../analyze';
1
+ import type { IAlgebra, IEquation, InputValue, IPiMathObject, literalType } from "../pimath.interface";
2
+ import { Fraction } from "../coefficients";
3
+ import { Equation } from "./equation";
4
+ import { Polynom } from "./polynom";
5
+ import { Solution } from "../analyze";
6
6
  export declare class LinearSystem implements IPiMathObject<LinearSystem>, IEquation<LinearSystem>, IAlgebra<LinearSystem> {
7
7
  #private;
8
8
  constructor(...values: (string | Equation)[]);
@@ -48,3 +48,4 @@ export declare class LinearSystem implements IPiMathObject<LinearSystem>, IEquat
48
48
  get variables(): string[];
49
49
  set variables(value: string | string[]);
50
50
  }
51
+ //# sourceMappingURL=linearSystem.d.ts.map
@@ -1,12 +1,5 @@
1
- /**
2
- * Polynom class can handle polynoms, reorder, resolve, ...
3
- */
4
1
  export declare class LogicalSet {
5
2
  #private;
6
- /**
7
- *
8
- * @param {string} value (optional) Default polynom to parse on class creation
9
- */
10
3
  constructor(value?: string);
11
4
  parse: (value: string) => this;
12
5
  get tex(): string;
@@ -19,3 +12,4 @@ export declare class LogicalSet {
19
12
  vennAB(): string[];
20
13
  vennABC(): string[];
21
14
  }
15
+ //# sourceMappingURL=logicalset.d.ts.map