Before solving the task, it is beneficial to read through the theory.

A spline is a smooth (that is a function which has derivatives of each order for all values in a domain of definition) function which constructed on a particular set of points. A cubic spline is a spline that is defined on a base of third-order polynomials.

The cubic splines are useful for interpolating and for generating an equally-spaced set of nodes as in the example.

**Step 1**

Find eight equally-spaced points on [0; 2pi] using formula:

xi = a + i(b-a)/n-1, where a = 0, b = 2pi, n = 8 and i is changing from 0 to (n-1).

**Step 2**

Construct a cubic spline through the calculated values.

You will have a system of seven third-order polynomials like this:

Si = ai + bi(x - xi) + ci(x-xi)2 + di(x-xi)3 in the interval [xi-1;xi]

**Step 3**

Find the coefficients ai, bi, ci, di.