I'm trying to do some very basic differential geometry of space curves. For example, a space curve $\gamma:\mathbb R\to\mathbb R^3$ has unit tangent and normal vectors given by $$t(s)=\frac{\gamma'(s)}{\lVert\gamma'(s)\rVert},\\ n(s)=\frac{t'(s)}{\lVert t'(s)\rVert}.$$ I want to define functions that would compute the tangent and normal vectors of an arbitrary curve at any $s$. I tried it in a higher-order functional style, like in say Haskell:
norm[x_] := Sqrt[x.x]
tangent[γ_] := Function[s, γ'[s]/norm[γ'[s]]]
normal[γ_] := Function[s, tangent[γ]'[s]/norm[tangent[γ]'[s]]]
(I need to define my own norm
because Mathematica doesn't like to differentiate Norm
.)
Unfortunately, this doesn't work. Let γ[s_] := {Cos[s], Sin[s], 0}
be our test curve, a circle. Then normal[γ][1] // N
does not return a vector, but instead a bizarre expression involving the dot product of 1.
and a vector. I have no idea how to begin figuring out what's going on.
I can do it in a less elegant way as
tangent[γ_, s_] := γ'[s]/norm[γ'[s]]
normal[γ_, s_] := D[tangent[γ, ss], ss]/norm[D[tangent[γ, ss], ss]] /. ss -> s
but this requires the use of a dummy variable and the not-so-pretty D[tangent[γ, ss], ss]
construction.
Why does my original implementation not work, and is there a simple way to fix it?
r[t]
a different curve it should work as well. $\endgroup$tangent
andnormal
for every curve I might be interested in. $\endgroup$