SAS IML

The IML (Interactive Matrix Language) procedure performs matrix algebra with syntax analogous to mathematical notation. For example --

 * example1.sas: Show a coulple of very simple examples
                 with IML. *;

  proc IML;
    A=normal(j(4,4,0));
    print A;
    print (inv(A));
    print (round(A*inv(A)))[format=9.5];
    call eigen(L, V, A);
    print L "  " V;
  quit;

This code produces five printed matrices --

                                 A

              -1.253148 -0.856078 1.0518742 0.4468411
              -0.070097 0.1458906 1.4817126 -1.245724
              -0.331142   -0.1145 -1.180911 0.1995223
               0.661465 0.5153042 0.2580392 -0.982066


        Inverse A:   5.0297508 -6.136989 -1.066315 9.8565039
                     -10.78647 11.229693 0.3111249  -19.0892
                     -0.783209 0.9724074 -0.702931 -1.732644
                     -2.477843 2.0143488 -0.739655   -4.8511


    Product A*inv(A):     1.00000   0.00000   0.00000   0.00000
                          0.00000   1.00000   0.00000   0.00000
                          0.00000   0.00000   1.00000   0.00000
                          0.00000   0.00000   0.00000   1.00000


           L                      V

   0.0738757         0    -0.458529 0.2191594 -0.644519         0
   -0.540774         0    0.8726142 -0.727558 -0.007312 0.5250264
   -1.401668 0.9439942    0.0659845 -0.178109 -0.063448 -0.286025
   -1.401668 -0.943994    0.1547317 -0.625224 0.3495741 0.3175707

The matrices L and V are eigenvalue and eigenvector matrices, respectively. Both of them contain "complex" numbers which often happens for asymmetric input matrices, in this case A. In math, the eigenvalue matrix is a diagonal matrix. Here it is a two-column matrix. The first column contains the real part of the complex value, and the second part contains the imaginary part of one of a pair of complex values. The other one in the pair is the complex conjugate of the first one. As ordered here, the last two eigenvalues are complex numbers.

The eigenvector matrix also contains complex entries. In fact, the last two columns contain the real and imaginary parts, resopectively, corresponding to the 3rd eigenvalue. The complex conjugate of the last two columns is the eigenvector associated with the last eigenvalue. These mathematical concepts are important in the study of dynamic systems, differential and difference equations.