# Numerical integration

0/1
##### Intros
###### Lessons
1. Overview of Numerical Integration

- Midpoint, Trapezoid and Simpsons Rule

0/9
##### Examples
###### Lessons
1. Questions Regarding the Midpoint Rule

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

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

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

1. Approximate $\int^5_1 x^{2} dx$ using Trapezoid Rule with 5 sub-intervals.
1. Questions Regarding the Simpsons Rule

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

1. Approximate $\int^4_1 \ln (x^{2}) dx$ using Simpsons Rule with 6 sub-intervals.
1. 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:

1. $E_{M}$
2. $E_{T}$
3. $E_{S}$

## Introduction to Numerical Integration

Numerical integration is a fundamental concept in mathematics and computational science, used to approximate the area under a curve or the definite integral of a function. The introduction video provides a comprehensive overview of this essential technique, laying the groundwork for understanding its applications and importance. Numerical integration becomes necessary when dealing with complex functions integration that are difficult or impossible to integrate analytically. It's particularly useful in scenarios where the function is only known at certain points or when the antiderivative cannot be expressed in closed form. Engineers, physicists, and data scientists frequently employ numerical integration to solve real-world problem solving, such as calculating volumes, work done by forces, or probability distributions. By breaking down the area into smaller, manageable pieces, numerical integration allows for accurate approximations of integrals, making it an indispensable tool in various fields of study and practical applications.

Understanding the definite integral of a function is crucial for mastering numerical integration techniques. Additionally, tackling complex functions integration can provide deeper insights into the behavior of different mathematical models. These skills are not only theoretical but also highly practical, aiding in real-world problem solving across various disciplines.

## Understanding the Need for Numerical Integration

Numerical integration is a crucial technique in mathematics and applied sciences, often necessary when traditional analytical methods fall short. The function e^(x^2) serves as an excellent example to illustrate why numerical integration is indispensable. This function, while seemingly simple, cannot be integrated using elementary functions, highlighting the limitations of traditional integration methods.

In calculus, we learn various techniques for integration, such as u-substitution, integration by parts, and partial fractions. However, these methods are not universally applicable. Some functions, like e^(x^2), resist these conventional approaches, leaving us without a closed-form antiderivative. This is where numerical integration steps in, offering a powerful alternative to overcome these challenges.

Numerical integration approximates the definite integral of a function by breaking it down into smaller, manageable pieces. This concept builds upon the foundation of the Riemann Sum, a method students typically encounter in introductory calculus courses. The Riemann Sum divides the area under a curve into rectangles and sums their areas to approximate the integral. Numerical integration techniques refine this idea, employing more sophisticated approximation methods to achieve greater accuracy.

While the Riemann Sum provides a basic understanding of area approximation, numerical integration methods like the Trapezoidal Rule, Simpson's Rule, and Gaussian Quadrature offer improved accuracy and efficiency. These techniques can handle complex functions that defy analytical integration, making them invaluable in scientific computing, engineering, and data analysis.

The case of e^(x^2) exemplifies why we need these numerical methods. Despite its innocent appearance, this function's integral cannot be expressed in terms of elementary functions. Attempting to integrate it analytically leads to a dead end. However, numerical integration allows us to compute definite integrals of this function with high precision, opening doors to solving problems in physics, statistics, and other fields where such integrals frequently appear.

Numerical integration not only solves problems that are analytically intractable but also provides practical advantages in computational efficiency. For many complex functions, even when an analytical solution exists, numerical methods can often produce results faster and with sufficient accuracy for real-world applications. This balance of speed and precision makes numerical integration an essential tool in modern scientific computing and engineering practices.

## The Midpoint Rule

The Midpoint Rule is a powerful numerical integration technique used to approximate the definite integral of a function. This method is derived from the Middle Riemann Sum and offers a more accurate estimation compared to left or right Riemann sums. The Midpoint Rule is particularly useful when dealing with complex functions that are difficult to integrate analytically.

At its core, the Midpoint Rule divides the area under a curve into subintervals and uses the function value at the midpoint of each subinterval to calculate the approximate area. The formula for the Midpoint Rule is:

