Chapter 3

3,185 views

Published on

Published in: Education, Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
3,185
On SlideShare
0
From Embeds
0
Number of Embeds
21
Actions
Shares
0
Downloads
80
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Chapter 3

  1. 1. CHAPTER 3 NUMERICAL METHOD
  2. 2. 3.1 The Trapezium Rule <ul><li>OBJECTIVES : The objectives of this lesson are to enable students to </li></ul><ul><li>a) derive the trapezium rule by dividing the area represented by dx into n ( n  7 ) </li></ul><ul><li>trapezium each with width h. </li></ul><ul><li>b) use the trapezium rule to approximate </li></ul>
  3. 3. Introduction <ul><li>What happens when a mathematical function cannot be integrated ? In these cases a numerical method can be used to find an approximate value for the integral </li></ul><ul><li>As the definite integral is a number which represents the area between y = f (x) , the x-axis and the lines </li></ul><ul><li>x = a and x =b . </li></ul>
  4. 4. <ul><li>Therefore , even if cannot be found, approximate value for can be found by evaluating the appropriate area using another method. The two common methods are the trapezium rule and Simpson’s rule. </li></ul><ul><li>However, here we will discuss the trapezium rule as requested by our syllabus . </li></ul>
  5. 5. The trapezium rule <ul><li>This method divides the area A under the curve </li></ul><ul><li>y = f(x) is into n vertical strips. The width of each strip is h. </li></ul><ul><li>The area under the curve  sum of areas of n trapezia. </li></ul><ul><li>Note :  approximately equal to </li></ul>
  6. 7. Let y 0 , y 1 , y 2 , …., y n be the values of the function f (x) . These correspond to the (n+1) ordinates x 0 , x 1 , x 2 , ……..,x n respectively.
  7. 8. <ul><li>Using </li></ul>Area of trapezium = ( width x sum of parallel sides ) The area of the first trapezium is A 1 = h ( y 0 + y 1 ) The areas of the second and the third trapezia are then A 2 = h ( y 1 + y 2 ) A 3 = h ( y 2 + y 3 )
  8. 9. <ul><li>Verify that if this process is continued then </li></ul><ul><li>A n-1 = h ( y n-2 + y n-1 ) </li></ul><ul><li>A n = h ( y n-1 + y n ) </li></ul><ul><li>Now add all of these separate areas together. The approximate value of A is given by </li></ul><ul><li>A  A 1 + A 2 + A 3 + … + A n-1 + A n </li></ul><ul><li> h ( y 0 + y 1 ) + h ( y 1 + y 2 ) + h ( y 2 + y 3 ) + … + h ( y n-2 + y n-1 ) + h ( y n-1 + y n ) </li></ul><ul><li> h ( y 0 + 2y 1 +2y 2 +2y 3 +… + 2y n-1 + y n ) </li></ul>
  9. 10. <ul><li>This method of approximating the area under a curve by n trapezia of equal width h is called the trapezium rule, and the result can be summarized as : </li></ul><ul><li>dx  h  y 0 + y n + 2 ( y 1 + y 2 + … + y n-1 )  </li></ul><ul><li>where h = and y r = f ( x r ) </li></ul>
  10. 11. <ul><li>Example 1 </li></ul><ul><li>Evaluate dx using 5 strips by the trapezium rule. </li></ul><ul><li>Notation: Working must have 4 or more decimal places. </li></ul>Solution The integration interval ( b- a ) = 6 –1 = 5 units So h = = = 1
  11. 12. The value of x at which y is calculated are : 1, 2, 3, 4, 5, 6 Tabulating the results as follows help the final calculation : 4.787 1.792 Totals 0.693 1.099 1.386 1.609 0 1.792 y 0 y 1 y 2 y 3 y 4 y 5 1 2 3 4 5 6 Remaining ordinates First and last ordinates y X
  12. 13. dx   ( y 0 + y 5 ) + 2 ( y 1 +… +y 4 )  =  1.792 + 2 ( 4.787 )  = 5.683
  13. 14. Example 2 <ul><li>Use the trapezium rule, with five ordinates, to evaluate e x ² dx . </li></ul><ul><li>Correct your answer to three decimal places. </li></ul>Solution: For five ordinates, ( y o , y 1 , y 2 , y 3 , y 4 ) evenly spaced in the range 0 ≤ x ≤ 0.8 , we need to divide this range into four equal parts The integration interval ( b- a ) = 0.8 - 0 = 0.8 units
  14. 15. <ul><li>So, h = = = 0.2 </li></ul><ul><li>The value of x at which y is calculated are : </li></ul><ul><li>0 , 0.2, 0.4, 0.6 , 0.8 </li></ul>3.6476 2.8965 Totals 1.0408 1.1735 1.4333 1 1.8965 y 0 y 1 y 2 y 3 y 4 0 0.2 0.4 0.6 0.8 Remaining ordinates First and last ordinates Y x
  15. 16. <ul><li>e x ² dx ≈  ( y0 + y4 ) + 2 ( y1 +… +y 3 )  </li></ul><ul><li> =  2.8965 + 2 ( 3.6476 )  </li></ul><ul><li> = 1.0192 </li></ul><ul><li>= 1.019 ( three decimal places ) </li></ul>
  16. 17. 3.2 Solutions of non – linear equations <ul><li>OBJECTIVE : The objective of this lesson is to enable students to understand the method of finding roots using the iteration method by writing: </li></ul><ul><li>f(x) = 0 in the form of x = g(x). The iteration scheme is x n+1 = g(x n ) , n = 1,2,3….. The method fails when  g  (x)  > 1 in the neighborhood of the roots of the equation. </li></ul>
  17. 18. Introduction <ul><li>Many equations cannot be solved exactly, but various methods of finding approximate numerical solutions exist. </li></ul><ul><li>The most commonly used methods have two main parts: </li></ul><ul><li>(a) finding an initial approximate value </li></ul><ul><li>(b) improving this value by an iterative process </li></ul>
  18. 19. <ul><li>Initial Values: </li></ul><ul><li>The initial value of the roots of f(x) = 0 can be located approximately by either a graphical or an algebraic method. </li></ul><ul><li>Graphical Method: </li></ul><ul><li>Either </li></ul><ul><li>(a) Plot ( or sketch ) the graph of y = f(x). </li></ul><ul><li>The real roots are the points where the curve cuts the x axis. </li></ul><ul><li>Or </li></ul><ul><li>(b) Rewrite f(x) = 0 in the form F(x) = G(x). </li></ul><ul><li>Plot ( or sketch ) y =F(x) and y = G(x). The real roots are at the points where these graphs intersect. </li></ul>
  19. 20. Example 1 <ul><li>Find the approximate value of the equation ln x + x - 4 = 0 by using the graphical method. </li></ul>y = 4-x y 0 1 2 3 4 the intersection is at x  2.9 x y y = ln x
  20. 21. <ul><li>Algebraic Method </li></ul><ul><li>Find two values a and b such that f(a) and f(b) have different signs. </li></ul><ul><li>At least one root must lie between a and b if f(x) is continuous. </li></ul><ul><li>If more than one root is suspected between a and b, sketch a graph of y = f(x). </li></ul>
  21. 22. <ul><li>Iterative Method </li></ul><ul><li>All iterative methods follow the same basic pattern. A sequence of approximations </li></ul><ul><li>x 1 , x 2 , x 3 , x 4 ….. is found , each one closer to the root  of f(x)=0. </li></ul><ul><li>Each approximation is found from the one before it using a specified method. </li></ul><ul><li>The process is continued until the required accuracy is reached. </li></ul><ul><li>Two methods we have to discuss are Iteration Method and Newton-Raphson Method. </li></ul>
  22. 23. <ul><li>Iteration Method </li></ul><ul><li>Rewrite the equation f(x) = 0 in the form x = g(x). </li></ul><ul><li>If the initial approximation is x 1 , then calculate </li></ul><ul><li>x 2 = g(x 1 ) </li></ul><ul><li>x 3 = g(x 2 ) </li></ul><ul><li>x 4 = g(x 3 ) </li></ul><ul><li>and so on ….. </li></ul><ul><li>This method fails if  g  (x)  > 1 near the root. </li></ul><ul><li>So, the value of  g  (x1)  should be < 1. </li></ul>
  23. 24. Example 2 <ul><li>Using the iteration method, find the solution of f(x) = x + e x near x = -0.6 to three decimal places. </li></ul>Solution Iteration method Write the given equation as x = - e x  x = g(x) g (x) = - e x g  (x) = - e x ,  g  (-0.6)  =  -e-0.6  = 0.5488 ( < 1 )
  24. 25. <ul><li>x 1 = -0.6 </li></ul><ul><li>x 2 = -e-0.6 = -0.5488 </li></ul><ul><li>x 3 = -e-0.5488 = -0.5453 </li></ul><ul><li>x 4 = -e-0.5453 = -0.5797 </li></ul><ul><li>x 5 = -e-0.5797 = -0.5601 </li></ul><ul><li>x 6 = -e-0.5601 = -0.5712 </li></ul><ul><li>x 7 = -e-0.5712 = -0.5648 </li></ul><ul><li>x 8 = -e-0.5648 = -0.5684 </li></ul><ul><li>x 9 = -e-0.5684 = -0.5664 </li></ul><ul><li>x 10 = -e-0.5664= -0.5676 </li></ul><ul><li>x 11 = -e-0.5676 = -0.5668 </li></ul><ul><li>x 12 = -e-0.5668 = -0.5673  the required solution is x = - 0.567 ( three decimal places )# </li></ul>
  25. 26. Example 3 <ul><li>Show that the equation has a root between 0.2 and 0.3. </li></ul><ul><li>Taking 0.2 as first approximation find the root of the equation ,giving your answer to three significant figures by using the iteration method. </li></ul>
  26. 27. <ul><li>Solution </li></ul><ul><li>f(x) = x 2 - + 4 </li></ul><ul><li> f(0.2) = </li></ul><ul><li>f(0.3) = = 0.756 ( positive ) </li></ul><ul><li>therefore f(x) has a root between x = 0.2 and x = 0.3. </li></ul>= - 0.96 ( negative )
  27. 28.  g(x) = g'(x) = = = g'(0.2) = = 0.0245 ( <1 ) therefore, g(x) = iteration function
  28. 29. <ul><li>x = g(x) </li></ul><ul><li>x 1 = 0.2 </li></ul><ul><li>x 2 = = 0.2475 </li></ul><ul><li>x 3 = = 0.2462 </li></ul><ul><li>x 4 = = 0.2463 </li></ul><ul><li>the required solution is 0.246 (3 sig. figs) </li></ul>x 3 and x 4 have same value when round up to three sig.figs. Hence we should stop the working.
  29. 30. 3.3 Solutions of non-linear equations <ul><li>OBJECTIVE : The objective of this lesson is to enable students to </li></ul><ul><li>find the root by the Newton-Raphson method using the formula </li></ul><ul><li>x n+1 = x n - , n = 1,2,3, … </li></ul>
  30. 31. Newton-Raphson Method <ul><li>If x 1 is an approximation to root  of f(x) =0 , then a better approximation x 2 is given by </li></ul><ul><li>. </li></ul><ul><li>Repeat this process as required . </li></ul><ul><li>The iteration is stop when </li></ul>
  31. 32. Example 1 <ul><li>Using the Newton-Raphson Method, find the solution of f(x) = x + e x near x = - 0.5 to three decimal places. </li></ul><ul><li>Solution </li></ul><ul><li>Let f(x) = x + e x </li></ul><ul><li>So f  (x) = 1 + e x </li></ul>
  32. 33. <ul><li>x 1 = -0.5 </li></ul><ul><li>= = = -0.5663 </li></ul><ul><li>= = - 0.5671 </li></ul><ul><li>= = - 0.5671 </li></ul><ul><li>The required solution is x = -0.567 ( three decimal places ) # . </li></ul>
  33. 34. <ul><li>Example 1 </li></ul><ul><li>Sketch the graph of y = e x and y = 2 – x where x< 2, on the same axes. </li></ul><ul><li>Get the first approximation, x 0 for the equation e x = 2 – x where 0 < x o < 1. </li></ul><ul><li>Hence, by using Newton-Raphson method , solve the equation of e -x = </li></ul>for x < 2 to three decimal places.
  34. 35. 2 1 Solution : y y = e x 1 x y = 2 - x 0 0.4
  35. 36. <ul><li>Newton-Raphson method: </li></ul><ul><li>e -x =  = 2 – x </li></ul><ul><li>e x = 2 – x  e x – 2 + x = 0 </li></ul><ul><li>f(x) = e x – 2 + x f ’(x) = e x + 1 </li></ul><ul><li>x 1 = first approximation = 0.4 ( from graph ) </li></ul>
  36. 37. 0.4 - [ ] = = 0.4043 = 0.4043 - [ ] = 0.4433 = 0.4433 - [ ] = 0.4428 = 0.4428 - [ ] = 0.4428 The required solution is 0.443 ( three decimal places ).
  37. 38. EXERCISES <ul><li>1.)By taking 0.2 as first approximation find the root of the equation </li></ul><ul><li>,giving your answer to three significant figures by using the Newton Raphson method. </li></ul><ul><li>(Ans : 0.246) </li></ul>
  38. 39. <ul><li>2.) </li></ul>Show that the equations 2sin x – x = 0 has a root between x = 1(radian) and x= 2 (radian). Find the root of the equation by using i) iteration method ii) Newton Raphson method Giving your answer to two decimal places.

×