[sage-support] Re: Entering matrices whose elements are functions of row/column indices?

2010-03-17 Thread Alec Mihailovs
On Mar 16, 10:47 pm, Alec Mihailovs alec.mihail...@gmail.com wrote: By the way, vector doesn't work with integer numpy arrays, from numpy import array vector(array([1,2])) Traceback (most recent call last): That shouldn't be too hard to implement - in particular, the following works, sage:

Re: [sage-support] Re: Entering matrices whose elements are functions of row/column indices?

2010-03-16 Thread Mike Hansen
On Mon, Mar 15, 2010 at 10:16 PM, Jason Grout jason-s...@creativetrax.com wrote: Whoever takes care of this original issue gets to claim a 3-digit ticket! http://trac.sagemath.org/sage_trac/ticket/261 Patch up for review. --Mike -- To post to this group, send email to

[sage-support] Re: Entering matrices whose elements are functions of row/column indices?

2010-03-16 Thread Alec Mihailovs
On Mar 16, 2:32 am, Mike Hansen mhan...@gmail.com wrote: On Mon, Mar 15, 2010 at 10:16 PM, Jason Grout jason-s...@creativetrax.com wrote: Whoever takes care of this original issue gets to claim a 3-digit ticket! http://trac.sagemath.org/sage_trac/ticket/261 Patch up for review. --Mike

Re: [sage-support] Re: Entering matrices whose elements are functions of row/column indices?

2010-03-16 Thread Mike Hansen
On Tue, Mar 16, 2010 at 12:38 PM, Alec Mihailovs alec.mihail...@gmail.com wrote: Will it work as matrix(5,f) as well, or only as matrix(5,5,f) ? It now works with both. --Mike -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to

[sage-support] Re: Entering matrices whose elements are functions of row/column indices?

2010-03-16 Thread Alec Mihailovs
On Mar 16, 3:57 pm, Mike Hansen mhan...@gmail.com wrote: On Tue, Mar 16, 2010 at 12:38 PM, Alec Mihailovs alec.mihail...@gmail.com wrote: Will it work as matrix(5,f) as well, or only as matrix(5,5,f) ? It now works with both. --Mike That's great! What about vector(3,f), f.vector(3), and

Re: [sage-support] Re: Entering matrices whose elements are functions of row/column indices?

2010-03-16 Thread Mike Hansen
On Tue, Mar 16, 2010 at 1:06 PM, Alec Mihailovs alec.mihail...@gmail.com wrote: What about vector(3,f), f.vector(3), and f.matrix(3,4) or f.matrix(5) ? I didn't do anything about vector() -- I could probably get to it later. There's no good way to make a syntax like f.matrix() or f.vector()

[sage-support] Re: Entering matrices whose elements are functions of row/column indices?

2010-03-16 Thread Alec Mihailovs
By the way, vector doesn't work with integer numpy arrays, from numpy import array vector(array([1,2])) Traceback (most recent call last): File stdin, line 1, in module File _sage_input_60.py, line 5, in module vector(array([_sage_const_1 ,_sage_const_2 ])) File , line 1, in module

[sage-support] Re: Entering matrices whose elements are functions of row/column indices?

2010-03-15 Thread Alec Mihailovs
On Mar 15, 3:39 am, Alec Mihailovs alec.mihail...@gmail.com wrote: The second problem is that something strange happens for 1x1 matrices, with any dtype, matrix(fromfunction(lambda i,j:i-j,(1,1),dtype=int)) [] matrix(fromfunction(lambda i,j:i-j+3,(1,1),dtype=int)) [0 0 0] [0 0 0] [0 0

Re: [sage-support] Re: Entering matrices whose elements are functions of row/column indices?

2010-03-15 Thread Eckhard Kosin
Am Montag, den 15.03.2010, 00:48 -0700 schrieb Alec Mihailovs: On Mar 15, 3:39 am, Alec Mihailovs alec.mihail...@gmail.com wrote: The second problem is that something strange happens for 1x1 matrices, with any dtype, matrix(fromfunction(lambda i,j:i-j,(1,1),dtype=int)) []

Re: [sage-support] Re: Entering matrices whose elements are functions of row/column indices?

2010-03-15 Thread Mike Hansen
On Mon, Mar 15, 2010 at 10:32 AM, Eckhard Kosin e...@mathematik-service-kosin.de wrote: sage: fromfunction(lambda i,j:i-j+3,(1,1),dtype=int) --- NameError                                 Traceback (most recent call last)

[sage-support] Re: Entering matrices whose elements are functions of row/column indices?

2010-03-14 Thread Alec Mihailovs
That could be also done as from numpy import fromfunction matrix(fromfunction(lambda i,j:i-j, (6,6), dtype=int)) [ 0 -1 -2 -3 -4 -5] [ 1 0 -1 -2 -3 -4] [ 2 1 0 -1 -2 -3] [ 3 2 1 0 -1 -2] [ 4 3 2 1 0 -1] [ 5 4 3 2 1 0] _.parent() Full MatrixSpace of 6 by 6 dense matrices over