4
$\begingroup$

I am trying to write a Mathematica program to compute the following:

For a given Hermitian matrix $\rho$, the operator $L_\theta$ with respect to a parameter $\theta$ is defined as:

\begin{equation} L_\theta = -\vec{y} \cdot \vec{r} \, \mathbb{I} + \vec{y} \cdot \vec{\sigma}, \quad \vec{y} = (\mathbb{I} - \vec{r}\vec{r}^T)^{-1} \, \partial_\theta \vec{r} \end{equation}

Here, $\vec{r}$ is a vector defined as:

\begin{equation} \vec{r} = (\mathrm{Tr}[\rho \sigma_x], \mathrm{Tr}[\rho \sigma_y], \mathrm{Tr}[\rho \sigma_z]), \end{equation}

$\vec{\sigma} = (\sigma_x, \sigma_y, \sigma_z)$ are the Pauli matrices, and $\partial_\theta \vec{r}$ is the derivative with respect to $\theta$.

I would like to write a Mathematica program that, given matrix $\rho[\theta]$, compute vector $\vec{r}$, its derivative with respect to $\theta$, and then constructs $L_\theta$ automatically.

I tried something like this:

 sigmaX = {{0, 1}, {1, 0}}; sigmaY = {{0, -I}, {I, 0}}; sigmaZ = {{1, 0}, {0, -1}}; Vector[rho_] := {Tr[rho.sigmaX], Tr[rho.sigmaY], Tr[rho.sigmaZ]}; rho[theta_] := {{(1 + Cos[theta])/2, Sin[theta]/2}, {Sin[theta]/2, (1 - Cos[theta])/2}}; Operator[rhoFunc_, theta_] := Module[{rho, r, dr, Id, P, L}, rho = rhoFunc[theta]; r = Vector[rho]; dr = D[r, theta]; Id = IdentityMatrix[3]; P = Inverse[Id - Outer[Times, r, r]].dr; L = -P.r IdentityMatrix[2] + P[[1]] sigmaX + P[[2]] sigmaY + P[[3]] sigmaZ; L ]; 

But I am not sure if this is the best way to implement it, and I get errors sometimes with defining $\rho[\theta]$ or computing derivatives.

I would appreciate a solution that works both symbolically and numerically.

$\endgroup$

1 Answer 1

2
$\begingroup$

It seems like a straightforward implementation should be fine.

σ = PauliMatrix /@ {1, 2, 3}; r[ρ_] := Map[Tr[ρ . #] &, σ]; y[r_, θ_] := LinearSolve[IdentityMatrix[3] - KroneckerProduct[r, r], D[r, θ]] L[r_, θ_] := With[{Y = y[r, θ]}, -Y . r PauliMatrix[0] + Y . σ] 

Then, with your rho,

FullSimplify[L[r[ρ[θ]], θ]] 

gives {{-Tan[θ], Sec[θ]},{Sec[θ], -Tan[θ]}}. When I execute your code I get issues with a singular matrix, a thread of unequal length, and a part that does not exist, so I cannot check that this is what you're searching for.

$\endgroup$
3
  • $\begingroup$ Thanks @evanb, does KroneckerProduct[r, r] correctly implement $\vec{r} \vec{r}^T$? $\endgroup$ Commented Oct 22 at 21:49
  • 1
    $\begingroup$ @seeker KroneckerProduct[{a, b, c}, {a, b, c}] == Outer[Times, {a, b, c}, {a, b, c}] yields True, so as long as your implementation with Outer[Times...] is right so is mine! $\endgroup$ Commented Oct 23 at 1:07
  • 1
    $\begingroup$ (If you need $rr^{\dagger}$ you should probably think about which you need to argument you need to conjugate.) $\endgroup$ Commented Oct 23 at 1:08

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.