# Numerical integration

### Numerical integration

Basic concepts: Riemann sum,

#### Lessons

Here are the three following ways to estimate the value of a definite integral with $n$ sub-intervals:

1) Midpoint Rule

$M_{n} = \int^b_a f(x)dx \approx \Delta x[f(x_{1})+f(x_{2})+...+f(x_{n-1})+f(x_{n})]$

Where $x_{i}$ is the midpoint of each interval.

2) Trapezoid Rule

$T_{n} = \int^b_a f(x)dx \approx \frac{\Delta x}{2} [f(x_{0})+2f(x_{1})+2f(x_{2})+...+2f(x_{n-1})+f(x_{n})]$

3) Simpsons Rule

$S_{n} = \int^b_a f(x)dx \approx \frac{\Delta x}{3} [f(x_{0})+4f(x_{1})+2f(x_{2})+...+2f(x_{n-2})+4f(x_{n-1})+f(x_{n})]$

If $f''$ is continuous from [$a, b$] and there is a value $M$ such that $|f''(x)| \leq M$ for all $x \in [a, b]$, then we can use the following formulas to calculate the error of the Midpoint and Trapezoid Rule:

1) Midpoint Rule Error Formula

$E_{M} \leq \frac{M(b-a)^{3}}{24n^{2}}$

2) Trapezoid Rule Error Formula

$E_{T} \leq \frac{M(b-a)^{3}}{12n^{2}}$

If $f^{(4)} (x)$ is continuous from $[a, b]$ and there is a value $K$ such that $|f^{(4)} (x)| \leq K$ for all $x \in [a, b]$, then we can use the following formulas to calculate the error of Simpsons Rule:

3) Simpson’s Rule Error Formula

$E_{S} \leq \frac{K(b-a)^{5}}{180n^{4}}$

Here is a formula that may be of use when calculating the points of interest in Trapezoid and Simpsons Rule:

$x_{i} = a + i\Delta x$

Where $x_{i}$ is the point of interest at $i$.

• 1.
Overview of Numerical Integration

- Midpoint, Trapezoid and Simpsons Rule

• 2.
Questions Regarding the Midpoint Rule

Approximate $\int^9_4 \sqrt{x} dx$ using Midpoint Rule with 5 sub-intervals.

• 3.
Approximate $\int^5_2 \frac{1}{2+x^{2}}$ using Midpoint Rule with 3 sub-intervals.

• 4.
Questions Regarding the Trapezoid Rule

Approximate $\int^1_0 e^{x} dx$ using Trapezoid Rule with 4 sub-intervals.

• 5.
Approximate $\int^5_1 x^{2} dx$ using Trapezoid Rule with 5 sub-intervals.

• 6.
Questions Regarding the Simpsons Rule

Approximate $\int^4_2 \sqrt{x-2} dx$ using Simpsons Rule with 4 sub-intervals.

• 7.
Approximate $\int^4_1 \ln (x^{2}) dx$ using Simpsons Rule with 6 sub-intervals.

• 8.
Questions Regarding Error Bounds

Let $f(x) = e^{x^{3}}$ consider $\int^1_0 e^{x^{3}} dx$. Assume you know that $|f''(x)| \leq 15e$ and $|f^{(4)}| \leq 585e$ for all $x \in [0, 1]$. If $n$ = 10, then find the following errors:

a)
$E_{M}$

b)
$E_{T}$

c)
$E_{S}$
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 36, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.9933710098266602, "perplexity": 933.3097763153532}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 5, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2018-09/segments/1518891817523.0/warc/CC-MAIN-20180225225657-20180226005657-00599.warc.gz"}