不可微函数的样条?

发布于 2024-07-25 05:59:46 字数 228 浏览 4 评论 0原文

我有一个有时在某一点不可微的函数。 当我现在使用样条曲线(degrafa 中的 Bezierspline)进行插值时,此时的插值无法按预期工作(此时我的函数有一个问题)。 现在,当使用样条线进行插值时,它会围绕该点绘制某种循环。 我认为发生这种情况是因为样条曲线需要函数的导数,而此时函数的导数并不唯一。

是对的吗? 在这种情况下你会建议我做什么?

预先感

谢塞巴斯蒂安

I have a function that sometimes is non-differentiable at a point. When I now use a spline (Bezierspline in degrafa) for interpolation the interpolation at this point does not work as expected (at this point my function has a kink). Now when interpolating with a spline it draws some kind of loop around this point. I think this happens because the spline needs the derivatives of the functions which is not unique at this point.

Is that right? What would you advise me to do in this case?

Thanks in advance

Sebastian

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

下壹個目標 2024-08-01 05:59:46

你无法计算“扭结”的梯度(正如你雄辩地说的那样)。 如果你确实需要在这样的点 (x) 处的梯度,我只需对 (xd) 和 (x+d) 处的梯度进行平均,其中 d 是一个足够小的增量。 它与您可能得到的任何其他单一答案一样在数学上有效。

例如,函数:

f(x) = |x|

将生成:

\   |   /
 \  |  /
  \ | /
   \|/
----+----

其中原点 (0,0) 处没有梯度。 但是,对 -0.0001(梯度 = -1)和 +0.0001(梯度 = +1)的梯度求平均值将得到零梯度(平线)。

对于在 (xd) 和 (x+d) 处产生非对称梯度的其他方程,这应该给出一个半不错的答案。

由于它已获得麻省理工学院的许可,我要做的就是修改源代码,以允许贝塞尔样条线使用 +/- delta 方法来计算非连续点处的梯度。 如果您认为值得添加,甚至可以将源代码更改推迟给开发人员。

You can't calculate the gradient of a "kink" (as you so eloquently put it). If you really need a gradient at such a point (x), I'd just average the gradient at (x-d) and (x+d) where d is a small enough delta. It's as mathematically valid as any other single answer you're likely to get.

For example, the function:

f(x) = |x|

will produce:

\   |   /
 \  |  /
  \ | /
   \|/
----+----

where there is no gradient at the origin (0,0). However, averaging the gradients at -0.0001 (gradient = -1) and +0.0001 (gradient = +1) will give you a gradient of zero (flat line).

This should give a half-decent answer for other equations that produce non-symmetrical gradients at (x-d) and (x+d) as well.

What I would do, since it's licensed under MIT, is to modify the source to allow an option for the Bezierspline to use that +/- delta method to calculate gradients at the non-continuous points. Maybe even push back the source changes to the developers if you think it's a worthwhile addition.

怎言笑 2024-08-01 05:59:46

听起来不错。 我已经有一段时间没有研究样条线了,但我很确定如果函数不连续,你的样条线在相同的点也应该是不连续的。 尽管我已经看到插值法在这一点上给出了近似曲线...如果没有其他人提出更好的答案,我会检查我的教科书。

但循环是一个很好的尝试。 对你的职能表示敬意。

That sounds right. It's been a while since I've looked at splines, but I'm pretty sure if the function is not continuous, your spline should also be discontinuous at the same points. Although I have seen interpolations that give an approximate curve at such a point... I'll check my text-books if no one else comes up with a better answer.

But a loop is a pretty good attempt. kudos to your function.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文