Download as pdf or txt
Download as pdf or txt
You are on page 1of 15

ERRORS IN TRAPEZOIDAL RULE

SUBMITTED BY: MINAHIL IJAZ (BSF1700487)


MAHNOOR MUSHTAQ (BSF1700626)
KAINAT MUSHTAQ (BSF1700631)
NIMRA KHIZAR (BSF1700495)
ANAM FATIMA(BSF1700564)
KALSOOM RUBAB (BSF1600252)
SADAF IQBAL (BSF1700505)
SUBMITTED TO: DR. AROOJ ADEEL
PROGRAMME: BS MATHEMATICS (8TH SEMESTER)
COURSE: NUMERICAL ANALYSIS-II
COURSE CODE: MATH4118

UNIVERSITY OF EDUCATION BANK ROAD CAMPUS MAY 23,2021


CONTENTS
➢ Errors
❖ Difference between mistake and error
❖ Types of error
• Mistakes,
• Systematic errors,
• Accidental errors.
➢ Trapezoidal rule
❖ Formula of trapezoidal rule
❖ Definition
❖ Examples
➢ Errors in trapezoidal rule
❖ Derivation
❖ Examples
➢ Applications
➢ Conclusion
➢ References
ERRORS IN TRAPEZOIDAL RULE
What is error?
An error is a mistake or the state of being wrong.

Example
An example of an error is when you add 2+2 and get 5. An example of error is when a
mistake leads you to come to the wrong collusion and you continue to believe this
incorrect conclusion.

What is the difference between error and mistake?


A ' mistake ' is usually accidental, you know it is wrong. Otherwise, an ' error ' is usually
made due to the lack of knowledge and is more formal than 'mistake'. "Machines never
make mistakes, but rather they make errors.

Errors of measurement are of three kinds:


• Mistakes,
• Systematic errors,
• Accidental errors.

Mistakes
Mistakes are errors that arise from inattention, inexperience, carelessness and poor
judgment or confusion in the mind of the observer. If a mistake is undetected, it produces
a serious effect on the final result. Hence every value to be recorded in the field must be
checked by some independent field observation.

Systematic Error

A systematic error is an error that under the same conditions will always be of the same
size and sign. A systematic error always follows some definite mathematical or physical
law, and a correction can be determined and applied. Such errors are of constant
character and are regarded as positive or negative according as they make the result too
great or too small.

Accidental Error
Accidental errors are those which remain after mistakes and systematic errors have been
eliminated and are caused by a combination of reasons beyond the ability of the observer
to control. They tend sometimes in one direction and some times in the other, i.e., they
are equally likely to make the apparent result too large or too small.
An accidental error of a single determination is the difference between (1) the true value
of the quantity and (2) a determination that is free from mistakes and systematic errors.
Accidental error represents limit of precision in the determination of a value. They obey
the laws of chance and therefore, must be handled according to the mathematical laws
of probability.

What is Trapezoidal Rule?


