Derivadas en coordenadas esféricas
Jorge Garza
Sept/2016

Trabajando en coordenadas cartesianas

x[r_,θ_,ϕ_]:=r Sin[θ]Cos[ϕ];
y[r_,θ_,ϕ_]:=r Sin[θ]Sin[ϕ];
z[r_,θ_,ϕ_]:=r Cos[θ];

θ=Pi/2;
r=2;
g1=Graphics3D[{PointSize[Large],Point[Table[{x[r,θ,ϕ],y[r,θ,ϕ],z[r,θ,ϕ]},{ϕ,0,2*Pi,Pi/8}]]}]

θ=Pi/4;
g2=Graphics3D[{PointSize[Large],Point[Table[{x[r,θ,ϕ],y[r,θ,ϕ],z[r,θ,ϕ]},{ϕ,0,2*Pi,Pi/8}]]}];
Show[g1,g2]

θ=Pi/10;
g3=Graphics3D[{PointSize[Large],Point[Table[{x[r,θ,ϕ],y[r,θ,ϕ],z[r,θ,ϕ]},{ϕ,0,2*Pi,Pi/8}]]}];

Show[g1,g2,g3]

Clear[x,y,z,r,θ,ϕ];

Trabajando en coordenadas esféricas

Definición de las variables en coordenadas esféricas

r[x_,y_,z_]:=Sqrt[x^2+y^2+z^2];
θ[x_,y_,z_]:=ArcCos[z/r[x,y,z]];
ϕ[x_,y_,z_]:=ArcTan[y/x];

Derivadas de las variables en coordenadas esféricas con respecto a las coordenadas cartesianas

derrx=FullSimplify[Simplify[D[r[x,y,z],x]]/.y->r Sin[θ] Sin[ϕ]/.x->r Sin[θ] Cos[ϕ]/.z->r Cos[θ]];
dertx=FullSimplify[Simplify[D[θ[x,y,z],x]]/.y->r Sin[θ] Sin[ϕ]/.x->r Sin[θ] Cos[ϕ]/.z->r Cos[θ]];
derpx=FullSimplify[Simplify[D[ϕ[x,y,z],x]]/.y->r Sin[θ] Sin[ϕ]/.x->r Sin[θ] Cos[ϕ]/.z->r Cos[θ]];
dertotalx=D[f[r,θ,ϕ],r]*derrx+D[f[r,θ,ϕ],θ]*dertx+D[f[r,θ,ϕ],ϕ]*derpx;
der2totalx=Expand[D[dertotalx,r]*derrx+D[dertotalx,θ]*dertx+D[dertotalx,ϕ]*derpx];

derry=FullSimplify[Simplify[D[r[x,y,z],y]]/.y->r Sin[θ] Sin[ϕ]/.x->r Sin[θ] Cos[ϕ]/.z->r Cos[θ]];
derty=FullSimplify[Simplify[D[θ[x,y,z],y]]/.y->r Sin[θ] Sin[ϕ]/.x->r Sin[θ] Cos[ϕ]/.z->r Cos[θ]];
derpy=FullSimplify[Simplify[D[ϕ[x,y,z],y]]/.y->r Sin[θ] Sin[ϕ]/.x->r Sin[θ] Cos[ϕ]/.z->r Cos[θ]];
dertotaly=D[f[r,θ,ϕ],r]*derry+D[f[r,θ,ϕ],θ]*derty+D[f[r,θ,ϕ],ϕ]*derpy;
der2totaly=Expand[D[dertotaly,r]*derry+D[dertotaly,θ]*derty+D[dertotaly,ϕ]*derpy];

derrz=FullSimplify[Simplify[D[r[x,y,z],z]]/.y->r Sin[θ] Sin[ϕ]/.x->r Sin[θ] Cos[ϕ]/.z->r Cos[θ]];
dertz=FullSimplify[Simplify[D[θ[x,y,z],z]]/.y->r Sin[θ] Sin[ϕ]/.x->r Sin[θ] Cos[ϕ]/.z->r Cos[θ]];
derpz=FullSimplify[Simplify[D[ϕ[x,y,z],z]]/.y->r Sin[θ] Sin[ϕ]/.x->r Sin[θ] Cos[ϕ]/.z->r Cos[θ]];
dertotalz=D[f[r,θ,ϕ],r]*derrz+D[f[r,θ,ϕ],θ]*dertz+D[f[r,θ,ϕ],ϕ]*derpz;
der2totalz=Expand[D[dertotalz,r]*derrz+D[dertotalz,θ]*dertz+D[dertotalz,ϕ]*derpz];

Resultado de la primera y segunda derivada

dertotalx

Collect[Simplify[der2totalx],{D[f[r,θ,ϕ],{r,2}],D[f[r,θ,ϕ],{θ,2}],D[f[r,θ,ϕ],{ϕ,2}],D[D[f[r,θ,ϕ],r],θ],D[D[f[r,θ,ϕ],r],ϕ],D[D[f[r,θ,ϕ],θ],ϕ],D[f[r,θ,ϕ],r],D[f[r,θ,ϕ],θ],D[f[r,θ,ϕ],ϕ]}]

Laplaciano

Collect[Simplify[der2totalx+der2totaly+der2totalz],{D[f[r,θ,ϕ],{r,2}],D[f[r,θ,ϕ],{θ,2}],D[f[r,θ,ϕ],{ϕ,2}],D[D[f[r,θ,ϕ],r],θ],D[D[f[r,θ,ϕ],r],ϕ],D[D[f[r,θ,ϕ],θ],ϕ],D[f[r,θ,ϕ],r],D[f[r,θ,ϕ],θ],D[f[r,θ,ϕ],ϕ]}]