Scipy平滑样条的偏导数不起作用。

huangapple go评论54阅读模式
英文:

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 &quot;C:\Users\xxxxx\AppData\Roaming\Python\Python39\site-packages\scipy\interpolate\_fitpack2.py&quot;, line 988, in partial_derivative
newc, ier = dfitpack.pardtc(tx, ty, c, kx, ky, dx, dy)
dfitpack.error: ((0 &lt;= nuy) &amp;&amp; (nux &lt; 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.

huangapple
  • 本文由 发表于 2023年3月7日 05:56:42
  • 转载请务必保留本文链接:https://go.coder-hub.com/75656192.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定