Following Example 24.2.3, plot an approximating cubic spline for the data \((k, \tan^{-1} k)\text{,}\)\(k=-5, -4, \dots, 5\text{.}\) For comparison, also plot the actual function \(y=\tan^{-1} x\) on the interval \([-5, 5]\text{.}\) How accurate is the approximation? Plot the difference of the spline and arctangent to answer this question.
This produces a normalized histogram of \(10^7\) sample sums, with \(k\) numbers in each sample. The numbers are chosen from uniform distribution on \([-1/2, 1/2]\text{.}\) Normalization means that the area under the histogram is 1 (in probability terms, this histogram approximates the probability density function of sample sums, hence the option “pdf”.)
What should the value \(k\) be in order for the histogram to resemble the cardinal B-spline of degree 3 shown in Figure 24.2.1? Find the answer experimentally after trying a few values of \(k\text{.}\) Having found a suitable \(k\text{,}\) confirm your guess by adding the graph of the cardinal spline to the histogram plot (recall hold on / hold off are useful for combining graphs.)