user1845261
user1845261

Reputation: 117

How to compute the derivative of a cubic spline interpolation using scipy?

I have dataset which look like this :

position number_of_tag_at_this_position
3 4
8 6
13 25
23 12

I want to apply cubic spline interpolation to this dataset to interpolate tag density; to do so, i run :

import numpy as np
from scipy import interpolate`
x = [3,8,13,23]`
y = [4,6,25,12]`
tck = interpolate.splrep(x,y) # cubic`

And now, i would like to calculate the derivative of the function at each point of the interpolation, How can i do this ? Thanks for your help !

Upvotes: 5

Views: 3606

Answers (1)

pv.
pv.

Reputation: 35125

See the manual:

http://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.splev.html

Note parameter der.

Upvotes: 2

Related Questions