So I happen to be working in a hobby side project which happens to be increasingly convoluted so now, naturally, I have come to the aid of the gurus.
It turns out that I am trying to solve the Frenet-Serret equations to find the curve, instead of the curvatures and torsions. Let $\bf T$, $\bf N$ and $\bf B$ be the Frenet frame vectors. And let us define the matrix $\bf Q$ to be
$ \bf Q = \left [ \begin{array}{c} \bf T \\ \bf N \\ \bf B \end{array} \right ] $
The Frenet-Serret equations can be defined as:
$ \left ( \frac{d}{ds} \right ) {\bf Q} = {\bf Q}' = {\bf F} \cdot {\bf Q} $
where
$ {\bf F}= \left [ \begin{array}{} 0 & \kappa & 0 \\ -\kappa & 0 & \tau \\ 0 & -\tau & 0 \end{array} \right ] $
I have the curvatures $\kappa(s)$ and torsions $\tau(s)$ for all $s$, they are continuous functions and I wish to find the curve that solves it. To do that, I put up a crude algorithm. I have little experience with solving differential equations in a computer, but I did not find libraries I could use to solve these equations in this fashion. So I kickstarted the Algorithm with some arbitrary starting conditions.
- ${\bf P}_0 = \bf 0$
- ${\bf T}_0 = [1,0,0]$
- ${\bf N}_0 = [0,1,0]$
- ${\bf B}_0 = {\bf T}_0 \times {\bf N}_0$
And then I started an iterative algorithm with termination conditions being the curve reaching a certain final length $S$. Each iteration increment the total length $S$ by means of small constant increments of $\delta s$. Each cycle goes like this:
- Assemble ${\bf Q}_i = \left [ \begin{array}{c} {\bf T}_i \\ {\bf N}_i \\ {\bf B}_i \end{array} \right ] $
Find the derivatives by means of ${\bf Q}_i' = {\bf F}(s) {\bf Q}_i$
Update the quantities by means of ${\bf Q}_i= {\bf Q}_{i-1} + {\bf Q}_{i-1}'$
- Update the curve by adding a new point ${\bf P}_i$ such that ${\bf P}_i = {\bf P}_{i-1} + {\bf T}_{i-1}$
This way I could, potentially, use a very small $\Delta s$ to approximate a trajectory which could be a sequence of points created by updating the starting point by means of the step 8 abov for a total length of trajectory. It $seems$ reasonable, but I suspect it might be just ignorance being bliss, because I implemented this in a simpe python algorithm and let it run, and the trajectory quickly explodes in huge coordinates, as if the particle has been going to extremes. Are those crazy coordinates a feature of the particular ${\bf F}$ matrix I am using, or is that ignorance comming up to say hi?
I thank all those who take their time to read this through and patiently correct me. I also thank those not so patient, I just want to know what is going wrong and why.
Thanksabunch!