如何将Bessel功能与可变边界集成?
简而言之,我试图绘制此功能: f(x) 这是具有可变限制的集成。 到目前为止,我的代码是:
import scipy
import scipy.integrate as integrate
import numpy as np
import matplotlib.pyplot as plt
X = np.linspace(0,6,1000)
def bessel(z): return scipy.special.kv(5/3,z)
def F(x): return x * scipy.integrate.quad(bessel(x),x,np.inf)
plt.loglog(X,F(X))
一个错误,上面写着“一个以上元素的数组的真实价值是模棱两可的。” 我在MATLAB中进行了相同的集成,解决方案是使用“ ArrayFun”,Python中是否有类似的功能将F(X)应用于X的每个元素?
In short I am trying to plot this function:
F(x)
which is an integration with a variable limit.
My code so far is:
import scipy
import scipy.integrate as integrate
import numpy as np
import matplotlib.pyplot as plt
X = np.linspace(0,6,1000)
def bessel(z): return scipy.special.kv(5/3,z)
def F(x): return x * scipy.integrate.quad(bessel(x),x,np.inf)
plt.loglog(X,F(X))
with an error that says "The truth value of an array with more than one element is ambiguous."
I've done this same integration in matlab, and the solution was to use "arrayfun" is there a similar function in python that applies F(x) to every element of X?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论