Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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 !

like image 344
user1845261 Avatar asked Nov 04 '22 10:11

user1845261


1 Answers

See the manual:

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

Note parameter der.

like image 175
pv. Avatar answered Nov 09 '22 08:11

pv.