Download Introduction to Integration

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Horner's method wikipedia , lookup

Mathematical optimization wikipedia , lookup

Newton's method wikipedia , lookup

Root-finding algorithm wikipedia , lookup

False position method wikipedia , lookup

Transcript
Numerical Calculation
Part 3: Integration
Dr.Entesar Ganash
Introduction to Integration
Integration is a method to obtain the total by adding slices
Integration can be used to find area under the
curve of a function
dx to mean the Δx slices are approaching zero in width
Introduction to Integration
Indefinite Integral
(no specific values)
Definite Integral
(from a to b)
the Definite Integral can be found by calculating the Indefinite Integral at points a and b,
then subtracting:
Introduction to Integration
2
 2 x dx  ??????
1
Numerical Integration Methods:
1. Trapezoidal method
2. Simpson’s method
calculating the area of the shape
Trapezoidal Rule

The area under f(x) is divided into vertical section each of width h, called the step
length
if there is n panels then h= (b-a)/n.
If we join the points where successive panels cut f(x), we can estimate the area under
f(x ) as the sum of resulting trapezium.
n 1
h

I   f (a)  f (b)  2 f (a  ih )
2
i 1

Example
Write a program to find the value of the following function using
trapezoidal method, take n=60
1
2
x
 dx
0
Solving
program trap
Implicit none
integer :: i ! counter
real :: h, sum, x
integer :: n ! the number of panels
real:: a,b
! the start& end integration term
a=0.0
b=1.0
n=60
h = (b-a)/real(n)
sum = 0.5*(f(a) + f(b))
Do i=1,n-1
x = a + i*h
sum = sum + f(x)
end Do
sum = h*sum
print *,'The numerical trapezoidal value=',sum
CONTAINS
function f(t)
real ::f, t
f=t**2
end function f
end program trap
1
continue
Solving
The result:
Exercise
Write a program to find the value of the following function using trapezoidal
method, take n=64
5
sin 2 ( x)
1 x dx
References
•Hahn, B.D., 1994, Fortran 90 For Scientists and Engineers, Elsevier.
•http://www.mathsisfun.com/calculus/integration-definite.html
•http://www.mathsisfun.com/calculus/integration-introduction.html
•Univ.,