问题标签 [quad]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
3 回答
768 浏览

python - 将 Python Quad 积分乘以浮点数

你好我对python很陌生,我正在尝试通过一组方程。我试图通过浮点数乘以四元积分的结果我的代码是:

我不断收到错误

我很不确定要做什么,我试过用def t1(t)lambda 函数替换,但又什么也没做。任何帮助都非常感谢,并在此先感谢您。

0 投票
1 回答
1690 浏览

python - python中scipy quad集成的问题

我对python很陌生,所以我希望我的措辞是有道理的。我目前正在尝试对一组方程进行建模,这些方程需要积分乘以浮点数。我仅从集成输出中获得了 Nan 输出,但我不知道为什么我的代码如下:

罪魁祸首似乎是方程 FI2 sp.iv(t2, s1) 中修改后的贝塞尔函数,它返回一个 Nan 值,但其他方程结果 Fk2 给出 0。有一段时间我收到以下错误:

但这已经停止了,现在我只得到 0.0 和 Nan。任何帮助都非常感谢我在这里迷路了。

0 投票
1 回答
1161 浏览

python - dblquad 的性能增益是否超过两倍四倍?

从 scipy 参考手册中,dblquad 在数学上等同于重复 quad 两次。最初,我认为 dblquad 必须比两倍 quad 具有性能优势(除了方法的便利性)。令我惊讶的是,似乎 dblquad 的性能更差。我从“SciPy 参考指南,版本 0.14.0”第 12-13 页中获取了一些示例,并进行了一些修改:

我的输出如下所示:

我们看到这两种方法产生相同的结果(确切的结果应该是 1、1/2、1/3、1/4)。但 dblquad 的表现更差。

有人对 dblquad 发生了什么有一些了解吗?我对 tplquad 和 nquad 也有同样的问题。

0 投票
1 回答
882 浏览

python - 如何定义integral.quad方法的不连续点序列

我有一个类似于狄拉克三角函数的被积函数。但它是有限的,而且基础非常狭窄。我需要整合它,但是四边形方法没有识别出这个奇点。

在查看 python 文档后:

:(浮点数,整数序列),可选。有界积分区间中的一系列断点,其中可能出现被积函数的局部困难(例如,奇异点、不连续点)。序列不必排序。

我试图定义奇点所在的点,但没有成功。

得到:

这个点怎么定义???

提前致谢!!!

0 投票
1 回答
176 浏览

python - scipy quad 仅使用 1 个细分并给出错误的结果

我想使用 quad 来获得高斯分布的平均值。我的第一次尝试和第二次尝试得到不同的结果。而 quad 的第二次尝试仅使用 1 个细分。

这是输出:

我犯了什么错误吗?

0 投票
0 回答
805 浏览

python - Integration of a function of two variables

I have a function func(rp,pi) for which I now have the values. I also have the values of rp and pi.

I now need to integrate this function within the limits of 0 to pi

enter image description here

How do I go about using quad from scipy to solve this? The doubt I have is, how does quad know that my integral limits are for pi and not rp?

I tried:

Here func is the list that has the values of the function. This does give me values, but I am not sure if this is right?

Here is download link to the file with rp,pi,func. The first column is rp, the second column is pi and the third column is func

0 投票
1 回答
41 浏览

matlab - 在matlab中使用quad时参数不足的错误

我以这种方式使用了 quad 函数:

但现在我的 F 函数改为:

我在其他循环中使用 Quad,所以每次迭代都有 y 值。

我试图以这种方式使用 Quad:

但我得到一个参数不足的错误。我能做些什么?

0 投票
2 回答
848 浏览

python - Python/Scipy - 与沿轴的四边形集成

我有一个二维数组。“xy”平面是从 (-1,-1) 到 (1,1) 的网格。我想在函数取决于点坐标的每个点计算和积分。

我知道对于离散数据,我可以使用 simps 或 trapz 并指定一个轴来整合(参见示例)。scipy.integrate.quad 是否可以在不使用如下所示的丑陋循环的情况下做到这一点?

0 投票
1 回答
1749 浏览

python - scipy.integrate.quad 在大范围内给出错误的结果

我试图整合两个“半”正态分布的总和。scipy.integrate.quad当我尝试在小范围内积分时工作正常,但在大范围内积分时返回 0。这是代码:

为什么会这样?

0 投票
1 回答
45 浏览

python - 将高斯与四边形积分时突然下降

我正在尝试将 u -> exp(-u²/2) 从 -infinity 集成到 x。当我绘制函数时,在 21 左右突然下降,在 36 左右下降到 0,而它应该大致恒定为 2.5。你怎么解释?

谢谢您的帮助!