[a to b] f(x) dx Δx * [f(x) + f(x) + ... + f(x)]

Where:

• a and b are the lower and upper limits of integration
• n is the number of subintervals
• Δx = (b - a) / n is the width of each subinterval
• x = a + (i - 1/2) * Δx is the midpoint of the i-th subinterval

The Midpoint Rule is derived from the Middle Riemann Sum by taking the limit as the number of subintervals approaches infinity. This refinement leads to a more accurate approximation of the definite integral.

To apply the Midpoint Rule, follow these steps:

1. Determine the integration limits (a and b) and the number of subintervals (n).
2. Calculate the width of each subinterval: Δx = (b - a) / n.
3. Find the midpoint of each subinterval: x = a + (i - 1/2) * Δx, where i ranges from 1 to n.
4. Evaluate the function f(x) at each midpoint.
5. Sum the function values at all midpoints.
6. Multiply the sum by Δx to get the final approximation.

The concept of subintervals is crucial in understanding the Midpoint Rule. By dividing the area under the curve into smaller sections, we can achieve a more accurate approximation. Each subinterval contributes a rectangular area to the total integral, with the height of the rectangle determined by the function value at the midpoint.

The use of midpoints is what sets this method apart from other Riemann sum techniques. By evaluating the function at the center of each subinterval, we capture a more representative value of the function over that range, leading to improved accuracy.

To illustrate the application of the Midpoint Rule, let's consider a step-by-step example:

1. Given: Integrate f(x) = x² from 0 to 2 using 4 subintervals.
2. Calculate Δx: (2 - 0) / 4 = 0.5
3. Find midpoints: x = 0.25, x = 0.75, x = 1.25, x = 1.75
4. Evaluate f(x) at midpoints: f(0.25) = 0.0625, f(0.75) = 0.5625, f(1.25) = 1.5625, f(1.75) = 3.0625
5. Sum the function values: 0.0625 + 0.5625 + 1.5625 + 3.0625 = 5.25
6. Multiply by Δx: 5.25 * 0.5 = 2.625

The Midpoint Rule approximation for this integral is 2.625, which

## The Trapezoid Rule

The Trapezoid Rule is a fundamental numerical integration technique used to approximate the definite integral of a function. This method offers improved accuracy compared to simpler methods like the Midpoint Rule, making it a valuable tool in various fields of mathematics and engineering. The Trapezoid Rule derives its name from the shape it uses to estimate the area under a curve: a series of trapezoids.

At its core, the Trapezoid Rule divides the area under a curve into multiple trapezoids, then calculates their combined area to approximate the integral. This approach provides a more accurate estimation than the Midpoint Rule, which uses rectangles for approximation. The increased accuracy stems from the Trapezoid Rule's ability to better account for the curve's shape at both endpoints of each subinterval.

The formula for the Trapezoid Rule is:

[a to b] f(x) dx (Δx/2) * [f(x) + 2f(x) + 2f(x) + ... + 2f(x) + f(x)]

Where:

• a and b are the lower and upper limits of integration
• n is the number of subintervals
• Δx is the width of each subinterval, calculated as (b-a)/n
• f(x), f(x), ..., f(x) are the function values at each point

One of the key features of the Trapezoid Rule formula is its coefficient pattern, which aids in memorization and application. The pattern is simple: the first and last terms (f(x) and f(x)) have a coefficient of 1, while all intermediate terms have a coefficient of 2. This pattern reflects the shared sides of adjacent trapezoids in the approximation.

The Trapezoid Rule finds extensive use in various scenarios where numerical integration is required. It's particularly useful when dealing with functions that are difficult or impossible to integrate analytically, or when only discrete data points are available. Some common applications include:

• Calculating the area under complex curves in physics and engineering
• Estimating the work done by a variable force in mechanics
• Computing volumes of irregular shapes in geometry
• Analyzing data in statistics and data science
• Solving differential equations in numerical analysis

