Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm attempting to understand how B-Spline derivatives work.

To do this, i've generated some data in MATLAB to plot sin(x) over 0 - 2*pi. I then use the splinetool to fit an order 2 spline to the data which it fits perfectly. However, when I look at the 1st derivative of this sine wave data it's max is 0.017 and it's min is -0.017.

I don't understand why the derivative of this data doesn't give exactly cos(x) with a max and min of 1, -1. Any insights please?

share|cite|improve this question
Unless you specified that the derivatives of your B-spline take specific values and derivatives at specific points, in general you cannot expect your B-spline to take the exact same values as the function you're approximating at points other than the points you derived your B-spline from. – J. M. Nov 29 '10 at 0:23
The data points should be disclosed. Suppose a spline interpolates at the three points x = 0, pi, 2pi? – hardmath Nov 29 '10 at 0:41
up vote 1 down vote accepted

A B-spline of order 2 is a continuous piecewise-linear function that interpolates between the assigned data points ("knots").

If the slopes of such a function vary between +0.017 and -0.017 on the interval $[0,2\pi]$, then by the Mean Value Theorem there cannot be more than $0.034\pi$ or about 0.1 between the minimum and maximum function values.

So either there are no data points near the minimum and maximum of $sin(x)$ on this interval or else some error has been made in computation (perhaps a mistake in scaling the x-axis that stretches everything out).

share|cite|improve this answer
Turns out it was an error in scaling, thanks...I was converting degrees to radians for the sin function, then plotting with degrees. So thats why I got 0.017 (pi / 180) as my max. – Projectile Fish Dec 1 '10 at 2:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.