{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Task 06\n", "\n", "**deadline: 11/04/2021 23:59 CET**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**[0.5 points]:** Write a function that calculates natural cubic spline interpolation of a given set of data points $ (x_i, y_i) $, $ i = 0, 1, \\dots, n - 1 $. The function returns a list of cubic splines in the form of `numpy.poly1d` so that the $ i $-th element of the list is the cubic spline interpolation in the interval $ [x_{i}, x_{i + 1}] $.\n", "\n", "**[0.5 points]:** Calculate the natural cubic spline interpolation of the following set of data points, \n", "\n", "$$\n", "(0, 0), \\ (1, 2), \\ (2, -1), \\ (3, 1) \n", "$$\n", "\n", "and plot the result. You may evaluate the correctness of your implementation using the [`scipy.interpolate.CubicSpline`](https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.CubicSpline.html) function with the `bc_type=\"natural\"` input argument." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "\n", "# add your code here\n" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.5" } }, "nbformat": 4, "nbformat_minor": 4 }