Find limit of integral with given value

69 Views Asked by At

We have a given equation:

$$\int_0^\alpha f(x)\ dx = \theta$$

with $f(x)$ and $\theta$ given.

$$\theta>0,$$ $$f(x) > 0 \text{ for all } x$$

What would be the most generic way to calculate $\alpha$? Numerical methods are allowed.

If no generic way exists, how could we calculate it for eg. $f(x) = \sin^2 x + 1$?

3

There are 3 best solutions below

0
On BEST ANSWER

First of all, Welcome to the site !

As already said in comments and answers, most of the time, you will need a numerical method and Newton will be the simplest (just remember that $x=\cos(x)$ does not show solutions).

For sure, I admit that you have been able to compute the required antiderivative. $$\int f(x)\ dx =F(x) \implies\int_0^\alpha f(x)\ dx = \theta \implies F(\alpha)= F(0)+\theta $$

Starting for a reasonable guess $\alpha_0$, the method will update it according to $$\alpha_{n+1}=\alpha_{n}-\frac{F(\alpha_{n})-F(0)- \theta} {f(\alpha_{n})}$$

For the simle example you give, you have $$F(x)=\frac{3 }{2}x-\frac{1}{4} \sin (2 x)$$ which will give, after some trigonometric simplifications, $$\alpha_{n+1}=\alpha_{n}+\frac{ \sin (2 \alpha_{n} )-6 \alpha_{n}+4 \theta }{3-2 \cos (2 \alpha_{n} )}$$ and a simple guess could be $\alpha_0=\frac 23\theta$.

Let us try using $\theta=123.456$. Then, the iterates will be $$\left( \begin{array}{cc} n & \alpha_{n} \\ 0 & 82.3040000000000 \\ 1 & 82.4807566822034 \\ 2 & 82.4706953627373 \\ 3 & 82.4706617145300 \\ 4 & 82.4706617141536 \end{array} \right)$$

0
On

Let $F(\alpha) := \int_0^{\alpha} f(x) \, \mathrm{d}x - \theta$. You are looking for the zeroes of $F$. There are standard numerical methods to find zeroes of differentiable functions, e.g. bisection or Newton's method. Of course you would need numerical integration to evaluate $F$ unless you know the anti-derivative of $f$ like in your example case.

0
On

Let $$ g(\alpha) = \int_0^\alpha f(x) \,\mathrm{d}x \text{.} $$ You want to find zeroes of $g(\alpha) - \theta$.

First, you should determine whether there are any solutions. By the Fundamental Theorem of Calculus, $\frac{\mathrm{d}}{\mathrm{d}\alpha}g(\alpha) = f(\alpha)$. Since $f(x) > 0$ for all $x$, $g$ is a monotonically increasing function. Consequently, for a solution to exist, you must have $$ \lim_{\alpha \rightarrow -\infty} g(\alpha) < \theta < \lim_{\alpha \rightarrow \infty} g(\alpha) \text{.} $$ Generically, I would start with Gauss-Laguerre quadrature for these two integrals over semi-infinite intervals. Alternatively, use a change of variables to a finite interval and then use tanh-sinh quadrature.

If $\theta$ is not between the two limits, then there is no solution. Alternatively, there is a solution and we have shown there is an $\alpha \in (-\infty, \infty)$ such that $g(\alpha) = \theta$. Then since $\int_0^0 \dots = 0$, if $\theta = 0$, we report $\alpha = 0$ as the solution. If $0 < \theta$, the solution is in $(0,\infty)$, otherwise the solution is in $(-\infty, 0)$. If not finished, use exponential search to reduce the semi-infinite interval to a finite interval containing the solution, then use binary search to reduce that interval until you reach your precision and accuracy goals.

Note that there are many improvements that can be made if $f$ has particular features.

For your example, \begin{align*} f(x) &= 1 + \sin^2 x \\ g(\alpha) &= \int_0^\alpha \; 1+\sin^2 x \, \mathrm{d}x \\ \lim_{\alpha \rightarrow -\infty} g(\alpha) &= - \infty \\ \lim_{\alpha \rightarrow \infty} g(\alpha) &= \infty \end{align*} So regardless of $\theta$, there is an $\alpha$ in $(-\infty, \infty)$ such that $g(\alpha) = \theta$. Since $g(0) = 0$, if $\theta = 0$, report $\alpha = 0$ is the solution. Throughout the following. if an evaluation of $g$ yields $\theta$, report the argument to $g$ as the solution. Otherwise, for $\theta > 0$, start exponential search in $(0, \infty)$, and for $\theta < 0$, start exponential search in $(-\infty, 0)$. Since the two continuations are similar via reflection, we continue with $\theta > 0$. We have $\alpha \in (0, \infty)$. We test \begin{align*} g(1) &= 1.272\dots \\ g(2) &= 3.189\dots \\ g(4) &= 5.752\dots \\ g(8) &= 12.07\dots \\ &\vdots \\ g(2^k) &= \frac{1}{2} \left( 3 \cdot 2^k - \cos(2^k)\sin(2^k) \right) \end{align*} successively, until we find $k$ such that $g(2^{k-1}) < \theta < g(2^k)$. (For the generic term in that list, we have used the fact that $g(\alpha) = \frac{1}{2}(3\alpha - \cos \alpha \sin \alpha)$, although that this $g$ can be expressed in elementary terms is an accident of your choice of $f$ and should not be expected generally.) Now we know how long is the binary representation of the magnitude of $\alpha$. Binary search successively determines the less significant bits. Continue until you have reached your precision and accuracy goals.