<s>[INST] Calculate velocity vector along a curve (as a function of time) I have a curve defined by an equation: $y = f(x)$
In my case, the equation is a polynomial $y = ax^3 + bx^2 + cx + d$.
I also have $2$ boundary conditions. Point $A$ and Point $B$. I know the velocity and position of $A$ and $B$ and I know the time taken to travel from $A$ to $B$ along the curve. With some simple calculus I have been able to the determine the variables, $a$, $b$, $c$, $d$. This means I know $\dfrac{\dot{y}}{\dot{x}}= f'(x)$ and $y=f(x)$.
What I really want to know is position and velocity as a function on time:
\begin{align*}
  \dot{x} &= v_x(t) \\
  \dot{y} &= v_y(t) \\
  x &= x(t) \\
  y &= f(x(t))
\end{align*}
How would I determine this for either my polynomial or for an equation $y=f(x)$?
 [/INST] Using cubic spline:
\begin{align*}
  p(x) &=
   \frac{x-b}{a-b}f(a)+\frac{x-a}{b-a}f(b) \\
  & \quad +
  (x-a)(x-b)\left \{
              \frac{x-b}{(a-b)^{2}} \left[ f'(a)-\frac{f(a)-f(b)}{a-b} \right]+
              \frac{x-a}{(b-a)^{2}} \left[ f'(b)-\frac{f(b)-f(a)}{b-a} \right]
            \right \} \\[5pt]
  p'(x) &=
  \frac{x-b}{a-b}f'(a)+\frac{x-a}{b-a}f'(b)+
  3(x-a)(x-b)\left \{
               \frac{f'(a)+f'(b)}{(b-a)^2}-\frac{2[f(b)-f(a)]}{(b-a)^3}
             \right \}
\end{align*}

Note that $p(x) \equiv f(x)$ if $f(x)$ is a cubic (or lower) polynomial, else $p(x)$ is just an interpolating polynomial.

Boundary conditions:


*

*$A=\begin{pmatrix} a \\ f(a) \end{pmatrix}$

*$B=\begin{pmatrix} b \\ f(b) \end{pmatrix}$

*$\boldsymbol{v}_A=\dfrac{v_A}{\sqrt{1+f'(a)^2}}
    \begin{pmatrix} 1 \\ f'(a) \end{pmatrix}$

*$\boldsymbol{v}_B=\dfrac{v_B}{\sqrt{1+f'(b)^2}}
    \begin{pmatrix} 1 \\ f'(b) \end{pmatrix}$
where $y$ is a single-valued function of $x$.

Caution:
  $a$, $b$ here are NOT the coefficients of the cubic polynomial but two distinct boundaries.

In general for space curve,
\begin{align*}
  \boldsymbol{p}(t) &=
   \frac{t-b}{a-b}\boldsymbol{x}(a)+\frac{t-a}{b-a}\boldsymbol{x}(b) \\
  & \quad +
   (t-a)(t-b)
   \left \{
     \frac{t-b}{(a-b)^{2}}
     \left[
       \boldsymbol{x}'(a)-\frac{\boldsymbol{x}(a)-\boldsymbol{x}(b)}{a-b}
     \right]+
     \frac{t-a}{(b-a)^{2}}
     \left[
       \boldsymbol{x}'(b)-\frac{\boldsymbol{x}(b)-\boldsymbol{x}(a)}{b-a}
     \right]
   \right \}
\end{align*}
</s>