6

I wish to solve for the curvature and torsion functions $k_1 = \dfrac{1}{1+s^2}, k_2 = \dfrac{s}{1+s^2}$ using the Frenet Serret system and obtain the parametric equations for the curve. I need the explicit equations rather than a plot.

How do I go about this??I am completely new to Mathematica and the related questions here seem to suggest NDSolve, but that isn't helping me as I am not sure how to go about it. Can someone guide me through this??

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
Vishesh
  • 163
  • 6

1 Answers1

14

Okay, this'll be a short answer just to show what you can do. What you are trying for here is essentially an inverse to FrenetSerretSystem, which will give the curvature and basis vectors from the parametric equations.

We have these equations for the tangent vector, the normal vector, and the binormal vector

\begin{align} \dfrac{d\mathbf{T}}{ds} &= & \kappa \mathbf{N}, \ \dfrac{d\mathbf{N}}{ds} &= - \kappa \mathbf{T} & & + \tau \mathbf{B},\ \dfrac{d\mathbf{B}}{ds} &= & -\tau \mathbf{N}, \end{align}

These, combined with the equation for $\mathbf{r}$

$$\mathbf{T} = {d\mathbf{r} \over ds}$$

mean that the curve is completely determined by the curvature and torsion. But you still need the initial conditions, and I make those up below.

Familiarize yourself with the usage of NDSolve

?NDSolve

NDSolve[eqns,u,{x,xmin,xmax}] finds a numerical solution to the ordinary differential equations eqns for the function u with the independent variable x in the range xmin to xmax.

I'll just cut right to the chase,

