PiMath API
    Preparing search index...

    Variable defaultConst

    default: {
        Domain: typeof Domain;
        Equation: typeof Equation;
        Errors: {
            DimensionError: typeof DimensionError;
            IndexError: typeof IndexError;
            InvalidArgumentError: typeof InvalidArgumentError;
            MathError: typeof MathError;
            NotImplementedError: typeof NotImplementedError;
            ParseError: typeof ParseError;
            PiMathError: typeof PiMathError;
            StateError: typeof StateError;
            UnsupportedOperationError: typeof UnsupportedOperationError;
        };
        Factor: typeof Factor;
        Fraction: typeof Fraction;
        Geometry: {
            Circle: typeof Circle;
            Line: typeof Line;
            Line3: typeof Line3;
            Plane3: typeof Plane3;
            Point: typeof Point;
            Sphere3: typeof Sphere3;
            Triangle: typeof Triangle;
            Vector: typeof Vector;
        };
        Interval: typeof Interval;
        LinearSystem: typeof LinearSystem;
        LogicalSet: typeof LogicalSet;
        Matrix: typeof Matrix;
        Monom: typeof Monom;
        Numeric: Readonly<
            {
                decompose: (value: number) => number[][];
                divideNumbersByGCD: (...values: number[]) => number[];
                dividers: (value: number) => number[];
                gcd: (...values: number[]) => number;
                greatestPower: (value: number, index: number) => number;
                lcm: (...values: number[]) => number;
                nthRoot: (value: number, index: number) => number;
                numberCorrection: (value: number, number_of_digits?: number) => number;
                primes: (nb?: number) => number[];
                pythagoreanTripletsWithTarget: (
                    target: number,
                    targetIsSquare?: boolean,
                ) => [number, number, number][];
                round: (value: number, decimals?: number) => number;
            },
        >;
        NumExp: typeof NumExp;
        PolyFactor: typeof PolyFactor;
        PolyMatrix: typeof PolyMatrix;
        Polynom: typeof Polynom;
        Random: {
            array: <T>(arr: T[], number?: number) => T[];
            bool: (percent?: number) => boolean;
            circle: (config?: RandomGeometryCircleConfig) => Circle;
            equation: (config?: RandomEquationConfig) => Equation;
            fraction: (config?: RandomCoefficientConfig) => Fraction;
            item: <T>(arr: T[]) => T;
            line: (config?: RandomGeometryLineConfig) => Line;
            line3: (config?: RandomGeometryLine3Config) => Line3;
            monom: (config?: RandomMonomConfig) => Monom;
            number: (from: number, to: number, exclude?: number[]) => number;
            numberSym: (max: number, allowZero?: boolean) => number;
            point: (config?: RandomGeometryPointConfig) => Point;
            point3: (config?: RandomGeometryPoint3Config) => Point;
            polynom: (config?: RandomPolynomConfig) => Polynom;
            prime: (max?: number) => number;
            shuffle: <T>(arr: T[]) => T[];
            triplet: (
                target: number,
                allowZero?: boolean,
            ) => [number, number, number] | null;
            vector: (config?: RandomGeometryVectorConfig) => Vector;
            vector3: (config?: RandomGeometryVector3Config) => Vector;
        };
        Root: typeof Root;
        Solution: typeof Solution;
        TableOfSigns: typeof TableOfSigns;
    } = ...

    Global PiMath object for non-module contexts (e.g. script tags). Named exports from this module cover the full public API, including types from pimath.interface and the Random / Numeric utilities.

    Type Declaration

    • Domain: typeof Domain
    • Equation: typeof Equation
    • Errors: {
          DimensionError: typeof DimensionError;
          IndexError: typeof IndexError;
          InvalidArgumentError: typeof InvalidArgumentError;
          MathError: typeof MathError;
          NotImplementedError: typeof NotImplementedError;
          ParseError: typeof ParseError;
          PiMathError: typeof PiMathError;
          StateError: typeof StateError;
          UnsupportedOperationError: typeof UnsupportedOperationError;
      }
    • Factor: typeof Factor
    • Fraction: typeof Fraction
    • Geometry: {
          Circle: typeof Circle;
          Line: typeof Line;
          Line3: typeof Line3;
          Plane3: typeof Plane3;
          Point: typeof Point;
          Sphere3: typeof Sphere3;
          Triangle: typeof Triangle;
          Vector: typeof Vector;
      }
    • Interval: typeof Interval
    • LinearSystem: typeof LinearSystem
    • LogicalSet: typeof LogicalSet
    • Matrix: typeof Matrix
    • Monom: typeof Monom
    • Numeric: Readonly<
          {
              decompose: (value: number) => number[][];
              divideNumbersByGCD: (...values: number[]) => number[];
              dividers: (value: number) => number[];
              gcd: (...values: number[]) => number;
              greatestPower: (value: number, index: number) => number;
              lcm: (...values: number[]) => number;
              nthRoot: (value: number, index: number) => number;
              numberCorrection: (value: number, number_of_digits?: number) => number;
              primes: (nb?: number) => number[];
              pythagoreanTripletsWithTarget: (
                  target: number,
                  targetIsSquare?: boolean,
              ) => [number, number, number][];
              round: (value: number, decimals?: number) => number;
          },
      >
    • NumExp: typeof NumExp
    • PolyFactor: typeof PolyFactor
    • PolyMatrix: typeof PolyMatrix
    • Polynom: typeof Polynom
    • Random: {
          array: <T>(arr: T[], number?: number) => T[];
          bool: (percent?: number) => boolean;
          circle: (config?: RandomGeometryCircleConfig) => Circle;
          equation: (config?: RandomEquationConfig) => Equation;
          fraction: (config?: RandomCoefficientConfig) => Fraction;
          item: <T>(arr: T[]) => T;
          line: (config?: RandomGeometryLineConfig) => Line;
          line3: (config?: RandomGeometryLine3Config) => Line3;
          monom: (config?: RandomMonomConfig) => Monom;
          number: (from: number, to: number, exclude?: number[]) => number;
          numberSym: (max: number, allowZero?: boolean) => number;
          point: (config?: RandomGeometryPointConfig) => Point;
          point3: (config?: RandomGeometryPoint3Config) => Point;
          polynom: (config?: RandomPolynomConfig) => Polynom;
          prime: (max?: number) => number;
          shuffle: <T>(arr: T[]) => T[];
          triplet: (
              target: number,
              allowZero?: boolean,
          ) => [number, number, number] | null;
          vector: (config?: RandomGeometryVectorConfig) => Vector;
          vector3: (config?: RandomGeometryVector3Config) => Vector;
      }

      Facade of the random generators and helpers. Each generator takes an optional configuration, described by its Random***Config type and by the rnd*** function it forwards to; the helpers (number, bool, item…) document their arguments below.

      • array: <T>(arr: T[], number?: number) => T[]

        Up to number distinct elements of arr (default 1), in random order; arr is not modified.

      • bool: (percent?: number) => boolean

        true with the probability percent (between 0 and 1, default 0.5).

      • circle: (config?: RandomGeometryCircleConfig) => Circle

        Random circle, from a center and a radius, optionally with integer points on it.

      • equation: (config?: RandomEquationConfig) => Equation

        Random equation or inequality, with controlled solutions (solution.count, nothing, everything).

      • fraction: (config?: RandomCoefficientConfig) => Fraction

        Random fraction or integer, with its sign, range and size under control.

      • item: <T>(arr: T[]) => T

        Random element of arr.

        if arr is empty.

      • line: (config?: RandomGeometryLineConfig) => Line

        Random line of the plane, from a point and a slope, with a chosen kind (vertical, horizontal, positive, negative).

      • line3: (config?: RandomGeometryLine3Config) => Line3

        Random line of space, from a point and a direction, with a chosen kind (general or parallel to a plane or an axis).

      • monom: (config?: RandomMonomConfig) => Monom

        Random term such as 3x² or -½xy.

      • number: (from: number, to: number, exclude?: number[]) => number

        Random integer in [from, to], both bounds included (swapped if from > to), never one of exclude.

        if exclude removes every value of the interval.

      • numberSym: (max: number, allowZero?: boolean) => number

        Random integer in [-max, max]; allowZero: false excludes 0.

      • point: (config?: RandomGeometryPointConfig) => Point

        Random point of the plane, constrained by axis, quadrant and range.

      • point3: (config?: RandomGeometryPoint3Config) => Point

        Random point of space, constrained by axis, plane, octant and range.

      • polynom: (config?: RandomPolynomConfig) => Polynom

        Random polynomial of a given degree, possibly factorable into linear factors.

      • prime: (max?: number) => number

        Random prime strictly lower than max (any prime of the list when max is omitted).

      • shuffle: <T>(arr: T[]) => T[]

        Shuffled copy of arr; arr is not modified.

      • triplet: (target: number, allowZero?: boolean) => [number, number, number] | null

        Random Pythagorean triplet whose hypotenuse is target, or null when there is none. Triplets that contain 0 are left out unless allowZero is true.

      • vector: (config?: RandomGeometryVectorConfig) => Vector

        Random vector of the plane, drawn like a point; the zero vector is excluded by default.

      • vector3: (config?: RandomGeometryVector3Config) => Vector

        Random vector of space, drawn like a point; the zero vector is excluded by default.

    • Root: typeof Root
    • Solution: typeof Solution
    • TableOfSigns: typeof TableOfSigns