python中的数值微分。
primelab的Python项目详细描述
python的数值微分方法,包括:
- 使用任意窗口大小的对称有限差分格式。在
- 具有独立左右窗参数的任意多项式阶Savitzky-Galoy导数。在
- 带可选滤波器的光谱导数。在
- 任意阶样条导数。在
- 多项式趋势滤波导数推广方法,如全变分导数。在
这些例子旨在综述一些常见的微分方法。这个软件包的目标是将这些常见的差异化方法绑定到一个易于实现的差异化接口上,以鼓励用户适应。在
用法:
fromprimelabimportdxdtimportnumpyasnpt=np.linspace(0,2*np.pi,50)x=np.sin(x)# Finite differences with central differencing using 3 points.result1=dxdt(x,t,kind="finite_difference",k=1)# Savitzky-Golay using cubic polynomials to fit in a centered window of length 1result2=dxdt(x,t,kind="savitzky_golay",left=.5,right=.5,order=3)# Spectral derivativeresult3=dxdt(x,t,kind="spectral")# Spline derivative with smoothing set to 0.01result4=dxdt(x,t,kind="spline",s=1e-2)# Total variational derivative with regularization set to 0.01result5=dxdt(x,t,kind="trend_filtered",order=0,alpha=1e-2)
项目参考:
[1]实验数据的数值微分:局部和全局方法-K.Ahnert和M.Abel
[2]噪声、非光滑数据的数值微分-Rick Chartrand
[3]广义LASSO-R.J.Tibshirani和J.Taylor的解路径
- 项目
标签: