'SciPy interpolation: precision of methods?

SciPy interpolation has 3 supported methods:

Supported are “linear” and “nearest”, and “splinef2d”. “splinef2d” is only supported for 2-dimensional data.

In Wikiversity, it is explained as a polynomial interpolation, and I think should be more precise than linear...

So 2 questions here:

  1. what is splinef2d? It is the one of wikiversity link?
  2. Which one of 3 avalaible methods is more precise in interpolation? nearest ,bilinear or splinef2d?


Solution 1:[1]

This requires a bit more digging in scipy. The splinef2d method is essentially fitting your data to a surface. The method you need to explore further is scipy.interpolate.bisplrep. This wraps around FITPACK's surffit subroutine. As far as I can tell the variables are of type real. With default compiler settings this means its real(kind=8) thus you are looking at double precision.This is expected to be contagious thus, python also deals with the same precision.

You can repeat the exercise now for QHull for details on LinearND interpolation. Based on what I see from their git repo, it seems to be of double precision.

On python's side, the variables are declared float and documentation says:

On a typical machine running Python, there are 53 bits of precision available for a Python float

About the precision of wrapped functions, by default python's float has double precision. See this answer.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1