Christoffel Symbols

Here is the code to get the Christoffel symbols in the case of a sphere. Mathematica is based on lists, lists of lists etc which was inspired by Lisp, a programming language that had been important in early AI development. If we have two vectors like u={2,3,4}, v={5,4,2}, then {u,v} is a matrix {2,3,4},{5,4,2}} where u,v are the row vectors. This is why drT = {ru,rv} is the transpose of the Jacobean. The rest of the code is pretty much what we defined in class. The picture to the right shows Elwin Christoffel (1829-1900). Image source: Wikipedia


r={Sin[v] Cos[u],Sin[v] Sin[u],Cos[v]};
ru=D[r,u];      rv=D[r,v];
n=Cross[ru,rv]; n=n/Sqrt[n.n];
nu=D[n,u];      nv=D[n,v];
drT={ru,rv};    dr=Transpose[drT];
g=drT.dr;       gi=Inverse[g];
dnT={nu,nv};    dn=Transpose[dnT];
h=-dnT.dr;      e=dnT.dn;
K=Det[h]/Det[g];
X={u,v}; d=2;
c[i_,j_,k_]:=(D[g[[j,k]],X[[i]]]
             +D[g[[k,i]],X[[j]]]
             -D[g[[i,j]],X[[k]]])/2;
Christoffel[i_,j_,k_]:=Sum[gi[[k,l]]*c[i,j,l],{l,d}];
S=Table[Simplify[Christoffel[i,j,k]],{i,d},{j,d},{k,d}];