Trapezoidal Rule is an integration rule, in Calculus, that evaluates the area under the
curves by dividing the total area into smaller trapezoids rather than using rectangles.
This technique is a much more accurate way to approximate area beneath a curve. To
construct the trapezoids, you mark the height of the function at the beginning and end of
the width interval, then connect the two points. However, this method requires you to
memorize a formula.
Another useful integration rule is the Trapezoidal Rule. Under this rule, the area under a
curve is evaluated by dividing the total area into little trapezoids rather than
rectangles.a = 𝑥0 < 𝑥1 < 𝑥2 < ⋯ < 𝑥𝑛 = b.
Definition
𝑏
Let f be continuous on[a, b]. The Trapezoidal Rule for approximating ∫𝑎 𝑓(𝑥)𝑑𝑥 is given
by
𝑏−𝑎
[𝑓(𝑎) + 2𝑓(𝑥1 ) + 2𝑓(𝑥2 ) + ⋯ + 2𝑓(𝑥𝑛−1 ) + 𝑓(𝑏)
2𝑛
The area of any trapezoid is one half of the height times the sum of the bases (the bases
are the parallel sides.) Recall the area formula. A = h/2( 𝑏1 + 𝑏2 ). The reason you see
all those 2's in the Trapezoidal Rule is that every base is used twice for consecutive
trapezoids except for the bases at the endpoints

QUESTION#1
𝟐
Evaluate∫𝟎 𝒚𝒅𝒙 from the following table using trapezoidal rule.

X 0 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 2.0
Y 1.21 1.37 1.46 1.59 1.67 2.31 2.91 3.83 4.01 4.79 5.31

SOLUTION
As we know that 𝑥0 = 0 , 𝑥1 = 0.2 , 𝑥2 = 0.4 , 𝑥3 = 0.6 , 𝑥4 = 0.8 , 𝑥5 = 1.0 , 𝑥6 =
1.2 , 𝑥7 = 1.4 ,
𝑥8 = 1.6 , 𝑥9 = 1.8 , 𝑥10 = 2.0 .
𝑦0 = 1.21 , 𝑦1 = 1.37 , 𝑦2 = 1.46 , 𝑦3 = 1.59 , 𝑦4 = 1.67 , 𝑦5 = 2.31 , 𝑦6 = 2.91 , 𝑦7 =
3.83 , 𝑦8 = 4.01 , 𝑦9 = 4.79 , 𝑦10 = 5.31 .
And ℎ = 0.2
The formula of trapezoidal rule is
2

∫ 𝑦𝑑𝑥 = [(𝑦 + 𝑦10 ) + 2(𝑦1 + 𝑦2 + 𝑦3 + 𝑦4 + 𝑦5 + 𝑦6 + 𝑦7 + 𝑦8 + 𝑦9 )]
2 0
0

Put values of 𝑦1 , 𝑦2 , 𝑦3 , 𝑦4 , … … … … 𝑦10 and h.


2 0.2
∫0 𝑦𝑑𝑥 = 2
[(1.21 + 5.31) + 2(1.37 + 1.46 + 1.59 + 1.67 + 2.31 + 2.91 + 3.83 +
4.01 + 4.79 + 5.31)]
2

∫ 𝑦𝑑𝑥 = 0.1[6.52 + 58.5]


0
2

∫ 𝑦𝑑𝑥 = 0.1[65.02]
0
2

∫ 𝑦𝑑𝑥 = 6.502
0

QUESTION#2
𝒙
Evaluate ∫𝟎𝟐 𝒔𝒊𝒏𝒙𝒅𝒙 by trapezoidal rule.

x 0 𝜋 2𝜋 3𝜋 4𝜋 5𝜋 6𝜋 7𝜋
22 22 22 22 22 22 22
y 0 0.9467 - -0.5541 0.9665 - 0.9225 0.66243
0.60969 0.06833
SOLUTION
We know that
𝑥𝑛 − 𝑥𝑜 𝜋⁄2 − 0 𝜋
ℎ= = =
𝑛 7 14
𝜋
ℎ=
14
𝑥
2

∫ 𝑠𝑖𝑛𝑥𝑑𝑥 = [(𝑦 + 𝑦7 ) + 2(𝑦1 + 𝑦2 + 𝑦3 + 𝑦4 + 𝑦5 + 𝑦6 )]
2 𝑜
0
𝜋
= [(0 + 0.66243) + 2(0.9467 − 0.60969 − 0.554 + 0.9665 − 0.06833 − 0.9225)]
2(14)
𝑥
2
𝜋
∫ 𝑠𝑖𝑛𝑥𝑑𝑥 = [(0.66243) + 2(−0.24142)]
28
0
𝑥
2
𝜋
∫ 𝑠𝑖𝑛𝑥𝑑𝑥 = [0.66243 − 0.48284]
28
0
𝑥
2
𝜋
∫ 𝑠𝑖𝑛𝑥𝑑𝑥 = [0.7959]
28
0
𝑥
2

∫ 𝑠𝑖𝑛𝑥𝑑𝑥 = 𝜋(0.028425)
0
𝑥
2

∫ 𝑠𝑖𝑛𝑥𝑑𝑥 = 0.089299
0

Error in Trapezoidal Rule


As error is the difference between exact value and estimate value.
𝐸𝑟𝑟𝑜𝑟 = 𝐸𝑡 − 𝐸𝑎
Similarly in the error of the composite trapezoidal rule is the difference between the value
of the integral and the numerical result.
For single applications, an estimate for the error
(𝑏 − 𝑎)ℎ2 ′′
𝑒𝑟𝑟𝑜𝑟 = − 𝑓 (𝜉)
12
If the function being integrated in linear 𝑒𝑟𝑟𝑜𝑟 = 0 otherwise 𝑒𝑟𝑟𝑜𝑟 ≠ 0.
The accuracy can be improved by increasing the no. of intervals and decreasing the
Value of ℎ. Error in trapezoidal modified the end terms. The trapezoidal rule is second-
order accurate. The error of is order ℎ2 .
It follows that if the integrand is concave up (and thus has a positive second derivative),
then the error is negative and the trapezoidal rule overestimates the true value.

Derivation
𝑛−1

𝐼 = [𝑦0 + 2 ∑ 𝑦𝑖 + 𝑦𝑛 ]
2
𝑖=1

= [𝑦0 + 2(𝑦1 + 𝑦2 + ⋯ + 𝑦𝑛−1 ) + 𝑦𝑛 ] … … . 𝑨
2

Equation (A) is the sum of Areas between the Curve𝑦 = 𝑓(𝑥) and the chords 𝑦𝑖 and
𝑦𝑖+1 , for 𝑖 = 0,1,2, … … 𝑛 − 1 .

Expanding y-𝑓(𝑥)𝑖𝑛 𝑡ℎ𝑒 𝑛𝑒𝑖𝑔ℎ𝑏𝑜𝑢𝑟ℎ𝑜𝑜𝑑 𝑜𝑓 𝑥 = 𝑥𝑜 𝑏𝑦 𝑇𝑎𝑦𝑙𝑜𝑟 ′ 𝑠 𝑠𝑒𝑟𝑖𝑒𝑠, 𝑤𝑒 𝑔𝑒𝑡


(𝑥−𝑥𝑜 )2
𝑦 = 𝑦𝑜 + (𝑥 − 𝑥𝑜 )𝑦 ′ 𝑜 + 𝑦𝑜′′ +…….. (1)
2!

Where 𝑦′𝑜 = [𝑦′(𝑥)]𝑥=𝑥𝑜 and so on.


𝑥1 𝑥𝑜 +ℎ
(𝑥 − 𝑥𝑜 )2
∴ ∫ 𝑦𝑑𝑥 = ∫ [𝑦𝑜 + (𝑥 − 𝑥𝑜 )𝑦′𝑜 + 𝑦′′𝑜 + ⋯ . ]𝑑𝑥
𝑥𝑜 𝑥𝑜 2!

ℎ2 ℎ3
= 𝑦𝑜 ℎ + 𝑦′′𝑜 + 𝑦′′′𝑜 + ⋯ (𝟐)
2! 3!
Now, area of the first trapezium in the interval [𝑥0 , 𝑥1 ]

= 𝐴1 = 2 (𝑦𝑜 + 𝑦1 ) (3)

Putting 𝑥 = 𝑥𝑜 + ℎ, 𝑦=𝑦1 𝑖𝑛 𝐸𝑞𝑛 (𝟏)


ℎ2
𝑦1 = 𝑦𝑜 + ℎ𝑦′𝑜 + 𝑦′′𝑜 + ⋯ (𝟒) ∴ 𝐹𝑟𝑜𝑚 𝐸𝑞𝑛𝑠 (𝟑) 𝑎𝑛𝑑 (𝟒), 𝑤𝑒 𝑔𝑒𝑡
2!
ℎ ℎ2
𝐴1 = [𝑦𝑜 + 𝑦𝑜 + ℎ𝑦′𝑜 + 𝑦′′𝑜 + ⋯
2 2!
ℎ2 ℎ3
= h𝑦𝑜 + 𝑦′𝑜 + 𝑦"𝑜 + ⋯(5)
2 2(2!)

Subtracting Eqn(5) from Eqn(2) gives the error in [𝑥𝑜 , 𝑥1 ] which is


𝑥1
1 1
= ∫ 𝑦 𝑑𝑥 − 𝐴1 = [ − ] ℎ3 𝑦′′𝑜 + ⋯
𝑥𝑜 3! 2(2!)

ℎ3
=− 𝑦′′ + ⋯
12 𝑜
ℎ3
∴ 𝑇ℎ𝑒 𝑝𝑟𝑖𝑛𝑐𝑖𝑝𝑎𝑙 𝑝𝑎𝑟𝑡 𝑜𝑓 𝑡ℎ𝑒 𝑒𝑟𝑟𝑜𝑟 𝑖𝑛 𝑡ℎ𝑒 𝑖𝑛𝑡𝑒𝑟𝑣𝑎𝑙 [𝑥𝑜 , 𝑥1 ] 𝑖𝑠 − 𝑦′′ + ⋯
12 𝑜
(by neglecting other terms).
ℎ3
Similarly, the error in [𝑥0 , 𝑥2 ] 𝑖𝑠 − 12 𝑦1 " + ⋯
ℎ3
and in [𝑥𝑛−1 , 𝑥𝑛 ] 𝑖𝑠 − 𝑦"𝑛−1
12

Hence, the total error is


ℎ3
E = − 12 [𝑦′′𝑜 + 𝑦′′1 + ⋯ + 𝑦′′𝑛−1 ]

Let 𝑦 ′′ (𝜉), 𝑎 < 𝜉 < 𝑏 𝑏𝑒 𝑡ℎ𝑒 𝑚𝑎𝑥𝑖𝑚𝑢𝑚 𝑜𝑓 |𝑦 ′′ 𝑜 |, |𝑦′′1 |, , ⋯ |𝑦𝑛−1 |,then we have
𝑛ℎ3 (𝑏−𝑎)ℎ2
E< − 𝑦"(𝜉) = − 𝑦 ′′ (𝜉) [∴ 𝑏 − 𝑎 = 𝑛ℎ]
12 12

Hence, the error in the trapezoidal rule is of the order ℎ2 .

Example#1
How large should we take 𝑛 in order to guarantee that the trapezoidal rule approximation
21
for ∫1 𝑥 𝑑𝑥 are accurate to within 0.001?

Solution
1
𝑓(𝑥) = = 𝑥 −1 ,1 ≤ 𝑥 ≤ 2
𝑥

𝑓 ′ (𝑥) = −1𝑥 −2
𝑓"(𝑥) = 2𝑥 −3
2
|𝑓"(𝑥)| = | |≤2
𝑥3
So,
𝑘=2
Formula for error in trapezoidal rule is
𝑘(𝑏 − 𝑎)3
𝐸𝑇 ≤
12𝑛2
Now Putting the values in this formula
2(2 − 1)3
|𝐸𝑇 | = ≤ 0.001
12𝑛2
2(1)3
≤ 0.001
12𝑛2
1
≤ 0.001
6𝑛2
1
≤ 𝑛2
6(0.001)
Taking Square root on both sides

1
√ ≤𝑛
6(0.001)

𝑛 ≥ 1.29 , 𝑛 = 13

Example#2
How large should we take 𝑛 in oder to gurantee that the trapezoidal rule approximation
1
for ∫0 cos (𝑥 2 )𝑑𝑥are accurate to within 0.0001?

Solution
𝑘(𝑏 − 𝑎)3
𝐸𝑇 ≤
12𝑛2
𝑓(𝑥) = cos(𝑥 2 )
𝑓 ′ (𝑥) = −2𝑥𝑠𝑖𝑛(𝑥 2 )
𝑓"(𝑥) = −2𝑠𝑖𝑛(𝑥 2 ) + cos(𝑥 2 ) (2𝑥)(−2𝑥)
𝑓"(𝑥) = −2𝑠𝑖𝑛(𝑥 2 ) − 4𝑥 2 cos(𝑥 2 )
|𝑓"(𝑥)| = | − (2𝑠𝑖𝑛(𝑥 2 ) + 4𝑥 2 cos(𝑥 2 )) |
|𝑓 ′′ (𝑥) ≤ 2(1) + 4(1)(1) = 6
So 𝑘 = 6.
Now putting these values in the formula, we get
6(1 − 0)3
𝐸≤ ≤ 0.0001
12𝑛2
6
≤ 0.0001
12𝑛2
1
≤ 0.0001
2𝑛2
1
≤ 𝑛2
2(0.0001)

1
√ ≤𝑛
2(0.0001)

𝑛 ≥ 70.7 = 71

Example#3
𝟒
In estimating ∫–𝟏 𝒄𝒐𝒔(𝟒𝒙)𝒅𝒙 using trapezoidal Rule with 𝑛 = 10, we can estimate the
error involved in the approximation using the error bounds formula.
1) For the trapezoidal Rule the error will be less than….?
2) Keep at least 2 decimal places accuracy in final answer

