Ask Your Question

evaluating the $U^\dagger U$ of an unitary matrix does not work

asked 2012-04-12 05:11:11 +0100

d3banjan gravatar image

updated 2012-04-12 05:13:55 +0100

mat = matrix([[0,1],[1,0]]) #creates a pauli matrix
u = exp(i*mat)# creates an unitary matrix
print ((u.H)*u).n() # u*u evaluated numerically

$U^\dagger U$ does not return the identity. why?

sage output-
[4.44305526025399e6 4.44305526025388e6]
[4.44305526025388e6 4.44305526025399e6]

edit retag flag offensive close merge delete


the weirdest thing - it works now! hmm .. i was using the worksheet interface. thanks!

d3banjan gravatar imaged3banjan ( 2012-04-12 08:13:50 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2012-04-12 06:08:10 +0100

twch gravatar image

Mhh strange: For me this code works fine on

On the sage Version which is installed on my PC (sage 4.7.1) the code throws an attribute Error: Attribute H unknown. However replacing .H by .conjugate_transpose() solves the problem there:

sage: mat = matrix([[0,1],[1,0]]) #creates a pauli matrix

sage: u = exp(i*mat) # creates an unitary matrix

sage: show(((u.conjugate_transpose())*u).n()) # u*u evaluated numerically

returns a unity matrix. Maybe the version you work with doesn't properly support .H either?

edit flag offensive delete link more



The U.H abbreviation for U.conjugate_transpose() was added only relatively recently.

Volker Braun gravatar imageVolker Braun ( 2012-04-12 07:01:42 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2012-04-12 05:11:11 +0100

Seen: 5,796 times

Last updated: Apr 12 '12