PiMath API
    Preparing search index...

    Interface IMatrixElement<T>

    Base contract of every PiMath value object: a displayable, duplicable mathematical entity.

    Note: construction (parse / from***) is intentionally NOT part of this contract — input shapes are class-specific and handled per class, not polymorphically. See .claude/specs/pimath-architecture.md.

    interface IMatrixElement<T> {
        display: string;
        tex: string;
        value: number | undefined;
        add(value: InputValue<T>): T;
        clone(): T;
        copy(value: T): T;
        divide(value: InputValue<T>): T;
        isEqual(value: InputValue<T>): boolean;
        isOne(): boolean;
        isZero(): boolean;
        multiply(value: InputValue<T>): T;
        one(): T;
        opposite(): T;
        pow(value: number): T;
        reduce(): T;
        subtract(value: InputValue<T>): T;
        withDigits(digits: number | null): this;
        zero(): T;
    }

    Type Parameters

    • T

    Hierarchy (View Summary)

    Index
    display: string

    ASCIIMath rendering of the current state (terminal output, not chainable).

    tex: string

    LaTeX rendering of the current state (terminal output, not chainable).

    value: number | undefined
    • Copy the mathematical state of another instance into this (display state is NOT transferred — the receiver keeps its own formatting). Entry point used when constructing/parsing from a same-type input. Distinct from clone. Classes without a real implementation throw NotImplementedError.

      Parameters

      • value: T

      Returns T

    • Show every numeric value as a decimal with digits digits after the point (exact values included: 3/2 becomes 1.50 with 2 digits).

      Parameters

      • digits: number | null

        integer from 0 to 100, or null to go back to the default display (exact fractions, approximate values with 3 digits).

      Returns this

      if digits is neither null nor an integer from 0 to 100.