sol = First@With[{κ = 1/(1 + s^2), τ = s/(1 + s^2)},
   NDSolve[{
     {t'[s], n'[s], b'[s]} ==
      {{0, κ, 0}, {-κ, 0, τ}, {0, -τ, 0}}.{t[
         s], n[s], b[s]},
     t[0] == Normalize[{1, 1, 1}],
     n[0] == Normalize[{-1, 1, 0}],
     b[0] == Cross[t[0], n[0]],
     t[s] == r'[s],
     r[0] == {1, 0, 0}},
    {t, n, b, r},
    {s, -300, 300}]
   ]

enter image description here

We get back interpolating functions for the various vectors involved. Now to visualize the results. I'm going to combine a ParametricPlot3D for $r$ with arrows for the other vectors. I'm going to scale the other vectors by a constant factor so they are visible on the curve.

Manipulate[With[
  {scale = 4},
  {rr, tt, bb, nn} = {r[s], t[s], b[s], n[s]} /. sol;

  Show[
   ParametricPlot3D[r[ss] /. sol, {ss, -30, 30}],
   Graphics3D[{
      {Directive[Red], Arrow[{rr, scale tt + rr}]},
      {Directive[Blue], Arrow[{rr, scale nn + rr}]},
      {Directive[Green], Arrow[{rr, scale bb + rr}]}},
     PlotRange -> Full
     ] /. sol
   ]
  ], {{s, -30}, -30, 30, .01}]

enter image description here

That example wasn't the most interesting because the curvature and torsion change too quickly with the parameter s. If we replace them with constants $(\kappa=5/26, \tau=1/26)$ we can get the classic helix

enter image description here

Or if we make the dependence on s much slower, $(\kappa = \dfrac{1}{1+.04s^2}, k_2 = \dfrac{.2s}{1+.04s^2})$ we get this cool plot

enter image description here

Analytic Solution with DSolve

Thanks to @EricTowers for pointing this out. I don't understand why it's true, but in order to get an analytic solution with DSolve it is necessary to not define the initial vectors.

sol = With[{κ = 5/26, τ = 1/26},
   DSolve[{
       {t'[s], n'[s], b'[s]} ==
         {{0, κ, 0}, {-κ, 0, τ}, {0, -τ, 
        0}}.{t[s],
              n[s], b[s]},
       t[0] == t0,
       n[0] == n0,
       b[0] == Cross[t[0], n[0]],
       t[s] == r'[s],
       r[0] == r0},
     {t[s], n[s], b[s], r[s]},
     s]
   ]
(* {{b[s] -> 
   1/52 E^(-((I s)/Sqrt[
     26])) (-I Sqrt[26] n0 + I Sqrt[26] E^(I Sqrt[2/13] s) n0 - 
      5 t0 - 5 E^(I Sqrt[2/13] s) t0 + 10 E^((I s)/Sqrt[26]) t0 + 
      t0\[Cross]n0 + E^(I Sqrt[2/13] s) t0\[Cross]n0 + 
      50 E^((I s)/Sqrt[26]) t0\[Cross]n0), 
  n[s] -> 1/
    52 E^(-((I s)/Sqrt[
     26])) (26 n0 + 26 E^(I Sqrt[2/13] s) n0 - 5 I Sqrt[26] t0 + 
      5 I Sqrt[26] E^(I Sqrt[2/13] s) t0 + I Sqrt[26] t0\[Cross]n0 - 
      I Sqrt[26] E^(I Sqrt[2/13] s) t0\[Cross]n0), 
  r[s] -> -(1/52) E^(-((I s)/Sqrt[
     26])) (130 n0 + 130 E^(I Sqrt[2/13] s) n0 - 
      260 E^((I s)/Sqrt[26]) n0 - 52 E^((I s)/Sqrt[26]) r0 - 
      25 I Sqrt[26] t0 + 25 I Sqrt[26] E^(I Sqrt[2/13] s) t0 - 
      2 E^((I s)/Sqrt[26]) s t0 + 5 I Sqrt[26] t0\[Cross]n0 - 
      5 I Sqrt[26] E^(I Sqrt[2/13] s) t0\[Cross]n0 - 
      10 E^((I s)/Sqrt[26]) s t0\[Cross]n0), 
  t[s] -> 1/
    52 E^(-((I s)/Sqrt[
     26])) (5 I Sqrt[26] n0 - 5 I Sqrt[26] E^(I Sqrt[2/13] s) n0 + 
      25 t0 + 25 E^(I Sqrt[2/13] s) t0 + 2 E^((I s)/Sqrt[26]) t0 - 
      5 t0\[Cross]n0 - 5 E^(I Sqrt[2/13] s) t0\[Cross]n0 + 
      10 E^((I s)/Sqrt[26]) t0\[Cross]n0)}} *)

and then we can plot it in much the same way,

ParametricPlot3D[
 r[s] /. sol /. {t0 -> Normalize[{1, 1, 1}], 
   n0 -> Normalize[{-1, 1, 0}], r0 -> {0, 0, 0}}, {s, -30, 30}]

enter image description here

And interestingly you can put this into FrenetSerretSystem to recover the curvature and torsion,

FrenetSerretSystem[
 First@(r[s] /. sol /. {t0 -> Normalize[{1, 1, 1}], 
     n0 -> Normalize[{-1, 1, 0}], r0 -> {0, 0, 0}}), s]
(* {{5/26, 1/26}, {{.....}}} *)

where I've ommitted the other vectors for brevity (too late for that now).

However, I still can't get an analytic solution for the non-constant curvature case in the OP, instead getting the error

Greater::nord: Invalid comparison with 1. -1. I attempted. >>

So in that case it's good that NDSolve works so well.

Jason B.
  • 68,381
  • 3
  • 139
  • 286
  • Thanks a lot for your response. I hope I dont have to ask questions like these in the future. I was looking for an analytic solution actually. Somehow everything seems complicated when I start off on a new software. – Vishesh Feb 12 '16 at 14:50
  • As an aside, could I still use DSolve to try and get an analytic solution? – Vishesh Feb 12 '16 at 14:51
  • 3
    No worries, I hope I didn't come across as too snarky with my comment above. This was fairly fun to do, I hope it helps get you on your way. Just play around with the stuff I've wrote to see what it does, how it can be changed and whatnot. – Jason B. Feb 12 '16 at 14:51
  • No, I felt nothing snarky. I need to learn to explore a bit more by myself before getting frustrated and asking for help the easy way. – Vishesh Feb 12 '16 at 14:53
  • 1
    I couldn't get DSolve to give me an answer, but you may be able to. I think if you tried the method on this page then you might be able to get a differential equation for r alone, but maybe not. – Jason B. Feb 12 '16 at 14:56
  • Yeah, the example there has only constants involved, so the differential equation is just good enough, whereas my curvature and torsion functions involve the independent variable in its second power, so maybe it is too much to expect an analytic solution. – Vishesh Feb 12 '16 at 14:58
  • 1
    So that's what you call a short answer... (+1) – Jens Feb 12 '16 at 16:34
  • 3
    Try: With[{κ = 5/26, τ = 1/26}, DSolve[{{t'[s], n'[s], b'[s]} == {{0, κ, 0}, {-κ, 0, τ}, {0, -τ, 0}}.{t[s], n[s], b[s]}, b[0] == Cross[t[0], n[0]], t[s] == r'[s], t[0] == t0, n[0] == n0, r[0] == r0, b[0] == t0 \[Cross]n0}, {t, n, b, r}, s]]) /. {Function[a_, b_] :> Function[a, Evaluate[FullSimplify[ComplexExpand[b]]]]} – Eric Towers Feb 12 '16 at 18:33
  • @EricTowers Thanks! I will give that a shot as soon as I'm back at my PC – Jason B. Feb 12 '16 at 19:03