-------- Original-Nachricht --------
Datum: Thu, 22 Nov 2007 17:05:09 +0900
Von: [email protected]
An: [email protected]
Betreff: eigenvector discrepency was (Re: [Matrix] eigenvalues, eigenvectors in Ruby ???)
Eigenvectors form an orthogonal basis of a vector space. As a basis
is just a maximal set of linear independent vectors, there
are infinitely many of them … the only condition is that they
span the eigenspace corresponding to the eigenvalue.
So, if the eigenvalue equations matrixvector=eigenvaluevector
hold, I’d not be concerned.
Cameron McBride [email protected] wrote:
Do you know right off how its accuracy compares to GSL/LAPACK routines?
That statement refers to inaccuracies in numerical
calculations introduced due to the fact that Float or Double precision
numbers cannot exactly represent certain numbers (this
actually holds true for any number that is not a ‘very’ finite
sum of powers of 2 and (1/2) - think of
1/10, sqrt(2),sqrt(3), pi.
It has nothing to do with differences in eigenvectors, even though
an entry in them might probably be 1/sqrt(2), rather than 0.7172,
as a numerical software might claim.
Now, as we know thanks to Ed Borasky, in Ruby, you have two choices:
a.) use bindings to GSL or R or Lapack or … , and thus ultimately to
do calculations in a fast language like C or Fortran, which
uses Double precision, and gives a fast, yet not quite exact result.
That’s what you would do almost exclusively. People who teach numerics
at universities will tell you you can’t do otherwise (i.e., that’s
their translation of the English "Matlab,
Octave etc. can’t do otherwise unless you rewrite almost everything
- once for being able to use Rationals, and then again, to be able
to use continued fractions - because you learned about them only
two months later …")
b.) use a pure Ruby, object-oriented implementation of numerical
algorithms as in the extended matrix.rb suggested by Ed Borasky.
That will give you exact calculations using Rationals right away,
and exact results of expressions like sqrt(2)+sqrt(3) via a
(yet to be written addition method for a class of continued fractions,
see Arithmetic with Continued Fractions, as the expressions
for sqrt(2) and sqrt(3) lead to periodic continued fractions, i.e.,
representations involving finite information).
The calculations to be done are far more involved than adding two
Floats,
and, additionally, Ruby is slower than C or Fortran, but it can be done,
using Ruby, in very finite coding time.
In most situations, sticking with a.) is ok., but if you really
wanted b.), no numerical software will do it for you, unless you rewrite
a substantial part of the code … in Ruby, you just define
another class and some methods to it.
Best regards,
Axel