英文:
partial derivatives of Scipy smooth spline not working
问题
spline = SmoothBivariateSpline(x, y, z, kx=3, ky=1)
splinedxx = spline.partial_derivative(2, 0)
这给了我以下错误:
File "C:\Users\xxxxx\AppData\Roaming\Python\Python39\site-packages\scipy\interpolate_fitpack2.py", line 988, in partial_derivative
newc, ier = dfitpack.pardtc(tx, ty, c, kx, ky, dx, dy)
dfitpack.error: ((0 <= nuy) && (nux < ky)) failed for the 7th argument nuy: pardtc:nuy=0
当我尝试第一阶导数时,也出现了相同的错误。我做错了什么?还是这是由我的数据引起的?
英文:
I tried to take the second x derivative of a fitted smooth spline in Scipy, like following:
spline = SmoothBivariateSpline(x,y,z,kx=3,ky=1)
splinedxx = spline.partial_derivative(2,0)
This give me following error:
File "C:\Users\xxxxx\AppData\Roaming\Python\Python39\site-packages\scipy\interpolate\_fitpack2.py", line 988, in partial_derivative
newc, ier = dfitpack.pardtc(tx, ty, c, kx, ky, dx, dy)
dfitpack.error: ((0 <= nuy) && (nux < ky)) failed for 7th argument nuy: pardtc:nuy=0
The same error is given when I try the first derivative. What did I do wrong? Or is it something caused by my data?
答案1
得分: 1
set ky=3
解决了问题。似乎 y 的顺序也需要大于对 x 的微分顺序。
英文:
set ky=3
solves the problem. It seems like the order of y also need to be greater than the order of differentiation on x.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论