Math 136 Fall 2024
Differential Geometry
(* This 4 line code computes the curvature of a parametrized manifold *)
(* In this example, we have a torus *)
(* Math 136 class https://people.math.harvard.edu/~knill/teaching/math136 *)
r={(3+Cos[v]) Cos[u],(3+Cos[v]) Sin[u],Sin[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];
Print[Simplify[K]]