While the Trapezoid Rule offers improved accuracy over the Midpoint Rule, it's important to note that it still introduces some error in its approximation. The error tends to decrease as the number of subintervals increases, allowing for more precise calculations at the cost of computational complexity. For functions with significant curvature, more advanced methods like Simpson's Rule may provide even better accuracy.

In conclusion, the Trapezoid Rule stands as a powerful and versatile tool in numerical integration. Its balance of simplicity and accuracy makes it an essential technique for students and professionals alike in fields requiring mathematical approximation. By understanding its formula, coefficient pattern, and applications, one can effectively leverage the Trapezoid Rule to solve a wide range of definite integral problems with confidence.

## Simpson's Rule: The Pinnacle of Numerical Integration

Simpson's Rule stands out as the most accurate among the three primary methods of numerical integration, surpassing both the Midpoint and Trapezoid Rules in precision. This high accuracy approximation technique is a cornerstone in calculus and numerical analysis, offering a superior approach to estimating the area under curves.

At its core, Simpson's Rule is based on approximating the integrand using quadratic functions, which allows it to capture the curvature of functions more effectively than its linear counterparts. The formula for Simpson's Rule is elegantly simple yet powerful:

ab f(x) dx (h/3) [f(x0) + 4f(x1) + 2f(x2) + 4f(x3) + 2f(x4) + ... + 4f(xn-1) + f(xn)]

Here, h represents the width of each subinterval, and n is the number of subintervals (which must be even). The distinctive feature of Simpson's Rule lies in its coefficient pattern: 1, 4, 2, 4, 2, ..., 4, 1. This pattern is crucial for its enhanced accuracy, as it weights the function values to better approximate the curve's shape.

The superiority of Simpson's Rule over the Midpoint and Trapezoid Rules becomes evident in its ability to exactly integrate polynomials up to degree three. This means it can perfectly calculate the area under curves such as parabolas and cubic functions, a feat neither the Midpoint nor Trapezoid Rule can achieve. For functions of higher degrees, Simpson's Rule still provides remarkably accurate approximations, often with significantly less error than its counterparts.

The key difference between Simpson's Rule and the other methods lies in its use of quadratic approximations. While the Midpoint Rule uses constant functions and the Trapezoid Rule uses linear functions to approximate the curve between points, Simpson's Rule employs parabolic arcs. This allows it to capture the curvature of the function more accurately, resulting in better approximations, especially for functions with significant curvature.

When should one use Simpson's Rule? It's particularly advantageous when dealing with smooth, continuous functions, especially those with significant curvature. In scenarios where high precision is crucial, such as in engineering calculations, physics simulations, or financial modeling, Simpson's Rule is often the go-to method. Its ability to provide accurate results with relatively few subintervals makes it computationally efficient, balancing accuracy with processing time.

The advantages of Simpson's Rule in approximating the area under curves are numerous. Firstly, its higher order of accuracy means it converges to the true value of the integral much faster as the number of subintervals increases. This rapid convergence is particularly beneficial when working with complex functions or when computational resources are limited. Secondly, Simpson's Rule is especially effective for functions that exhibit symmetry or periodic behavior, as its quadratic approximation can capture these characteristics well.

Moreover, Simpson's Rule shines in situations where the integrand is known only at discrete points and cannot be expressed as a continuous function. In such cases, its ability to interpolate between points using quadratic approximations proves invaluable. This makes it particularly useful in data analysis and experimental sciences, where measurements are often taken at regular intervals.

Despite its superiority, it's important to note that Simpson's Rule is not without limitations. It requires an even number of subintervals, which can sometimes be inconvenient. Additionally, for functions with sharp turns or discontinuities, even Simpson's Rule may struggle to provide accurate results without using a large number of subintervals.

In conclusion, Simpson's Rule represents the pinnacle of basic numerical integration techniques. Its unique coefficient pattern and quadratic approximation approach set it apart, offering unparalleled accuracy in estimating the area under curves. For those seeking high-precision numerical integration, especially for smooth, continuous functions, Simpson's Rule is an indispensable tool in the mathematical toolkit.

## Error Estimation in Numerical Integration

