Skip to content

The reduced row echelon form of a symbolic matrix is NaN, and the rank of [[a, b], [2a, 2b]] is 2 #2345

Closed

Description

@Rafael-SOWNet

The row echelon forms divide by a pivot without first checking whether it is identically zero. In a symbolic matrix the pivot can be an expression like c + -c / a * a, which is 0 but is not recognised as 0. On master (d41933e):

Answered Should be
[[a, b], [c, d]].ReducedRowEchelonForm, simplified NaN [[1, 0], [0, 1]], where a d - b c ≠ 0
[[1, b], [c, d]].ReducedRowEchelonForm, simplified NaN [[1, 0], [0, 1]], where d - b c ≠ 0
[[a, b], [2a, 2b]].ReducedRowEchelonForm, simplified NaN [[1, b / a], [0, 0]], where a ≠ 0
[[a, b], [2a, 2b]].Rank 2 1 (0 where a = b = 0)

The last row is a wrong answer: the second row is twice the first. Rank counts the rows of the reduced form whose leading element is not null. That form is not simplified, and its second row leads with 2 * a + -2 * a / a * a, which is not null.

The elimination itself shows it. [[a, b], [c, d]].RowEchelonForm is [[a, b], [c + -c / a * a, d + -c / a * b]]. The reduced form goes on to divide by c + -c / a * a. Matrices of numbers are right, since #2279 made the elimination divide exactly. This is the symbolic sibling of #2270.

What it should do.

  • Simplify each candidate pivot before choosing it, and pass over one that simplifies to 0. That alone gives the rank of 1 above.
  • A pivot like a or a d - b c can be 0 for some values, so the form holds only where it is not. That is either a condition to carry, as provided, or the place to decline. NaN is neither.

Found while building browser demos of the library (a matrix view).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions