I am trying to achieve the formula `hbar / 2 * cos(wt) * sin(theta)`

. However, my Mathematica expression doesn’t seem to simplify the half/double angle formulas. I am wondering how I could refine my approach. Here’s my code:

`Sz[J_] := \[HBar]* Table[ KroneckerDelta[i, j]*(J + 1 - i), {i, 2*J + 1}, {j, 2*J + 1}] Sx[J_] := Chop[\[HBar]*.5* Table[(KroneckerDelta[i, j + 1] + KroneckerDelta[i + 1, j])*((J + 1)*(i + j - 1) - i*j)^.5, {i, 2*J + 1}, {j, 2*J + 1}]] Sy[J_] := \[HBar]* Table[I/2*(KroneckerDelta[i, j + 1] - KroneckerDelta[i + 1, j])*((J + 1)*(i + j - 1) - i*j)^.5, {i, 2*J + 1}, {j, 2*J + 1}] Sn[J_, theta_, phi_] := Simplify[Sx[J]*Sin[theta]*Cos[phi] + Sy[J]*Sin[theta]*Sin[phi] + Sz[J]*Cos[theta], Assumptions -> {0 <= theta <= Pi, 0 <= phi < 2*Pi, Element[theta, Reals]}] U[H_, t_] := Simplify[Chop[ComplexExpand[MatrixExp[-I*H*t/\[HBar]]]], Assumptions -> Element[t, Reals]] {nvals, nvecs} = Eigensystem[Sn[.5, theta, 0]]; psi = Simplify[U[w Sz[.5], t].nvecs[[2]], Assumptions -> Element[w, Reals]]; Simplify[ComplexExpand[Conjugate[psi].Sx[.5].psi]] `

And here’s my output:

`(\[HBar] Sin[ theta] ((-2. - 2. Cos[theta]) Cos[(0.5 + 0. I) t w]^2 + (2. + 2. Cos[theta]) Sin[(0.5 + 0. I) t w]^2))/(-1. + Cos[2 theta]) `