Solution
1) We know that

𝑛ℎ3 ′′ (𝑏 − 𝑎)ℎ2 ′′
𝐸< 𝑦 (𝑥) = − 𝑦 (𝑥)[ ∴ 𝑏 − 𝑎 = 𝑛ℎ ]
12 12
Let
𝐹(𝑥) = 𝑐𝑜𝑠(4𝑥)
𝐹’(𝑥) = −4 𝑠𝑖𝑛(4𝑥)
𝐹’’(𝑥) = − 16 𝑐𝑜𝑠(4𝑥)
Maximum of F’’(x) on [-1, 4] = 16
Putting the values in above formula, we get
(4 − (−1))3
𝐸≤ . 16
12(10)2
125
𝐸≤ . 16
1200
5
𝐸≤
3
2) 𝐸 ≤ 1.67

Example#4
1 2
If trapezoidal rule is used to evaluate ∫0 𝑒 𝑥 𝑑𝑥 with 10 subintervals then the absolute
error cannot exceeds.
a) 0.0136 b) 0.0126 c) 0.0146 d) o.0116
Solution

𝑘(𝑏 − 𝑎)3
𝐸=
12𝑛2
1 2
Let 𝑌 = ∫0 𝑒 𝑥 𝑑𝑥𝑛 = 10
2
𝐹(𝑥) = 𝑒 𝑥
Here 𝑘 = 𝐹’’(𝑥)
2
𝐹’(𝑥) = 𝑒 𝑥 (2𝑥)
2 2
𝐹’’(𝑥) = 𝑒 𝑥 (2) + (2𝑥) 𝑒 𝑥 (2𝑥)
2 2
𝐹 ′′ (𝑥) = 2𝑒 𝑥 + 4𝑥 2 𝑒 𝑥
𝐹 ′′ (0) = 2 + 4(0)𝑒 0
𝐹 ′′ (0) = 2
𝐹 ′′ (1) = 2(𝑒) + 4(1)2 (𝑒1 )
𝐹 ′′ (1) = 6𝑒
𝐹 ′′ (1) = 16.3096
Now put these values in above formula, we get
16.3096 ∗ (1 − 0)3
𝐸=
12(102 )
𝐸 = 0.0136
Hence the correct answer is 0.0136.

