1/cosh的Sympy符号FFT(x)
我正在尝试通过通过错误地计算出$ 1/cosh(x)$的符号FFT,
# %%
import sympy as sp
import numpy as np
import sympy.abc as spa
g = sp.fourier_transform(1/sp.cosh(spa.x), spa.x, spa.k)
print(g)
sp.plot(g)
但请继续遇到
> --------------------------------------------------------------------------- TypeError Traceback (most recent call
> last)
> ~\AppData\Local\Programs\Python\Python38-32\lib\site-packages\sympy\plotting\experimental_lambdify.py
> in __call__(self, args)
> 175 #The result can be sympy.Float. Hence wrap it with complex type.
> --> 176 result = complex(self.lambda_func(args))
> 177 if abs(result.imag) > 1e-7 * abs(result):
>
> ~\AppData\Local\Programs\Python\Python38-32\lib\site-packages\sympy\plotting\experimental_lambdify.py
> in __call__(self, *args, **kwargs)
> 271 def __call__(self, *args, **kwargs):
> --> 272 return self.lambda_func(*args, **kwargs)
> 273
>
> <string> in <lambda>(x0)
任何想法,这意味着什么?
I'm trying to compute the symbolic fft of $1/cosh(x)$ via
# %%
import sympy as sp
import numpy as np
import sympy.abc as spa
g = sp.fourier_transform(1/sp.cosh(spa.x), spa.x, spa.k)
print(g)
sp.plot(g)
but keep getting the error
> --------------------------------------------------------------------------- TypeError Traceback (most recent call
> last)
> ~\AppData\Local\Programs\Python\Python38-32\lib\site-packages\sympy\plotting\experimental_lambdify.py
> in __call__(self, args)
> 175 #The result can be sympy.Float. Hence wrap it with complex type.
> --> 176 result = complex(self.lambda_func(args))
> 177 if abs(result.imag) > 1e-7 * abs(result):
>
> ~\AppData\Local\Programs\Python\Python38-32\lib\site-packages\sympy\plotting\experimental_lambdify.py
> in __call__(self, *args, **kwargs)
> 271 def __call__(self, *args, **kwargs):
> --> 272 return self.lambda_func(*args, **kwargs)
> 273
>
> <string> in <lambda>(x0)
any ideas what this means?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在
isympy
会话中:我要抱怨不完整的追溯,但很长。您仍然离开了最后一个块,一个带有错误的错误
> code> print(g);你为什么不展示呢?请显示尽可能多的信息。它可以帮助我们中那些无法复制您的代码的人(目前)。
我以前从未使用过这个问题,但是即使我使用
subs
用数字替换变量,它仍然不会产生数字值。所以没有什么可绘的。In a
isympy
session:I was going to complain about an incomplete traceback, but it is very long. Still you left off the final block, the one with the error
You
print(g)
; why didn't you show that? Please show as much information as you can. It helps those of us who can't replicated your code (at the moment).I haven't worked with this before, but even if I use
subs
to replace the variables with numbers, it still doesn't yield a numeric value. So there's nothing to plot.