如何将曲线下的面积分成相等的段

How to divide area under a curve into equal segments

我正在尝试将以表格形式给出的曲线下的面积 分成相等的面积段。我必须求解以下积分并找到一组点 x_0,x_1,...,x_k,x_N 满足以下条件

不幸的是,我真的不知道如何为表格函数执行此操作。对于解析线性或二次函数,上述结果导致求解 x_k 的二次或三次方程。 我尝试迭代x_k的值,直到积分小于k/N。我从第一个固定值 x_0 开始,并尝试找到积分为 k/N 的 x_1,然后使用 x_1 作为新的下限并寻找 x_2 与相同的 属性.
我认为存在一种更有效的方法来做到这一点,这就是为什么我决定在这里询问专家的原因。 我会很感激你的想法。

如果不进一步了解函数 f(x),就不可能得到准确的正确答案。但是,我们可以使用 f(x) 的合理近似值并使用它,因此我们的答案也是合理的近似值。

积分中使用的一个常见近似值是梯形法则,我们假设函数在 x_i 的连续值之间是线性的,因此这些值之间的面积是梯形并且很容易计算。因此,让我们对 f(x) 进行相同的近似。假设给定的点是 (x[i], f(x[i])) 并且我们正在寻找 x 坐标 z[i].

算法将是(伪代码):

Sort the values (x[i], f(x[i])) by the first coordinate
if any of the neighboring x[i] are equal but the corresponding f(x[i]) are not:
    raise an error
Sum the trapezoidal areas to get the total area
Find the desired area between x-coordinates
Run through the x[i] and sum individual trapezoid areas
    When the summed area are greater than the desired area,
        Use interpolation to find z[i] between the x[i] that give the desired area

说的应该很清楚了。插值将是二次插值,应该足够简单。

根据您的评论,f 已知是非负的。此外,您给出的示例具有有界连续二阶导数。

假设您首先在 n 点(n 待定)和 gf的积分根据trapezoidal rule. Since f is non-negative, g is monotonically non-decreasing. Consequently, you can find the closest x point closest to the value of gmax / k via binary search的累积逼近,复杂度为Θ(log(n)).事实上,您只需执行 k 次即可。

请注意,您需要的近似值是 g,而不是 x。但是,使 n 足够大,可以确保对 x 的良好近似是对 g 的良好近似以及。为了确定n,可以使用known bounds on the error of the trapezoidal formula.