On Sat, Aug 20, 2011 at 11:31 AM, Rob Beezer <goo...@beezer.cotse.net> wrote:
> I find the preparser perilous.  It does some great things, such as the
> "F.<a> =" syntax.  But every addition seems to come with a high cost.
> The *.sage/*.py dichotomy is confusing for new folks who want to write
> scripts immediately.  And then there is the whole Integer() quagmire.
>
> On the flip side, I have never bristled at Sage syntax for matrices.
> And I hardly ever type in a matrix anyway, except when doing dumb
> little tests.  If I need a small "classroom example" I use the various
> versions of the random_matrix() constructor repeatedly until I get a
> matrix with the desired properties *and* the desired aesthetics.
>
> What I would really like to have is a routine that prints a matrix in
> a (column-aligned) form that is acceptable input (continuation
> markers, etc) so it can be cut/paste into doctests, worksheets, and
> examples.  (Yes, I know Mathematica's InputForm[].)  Not a hard thing
> to build, just have not reached that far down my list yet.

Since you mention "InputForm[]", I can't help but mention Sage's
analogue of that (written by Carl Witty), which is called
"sage_input":

sage: a = random_matrix(QQ,4)
sage: sage_input(a)
matrix(QQ, [[0, 1, -1, 1/2], [0, -1, -2, 0], [0, 0, 2, 0], [1, 0, -1, 2]])


If I were entering the above matrix by hand, I would likely do:

a = matrix(QQ, 4,
[0, 1, -1, 1/2,
 0, -1, -2, 0,
 0, 0, 2, 0,
 1, 0, -1, 2])

I would gain absolutely nothing at all in this case by using
semicolons at the end of each line.

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to