Here are the states
and
. (we show bras rather than
kets to conserve space)
The functions ketx , brax , kety , bray produce
eigenstates of
,
or
,
with, as before, the index
selecting the state with eigenvalue
and
selecting the state with eigenvalue
.
Compare this to the inner product
Here are different ways to make
and
.
This example used Maxima's
is(
)
function which
tries to determine whether the predicate expr is true or false.
There is also a function tovect that
is the inverse (up to a phase) of proj -- it returns the ket corresponding to a
projection operator. If the input matrix is not a projection operator,
the result is undefined.
op.
Once again, we will employ the
is
sqrt(a)*ket(0,0)+ sqrt(1-a)*ket(1,1). This
only works for qubits (assume(a>0,1-a>0) when manipulating this state
The assume
| (1) | ![]() |
As an exercise, we will check our definitions of the Bell
states by testing for orthonormality. We first define an array
function that returns the inner product of two Bell states.
An array function f[x,y] is like an ordinary function
f(x,y) except that it can be used where an array is
expected.
Create a
matrix with genmatrix
which maps the two dimension array f over the indices of the matrix with the given range.
But instead of the named function f we could have used
just a function body with the
lambda
function,
which returns a function that is not bound to a symbol.
It is obviously the
identity matrix. The
function identitymatrixp(
)
is a predicate defined in the
quantum information package in analogy to the Maxima
function zeromatrixp
.
It returns true only if its
argument is an identity matrix. (The symbol
%
refers to the previous output.
In the following sections, we often perform these comparisons in a single line. This
is how the test appears in the regression test suite.
We see that these four vectors are orthonormal and thus form a basis in
.
We can also check that
| (2) |
| (3) | ![]() |
werner(a,i,j).
The entropy depends on neither