Ask Your Question

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

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 close merge delete

## Comments

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

( 2012-04-12 08:13:50 +0200 )edit

## 1 Answer

Sort by ยป oldest newest most voted

Mhh strange: For me this code works fine on sagenb.org: http://sagenb.org/home/pub/4689

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?

more

## Comments

1

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

( 2012-04-12 07:01:42 +0200 )edit

## Your Answer

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

Add Answer

## Stats

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

Seen: 5,659 times

Last updated: Apr 12 '12