[Numpy-discussion] Can you help me find a dumb matrix multiply mistake

josef.pktd@gmai... josef.pktd@gmai...
Fri Feb 26 15:18:27 CST 2010


On Fri, Feb 26, 2010 at 4:01 PM, Rick Muller <rpmuller@gmail.com> wrote:
> I'm making a mistake here, one that I suspect is a dumb error. I'm not as
> familiar with the math of complex hermetian matrices as I am with real
> symmetry matrices.
>
> I want to diagonalize the matrix:
>
> Y = matrix([[0,-1j],[1j,0]])     # this is the Y Pauli spin matrix
>
> Ey,Uy = eigh(Y)
>
> When I try to do:
>
> print Uy.H * diag(Ey) * Uy
>
> rather than getting Y back, I get:
>
> [[ 0.+0.j -1.+0.j]
>  [-1.+0.j  0.+0.j]]

to get Y back:

>>> Uy * np.diag(Ey) * Uy.H
matrix([[ 0.+0.j,  0.-1.j],
        [ 0.+1.j,  0.+0.j]])

>>> Uy * np.diag(Ey) * Uy.H - Y
matrix([[ 0. +0.00000000e+00j,  0. +2.22044605e-16j],
        [ 0. -2.22044605e-16j,  0. +0.00000000e+00j]])

Josef

>
> I also tried
>
> dot(Uy.H,dot(diag(Ey),Uy))
>
> to make sure this isn't a matrix/array problem with the same result. Can
> someone spot what I'm doing wrong?
>
>
>
> --
> Rick Muller
> rpmuller@gmail.com
> 505-750-7557
>
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>


More information about the NumPy-Discussion mailing list