Example#5
3 1
Estimate the error in approximating the integral ∫1 𝑑𝑥 with 𝑛 = 4 using the
(𝑥+2)2
Trapezoidal Rule.

Solution
Here
𝑓(𝑥) = (𝑥 + 2)−2
𝑓 ′ (𝑥) = −2(𝑥 + 2)−3
𝑓 ′ ′(𝑥) = 6(𝑥 + 2)−4
𝑓 ′′ (1) = 6(1 + 2)−4
6
𝑓 ′′ (1) = = 0.07407
81
𝑓 ′′ (3) = 6(3 + 2)−4
6
𝑓 ′′ (3) = = 0.0096
625
𝑘(𝑏 − 𝑎)3
𝐸=
12𝑛2

(3 − 1)3 6
𝐸≤ [ ] = 0.0308
12(4)2 81

Applications of trapezoidal rule


• Trapezoidal is one of the family members of numerical-integration formula.
• The trapezoidal rule has faster convergence.
• It is applicable for equal intervals.
• The error of is orderℎ2 .
• The accuracy can be improved by increasing the no. of intervals and decreasing the
value of ℎ.
• This is an improvement on the midpoint implementation.
• Moreover, the trapezoidal rule tends to become extremely accurate than periodic
functions.
CONCLUSION
• Trapezoidal rule can be applied accurately for non-periodic function, also in terms of
periodic integrals.
• When periodic functions are integrated over their periods, trapezoidal rule looks for
extremely accurately.
• Trapezoidal rule is a rule that evaluates the area under the curves by dividing the total
are into smaller trapezoids rather than using rectangles.
• This integration works by approximating the region under the graph of a function as
a trapezoid and it calculates the area.
• The trapezoidal rule is applicable for equal intervals and has faster convergence.

References
✓ http://powersystemfreebooks.blogspot.com/2019/09/pdf-
complete-book-numerical-methods-by.html
✓ https://en.wikipedia.org/wiki/Trapezoidal_rule#:~:text=It%20fol
lows%20that%20if%20the,rule%20overestimates%20the%20tru
e%20value.&text=Similarly%2C%20a%20concave%2Ddown%20f
unction,but%20none%20is%20counted%20above.
✓ https://sites.google.com/view/qzbgskmkuf/application-of-
trapezoidal-rule-in-real-life

You might also like