Evan Cooch <evan.cooch at cornell.edu> writes:
> Consider
>
> test : matrix([-0.13333333333333,-0.16666666666667],[0.04,0.0]);
>
> when I execute
>
> float(eigenvalues(test));
>
> I get
>
> (%o210)
> [[-4.971296243246757*10^-28*(9.4825272469217148*10^25*%i+1.3410318638167688*10^26),
> 4.971296243246757*10^-28*(9.4825272469217148*10^25*%i-1.3410318638167688*10^26)],[1.0,1.0]]
>
>
> However, I *know* the eigenvalues for this matrix are
>
> -.6666666665e-1+.4714045212e-1*I, -.6666666665e-1-.4714045212e-1*I
>
> (These are what Maple, Mathematica, and R all return, in some fashion).
>
> So, either Maxima is in error, or I'm not interpreting the output
> correctly. At minimum, I need to to be able to determine if the
> eigenvalues are real, or complex, and if complex, what the sign of the
> real and imaginary parts is for a given value.
They agree in fact. Notice that the (...)*10^-28 bit is then multiplied
by something times 10^25... The quick and dirty answer:
(%i1) display2d: false;
(%o1) false
(%i2) test : matrix([-0.13333333333333,-0.16666666666667],[0.04,0.0]);
(%o2) matrix([-0.13333333333333,-0.16666666666667],[0.04,0.0])
(%i3) float(eigenvalues(test));
rat: replaced 0.0066666666666668 by 335089257989/50263388698349 = .006666666666666799
rat: replaced -0.13333333333333 by -2668009257921/20010069434408 = -0.13333333333333
(%o3) [[-4.971296243246757e-28*(9.482527246921714e+25*%i
+1.341031863816769e+26),
4.971296243246757e-28*(9.482527246921714e+25*%i
-1.341031863816769e+26)],[1.0,1.0]]
(%i4) expand(%);
(%o4) [[-.04714045207910694*%i-0.066666666666665,
.04714045207910694*%i-0.066666666666665],[1.0,1.0]]
But ick. Better is to notice that you were plugging in floating point
approximations to rational numbers. Why not just use the actual numbers?
(%i1) display2d: false;
(%o1) false
(%i2) test2 : matrix([-2/15,-1/6],[1/25,0]);
(%o2) matrix([-2/15,-1/6],[1/25,0])
(%i3) eigenvalues(test2);
(%o3) [[-(sqrt(2)*%i+2)/30,(sqrt(2)*%i-2)/30],[1,1]]
(%i4) expand(%), numer;
(%o4) [[-.04714045207910317*%i-.06666666666666667,
.04714045207910317*%i-.06666666666666667],[1,1]]
Tada! (And no horrible powers of ten in sight)
Rupert
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 315 bytes
Desc: not available
URL: <http://www.math.utexas.edu/pipermail/maxima/attachments/20121101/716c5505/attachment.pgp>