AttributeError: object has no attribute 'eigenvalues'

249 views
Skip to first unread message

q

unread,
Nov 4, 2009, 4:30:21 PM11/4/09
to sage-support
I was trying to find the eigenvalues of a matrix.
I tried the example from the tutorial (http://www.sagemath.org/doc/
tutorial/tour_linalg.html):

sage: A = matrix([[0, 4], [-1, 0]])
sage: A.eigenvalues ()

And I got this error:

"AttributeError: 'sage.matrix.matrix_integer_dense.Matrix_integer_de'
object has no attribute 'eigenvalues'"

Can someone please explain this to me?

I'm using Ubuntu 9.04, sage version 3.0.5 which I installed from the
synaptic package manager.

Thanks,

Michael Welsh

unread,
Nov 4, 2009, 4:35:07 PM11/4/09
to sage-s...@googlegroups.com

On 5/11/2009, at 10:30 AM, q wrote:

> Can someone please explain this to me?

Works fine for me -


sage: A = matrix([[0, 4], [-1, 0]])
sage: A

[ 0 4]
[-1 0]
sage: A.eigenvalues
<built-in method eigenvalues of
sage.matrix.matrix_integer_dense.Matrix_integer_dense object at
0x100408f80>
sage: A.eigenvalues()
[-2*I, 2*I]

>
> I'm using Ubuntu 9.04, sage version 3.0.5 which I installed from the
> synaptic package manager.

Upgrade. It might not be your problem, but 3.0.5 is ancient...
--
http://yomcat.geek.nz

Dan Drake

unread,
Nov 4, 2009, 6:15:11 PM11/4/09
to sage-s...@googlegroups.com
On Wed, 04 Nov 2009 at 01:30PM -0800, q wrote:
> sage: A = matrix([[0, 4], [-1, 0]])
> sage: A.eigenvalues ()

There's a space between "eigenvalues" and "()". Python (and hence Sage)
gets confused by that. Use A.eigenvalues() with no spaces.

Dan

--
--- Dan Drake
----- http://mathsci.kaist.ac.kr/~drake
-------

signature.asc

Simon King

unread,
Nov 4, 2009, 7:07:35 PM11/4/09
to sage-support
Hi Dan!

On 5 Nov., 00:15, Dan Drake <dr...@kaist.edu> wrote:
...
> There's a space between "eigenvalues" and "()". Python (and hence Sage)
> gets confused by that. Use A.eigenvalues() with no spaces.

No, that's not true. On sage.math, it works with the additional space.
sage: A = matrix([[0, 4], [-1, 0]])
sage: A.eigenvalues ()
[-2*I, 2*I]

So, probably it is really just the vintage sage 3.0.5

Cheers,
Simon

Jason Grout

unread,
Nov 4, 2009, 8:27:41 PM11/4/09
to sage-s...@googlegroups.com


Yep. I believe this is the relevant patch, showing it went in in 3.1.2:

http://trac.sagemath.org/sage_trac/ticket/3794

Jason

--
Jason Grout

Dan Drake

unread,
Nov 4, 2009, 8:40:06 PM11/4/09
to sage-s...@googlegroups.com

Wow, you're right. I suppose it is a problem with 3.0.5. Are there any
plans to update the Debian package?

signature.asc

Jason Grout

unread,
Nov 4, 2009, 9:16:24 PM11/4/09
to sage-s...@googlegroups.com
Dan Drake wrote:
> On Wed, 04 Nov 2009 at 04:07PM -0800, Simon King wrote:
>> Hi Dan!
>>
>> On 5 Nov., 00:15, Dan Drake <dr...@kaist.edu> wrote:
>> ...
>>> There's a space between "eigenvalues" and "()". Python (and hence Sage)
>>> gets confused by that. Use A.eigenvalues() with no spaces.
>> No, that's not true. On sage.math, it works with the additional space.
>> sage: A = matrix([[0, 4], [-1, 0]])
>> sage: A.eigenvalues ()
>> [-2*I, 2*I]
>>
>> So, probably it is really just the vintage sage 3.0.5
>
> Wow, you're right. I suppose it is a problem with 3.0.5. Are there any
> plans to update the Debian package?

Yes, sort of. See the thread on a PPA package for Sage on sage-devel.

Jason

--
Jason Grout

q

unread,
Nov 5, 2009, 10:19:12 PM11/5/09
to sage-support
Thanks for the replies everyone.

I tried it, and as someone mentioned, the space between eigenvalues
and () doesn't make a difference.

So I tried updating. I installed the binary distribution, but got the
"Illegal instruction" error at startup. So I tried the

rm spkg/installed/mpir* spkg/installed/atlas*
make

as given in the FAQ, but it still didn't work- I still got the
"illegal instruction". So I tried installing from source. I got the
"illegal instruction" error again, tried

rm spkg/installed/mpir* spkg/installed/atlas*
make

and again got "illegal instruction."

So then I thought, I'll just reinstall the 3.05 from Ubuntu's package
manager and install the patch. I deleted (well, I think) all of the
new sage stuff I installed, and reinstalled 3.05. But now when I type
"sage" into the terminal I get "/usr/local/bin/sage: No such file or
directory".

I have no idea where to go from here.

I'm using an 8 year old HP with a Pentium 4 CPU, it's 32 bit i686 with
Ubuntu 9.04.

I'm just going to give up, because doing all this took me many hours,
and I had to learn/try a lot of stuff about working with the command
line that I've never done before. The installation directions are
confusing to someone who doesn't know very much about computers. I
mean, I got Linux installed on my own, but I probably represent the
lower bound in computer knowledge of Linux users. I'm getting a new
computer in 4 months, so I'll just try again then.

Thanks for your help though.

Jason Grout

unread,
Nov 5, 2009, 10:31:41 PM11/5/09
to sage-s...@googlegroups.com

Wow, I wish you would have asked for help before going through all of that.

Just download the source of Sage, uncompress it, cd into the directory,
and type "make". Then wait a few hours (probably 3-4, maybe?). Then
you'll have a freshly compiled version.

Right now, there are some people that have expressed interest in making
a Debian/Ubuntu package of the current Sage, so you'd just add a line to
your Software Sources and then install it from the repository. I hope
this happens soon.

Thanks,

Jason

--
Jason Grout

Jason Grout

unread,
Nov 5, 2009, 10:32:53 PM11/5/09
to sage-s...@googlegroups.com
q wrote:
> I'm just going to give up, because doing all this took me many hours,
> and I had to learn/try a lot of stuff about working with the command
> line that I've never done before. The installation directions are
> confusing to someone who doesn't know very much about computers. I
> mean, I got Linux installed on my own, but I probably represent the
> lower bound in computer knowledge of Linux users. I'm getting a new
> computer in 4 months, so I'll just try again then.

Also, of course, feel free to use the free online sage server at
sagenb.org to do things!

Jason

--
Jason Grout

Reply all
Reply to author
Forward
0 new messages