    |\^/|     Maple 9.5 (IBM INTEL LINUX)
._|\|   |/|_. Copyright (c) Maplesoft, a division of Waterloo Maple Inc. 2004
 \  MAPLE  /  All rights reserved. Maple is a trademark of
 <____ ____>  Waterloo Maple Inc.
      |       Type ? for help.
# Kincaid and Cheney Problem 5.2#1
# Schur's factorization for 2x2 matrix
> 
# Written December 2012 by Eric Olson for Math 701
> 
> restart;
> kernelopts(printbytes=false);
                                      true

> with(LinearAlgebra):
> A:=Matrix([[3,8],[-2,3]]);
                                      [ 3    8]
                                 A := [       ]
                                      [-2    3]

> Lambda,X:=Eigenvectors(A);
                                  [3 + 4 I]  [-2 I    2 I]
                     Lambda, X := [       ], [           ]
                                  [3 - 4 I]  [ 1       1 ]

> lambda:=Lambda[1];
                               lambda := 3 + 4 I

> x:=X[1..2,1];
                                       [-2 I]
                                  x := [    ]
                                       [ 1  ]

> x:=x/Norm(x,2);
                                    [        1/2]
                                    [-2/5 I 5   ]
                                    [           ]
                               x := [    1/2    ]
                                    [   5       ]
                                    [   ----    ]
                                    [    5      ]

> e1:=Vector([1,0]);
                                         [1]
                                   e1 := [ ]
                                         [0]

> beta:=x[1]/abs(x[1]);
                                   beta := -I

> y:=beta*e1;
                                        [-I]
                                   y := [  ]
                                        [0 ]

> alpha:=simplify(rationalize(sqrt(2)/Norm(x-y,2)));
                            1/2           1/2 1/2         1/2
                           2    (50 - 20 5   )    (5 + 2 5   )
                  alpha := -----------------------------------
                                           10

> v:=simplify(alpha*(x-y));
                     [             1/2           1/2 1/2      ]
                     [     1/10 I 2    (50 - 20 5   )         ]
                     [                                        ]
                v := [ 1/2           1/2 1/2         1/2   1/2]
                     [2    (50 - 20 5   )    (5 + 2 5   ) 5   ]
                     [----------------------------------------]
                     [                   50                   ]

> U:=simplify(IdentityMatrix(2)-v.HermitianTranspose(v));
                             [     1/2                 ]
                             [  2 5                 1/2]
                             [  ------      -1/5 I 5   ]
                             [    5                    ]
                        U := [                         ]
                             [                    1/2  ]
                             [       1/2       2 5     ]
                             [1/5 I 5        - ------  ]
                             [                   5     ]

> T:=simplify(U.A.HermitianTranspose(U));
                                [3 + 4 I      -6   ]
                           T := [                  ]
                                [   0       3 - 4 I]

> U:=evalf(U);
                         [ 0.8944271908     -0.4472135954 I]
                    U := [                                 ]
                         [0.4472135954 I     -0.8944271908 ]

> T:=evalf(T);
                              [3. + 4. I       -6.   ]
                         T := [                      ]
                              [   0.        3. - 4. I]

> 
> matprint:=proc(outfile,M)
>     local fd,i,j;
>     fd:=open(outfile,WRITE);
>     for i from 1 to 2 do
>         for j from 1 to 2 do
>             if(type(M[i,j],realcons)) then
>                 fprintf(fd,"%g",M[i,j])
>             elif(type(M[i,j],imaginary)) then
>                 fprintf(fd,"%gI",Im(M[i,j]))
>             else
>                 fprintf(fd,"%Zg",M[i,j])
>             fi;
>             if(j<2) then
>                 fprintf(fd,"&")
>             else
>                 fprintf(fd,"\\cr\n")
>             fi
>         od
>     od;
>     close(fd)
> end proc;
matprint := proc(outfile, M)
local fd, i, j;
    fd := open(outfile, WRITE);
    for i to 2 do for j to 2 do
            if type(M[i, j], realcons) then fprintf(fd, "%g", M[i, j])
            elif type(M[i, j], imaginary) then
                fprintf(fd, "%gI", Im(M[i, j]))
            else fprintf(fd, "%Zg", M[i, j])
            end if;
            if j < 2 then fprintf(fd, "&")
            else fprintf(fd, "\cr
                ")
            end if
        end do
    end do;
    close(fd)
end proc

> 
> matprint("U.tex",U);
> matprint("T.tex",T);
> quit
bytes used=5311532, alloc=3210676, time=0.73