Numerical integration is a fundamental technique in computational mathematics used to approximate definite integrals when analytical solutions are difficult or impossible to obtain. However, these approximations inherently introduce errors. Understanding and estimating these errors is crucial for assessing the accuracy and reliability of numerical integration methods.

The concept of error in numerical integration refers to the difference between the true value of the definite integral and the approximated value obtained through numerical methods. This error arises from the discretization of the continuous function and the limitations of the chosen integration method. Estimating and controlling this error is essential for ensuring the validity of computational results in various scientific and engineering applications.

Three common numerical integration methods are the Midpoint Rule, Trapezoidal Rule, and Simpson's Rule. Each of these methods has associated error formulas that provide insights into their accuracy and limitations:

1. Midpoint Rule Error Formula:
E_m = -(b-a)^3 / (24n^2) * f''(ξ)
Where (b-a) is the integration interval, n is the number of subintervals, and f''(ξ) is the second derivative of the function at some point ξ in the interval.

2. Trapezoidal Rule Error Formula:
E_t = -(b-a)^3 / (12n^2) * f''(ξ)
This formula is similar to the Midpoint Rule but with a different constant factor.

3. Simpson's Rule Error Formula:
E_s = -(b-a)^5 / (2880n^4) * f^(4)(ξ)
Here, f^(4)(ξ) represents the fourth derivative of the function at some point ξ in the interval.

These error formulas rely on several important assumptions and requirements regarding the continuity of derivatives:

1. Continuity: The function being integrated must be continuous over the entire integration interval.

2. Differentiability: For the Midpoint and Trapezoidal Rules, the function must have a continuous second derivative. For Simpson's Rule, a continuous fourth derivative is required.

