scipy 1.8.0 Pypi GitHub Homepage
Other Docs
NotesParametersReturnsBackRef
antiderivative(self, n=1)

Notes

versionadded

Parameters

n : int, optional

Order of antiderivative to evaluate. Default: 1

Returns

spline : UnivariateSpline

Spline of order k2=k+n representing the antiderivative of this spline.

Construct a new spline representing the antiderivative of this spline.

See Also

derivative
splantider

Examples

>>> from scipy.interpolate import UnivariateSpline
... x = np.linspace(0, np.pi/2, 70)
... y = 1 / np.sqrt(1 - 0.8*np.sin(x)**2)
... spl = UnivariateSpline(x, y, s=0)

The derivative is the inverse operation of the antiderivative, although some floating point error accumulates:

>>> spl(1.7), spl.antiderivative().derivative()(1.7)
(array(2.1565429877197317), array(2.1565429877201865))

Antiderivative can be used to evaluate definite integrals:

>>> ispl = spl.antiderivative()
... ispl(np.pi/2) - ispl(0) 2.2572053588768486

This is indeed an approximation to the complete elliptic integral $K(m) = \int_0^{\pi/2} [1 - m\sin^2 x]^{-1/2} dx$ :

>>> from scipy.special import ellipk
... ellipk(0.8) 2.2572053268208538
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

scipy.interpolate._fitpack2.UnivariateSpline.derivative scipy.interpolate._fitpack2.UnivariateSpline.antiderivative

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /scipy/interpolate/_fitpack2.py#518
type: <class 'function'>
Commit: