# 又来挖大坑了：Scipy数值分析

## 第一坑：插值算法

### interp1d

Specifies the kind of interpolation as a string (‘linear’, ‘nearest’, ‘zero’, ‘slinear’, ‘quadratic, ‘cubic’ where ‘slinear’, ‘quadratic’ and ‘cubic’ refer to a spline interpolation of first, second or third order) or as an integer specifying the order of the spline interpolator to use. Default is ‘linear’.

### interp2d

kind : {‘linear’, ‘cubic’, ‘quintic’}, optional The kind of spline interpolation to use. Default is ‘linear’.

### griddata

method : {‘linear’, ‘nearest’, ‘cubic’}, optional Method of interpolation. One of nearest return the value at the data point closest to the point of interpolation. See NearestNDInterpolator for more details. linear tesselate the input point set to n-dimensional simplices, and interpolate linearly on each simplex. See LinearNDInterpolator for more details. cubic (1-D) return the value determined from a cubic spline. cubic (2-D) return the value determined from a piecewise cubic, continuously differentiable (C1), and approximately curvature-minimizing polynomial surface. See CloughTocher2DInterpolator for more details.

### 其他函数

#### 众多的单变量样条

1. 五次以内的UnivariateSpline（这个一般不会经过所有点，根据s来定）：
1. 五次以内的InterpolatedUnivariateSpline，这个你一般不会用到，因为相当于UnivariateSpline在s=0的情况
1. 五次以内的LSQUnivariateSpline，这个当你需要操作knot的时候你会考虑用到

__call__(x[, nu, ext])	Evaluate spline (or its nu-th derivative) at positions x.
antiderivative([n])	Construct a new spline representing the antiderivative of this spline.
derivative([n])	Construct a new spline representing the derivative of this spline.
derivatives(x)	Return all derivatives of the spline at the point x.
get_coeffs()	Return spline coefficients.
get_knots()	Return positions of (boundary and interior) knots of the spline.
get_residual()	Return weighted sum of squared residuals of the spline approximation: sum((w[i] * (y[i]-spl(x[i])))**2, axis=0).
integral(a, b)	Return definite integral of the spline between two given points.
roots()	Return the zeros of the spline.
set_smoothing_factor(s)	Continue spline computation with the given smoothing factor s and with the knots found at the last call.


#### 应该提及的函数

scipy.interpolate.Rbf(*args) 用过SVM的不会不知道这个东东。

scipy.signal.resample 用来重采样，可以看做一种逼近

scipy.signal.bspline 返回贝塞尔样条的基函数，以后会专门提及这个

scipy.interpolate.lagrange 著名的但是并不常用的拉格朗日插值

scipy.interpolate.approximate_taylor_polynomial 泰勒展开的数值逼近

scipy.misc.pade(an, m) 函数的Pade逼近，这个必须再有一帖，不过不是Scipy的了。