Maxima Function
eigens_by_jacobi (A)
eigens_by_jacobi(A,field_type)
Computes the eigenvalues and eigenvectors of A by the method of Jacobi rotations.
A must be a symmetric matrix (but it need not be positive definite nor positive semidefinite).
field_type indicates the computational field, either floatfield
or bigfloatfield
.
If field_type is not specified, it defaults to floatfield
.
The elements of A must be numbers or expressions which evaluate to numbers
via float
or bfloat
(depending on field_type).
Examples:
(%i1) S: matrix([1/sqrt(2), 1/sqrt(2)],[-1/sqrt(2), 1/sqrt(2)]); [ 1 1 ] [ ------- ------- ] [ sqrt(2) sqrt(2) ] (%o1) [ ] [ 1 1 ] [ - ------- ------- ] [ sqrt(2) sqrt(2) ] (%i2) L : matrix ([sqrt(3), 0], [0, sqrt(5)]); [ sqrt(3) 0 ] (%o2) [ ] [ 0 sqrt(5) ] (%i3) M : S . L . transpose (S); [ sqrt(5) sqrt(3) sqrt(5) sqrt(3) ] [ ------- + ------- ------- - ------- ] [ 2 2 2 2 ] (%o3) [ ] [ sqrt(5) sqrt(3) sqrt(5) sqrt(3) ] [ ------- - ------- ------- + ------- ] [ 2 2 2 2 ] (%i4) eigens_by_jacobi (M); The largest percent change was 0.1454972243679 The largest percent change was 0.0 number of sweeps: 2 number of rotations: 1 (%o4) [[1.732050807568877, 2.23606797749979], [ 0.70710678118655 0.70710678118655 ] [ ]] [ - 0.70710678118655 0.70710678118655 ] (%i5) float ([[sqrt(3), sqrt(5)], S]); (%o5) [[1.732050807568877, 2.23606797749979], [ 0.70710678118655 0.70710678118655 ] [ ]] [ - 0.70710678118655 0.70710678118655 ] (%i6) eigens_by_jacobi (M, bigfloatfield); The largest percent change was 1.454972243679028b-1 The largest percent change was 0.0b0 number of sweeps: 2 number of rotations: 1 (%o6) [[1.732050807568877b0, 2.23606797749979b0], [ 7.071067811865475b-1 7.071067811865475b-1 ] [ ]] [ - 7.071067811865475b-1 7.071067811865475b-1 ]