如何将Bessel功能与可变边界集成?

发布于 2025-02-03 05:48:33 字数 534 浏览 2 评论 0原文

简而言之,我试图绘制此功能: 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 技术交流群。

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文