Python中两个函数的卷积
我必须在 Python 中实现两个函数的卷积,但 SciPy/Numpy 似乎仅具有用于两个数组卷积的函数。
在我尝试使用卷积的正则积分表达式来实现这一点之前,我想问是否有人知道执行这些操作的现有模块。
如果做不到这一点,SciPy 提供的几种集成中哪一种最适合此目的?
谢谢!
I will have to implement a convolution of two functions in Python, but SciPy/Numpy appear to have functions only for the convolution of two arrays.
Before I try to implement this by using the the regular integration expression of convolution, I would like to ask if someone knows of an already available module that performs these operations.
Failing that, which of the several kinds of integration that SciPy provides is the best suited for this?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,SciPy/Numpy 最关心的是数组。
如果您可以容忍近似解,并且您的函数仅在一定范围的值(不是无限)上运行,您可以用这些值填充数组并对数组进行卷积。
如果您想要更“正确”的微积分知识,您可能需要一个强大的求解器(mathmatica、maple...)
Yes, SciPy/Numpy is mostly concerned about arrays.
If you can tolerate an approximate solution, and your functions only operate over a range of value (not infinite) you can fill an array with the values and convolve the arrays.
If you want something more "correct" calculus-wise you would probably need a powerful solver (mathmatica, maple...)
如果您逐点需要,您可以尝试实现离散卷积。
You could try to implement the Discrete Convolution if you need it point by point.