On Mar 14, 2011, at 22:08 , John H Palmieri wrote:
> 
> On Monday, March 14, 2011 9:02:48 PM UTC-7, Justin C. Walker wrote:
>> 
>> Hi, and Welcome,
>> 
>> On Mar 14, 2011, at 20:14 , Ben123 wrote:
>> 
>>> Hello. I'm a new user to Sage. I am trying to create a matrix without
>>> knowing the values when it is initialized. All the examples I see have
>>> static matrices like
>>> A = matrix(QQ,2,2,[2,1,1,2])
>>> My goal is to create a 2x2 matrix which I can then give values for
>>> later
>>> A[1][1]=5
>> 
>> That is correct, although I am at a loss to explain why that's how it is.
>> 
>> With your matrix, 
>> sage: A[1]
>> (1, 2)
>> 
>> so clearly, the rows are "tuples", which are immutable.
>> 
> 
> sage: A[1]
> (1, 2)
> sage: type(A[1])
> <type 'sage.modules.vector_rational_dense.Vector_rational_dense'>
> sage: A[1].is_immutable()
> True
> 
> So A[1] is a row vector, and those are immutable.  Trying to set A[1][1] is 
> trying to modify an entry of this vector.

The question is why are matrix rows implemented as immutable objects, not how 
they are implemented.  It seems strange to me to be able to change the 
individual matrix coefficients as matrix coefficients, but not as elements of a 
row of a matrix...

>> When LuteFisk is outlawed,
>> Only outlaws will have LuteFisk
>> 
> Would this be bad?

My god...the humanity...

Justin

--
Justin C. Walker, Curmudgeon at Large
Institute for the Absorption of Federal Funds
-----------
I'm beginning to like the cut of his jibberish.
-----------



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

Reply via email to