You are on page 1of 18

UNIVERSITY OF GONDAR

INSTITUTE OF TECHNOLOGY
DEPPARTMENT OF COMPUTER
ENGINEERING
COMPUTETIONAL METHOD GROUP
ASSIGNMENT

No Name........................................................................ID
1 Melkamu Gobezie...............................................01255/14 submission date
2 Asmamaw Kassie................................................00727/14 18/10/2015 EC
3 Temesgen Molla ..................................................01322/14 submitted to
4 Dawit Degu...........................................................01926/14 Mr. Temesgen Geta
5 Ayichew Mulusew................................................02668//14 Gondar Ethiopia
contents
 Introduction to Numerical Differentiation and Integration
 Numerical Integration
 Simpson's 3/8 Rule
 Error of Simpson's 3/8 Rule
 methods for numerical integration
 Advantages and Disadvantages of Simpson's 3/8 rule
Numerical Differentiation
and Integration

Numerical Integration Simpson’s 3/8 Rule


( including Error of Simpson’s 3/8 Rule)

First, let's go over some basics.


 Numerical differentiation and numerical integration are techniques that
are commonly used in numerical analysis to approximate the values of
derivatives and integrals, respectively when an analytical solution is not
possible or practical.
 These methods involve using numerical algorithms to compute
approximations of the derivative or integral based on discrete data points.
Numerical Differentiation
and Integration

 Numerical integration is the process of finding the area under a curve


using computational methods.
 Numerical Derivatives represent the rate of change of a function at a
specific point and provide valuable information about the behavior of the
function.
 One method for numerical integration is Simpson's rule, it is also called
Simpson's second rule, is proposed by Thomas Simpson. It is
based upon a cubic interpolation rather than a quadratic
interpolation.
Simpson's 3/8 rule

 Simpson's 3/8 rule is a numerical integration technique used to approximate


the definite integral of a function over an interval [a,b].
 - In this method, the interval [a,b] is divided into sub-intervals of equal
width h = (b-a)/3, and the function f(x) is approximated by a third-degree
polynomial that passes through the four end points and the midpoint of
each sub-interval.
methods for numerical integration

There are several numerical methods commonly used to approximate derivatives.


Let's explore two of them: the forward difference approximation and the central
difference approximation.

1. Forward Difference Approximation:


The forward difference approximation estimates the derivative using the slope of
a secant line between two points. The formula for the forward difference
approximation of the derivative is:

f'(x) ≈ (f(x + h) - f(x)) / h

Here, h is a small step size or interval that determines the proximity of the points
used to calculate the slope. Smaller values of h generally result in more accurate
approximations, but too small a value may introduce numerical errors.
methods for numerical integration

2. Central Difference Approximation:


The central difference approximation provides a more accurate
estimate of the derivative by considering points on both sides of the
target point. The formula for the central difference approximation of the
derivative is:

f'(x) ≈ (f(x + h) - f(x - h)) / (2h)

Similar to the forward difference approximation, h represents the step


size. However, in the central difference approximation, two function
evaluations are used, resulting in higher accuracy compared to the
forward difference method.
formulas of Simpson's 3/8 rule
Simpson's 3/8 rule involves approximating the curve with a quadratic function
between each set of three data points and then computing the area under the
resulting parabolas
Simpson's 3/8 rule is as follows:

where h=(b-a)/3 is the step size.


error in Simpson's 3/8 rule

The error in Simpson's 3/8 rule is given by:

where ξ is some point in the


interval [a, b].
example

 here's an example problem that can be solved using Simpson's 3/8 rule:

 Find the approximate value of ∫[0,6] (2x^3+ 3) dx using Simpson's 3/8 rule.

 Here's how to solve this problem step-by-step:

 Step 1: Find h
 h = (b-a)/3 = (6-0)/3 = 2

 Step 2: Plug in the values of x


 x = 0, 2, 4, 6 into f(x) = 2x^3+ 3 to get f(0) = 3, f(2) = 19, f(4) = 131, and f(6) =
435
example

Step 3: Substitute the values into the Simpson's


3/8 formula
∫[0,6] (2x^3+ 3) dx ≈ 3(2)/8 [f(0) + 3f(2) + 3f(4)
+ f(6)]
= (6/8)( 3 + 3(19) + 3(131) + 435)
=666.00

Thus, the approximate value of the integral using


Simpson's 3/8 rule is 666.00
MATLAB CODE
• function I = simpson38(f, a, b)
• % The input arguments are:
• % f - The integrand as a function handle
• % a - The lower limit of integration
• % b - The upper limit of integration
• % The output of the function is:
• % I - The value of the definite integral
• % Check if the limits of integration are valid
• if a >= b
• error('The upper limit must be greater than the lower limit')
• end
• % Calculate the step size
• h = (b - a) / 3;
cont...
• % Calculate the values of the function at the four endpoints
• fa = f(a);
• fb = f(a + h);
• fc = f(a + 2*h);
• fd = f(b);
• % Calculate the value of the definite integral using Simpson's 3/8
rule
• I = (3*h/8)*(fa + 3*fb + 3*fc + fd);
• end
• Note that this code assumes that the integrand f is a function handle
that can be called using the MATLAB syntax f(x), where x is a scalar
or a vector.
cont...
• % Calculate the value of the definite integral using Simpson's 3/8
rule
• I = (3*h/8)*(fa + 3*fb + 3*fc + fd);
• end
• Note that this code assumes that the integrand f is a function handle
that can be called using the MATLAB syntax f(x), where x is a scalar
or a vector.
Advantages and Disadvantages of
Simpson's 3/8 rule
• Advantage
• Simpson's 3/8 rule is more accurate than the trapezoidal rule.
• The error of Simpson's 3/8 rule is of the order O(h^4), which means
that the error decreases as the step size h decreases.
• Simpson's 3/8 rule is relatively easy to implement.
Advantages and Disadvantages of
Simpson's 3/8 rule
• Disadvantage
• Simpson's 3/8 rule requires one more function evaluation than the
trapezoidal rule.
• Simpson's 3/8 rule is not as versatile as some other numerical
integration methods.
conclusion

The Simpsons 3/8 rule is generally considered to be more accurate than the simpler
Trapezoidal rule and the Simpsons 1/3 rule, but requires 3n evaluations of the
function f(x) in order to approximate the integral over n sub-intervals. it aslo easy to
implement.
Thank you!!!
Questions?

You might also like