I'm interested in numerical analysis but I don't have experience on it. I was wondering how one can solve integral equations numerically like $\int_0^x e^{t^3}dt=4$? I was thinking whether there is some numerical differential equation solution method faster that finding some range $a\leq x\leq b$ and then splitting that range half and repeating.
-
For a simple solution, some variation of binary search comes to mind. Use some numeric integration method with a reasonable step ($\Delta x$); if after some iteration you come with a value greater then 4, decrease the step in half and repeat the iteration. – lisyarus Mar 16 '15 at 21:43
1 Answers
I will map out the approach and see if you can fill in the details.
We are asked to find the value of $x$ where:
$$\int_0^x e^{t^3}~dt = 4$$
We need two numerical approaches here. One to find the zeros of the function $f(x)$, Newton's Method, and one to estimate the integral, Composite Simpson or whichever integration rule you prefer, like Composite Trapezoidal or many others, above where:
$$f(x) = \displaystyle \int_0^{x}~ e^{t^3}~dt - 4 = 0$$
The derivative wrt $x$ of this function is:
$$f'(x) = e^{x^3}$$
The Newton-Raphson method is given by:
$$\displaystyle x_{n+1} = x_n - \dfrac{f(x_n)}{f'(x_n)} = x_n - \dfrac{\displaystyle \int_0^{x_n} e^{t^3}~dt - 4}{e^{x_n^3}}$$
At each iteration, we have to use the Composite Simpson's Rule to find the value of that integral for the next $x_n$.
$$s = \int_a^b f(x) \approx \dfrac{h}{3} \left( f(a) + f(b) + 4 \sum_{i=1}^{n/2}~f(a + (2i - 1)h)+2 \sum_{i=1}^{(n-2)/2} f(a+2 ih) \right)$$
Choose the initial starting point is $x_0$ with a desired accuracy of $\epsilon$.
The iterations will proceed as follows:
- $x_0 = x_0$
- Using Composite Simpson, with needed $n$: $s$ evaluated between $(0, x_0)$ gives $s = s_0$
- Using Newton's iteration: $x_1 = x_0 - \dfrac{f(x_0)}{f'(x_0)} = x_1$
- $s$ evaluated between $(0, x_1)$ gives $s = s_1$
- Continue this until the number of iterations converges to the desired accuracy.
The numerical approach should yield an $x \approx 1.39821$. Next, you can compare this to the exact result and validate we found the correct value of $x$.
Curious question, is it possible to calculate the value of $n$ for the desired accuracy apriori to doing the iterative steps when using these two numerical approaches? Probably (actually the answer is yes), but I will leave that for you to ponder.
Aside: We can also just use a numerical integrator and randomly try points and more easily bound the problem and then use a the procedure above to fine tune to the desired accuracy. It all comes down to computational complexity.
- 56,093
-
For the question at the end: yes you can, you just need an upper bound on the solution $x^*$. For a blunt approach, note that for $x=3$, a crude use of the rectangle rule shows that the integral is at least $e^8+e+1>4$. So the solution is between $0$ and $3$. Now any error estimate for $\int_0^3 e^{t^3} dt$ will carry over to $\int_0^x e^{t^3} dt$, provided the value of the step size $h$ stays the same or decreases. – Ian Mar 16 '15 at 21:45
-
@Ian: I suspected as much and realize it is possible, but have not worked out the details myself. Regards – Amzoti Mar 16 '15 at 21:52
-
Also, since it isn't hard to find that $1$ is a lower bound, you can precompute $\int_0^1 e^{t^3} dt$ to save some effort per step. (Both of these comments weren't so much directed to you as to the OP.) :) – Ian Mar 16 '15 at 21:53
-