# scipy.interpolate.LSQUnivariateSpline.integral¶

LSQUnivariateSpline.integral(a, b)[source]

Return definite integral of the spline between two given points.

Parameters: a : float Lower limit of integration. b : float Upper limit of integration. integral : float The value of the definite integral of the spline between limits.

Examples

>>> from scipy.interpolate import UnivariateSpline
>>> x = np.linspace(0, 3, 11)
>>> y = x**2
>>> spl = UnivariateSpline(x, y)
>>> spl.integral(0, 3)
9.0


which agrees with $$\int x^2 dx = x^3 / 3$$ between the limits of 0 and 3.

A caveat is that this routine assumes the spline to be zero outside of the data limits:

>>> spl.integral(-1, 4)
9.0
>>> spl.integral(-1, 0)
0.0


#### Previous topic

scipy.interpolate.LSQUnivariateSpline.get_residual

#### Next topic

scipy.interpolate.LSQUnivariateSpline.roots
{"ft_lang_label":"__label__en","ft_lang_prob":0.6854064,"math_prob":0.99595904,"size":719,"snap":"2021-21-2021-25","text_gpt3_token_len":210,"char_repetition_ratio":0.17062937,"word_repetition_ratio":0.037383176,"special_character_ratio":0.2976356,"punctuation_ratio":0.20408164,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9910645,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-05-05T21:04:03Z\",\"WARC-Record-ID\":\"<urn:uuid:6b276152-91cf-42d9-bd11-8d3fa555bf71>\",\"Content-Length\":\"9081\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:0cfcdbcb-a469-4b3a-9a0a-fa32b87039ae>\",\"WARC-Concurrent-To\":\"<urn:uuid:7baa8db9-c666-49d0-aac6-22de33b4f010>\",\"WARC-IP-Address\":\"50.17.248.72\",\"WARC-Target-URI\":\"https://docs.scipy.org/doc/scipy-0.18.0/reference/generated/scipy.interpolate.LSQUnivariateSpline.integral.html\",\"WARC-Payload-Digest\":\"sha1:O5UAZX4P7XRDLNRQ4FSKSM6YURNFB47X\",\"WARC-Block-Digest\":\"sha1:QTPDPTTHYLLDS35YSH3VPVJJCL6CSMCY\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-21/CC-MAIN-2021-21_segments_1620243988696.23_warc_CC-MAIN-20210505203909-20210505233909-00113.warc.gz\"}"}