On Fri, Aug 19, 2011 at 3:21 PM, Simon King <simon.k...@uni-jena.de> wrote:
> On 19 Aug., 21:26, Jason Grout <jason-s...@creativetrax.com> wrote:
>> But then what about:
>>
>> [1, 2,
>> 3, 4]
>
> Note the small difference:
> [1,2,
> 3,4]
> is a list in Python. But
> [1,2
> 3,4]
> (if I am not mistaken) is a syntax error in Python, and thus the
> preparser could preprocess it and turn it into a matrix:

IMHO, small difference == bad idea

> The line break replaces the semicolon, hence, the example that you
> give corresponds  to [1,2,;3,4] (which hopefully is a syntax error in
> Matlab), while the second version becomes [1,2;3,4] (which seems to be
> the matlab idea of a matrix).
>
> That said, I think one of the strength of Sage is to use a mainstream
> language. It should not be  weakened too much by syntactical sugar, in
> particular if it lacks precision (by gratuitous assumptions on the
> base ring).
>
> Concerning some matlab users feeling irritated by any deviation from
> matlab syntax: I guess that Sage is not going to be a Matlab clone,
> and thus that kind of users is lost.
>
> Every thinking person must be aware that, to some extent, *the same*
> idea can be expressed in different languages. I hope that every person
> working in numerics would not mind to use a CAS with a decent
> programming language, provided that it offers *the functions* (but not
> necessarily the function names or the syntax) of Matlab.

I don't see this a question of cloning Matlab, rather it's a feature
(concise matrix literals) that we'd like to have too.

> Concerning matrices: Are people working in numerics really
> interactively typing in matrices? Or are they usually just reading
> matrices from files that are created by programs (e.g., based on data
> from an experiment)? If the latter is the case then syntactical sugar
> wouldn't really matter.

Personally, I'd want them for 2x2 matrices.

I would also be in favor of supporting a much more flexible
matrix(str) constructor, where (for example) newlines would be treated
as row breaks and other whitespace between identifiers treated as
column breaks (similar to implicit multiplication) and
leading/trailing []'s are ignored. E.g. could do

sage: matrix("""
[1 2]
[3 4]
""")

- Robert

-- 
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