Compute the spline for the antiderivative (integral) of a given spline.
New in version 0.13.0.
Parameters: | tck : tuple of (t, c, k)
n : int, optional
|
---|---|
Returns: | tck_ader : tuple of (t2, c2, k2)
|
Notes
The splder function is the inverse operation of this function. Namely, splder(splantider(tck)) is identical to tck, modulo rounding error.
Examples
>>> from scipy.interpolate import splrep, splder, splantider, splev
>>> x = np.linspace(0, np.pi/2, 70)
>>> y = 1 / np.sqrt(1 - 0.8*np.sin(x)**2)
>>> spl = splrep(x, y)
The derivative is the inverse operation of the antiderivative, although some floating point error accumulates:
>>> splev(1.7, spl), splev(1.7, splder(splantider(spl)))
(array(2.1565429877197317), array(2.1565429877201865))
Antiderivative can be used to evaluate definite integrals:
>>> ispl = splantider(spl)
>>> splev(np.pi/2, ispl) - splev(0, ispl)
2.2572053588768486
This is indeed an approximation to the complete elliptic integral :
>>> from scipy.special import ellipk
>>> ellipk(0.8)
2.2572053268208538