We often need to evaluate the definite integral of a function that has no explicit anti-derivative or whoseanti-derivative is not easy to obtain. The basic method involved in approximating∫ baf(x) dx...







We often need to evaluate the definite integral of a function that has no explicit anti-derivative or whose


anti-derivative


is


not


easy


to


obtain.


The


basic


method


involved


in


approximating





b


a


f
(
x
)


dx


is


called


numerical quadrature.


It uses a sum


n



i
=0


a
i
f
(
x
i
) to approximate





b


a


f
(
x
)


dx
.


We


have


seen


one


such


method


from


Math


5A.


Recall


that


the


definite


integral


is


defined


as


a


limit


of


Riemann sums,


so any Riemann sum could be used as an approximation to the integral:


If we divide [
a,b
]


into


n


subintervals


of


equal


length



x


=


b



a


n


,


then


we


have





b


a


f
(
x
)


dx





n



i
=1


f
(
x

i


)∆
x
,


where


x

i


is


any


point in the


i
th subinterval [
x
i

1
,x
i
].


If


x

i


is chosen to be the left endpoint of the interval, then


x

i


=


x
i

1


and we have





b


a


f
(
x
)


dx



L
n


=


n



i
=1


f
(
x
i

1
)∆
x
.


If we choose


x

i


to be the right endpoint, then


x

i


=


x
i


and


we have





b


a


f
(
x
)


dx



R
n


=


n



i
=1


f
(
x
i
)∆
x


(as shown in the figure below).


In this project, we are going to discuss three more approximation rules:


Midpoint Rule, Trapezoidal


Rule and Simpson’s Rule
.


1


















Midpoint Rule


If


we


consider


the


case


where


x

i


is


chosen


to


be


the


midpoint



̄

x
i


of


the


subinterval


[
x
i

1
,x
i
].


Then


we


have





b


a


f
(
x
)


dx



M
n


= ∆
x
[
f
( ̄
x
1
) +


f
( ̄
x
2
) + +


···
+


f
( ̄
x
n
)]
,


where ∆
x


=


b



a


n


and



̄

x
i


=


1


2 (
x
i

1


+


x
i
)


As shown in the figure below


The following algorithm uses the Midpoint Rule on


n


subintervals to approximate


I


=





b


a


f
(
x
)


dx
:





INPUT


endpoints


a
,


b
; positive integer


n
.





OUTPUT


approximate solution


XI


to


I
.





Step 1


Set


h


=


b



a


n


.





Step 2


Set


XI


= 0;


Xbar


=


a


+


h


2


:


– Step 3


For


i


= 1
,
2
,
···
n


do Steps 4 to 6.


– Step 4


Set


XI


=


XI


+


f
(
Xbar
)


– Step 5


Set


i


=


i


+ 1


– Step 6


Set


Xbar


=


Xbar


+


h





Step 7


XI


=


XI



h
.





Step 8 OUTPUT
(XI) and


STOP
.


2


















Trapezoidal Rule


Another approximation is called the Trapezoidal Rule:





b


a


f
(
x
)


dx



T
n


=



x


2


[
f
(
x
0
)+2
f
(
x
1
)+2
f
(
x
2
)+
···
+2
f
(
x
n

1
+
f
(
x
n
)]
,


where ∆
x


=


b



a


n


and


x
i


=


a
+
i

x


The reason for the name Trapezoidal Rule can be seen from the figure below, which illustrates the case with


f
(
x
)



0 and


n


= 4.


The area of the trapezoid that lies above the


i
th subinterval is



x


(
f
(
x
i

1
) +


f
(
x
i
)


2


)


=



x


2


[
f
(
x
i

1
) +


f
(
x
i
)]


and if we add the areas of all these trapezoids, we get the right side of the Trapezoid Rule.


The following algorithm uses the Trapezoidal Rule on


n


subintervals to approximate


I


=





b


a


f
(
x
)


dx
:





INPUT


endpoints


a
,


b
; positive integer


n
.





OUTPUT


approximate solution


XI


to


I
.





Step 1


Set


h


=


b



a


n


.





Step 2


Set


i


= 1;


XI


=


f
(
a
) +


f
(
b
);


Xbar


=


a
:


– Step 3


While


i



n



1 do Steps 4 to 6:.


– Step 4


Set


Xbar


=


Xbar


+


h


– Step 5


Set


XI


=


XI


+ 2



f
(
Xbar
)


– Step 6


Set


i


=


i


+ 1





Step 7


XI


=


XI



h



0
.
5.





Step 8 OUTPUT
(XI) and


STOP
.


3


















Simpson’s Rule


The above rules for approximate integration results from using straight line segments to approximate a


curve.


(Left/Right


end


point


and


midpoint


use


line


segment


with


0


slope


while


Trapezoidal


Rule


uses


line


segment


with


slope


f
(
x
i
)



f
(
x
i

1
)


x
i



x
i

1


.


The


following


approximation


uses


parabolas


instead


of


straight


line


segments.


As before, we divide [
a,b
] into


n


subintervals of equal length


h


= ∆
x


=


b



a


n


, but this time we assume


that


n


is


an


even


positive


integer.


Then


on


each


consecutive


pair


of


intervals


we


approximate


the


curve


y


=


f
(
x
)





0


by


a


parabola


as


shown


below.


If


y
i


=


f
(
x
i
),


then


P
i
(
x
i
,y
i
)


is


the


point


on


the


curve


lying


above


x
i
.


A typical parabola passes through three consecutive points


P
i
,P
i
+1
,


and


P
i
+2
.


Although


we


assume


for


the


case


in


which


f
(
x
)





0,


it


is


a


reasonable


approximation


for


any


continuous


function


f


and


this


method


is


called


Simpson’s


Rule


after


the


English


mathematician


Thomas


Simpson.


Please notice that the pattern of coefficients in the formula below are 1
,
4
,
2
,
4
,
2
,
···


,
4
,
2
,
4
,
1.





b


a


f
()


dx



S
n


=



x


3


[
f
(
x
0
) + 4
f
(
x
1
) + 2
f
(
x
2
) + 4
f
(
x
3
) +


···
+ 2
f
(
x
n

2
) + 4
f
(
x
n

1
) +


f
(
x
n
)]


where


n


is even and ∆
x


=


b



a


n


.


The following algorithm uses the Simpson’s Rule on


n


subintervals to approximate


I


=





b


a


f
(
x
)


dx
:





INPUT


endpoints


a
,


b
; even positive integer


n
.





OUTPUT


approximate solution


XI


to


I
.





Step 1


Set


h


=


b



a


n


.





Step 2


Set X


odd=


a


+


h
; X


even=X


odd+
h
;


i


= 1


Set


XI


=


f
(
a
) +


f
(
b
);


– Step 3


While


i



n



1 do Steps 4 and 5:.


– Step 4


If


i


is odd, then set


XI


=


XI


+ 4



f
(X


odd); X


odd = X


odd + 2



h


else, set


XI


=


XI


+ 2



f
(X


even); X


even = X


even + 2



h
;


– Step 5


Set


i


=


i


+ 1





Step 7


XI


=


XI



h


3


.





Step 8 OUTPUT
(XI) and


STOP
.


4


















Please apply the methods introduced above to the following integrals:








2


1



x
3



1


dx








π/
2


0


3

1 + cos


x dx








3


1


e
1
/x


dx








3


1


sin


x


x


dx








3



1


1


8
πe

(
x

1)2


8


dx








3


1


e
x


x dx




































Nov 14, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here