# su2 matrix exponentiation

Hi,

does anyone know if sage math is able to successfully calculate exp(G) where G belongs to su(2) ? The sagemath commands are given below :

var('phi theta', domain='real')

u = vector([cos(phi)*sin(theta),sin(phi)*sin(theta),cos(theta)])
u.norm().simplify_trig()

sigma_x = matrix([[0,1],[1,0]])
sigma_y = matrix([[0,-i],[i,0]])
sigma_z = matrix([[1,0],[0,-1]])
sigma_x, sigma_y, sigma_z

var('t',domain='real')

G = -i*t*(sigma_x*u[0]+sigma_y*u[1]+sigma_z*u[2])
G.trace(), (G.det()/t**2).simplify_full(), G.is_hermitian()

exp(G)


exp(G) returns the following error code :

TypeError: ECL says: Error executing code in Maxima: Unable to find the spectral representation

Thank you for helping.

Epi

edit retag close merge delete

Sort by » oldest newest most voted

Using sympy, it seems to work:

sage: a,b,c,d = [a._sympy_() for a in G.list()]
sage: from sympy import Matrix as SympyMatrix
sage: G_sympy = SympyMatrix([[a,b], [c,d]])
sage: G_sympy_exp = G_sympy.exp()
sage: G_sympy_exp.simplify()
sage: G_sympy_exp
Matrix([
[(-(cos(theta) - 1)*exp(2*I*t) + cos(theta) + 1)*exp(-I*t)/2,                I*(I*sin(phi) - cos(phi))*sin(t)*sin(t
heta)],
[        (-exp(2*I*t) + 1)*exp(I*phi)*exp(-I*t)*sin(theta)/2, ((cos(theta) + 1)*exp(2*I*t) - cos(theta) + 1)*exp(-I
*t)/2]])


Then using copy-paste, I am able to construct the matrix G_exp as a Sage object:

sage: G_sympy_exp.tolist()
[[(-(cos(theta) - 1)*exp(2*I*t) + cos(theta) + 1)*exp(-I*t)/2,
I*(I*sin(phi) - cos(phi))*sin(t)*sin(theta)],
[(-exp(2*I*t) + 1)*exp(I*phi)*exp(-I*t)*sin(theta)/2,
((cos(theta) + 1)*exp(2*I*t) - cos(theta) + 1)*exp(-I*t)/2]]
sage: G_exp = matrix([[(-(cos(theta) - 1)*exp(2*I*t) + cos(theta) + 1)*exp(-I*t)/2,
....:   I*(I*sin(phi) - cos(phi))*sin(t)*sin(theta)],
....:  [(-exp(2*I*t) + 1)*exp(I*phi)*exp(-I*t)*sin(theta)/2,
....:   ((cos(theta) + 1)*exp(2*I*t) - cos(theta) + 1)*exp(-I*t)/2]]
....: )
sage: G_exp
[-1/2*((cos(theta) - 1)*e^(2*I*t) - cos(theta) - 1)*e^(-I*t)                  (-I*cos(phi) - sin(phi))*sin(t)*sin(theta)]
[            -1/2*(e^(2*I*t) - 1)*e^(I*phi - I*t)*sin(theta)  1/2*((cos(theta) + 1)*e^(2*I*t) - cos(theta) + 1)*e^(-I*t)]


Note: I was expecting that G._sympy_() would return the equivalent matrix in Sympy but this method does not exist. It would be nice to add it. Also, there must be an easier way to convert the sympy G_sympy_exp back to a sage matrix instead of the copy-paste I am doing above.

more

I have added these sage commands

((G_exp.expand().simplify_full() - cos(t)*matrix.diagonal([1,1]))/sin(t)).expand().simplify_trig()
((G_exp[1,0].real_part().simplify_trig() + i* G_exp[1,0].imag_part().simplify_trig()).factor())/sin(t)
(-i*sigma_x*u[0]-i*sigma_y*u[1]-i*sigma_z*u[2]).factor()


for checking the expected result (exp(tX)=cos(t)Id+sin(t)X, X in su(2) and det(X)=1).

It is surprising that the sage exp cannot perform it.

( 2018-08-22 17:30:44 +0200 )edit