#14132: documentation for matrix( ) mentions ncols and nrows
--------------------------------------+-------------------------------------
Reporter: ManDay | Owner: mvngu
Type: defect | Status: needs_info
Priority: major | Milestone: sage-5.9
Component: documentation | Resolution:
Keywords: matrix ncols nrows | Work issues:
Report Upstream: N/A | Reviewers:
Authors: | Merged in:
Dependencies: | Stopgaps:
--------------------------------------+-------------------------------------
Changes (by knsam):
* cc: jason (added)
Old description:
> matrix( ncols=...,nrows=... ) does not create a matrix (even a sparse
> one) with the according number of columns and rows, contrary to what's
> described here
>
> http://sagemath.org/doc/reference/sage/matrix/constructor.html
New description:
matrix( ncols=...,nrows=... ) does not create a matrix (even a sparse one)
with the according number of columns and rows, contrary to what's
described here
http://sagemath.org/doc/reference/sage/matrix/constructor.html
------
EDIT.
This ticket brings to the fore, the some anomalies in the matrix
constructor class. This is basically about how we handle edge cases.
Work Issues.
(1) Implementation Issues.
(*) the keywords `nrows` and `ncols` are not working as desired.
(2) Documentation Issues.
(*) ''''Annotated List of Examples''''. Right now, there are a bunch of
examples out there. They are not all^TM^ - not even most of - the possible
ways to use the `matrix` command.
(*) "The ring defaults to ZZ if it is not specified or cannot be
determined from the entries." Clearly not happening:
{{{
sage: matrix(nrows=2, ncols=3)
[]
sage: matrix(2,3)
[0 0 0]
[0 0 0]
sage: matrix(ZZ, nrows=2, ncols=3)
[0 0 0]
[0 0 0]
}}}
(*) "If the numbers of rows and columns are not specified and cannot be
determined, then an empty 0x0 matrix is returned." There are two issues:
{{{
sage: matrix(ZZ, ncols=3)
[]
}}}
As the example illustrates, the "and" should be really an "or". "an empty
matrix" should be the empty matrix.
(*) "The ring, number of rows, and number of columns of the matrix can
be specified by setting the ring, nrows, or ncols parameters or by passing
them as the first arguments to the function in the order ring, nrows,
ncols." All examples are of the kind described after "or". We should add
examples of the first kind. (Doing that would have uncovered the
implementation issues.)
--
Comment:
OK, I explored this a bit: here are my observations.
(1) `nrows`, `ncols` ARE keywords! And, so this is not a bug in the
documentation as far as I can see. But, the documentation needs to
enhanced: although the documentation claims that these parameters can be
set, there is no example illustrating this. IMHO, we should add examples.
Also, the problem is as described in the description.
(2) The bug is very strange!
{{{
sage: matrix(nrows=2, ncols=3)
[]
sage: matrix(2,3)
[0 0 0]
[0 0 0]
sage: matrix(ZZ, nrows=2, ncols=3)
[0 0 0]
[0 0 0]
sage: matrix(ZZ, ncols=3)
[]
}}}
I'll add some examples and lines from the documentation that the examples
contradict! I am tempted to make this "blocker" given that a basic things
such as this is buggy (although these are only edges, we need to have them
documented better).
---------
I am also ccing Jason who completely rewrote this part of sage.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/14132#comment:7>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.