Ask Your Question

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

asked 2012-04-11 22:11:11 -0500

d3banjan gravatar image

updated 2012-04-11 22:13:55 -0500

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 01:13:50 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2012-04-11 23:08:10 -0500

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 00:01:42 -0500 )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-11 22:11:11 -0500

Seen: 5,463 times

Last updated: Apr 11 '12