PiMath API
    Preparing search index...

    Class Matrix

    A matrix of Fractions. Built from a string ("((1,2),(3,4))"), an array of rows, or a number of rows and columns (a zero matrix). The operations are those of AbstractMatrix.

    new Matrix([[1, 2], [3, 4]]).determinant().display // "-2"
    

    Hierarchy (View Summary)

    Implements

    Index
    • get asBmatrix(): this

      Delimiter option: square brackets. Chainable, persistent.

      Returns this

    • get asBraceMatrix(): this

      Delimiter option: braces. Chainable, persistent.

      Returns this

    • get asDoubleVmatrix(): this

      Delimiter option: double vertical bars. Chainable, persistent.

      Returns this

    • get asPmatrix(): this

      Delimiter option: round brackets (default). Chainable, persistent.

      Returns this

    • get asVmatrix(): this

      Delimiter option: single vertical bars, as for a determinant. Chainable, persistent.

      Returns this

    • get dimension(): { cols: number; rows: number }

      Number of rows and columns, as {rows, cols}.

      Returns { cols: number; rows: number }

    • get display(): string

      Text output such as ((1,2),(3,4)). The outer brackets follow the delimiter option, and a partition adds a |. This is the format read by parse.

      Returns string

    • get tex(): string

      LaTeX output: a pmatrix environment by default, one row per line. With a partition (withPartition), an array with a vertical bar. An empty matrix gives an empty string.

      Returns string

    • Call callback(value, row, column) for each entry. The entries are the real objects: they can be modified.

      Parameters

      • callback: (aij: Fraction, row: number, column: number) => void

      Returns void

    • Returns true if the augmented matrix [A|b] has a consistent system of equations. A row [0…0 | c≠0] after row reduction signals inconsistency. Always returns true when no partition has been set.

      Returns boolean

    • Raise to a non-negative integer power. The power 0 gives the identity.

      Parameters

      • value: number

      Returns this

      if value is negative or not an integer.

      if the matrix is not square and the power is 2 or more.

    • Sets the column index that separates the coefficient columns from the augmented column(s) in display and tex output. A | separator is inserted before column col. The partition persists until overwritten.

      Parameters

      • col: number

      Returns this

      if col is not strictly between 0 and the column count

    • Build a zero matrix. Without cols, the matrix is square.

      Parameters

      • rows: number
      • Optionalcols: number

      Returns Matrix