> # This spread sheet computes the answers to the example problem
# of Homework 1.

# Please do not use the Maple worksheet QC6_Lib.mws for this example
# This worksheet works without it.

> with(linalg):

Warning, the protected names norm and trace have been redefined and unprotected

> # We wish to observe the state psi with respect to the observable A

psi:=evalm( (1/sqrt(3)) * matrix(4,1,[1,I,0,-1]) );
A:=matrix(4,4, [0, 0,1,-I,
0, 0,I,-1,
1,-I,0, 0,
I,-1,0, 0 ] );

> # We now compute the two eingenvals of A along with their eigenvectors

List:=[eigenvects(A)];
a1:=op(1, op(1,List) );
v1:=op(1, op(3, op(1,List) ) );
v2:=op(2, op(3, op(1,List) ) );

a2:=op(1, op(2,List) );
v3:=op(1, op(3, op(2,List) ) );
v4:=op(2, op(3, op(2,List) ) );

> # We now you the GramSchmidt to create orthogonal bases for the two eigenspaces V+ and V-.

VectorSet1:=GramSchmidt({v1,v2});
ww1:=op(1,VectorSet1); ww2:=op(2,VectorSet1);
VectorSet2:=GramSchmidt({v3,v4});
ww3:=op(1,VectorSet2); ww4:=op(2,VectorSet2);

> # We now normalize the eigenkets

for i from 1 to 4 do
w||i:=convert(evalm( (1/norm(ww||i, 2)) * ww||i ), matrix):
od;

> # Thus, the eigenvectors for the eigenvalue a1 are w1 and w2.
# They form an orthonormal basis of the eigenspace V+
# Also, the eigenvectors for the eigenvalue a2 are w3 and w4.
# They form an orthonormal basis of the eigenspace V-
# Moreover, all w1 & w2 are each mutually orthogonal to w3 & w4
# because eigenvectors corresponding to distinct eigenvectors
# must be orthogonal.

> # We can now verify that the spectral decomposition theorem is true,
# which of course it is.

Proj1:=evalm( w1 &* htranspose(evalm(w1)) );
Proj2:=evalm( w2 &* htranspose(evalm(w2)) );
Proj3:=evalm( w3 &* htranspose(evalm(w3)) );
Proj4:=evalm( w4 &* htranspose(evalm(w4)) );

> # So the Projection operators for the eigenspace V+ and V- are respectively
ProjPlus:= evalm(Proj1 + Proj2);
ProjMinus:=evalm(Proj3 + Proj4);

> # Since by the spectral decomposition theorem, A = a1* ProjPlus + a2*ProjMinus,
# we should get A with the following computation

evalm( evalm(a1*ProjPlus) + evalm(a2*ProjMinus) );

> # We now compute the coefficients of the expansion of psi in
# the eigenbasis w1, w2, w3, w4

alpha||1:=evalm(htranspose(w1) &* psi)[1,1];
alpha||2:=evalm(htranspose(w2) &* psi)[1,1];
alpha||3:=evalm(htranspose(w3) &* psi)[1,1];
alpha||4:=evalm(htranspose(w4) &* psi)[1,1];

> # We now verify that these coefficients are correct.

map(simplify, evalm(evalm(alpha1*w1 + alpha2*w2) + evalm(alpha3*w3 + alpha4*w4)));

> # Thus, the probability that eigenvalue a1 is read
# as a result of the measurement is:

ProbPlus:= abs(alpha1)^2 + abs(alpha2)^2;
ProbMinus:=abs(alpha3)^2 + abs(alpha4)^2;

> # The respective resulting states are:

StatePlus:= map(simplify,
evalm( (1/sqrt(abs(alpha1)^2 + abs(alpha2)^2)) * evalm(alpha1*w1 + alpha2*w2) )
);
StateMinus:=map(simplify,
evalm( (1/sqrt(abs(alpha3)^2 + abs(alpha4)^2)) * evalm(alpha3*w3 + alpha4*w4) )
);

>

Maple TM is a registered trademark of Waterloo Maple Inc.
Math rendered by WebEQ