kill(all);

van=facebook.com/LearningCalculus;

      Define the operator <a| for bra and |b> for ket

x:[1,2,3,4];

y:[4,3,2,1];

a[i,j] := x[i]+y[i]*%i;

A[i,j] := x[j]-y[j]*%i;

bra(a):=genmatrix (a, 4, 1)$
ket(A):=genmatrix (A,1,4);

bra(a);

ket(A);

bra(a) . ket(A);

fullratsimp(%);