3. Boundedness: The relevant derivatives (second for Midpoint and Trapezoidal, fourth for Simpson's) must be bounded within the integration interval.

4. Existence of ξ: The error formulas assume the existence of a point ξ within the integration interval where the derivative takes on its maximum value.

These assumptions are crucial for the validity of the error estimates. In practice, verifying these conditions for complex functions can be challenging, and care must be taken when applying these error formulas to ensure their applicability.

Interpreting and using these error estimates in practical applications involves several key considerations:

1. Maximum Error Estimation: The error formulas provide an upper bound for the maximum error. In practice, the actual error is often smaller than this estimate.

2. Convergence Rate: The error formulas reveal the convergence rate of each method. For example, doubling the number of subintervals reduces the error by a factor of 4 for the Midpoint and Trapezoidal Rules, and by a factor of 16 for Simpson's Rule.

3. Method Selection: By comparing the error estimates, one can choose the most appropriate method for a given problem. Simpson's Rule generally provides higher accuracy for smooth functions.

4. Adaptive Integration: Error estimates can guide adaptive integration algorithms, where the subinterval size is adjusted based on local error estimates to achieve a desired overall accuracy.

5. Uncertainty Quantification: In scientific and engineering applications, error estimates contribute to uncertainty quantification, helping to assess the reliability of computational results.

6. Computational Efficiency: Understanding error behavior allows for optimizing the trade-off between accuracy and computational cost by choosing

## Practical Applications and Examples

Numerical integration plays a crucial role in various real-world scenarios, offering practical solutions to complex problems. Let's explore some examples and compare different methods to understand their applications and accuracies.

### Example 1: Calculating the Area of an Irregular Field

Suppose a farmer needs to determine the area of an irregularly shaped field. The field's boundary can be approximated by the function f(x) = 2x^2 + 3x + 1 from x = 0 to x = 4.

#### Midpoint Method:

1. Divide the interval [0, 4] into 4 subintervals.
2. Calculate the midpoint of each subinterval: 0.5, 1.5, 2.5, 3.5.
3. Evaluate f(x) at each midpoint.
4. Sum the results and multiply by the width of each subinterval (1).
5. Area 1 * [f(0.5) + f(1.5) + f(2.5) + f(3.5)] = 57.5 square units

#### Trapezoid Method:

1. Evaluate f(x) at x = 0, 1, 2, 3, and 4.
2. Apply the trapezoid formula: (b-a) * [f(a) + f(b)] / 2 for each subinterval.
3. Sum the results.
4. Area 58.33 square units

#### Simpson's Method:

1. Evaluate f(x) at x = 0, 1, 2, 3, and 4.
2. Apply Simpson's formula: (b-a) / 6 * [f(a) + 4f((a+b)/2) + f(b)] for each pair of subintervals.
3. Sum the results.
4. Area 58.67 square units

Comparing the results, we see that Simpson's method provides the most accurate approximation for this problem.

### Example 2: Calculating Power Consumption

An electrical engineer needs to determine the total energy consumed by a device over time. The power consumption is given by P(t) = 50 + 10sin(πt/12) watts, where t is in hours. Calculate the energy consumed over 24 hours.

#### Midpoint Method (with 6 subintervals):

Energy 1200.00 watt-hours

#### Trapezoid Method (with 6 subintervals):

Energy 1200.00 watt-hours

#### Simpson's Method (with 6 subintervals):

Energy 1200.00 watt-hours

In this case, all methods provide the same result due to the symmetry of the sine function over the given interval.

### Choosing the Appropriate Method

When selecting a numerical integration method, consider the following factors:

• Accuracy requirements: Simpson's method generally provides higher accuracy for smooth functions.
• Computational resources: The Midpoint and Trapezoid methods are simpler and may be preferred for quick estimations.
• Function complexity: For highly oscillatory functions, adaptive methods or higher-order techniques may be necessary.
• Available data points: The Trapezoid method is suitable when only endpoint

## Conclusion

Numerical integration is a powerful tool for approximating definite integrals, especially when analytical solutions are challenging. We've explored three main methods: the Rectangle Rule, Trapezoidal Rule, and Simpson's Rule. Each technique offers unique advantages in accuracy and computational efficiency. The introduction video provided a crucial foundation for understanding these concepts, highlighting their practical applications in various fields. To truly master numerical integration, further practice and exploration are essential. Consider applying these methods to real-world problems in physics, engineering, or economics. As you delve deeper, you'll discover more advanced techniques and their specific use cases. Remember, the choice of method depends on the function's complexity and desired accuracy. We encourage you to continue your journey in numerical analysis, experimenting with different approaches and comparing their results. By doing so, you'll develop a robust toolkit for solving complex integration problems in your academic and professional endeavors.

### Example:

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:

$E_{M}$

#### Step 1: Understanding the Problem

First, we need to understand the given problem. We are asked to find the error bound for the midpoint rule when approximating the integral $\int^1_0 e^{x^{3}} dx$. The function $f(x) = e^{x^{3}}$ is given, and we are provided with the bounds for the second and fourth derivatives of the function: $|f''(x)| \leq 15e$ and $|f^{(4)}(x)| \leq 585e$ for all $x \in [0, 1]$. Additionally, the number of subintervals $n$ is given as 10.

#### Step 2: Identifying the Error Formula for the Midpoint Rule

The error for the midpoint rule, denoted as $E_{M}$, can be approximated using the formula: $E_{M} \leq \frac{M(b - a)^3}{24n^2}$ where $M$ is the maximum value of the absolute second derivative of the function over the interval $[a, b]$, $a$ and $b$ are the limits of integration, and $n$ is the number of subintervals.

#### Step 3: Extracting Given Values

From the problem, we have the following values:

• $a = 0$
• $b = 1$
• $n = 10$
• $M = 15e$ (since $|f''(x)| \leq 15e$)

#### Step 4: Plugging Values into the Formula

Next, we substitute the given values into the error formula for the midpoint rule: $E_{M} \leq \frac{15e(1 - 0)^3}{24 \cdot 10^2}$ Simplifying the expression inside the formula: $E_{M} \leq \frac{15e \cdot 1}{24 \cdot 100}$ $E_{M} \leq \frac{15e}{2400}$ $E_{M} \leq \frac{15e}{2400}$

#### Step 5: Simplifying the Result

Finally, we simplify the fraction to get the error bound: $E_{M} \leq \frac{15e}{2400}$ $E_{M} \leq \frac{e}{160}$

#### Conclusion

Thus, the error bound for the midpoint rule when approximating the integral $\int^1_0 e^{x^{3}} dx$ with $n = 10$ subintervals is $\frac{e}{160}$. This means the actual error in the approximation will be less than or equal to this value.

### FAQs

1. What is numerical integration and why is it important?

Numerical integration is a method used to approximate the definite integral of a function when analytical solutions are difficult or impossible. It's important because it allows us to solve complex integration problems in various fields such as physics, engineering, and economics. Numerical integration is particularly useful for functions that are only known at certain points or when the antiderivative cannot be expressed in closed form.

2. What are the main methods of numerical integration?

The three main methods of numerical integration discussed are the Midpoint Rule (also known as the Rectangle Rule), the Trapezoidal Rule, and Simpson's Rule. Each method approximates the area under a curve by dividing it into smaller shapes (rectangles, trapezoids, or parabolic segments) and summing their areas. Simpson's Rule is generally the most accurate of these three methods.

3. How does Simpson's Rule differ from the Midpoint and Trapezoidal Rules?

Simpson's Rule uses quadratic approximations to estimate the area under a curve, while the Midpoint Rule uses rectangles and the Trapezoidal Rule uses trapezoids. This allows Simpson's Rule to capture the curvature of functions more effectively, resulting in higher accuracy, especially for smooth functions. Simpson's Rule can exactly integrate polynomials up to degree three, which neither the Midpoint nor Trapezoidal Rule can achieve.

4. How can I estimate the error in numerical integration?

Error estimation in numerical integration involves using specific formulas for each method. For example, the error formula for Simpson's Rule is E_s = -(b-a)^5 / (2880n^4) * f^(4)(ξ), where (b-a) is the integration interval, n is the number of subintervals, and f^(4)(ξ) is the fourth derivative of the function at some point ξ in the interval. These formulas provide an upper bound for the maximum error, helping assess the accuracy of the approximation.

5. What are some practical applications of numerical integration?

Numerical integration has numerous practical applications. It's used to calculate areas of irregular shapes (like in land surveying), determine energy consumption over time in electrical engineering, compute volumes of complex objects in manufacturing, analyze data in statistics and data science, and solve differential equations in physics and engineering. It's also crucial in financial modeling for calculating present and future values of cash flows.

### Prerequisite Topics for Numerical Integration

Understanding numerical integration requires a solid foundation in several key calculus concepts. One of the most fundamental prerequisites is the definite integral, which forms the basis for many numerical integration techniques. Mastering definite integrals allows students to grasp the concept of area under a curve, which is essential in numerical integration methods.

Another crucial prerequisite is the Riemann Sum. This concept serves as a stepping stone to numerical integration, as it introduces the idea of approximating the area under a curve using rectangles. Understanding Riemann sums helps students appreciate the fundamental principles behind various numerical integration techniques.

While not always directly used in numerical integration, knowledge of partial fractions integration can be beneficial. This technique enhances students' overall integration skills and problem-solving abilities, which are valuable when tackling complex numerical integration problems.

Integration by parts is another important prerequisite. Although numerical integration often deals with functions that are difficult or impossible to integrate analytically, understanding integration by parts provides insight into the structure of integrals and can be useful in certain numerical methods.

Lastly, familiarity with the average value of a function is valuable when studying numerical integration. This concept helps students interpret the results of numerical integration in real-world contexts and understand its applications in various fields.

By mastering these prerequisite topics, students build a strong foundation for understanding numerical integration. Each concept contributes to a deeper comprehension of how numerical methods approximate integrals and why these approximations are necessary in many practical situations. The definite integral provides the theoretical basis, while Riemann sums introduce the idea of approximation. Techniques like partial fractions and integration by parts enhance overall integration skills, and understanding the average value of a function helps in interpreting results.

As students progress in their study of numerical integration, they'll find that these prerequisite topics continually resurface, reinforcing their importance. The interconnectedness of these concepts with numerical integration highlights the cumulative nature of mathematical learning. By thoroughly grasping these prerequisites, students will be better equipped to tackle the challenges of numerical integration and appreciate its significance in solving real-world problems where analytical solutions are not feasible.

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$.