The eigen routine uses numpy. If you do
p,e=m.eigen()

then p is an array of eigenvalues and e is a matrix whose columns are
eigenvectors.
The documentation works fine in my local install not sure why it fails
on sage.math



 
Josh

On Aug 3, 2:43 pm, Robert Bradshaw <[EMAIL PROTECTED]>
wrote:
> Linear algebra over RR is generic and, in many cases, really bad so
> far. Use RDF or even scipy unless you really need arbitrary
> precision. (If the RDF interface is inconsistent, fix it and send a
> patch :-)
>
> - Robert
>
> On Aug 1, 2007, at 6:28 AM, Robert Miller wrote:
>
>
>
> > Hi everyone,
>
> > I have a symmetric square matrix of real numbers, and I wish to
> > compute the (necessarily) real eigenvalues of this matrix.
>
> > sage: version()
> > 'SAGE Version 2.7.2, Release Date: 2007-07-28'
>
> > sage: M = random_matrix(RDF, 4, 4)
> > sage: M += M.transpose()
>
> > Now M is such a matrix. My first instinct was to try 'eigenspaces':
>
> > sage: M.eigenspaces()
> > Exception (click to the left for traceback):
> > ...
> > NotImplementedError
>
> > So I then tried using RR instead of RDF, and often I was getting
> > variables in the eigenvalues. The example is no longer symmetric, and
> > I suspect this might be why:
>
> > sage: M = random_matrix(RR, 4, 4)
> > sage: M.eigenspaces()
> > [
> > (-0.687210648633541, []),
> > (0.251596873005605, []),
> > (1.00000000000000*a2, [])
> > ]
>
> > Wouldn't it be better to return the complex eigenvalues?
>
> > When I went back to RDF, I was surprised by the function eigen, which
> > seems to be doing exactly what I want:
>
> > sage: M = random_matrix(RDF, 4, 4)
> > sage: M += M.transpose()
> > sage: M.eigen()
> > ([2.83698656526, 1.12513535857, -1.92195925813, -0.781971696103],
> > [  -0.685785481323    0.676886167426   -0.249484727275
> > -0.0963367054158]
> > [   0.171856298084 -0.00520796932156   -0.108449572475
> > -0.97912051357]
> > [   0.704671991219    0.683316875186   -0.135215217363
> > 0.135026952387]
> > [  0.0600089260487   -0.273634868922   -0.952739684321
> > 0.117515876478])
>
> > However, the output is a little confusing-- I'm guessing either the
> > columns or rows of the matrix are the eigenvectors. So I check the
> > documentation (this is on sagenb.org):
>
> > sage: M.eigen?
> > Traceback (most recent call last):
> >   File "<stdin>", line 1, in <module>
> >   File "/home/server2/nb1/sage_notebook/worksheets/rlmill/0/code/
> > 50.py", line 4, in <module>
> >     print _support_.docstring("M.eigen", globals())
> >   File "/usr/local/sage-2.6/local/lib/python2.5/site-packages/sage/
> > server/support.py", line 142, in docstring
> >     s += 'Definition:  %s\n'%sageinspect.sage_getdef(obj, obj_name)
> >   File "/usr/local/sage-2.6/local/lib/python2.5/site-packages/sage/
> > misc/sageinspect.py", line 267, in sage_getdef
> >     spec = sage_getargspec(obj)
> >   File "/usr/local/sage-2.6/local/lib/python2.5/site-packages/sage/
> > misc/sageinspect.py", line 252, in sage_getargspec
> >     args, varargs, varkw = inspect.getargs(func_obj.func_code)
> > UnboundLocalError: local variable 'func_obj' referenced before
> > assignment
>
> > I have absolutely no idea what to make of this.
>
> > -R Miller


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to