(* <<Calculus`VectorAnalysis`   <-- the statement to the left is now replaced by the "Vector Analysis Package"  *)

Grad[r^2, {r, θ, φ},"Spherical"]

(* Cartesian[x,y,z] *)

(* SetCoordinates[Cartesian[x,y,z]] *)

(* {CoordinateSystem, Coordinates[ ]}  *)

xhat={1,0,0}; yhat={0,1,0}; zhat={0,0,1};

ehatPlus=-((xhat+I yhat)/(Sqrt[2])); ehatMinus=((xhat-I yhat)/(Sqrt[2]));
ehatZero=zhat;  ehatvec[m_]:=(ehat=If[m==0,ehatZero,If[m==1,ehat=ehatPlus,ehat=ehatMinus]]; If[Abs[m]>1,{0,0,0},ehat])

ehatvec[0]

ehatvec[1]

ehatvec[-1]

ehatvec[2]

nhat = {Sin[t]Cos[p],Sin[t]Sin[p],Cos[t]}

(* New clebsch-gordan coefficient which tests for trivial zeroes:  *)
clebsch[{aa_,bb_},{cc_,dd_},{ee_,ff_}] :=
  If[Abs[aa-cc] <= ee && ee <= aa+cc &&
	bb+dd == ff && -aa<= bb && bb<= aa &&
	-cc<=dd && dd<=cc && -ee <=ff && ff<= ee,
 	ClebschGordan[{aa,bb},{cc,dd},{ee,ff}],0]

clebsch[{1,1},{1,-1},{1,0}]

clebsch[{1,-1},{1,1},{1,0}]

clebsch[{1,0},{1,0},{2,0}]

VectorSphericalHarmonic[J_,L_,M_,t_,p_]:=Sum[clebsch[{L,m},{1,M-m},{J,M}]SphericalHarmonicY[L,m,t,p] ehatvec[M-m],{m,-L,L}]

VectorSphericalHarmonic[1,2,0,θ,ϕ]//ExpToTrig

VectorSphericalHarmonic[0,1,0,θ,ϕ]//ExpToTrig

{L,m}

M

vec1test=-(Sqrt[(2/3)])VectorSphericalHarmonic[1,2,0,θ,ϕ]+(Sqrt[(1/3)])VectorSphericalHarmonic[1,0,0,θ,ϕ]/.{θ->0.3,ϕ->0.7}

Let's check the orthogonality and normalization relations, to see if the above program appears to be working.

(∫_0^(2π))(∫_0^π)Conjugate[VectorSphericalHarmonic[1,2,0,θ,ϕ]].VectorSphericalHarmonic[1,0,0,θ,ϕ]Sin[θ]\[DifferentialD]θ\[DifferentialD]ϕ

(∫_0^(2π))(∫_0^π)Conjugate[VectorSphericalHarmonic[2,1,0,θ,ϕ]].VectorSphericalHarmonic[1,1,0,θ,ϕ]Sin[θ]\[DifferentialD]θ\[DifferentialD]ϕ

(∫_0^(2π))(∫_0^π)Conjugate[VectorSphericalHarmonic[1,2,1,θ,ϕ]].VectorSphericalHarmonic[1,2,1,θ,ϕ]Sin[θ]\[DifferentialD]θ\[DifferentialD]ϕ

It works!  Kewl!

jj

Clear[jj]

jj[L_,z_]:=(Sqrt[π/(2z)])BesselJ[L+1/2,z]

jjD[L_,x_]:=D[(Sqrt[π/(2z)])BesselJ[L+1/2,z],z]/.z->x

DjjDr[L_,k_,r_]:=D[(Sqrt[π/(2k r)])BesselJ[L+1/2,k r],r]

DjjDr[1,k,r]//Simplify

L

k

M

Clear[L,k]

CurlOfX[L_,M_,k_,r_,θ_,ϕ_]:=I (DjjDr[L,k,r]-(L/r)jj[L, k r])(Sqrt[(L/(2L+1))])VectorSphericalHarmonic[L,L+1,M,θ,ϕ]+I (DjjDr[L,k,r]+((L+1)/r)jj[L, k r])(Sqrt[((L+1)/(2L+1))])VectorSphericalHarmonic[L,L-1,M,θ,ϕ]

CurlOfX[1,0,k,r,θ,ϕ]//ExpToTrig;

%//PowerExpand//Simplify

%/.{k->1.0,r->5.7,θ->0.33,ϕ->1.77}

VectorSphericalHarmonic[1,1,0,θ,ϕ]//ExpToTrig   (*  Just to clarify, these are the Cartesian components, written in terms of spherical coordinates:  *)

jj[1,k r]//PowerExpand