NaN adds a lot of whitespace in the representation of a matrix. Without NaN: matrix([[1, 2], [3, 4]]) With NaN: matrix([[ nan, 2. ], [ 3. , 4. ]]) There's enough room for the wikipedia entry for nan.