1
$\begingroup$

I would like to interpolate a set of points in the real plane $(x_i,y_i), \ 1\leq i \leq n$ with specified end derivatives up to the second order. That is finding $f \in \mathcal{C}^2(\mathbb{R},\mathbb{R})$ such that $$ \forall 1 \leq i \leq n, \ f(x_i)=y_i $$ $$ f'(x_1^+) = a, \ f'(x_n^-) = b$$ $$ f''(x_1^+) = c, \ f''(x_n^-) = d$$

Using cubic splines I can either fix first or second order end derivatives but not both. Is there another family of interpolation functions that would solve my problem ?

$\endgroup$

1 Answer 1

1
$\begingroup$

Splines of all degrees exist and are fairly easy to compute (just by solving linear equations). The simplest interpolant would just be a polynomial -- what CAD people call a Bezier curve.

You have $n+4$ constraints, (the $n$ points plus four end conditions), so you will need a polynomial thta has $n+4$ coefficients, which means it will have degree $n+3$. Call it $f$, and call its coefficients $p_1, p_2, \ldots , p_{n+4}$. The equations you wrote give you $n+4$ linear equations that you can solve for $p_1, p_2, \ldots , p_{n+4}$.

There are some numerical difficulties, so, if you write code to do this, you need to be a bit careful.

$\endgroup$
2
  • $\begingroup$ I see, you get a confluent Vandermonde matrix that you can invert, given that abscissae are different from each other. Thanks a lot ! $\endgroup$
    – vanna
    Commented Jun 4, 2012 at 8:49
  • $\begingroup$ Yes. The Vandermonde matrix is the source of the "difficulties" I mentioned. Numerically, it's very badly conditioned. It's far better to do the computations using some other basis functions (rather than polynomials expressed in the power basis). Bernstein or Chebyshev polynomials are much better, for example. But, you shouldn't be writing this code yourself, anyway. It should be easy to find existing software. $\endgroup$
    – bubba
    Commented Jun 5, 2012 at 0:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .