On Thu, Jan 15, 2009 at 3:12 PM, Jason Grout
<[email protected]> wrote:
>
> c mullan wrote:
>> Hi,
>>
>> Suppose I compute the Jordan Normal Form of a matrix,
>>
>> A.jordan_form()
>>
>> Then in the output I can see that the block sizes are indicated (by
>> subdivide='True'), but I can't extract this information. I would like
>> a list of block sizes, (e.g. [2,2,1,1,1] for a 7x7 matrix).
>>
>> I cannot figure out how to do this, any ideas?
>>
>
>
> sage: a = matrix(ZZ,4,[1, 0, 0, 0, 0, 1, 0, 0, 1, -1, 1, 0, 1, -1, 1, 2])
> sage: b=a.jordan_form()
> sage: b
>
> [2|0 0|0]
> [-+---+-]
> [0|1 1|0]
> [0|0 1|0]
> [-+---+-]
> [0|0 0|1]
> sage: b.subdivisions
> ([0, 1, 3, 4], [0, 1, 3, 4])

I just have to comment:

sage: b.subdivisions = 10
sage: b.subdivisions
10

Notice that you can make the subdivisions nonsense because it can be changed.
Also, of course,
sage: b.subdivisions?
...     The Integer class represents arbitrary precision
        integers.  It derives from the Element class, so
[other useless stuff]

I don't like that at all either.  I wish that subdivisions were a
method with a proper docstring, doctests, etc., and that variable were
hidden.

Then one would do:
   sage: b.subdivisions?
   useful stuff (and also it would be in the reference manual)
and
   sage: b.subdivisions()
   ([0, 1, 3, 4], [0, 1, 3, 4])


One could argue that throughout Sage maybe we should use attributes
for properties and function calls much less. However, there's no
hundreds of thousands of lines of code, and it mostly uses the
"b.subdivisions() style" instead of the "b.subdivisions" style, so for
consistency at this point, I think we should just stick to that.

Thoughts?

 -- William

>
> That will give you the indices of the subdivisions, for any subdivided
> matrix.  You can then calculate the jordan block sizes from that by
> subtracting each pair of numbers.
>
>
>
> Alternatively, maybe there could be something in the jordan form
> function that returns the jordan block sizes for each of the eigenvalues...
>
> Jason
>
>
> >
>



-- 
William Stein
Associate Professor of Mathematics
University of Washington
http://wstein.org

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to