Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a n x n matrix. I would like to

(a) take successively higher powers of the matrix and then multiply by projection vectors until the resulting vectors differ by only a scalar factor.

(b) calculate the dominant eigenvalue of the matrix to compare to (a)

and (c) calculate, using the same tactic as in (a), the dominant right and left eigenvectors.

This is too much work to do by hand, so my question is: can anyone recommend a program/language or package that would be ideal for the above calculations?


share|cite|improve this question
It seems to me that OP wants nothing more than a simple power method implementation, and the answers given thus far do quite a bit more than that... NAPACK has a power method implementation (in FORTRAN of course); translation to other computing environments shouldn't be too hard... – J. M. Apr 25 '12 at 12:07

You should check out a Computer Algebra System (CAS) and pick one that you like the interface for. There are commercial to open sourced - freeware ones and here is a comparison (many of the responses refer to these, but this is a nice list.

For example, Mathematica ($) or Maxima or SAGE (both free).


Enjoy - A

share|cite|improve this answer
$$+\left(\text{multiplicative identity in}\; \mathbb R\right)$$ – amWhy May 18 '13 at 0:50

There are various standardized answers for your question.

The most obvious solution would be to use a computer algebra system, e.g., Mathematica, Matlab or Maple (both commercial), as well as Axiom or Octave (free).

If you prefer to use a certain programming language, there are a number of linear algebra libraries that may help. For C and Fortran, the classic library to use is probably BLAS (basic linear algebra) in conjunction with something like LINPACK for more advanced operations.

share|cite|improve this answer

High Level:

For a high level interface, you may use any commercial or free software including:

  • MATLAB/Octave/SciLab and the many other clones
  • Maple/Mathematica/R
  • NumPy/SciPy

Low Level:

You might want to study LAPACK a little closely.

There are many many libraries which provide support for what you wish to achieve. Including Boost, GSL, Eigen etc.

share|cite|improve this answer
Is it possible to compute steps a-c above in R, if I have a small sparse matrix (6 x 6)? I have tried using the basic functions svd() and qr() to get dominant eigenvalues and decomposition of the matrix, but the results are not ideal (i.e., wrong or not iterated enough to converge on a plausible answer). – eric Apr 25 '12 at 14:48
I haven't tried it myself but I don't see any reason why. Regd. (a), Computing $A^2$ is trivial in R. Calculating dominant eigenvalue is also trivial (using eigen(A)). I'm not as knowledgeable about (c). Also, it is not difficult to "extend" R to behave like MATLAB. Check out this and this. – Inquest Apr 25 '12 at 14:56
I hit the character cap, continuing, have you tried using eigen() function? Also, why not try using Octave or NumPy? I would have preferred Octave since it is high level and you wouldn't have to bother with implementation till I got the underlying math right. – Inquest Apr 25 '12 at 15:03
Using eigen(A) in R gives an odd result, not the one I'm expecting, anyhow, so I'll try my hand at Octave, see what comes out. Thanks again for your help. – eric Apr 25 '12 at 15:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.