Chapter 2. Interpolation and Approximation

Approximation theory states how to find the best approximation to a given function by another function from some predetermined class and how good this approximation is. In this chapter, we are going to explore this field through two settings: interpolation and least squares approximation.

Motivation

Consider a meteorological experiment that measures the temperature of a set of buoys located on a rectangular grid at sea. We can emulate such an experiment by indicating the longitude and latitude of the buoys on a grid of 16 × 16 locations, and random temperatures on them between say 36ºF and 46ºF:

In [1]: import numpy as np, matplotlib.pyplot as plt, \
   ...: matplotlib.cm as cm; \
 ...: from mpl_toolkits.basemap ...

Get Mastering SciPy now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.