Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

Computation of the curvatures of a torus as surface of revolution

Views: 112
Kernel: SageMath 8.3

A Torus and its Curvatures

Let's consider a torus, parametrized as a surface of revolution and compute its different curvatures.

u,v = var('u v') x(u,v) = ((2*cos(u)+3)*cos(v), (2*cos(u)+3)*sin(v), 2*sin(u) )

First Step, all the partial derivatives we'll need.

For all of our computations, we'll want the uu and vv partial derivatives of x(u,v)x(u,v) of order 1 and 2. So we compute them and store them in some variables.

xu = x.diff(u) xv = x.diff(v) xuu = x.diff(u,2) xuv = xu.diff(v) xvv = x.diff(v,2) show(xuv) # just as a check
(u,v)  (2sin(u)sin(v),2cos(v)sin(u),0)\renewcommand{\Bold}[1]{\mathbf{#1}}\left( u, v \right) \ {\mapsto} \ \left(2 \, \sin\left(u\right) \sin\left(v\right),\,-2 \, \cos\left(v\right) \sin\left(u\right),\,0\right)

First Fundamental Form

E = xu.dot_product(xu).simplify_full() F = xu.dot_product(xv).simplify_full() G = xv.dot_product(xv).simplify_full() I = matrix(SR, 2,2, [E,F, F, G]) show(I) # as a check
(4004cos(u)2+12cos(u)+9)\renewcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rr} 4 & 0 \\ 0 & 4 \, \cos\left(u\right)^{2} + 12 \, \cos\left(u\right) + 9 \end{array}\right)

The Normal Vector

q = xu.cross_product(xv) size = q.norm().simplify_full().canonicalize_radical() show(size) # this should equal sqrt(EG-F^2), let's check
4cos(u)+6\renewcommand{\Bold}[1]{\mathbf{#1}}4 \, \cos\left(u\right) + 6
show(sqrt(E*G-F^2).canonicalize_radical()) # here is sqrt(EG-F^2)
4cos(u)+6\renewcommand{\Bold}[1]{\mathbf{#1}}4 \, \cos\left(u\right) + 6
n = (q(u,v)/size).simplify_full() show(n) # the unit normal vector
(cos(u)cos(v),cos(u)sin(v),sin(u))\renewcommand{\Bold}[1]{\mathbf{#1}}\left(-\cos\left(u\right) \cos\left(v\right),\,-\cos\left(u\right) \sin\left(v\right),\,-\sin\left(u\right)\right)
norm(n).simplify_full() # another check, just because things get brittle and I get worried.
1

The Second Fundamental Form

Now we have enough data to compute the second fundamental form. We don't have script letters here, so I'm gonna cheat.

ell = n.dot_product(xuu) em = n.dot_product(xuv) en = n.dot_product(xvv) II = matrix(SR, 2,2, [ell, em, em, en]).simplify_full() show(II)
(2002cos(u)2+3cos(u))\renewcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rr} 2 & 0 \\ 0 & 2 \, \cos\left(u\right)^{2} + 3 \, \cos\left(u\right) \end{array}\right)

The Shape Operator

Product = I.inverse()*II S = Product.simplify_full() show(S)
(1200cos(u)2cos(u)+3)\renewcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rr} \frac{1}{2} & 0 \\ 0 & \frac{\cos\left(u\right)}{2 \, \cos\left(u\right) + 3} \end{array}\right)

Finally, curvatures

The Gaussian curvature is the determinant of the shape operator:

K = det(S) show(K)
cos(u)2(2cos(u)+3)\renewcommand{\Bold}[1]{\mathbf{#1}}\frac{\cos\left(u\right)}{2 \, {\left(2 \, \cos\left(u\right) + 3\right)}}

The mean curvature is half the trace of the shape operator:

H = (1/2)*S.trace() show(H)
cos(u)2(2cos(u)+3)+14\renewcommand{\Bold}[1]{\mathbf{#1}}\frac{\cos\left(u\right)}{2 \, {\left(2 \, \cos\left(u\right) + 3\right)}} + \frac{1}{4}

...and the principal curvatures are the eigenvaules of the shape operator. In this case, the matrix is diagonal, so these are easy to read off. But generally, one could use this command:

S.eigenvalues()
[cos(u)/(2*cos(u) + 3), 1/2]

and if for some reason that command won't work for you, you can always do it by hand:

p = S.characteristic_polynomial() show(p)
x2+(cos(u)2cos(u)+312)x+cos(u)2(2cos(u)+3)\renewcommand{\Bold}[1]{\mathbf{#1}}x^{2} + \left(-\frac{\cos\left(u\right)}{2 \, \cos\left(u\right) + 3} - \frac{1}{2}\right) x + \frac{\cos\left(u\right)}{2 \, {\left(2 \, \cos\left(u\right) + 3\right)}}
p.roots()
[(-1/4*sqrt((2*cos(u)/(2*cos(u) + 3) + 1)^2 - 8*cos(u)/(2*cos(u) + 3)) + 1/2*cos(u)/(2*cos(u) + 3) + 1/4, 1), (1/4*sqrt((2*cos(u)/(2*cos(u) + 3) + 1)^2 - 8*cos(u)/(2*cos(u) + 3)) + 1/2*cos(u)/(2*cos(u) + 3) + 1/4, 1)]
[elt[0].simplify_full().canonicalize_radical() for elt in p.roots()]
[cos(u)/(2*cos(u) + 3), 1/2]

Let's Make a Picture!

cm = colormaps.ocean def my_color(u,v): return float (5/6*(1 + 2*K.subs(u=u,v=v))) Surface = parametric_plot3d(x(u,v), (u,0,6.28),(v,0,3.14) , color=(my_color,cm))
show(Surface,aspect_ratio=[1,1,1])