1 / 13

Solving equations numerically

y. x. Solving equations numerically. The sign - change rule. If the function f(x) is continuous for an interval a  x  b of its domain , if f(a) and f(b) have opposite signs, then there is at least one root of f(x) = 0 between a and b. Consider an equation f(x) = x 2 -5x + 2 = 0.

sylvie
Download Presentation

Solving equations numerically

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. y x Solving equations numerically The sign - change rule If the function f(x) is continuous for an interval a  x  b of its domain , if f(a) and f(b) have opposite signs, then there is at least one root of f(x) = 0 between a and b. Consider an equation f(x) = x2 -5x + 2 = 0 f(0) = 2 There is a sign-change f(1) = -2 This means that there is a solution between x = 0 and x = 1.

  2. f(0) = -3 f(2) = 3 y x Solving equations numerically The sign - change rule Consider an equation f(x) = (2x – 1)(x – 1)(2x – 3) There is a sign-change It is clear from the graph that there are three roots between x = 0 and x = 2

  3. Examples Show that a root of the equation x3 – 5x – 4 = 0 lies in the interval [2, 3]. f(2) = 23 – 5  2 – 4 = 8 – 10 – 4 = - 6 < 0 f(3) = 33 – 5  3 – 4 = 27 – 15 – 4 = 8 > 0 There is a change of sign so the root lies in the interval [2, 3] 4.32 is an approximation to a root of the equation xlnx – 2 – x = 0. Check its accuracy to 2 decimal places. f(4.315) = 4.315  ln4.315 – 2 – 4.315 = - 0.00605 < 0 f(4.325) = 4.325  ln4.325 – 2 – 4.325 = 0.00858 > 0 Change of sign, so the root is accurate to 2 decimal places.

  4. y x Decimal search Consider f(x) = x3 – 5x – 4 ; f(2) = - 6 and f(3) = 8 f(2.5) = 2.53 – 5  2.5 – 4 = -0.875 f(2.6) = 2.63 – 5  2.6 – 4 = 0.576 For 1 decimal place the root is 2.5 or 2.6 f(2.55) = 2.553 – 5  2.55 – 4 = -0.169 x = 2.5 is ignored so the root must be x = 2.6 for one decimal place.

  5. Use decimal search to find each root correct to two decimal places. (i) f(x) = x + (x3 + 1) - 7 x f(x) sign 0 -6.0000 negative 1 -0.5858 negative 2 -2.0000 negative A root lies between 2 and 3 and it is probably closer to 3. 3 0.2915 positive 2.6 -0.0900 negative A root lies between 2.6 and 2.7 and it is probably closer to 2.6. 2.7 0.2479 positive 2.62 -0.0229 negative A root lies between 2.62 and 2.63 and it is probably closer to 2.63. 2.63 0.0180 positive 2.625 -0.0060 negative This confirms that the root is 2.63

  6. Use decimal search to find each root correct to two decimal places. (ii) f(x) = x5 + x3 - 1999 x f(x) sign 2 -1959 negative 3 -1729 negative 4 -911 negative A root lies between 4 and 5. 5 1251 positive 4.5 -62.59 negative A root lies between 4.5 and 4.6. 4.6 158 positive 4.54 23.34 positive 4.53 1.576 positive A root lies between 4.52 and 4.53. 4.52 -20.00 negative 4.525 -9.236 negative This confirms that the root is 4.53.

  7. f(x) x Iteration Consider the equation f(x) = x2 – 5x + 2 = 0 The graph of f(x) shows that one root lies between 0 and 1 and the other root lies between 4 and 5. First step is rearrange x2 – 5x + 2 = 0 in the form x = g(x) Possible rearrangements: x2 – 5x = - 2 x(x – 5) = -2 x = 2/(5 – x) x2 = 5x – 2 x = (5x – 2) x2 = 5x – 2 x = 5 – 2/x 5x = x2 + 2 x = (x2 + 2)/5

  8. Graph of rearranged equations x = 5 – 2/x x = (5x – 2) x = 2/(5-x) x = (x2 + 2)/5

  9. Using xn+1 = g(xn) f(x) = x2 – 5x + 2 = 0  xn+1 = (5xn – 2) Starting value x0 = 4 x8 = 4.5566 x1 = (5  4 – 2) = 4.2426 x9 = 4.5588 x2 = 4.3833 x10 = 4.5600 x3 = 4.4628 x11 = 4.5607 4.56 x12 = 4.5611 x4 = 4.5071 x13 = 4.5613 x5 = 4.5316 x14 = 4.5614 x6 = 4.5451 x15 = 4.5615 x16 = 4.5615 x7 = 4.5525 root = 4.56 (2 d.p.)

  10. f(x) = x2 – 5x + 2 = 0 xn+1 = 5 – 2/xn xn+1 = (xn2 + 2)/5 xn+1 = 2/(5 – x) x0 = 4 x0 = 4 x0 = 4 x1 = 2.0000 x1 = 3.600 x1 = 4.5000 x2 = 1.2000 x2 = 2.9920 x2 = 4.5556 x3 = 0.6880 x3 = 4.5610 x3 = 2.1904 x4 = 0.4947 x4 = 4.5615 x4 = 1.3598 x5 = 0.4489 x5 = 4.5615 x5 = 0.7697 x6 = 0.4388 x6 = 0.5185 x7 = 0.4485 x7 = 0.4538 x8 = 0.4385 x8 = 0.4412 x9 = 0.4389 x10 = 0.4385 x11 = 0.4385

  11. x0 = 4.5 xn+1 = 5 – 2/xn

  12. Example Consider x3 – 5x – 4 = 0 , rearrange in the form xn+1 = f(xn) x3 = 5x + 4  Let x0 = 2 x8 = 2.56154 x1 = 2.41012 x9 = 2.56155 x2 = 2.52250 x10 = 2.56155 x3 = 2.55159 x4 = 2.55902 x5 = 2.56091 x6 = 2.56139 x7 = 2.56151

  13. y x Example Using iteration method formula xn+1 = 2 + ln(xn), find a root of the equation ln(x) – x + 2 = 0, (correct to 3 s.f.) and starting with x0 = 2. x0 = 2 x1 = 2.693 147 181 x2 = 2.290 710 465 x3 = 3.095 510 973 x4 = 3.129 952 989 x5 = 3.141 017 985 x6 = 3.144 546 946 x7 = 3.145 699 825 x8 = 3.146 026 848 So a root is 3.15 (3 s.f.) x9 = 3.146 140 339

More Related