انت هنا الان : شبكة جامعة بابل > موقع الكلية > نظام التعليم الالكتروني > مشاهدة المحاضرة
الكلية كلية تكنولوجيا المعلومات
القسم قسم البرامجيات
المرحلة 2
أستاذ المادة حيدر كاظم زغير الجبوري
17/11/2014 05:20:10
Solutions of Equations in one Variable. Locating the position of roots (programming method): To locate the position of roots of the function (equation) f(x)=0 by using programming method, let f(x) be continuous function on the interval [a,b]. We divide the interval [a,b] into n subintervals a=x0Example 1: Find the approximate location of the function f(x)=x4-7x3+3x2+26x-10=0 on the interval [-8,8] with n=4 and n=8.. f(x)=x3+4x2-10=0 on the interval [1,2] with n=5. f(x)=x3-4x+1=0 on the interval [-1,4] with n=5. Solution: (1): Let n=4, h= x -8 -4 0 4 8 f(x) + + - - + There is a root between (-4,0) and (4,8). If n=8, h=2: x -8 -6 -4 -2 0 2 4 6 8 f(x) + + + + - + - + + There is a root between (-2,0), (0,2), (2,4) and (4,6). Solution: (2): Let n=5, h=0.2 x 1 1.2 1.4 1.6 1.8 2 f(x) - - + + + + There is a root between (1.2,1.4). Solution: (3): Let n=5, h=1 x -1 0 1 2 3 4 f(x) + + - + + +
There is a root between (0,1) and (1,2). It s clear that we study ( in this chapter ) numerical methods for solving equation : f(x)=0…(1) where x and f(x) are real . The values of x for which (1) holds are called roots of equation for example :- x^2-x-2=0 …(1-1) x^3+x^2-3x-2=0 ...(1-2) 2^x-5x+2=0 ...(1-3) e^x-3x=0 …(1-4) Equation (1-1) is a second degree polynomial whose roots are x=2,x=-1 , but for the other equation (1-2,1-3,1-4) it is difficult ( if it is not possible ) to be able to express the roots through a formula as equation (1-1) , hence we have to obtain the roots of the equation(1-2,1-3,1-4) numerically we study some methods 1- False-Position method (Regula falsi method): Suppose a continuous function f defined on the interval [a,b] is given with f(a) and f(b) of opposite sign (i.e. f(a)?f(b)<0). To derive a formula for false-position method, approximate the graph of f by a straight line on [a,b] connecting (a, f(a)) and (b, f(b)) which intersect x-axis at (c,0) where c is more approximate to the exact (actual) root than a and b. To obtain a formula for c we use the slop equality: ? ? To find another approximation: <0 there is a root between a, c? d= If f(a)?f(c) >0 there is a root between b, c? d= =0 c is exact root ((Stop)). We stop iteration if the interval width is as small as desired i.e. for any i. Straight line
• • •
Example : Use an approximate root of f(x)=xlogx-1=0 by using False position method with ?=0.005 for five digit Solution : Let x_1=2 , x_2=3 f(x_1 )=-0.39791 , f(x_2 )=0.43136?f(x_1 )× f(x_2 )<0 x_3=(x_1 f(x_2 )-x_2 f(x_1 ))/(f(x_2 )-f(x_1 ) ) = (2(0.43136)-3(-0.39791))/(0.43136-0.39791)=2.47985 , ?|x_3-x_2 |>? f(x_3 )=-0.02188 find x_4 ?f(x_2 )× f(x_3 )<0 ?x_4=(x_2 f(x_3 )-x_3 f(x_2 ))/(f(x_3 )-f(x_2 ) )=(3(-0.02188)-2.47985(0.43136))/(-0.02188-0.43136) =2.50496 , ?|x_4-x_3 |>? f(x_4 )=-0.00101 find x_5?f(x_2 )× f(x_4 )<0 ?x_5=(x_2 f(x_4 )-x_4 f(x_2 ))/(f(x_4 )-f(x_2 ) )=(3(-0.00101)-2.50496(0.43136))/(-0.00101-0.43136) =2.50611 ?|2.50611-2.50496|=0.001 ? The root is 2.50611 H.W: Use false position method to find the root of x^5-x-0.2 ,?=0.005 Solutions of Equations in one Variable. Locating the position of roots (programming method): To locate the position of roots of the function (equation) f(x)=0 by using programming method, let f(x) be continuous function on the interval [a,b]. We divide the interval [a,b] into n subintervals a=x0Example 1: Find the approximate location of the function f(x)=x4-7x3+3x2+26x-10=0 on the interval [-8,8] with n=4 and n=8.. f(x)=x3+4x2-10=0 on the interval [1,2] with n=5. f(x)=x3-4x+1=0 on the interval [-1,4] with n=5. Solution: (1): Let n=4, h= x -8 -4 0 4 8 f(x) + + - - + There is a root between (-4,0) and (4,8). If n=8, h=2: x -8 -6 -4 -2 0 2 4 6 8 f(x) + + + + - + - + + There is a root between (-2,0), (0,2), (2,4) and (4,6). Solution: (2): Let n=5, h=0.2 x 1 1.2 1.4 1.6 1.8 2 f(x) - - + + + + There is a root between (1.2,1.4). Solution: (3): Let n=5, h=1 x -1 0 1 2 3 4 f(x) + + - + + +
There is a root between (0,1) and (1,2). It s clear that we study ( in this chapter ) numerical methods for solving equation : f(x)=0…(1) where x and f(x) are real . The values of x for which (1) holds are called roots of equation for example :- x^2-x-2=0 …(1-1) x^3+x^2-3x-2=0 ...(1-2) 2^x-5x+2=0 ...(1-3) e^x-3x=0 …(1-4) Equation (1-1) is a second degree polynomial whose roots are x=2,x=-1 , but for the other equation (1-2,1-3,1-4) it is difficult ( if it is not possible ) to be able to express the roots through a formula as equation (1-1) , hence we have to obtain the roots of the equation(1-2,1-3,1-4) numerically we study some methods 1- False-Position method (Regula falsi method): Suppose a continuous function f defined on the interval [a,b] is given with f(a) and f(b) of opposite sign (i.e. f(a)?f(b)<0). To derive a formula for false-position method, approximate the graph of f by a straight line on [a,b] connecting (a, f(a)) and (b, f(b)) which intersect x-axis at (c,0) where c is more approximate to the exact (actual) root than a and b. To obtain a formula for c we use the slop equality: ? ? To find another approximation: <0 there is a root between a, c? d= If f(a)?f(c) >0 there is a root between b, c? d= =0 c is exact root ((Stop)). We stop iteration if the interval width is as small as desired i.e. for any i. Straight line
• • •
Example : Use an approximate root of f(x)=xlogx-1=0 by using False position method with ?=0.005 for five digit Solution : Let x_1=2 , x_2=3 f(x_1 )=-0.39791 , f(x_2 )=0.43136?f(x_1 )× f(x_2 )<0 x_3=(x_1 f(x_2 )-x_2 f(x_1 ))/(f(x_2 )-f(x_1 ) ) = (2(0.43136)-3(-0.39791))/(0.43136-0.39791)=2.47985 , ?|x_3-x_2 |>? f(x_3 )=-0.02188 find x_4 ?f(x_2 )× f(x_3 )<0 ?x_4=(x_2 f(x_3 )-x_3 f(x_2 ))/(f(x_3 )-f(x_2 ) )=(3(-0.02188)-2.47985(0.43136))/(-0.02188-0.43136) =2.50496 , ?|x_4-x_3 |>? f(x_4 )=-0.00101 find x_5?f(x_2 )× f(x_4 )<0 ?x_5=(x_2 f(x_4 )-x_4 f(x_2 ))/(f(x_4 )-f(x_2 ) )=(3(-0.00101)-2.50496(0.43136))/(-0.00101-0.43136) =2.50611 ?|2.50611-2.50496|=0.001 ? The root is 2.50611 H.W: Use false position method to find the root of x^5-x-0.2 ,?=0.005
المادة المعروضة اعلاه هي مدخل الى المحاضرة المرفوعة بواسطة استاذ(ة) المادة . وقد تبدو لك غير متكاملة . حيث يضع استاذ المادة في بعض الاحيان فقط الجزء الاول من المحاضرة من اجل الاطلاع على ما ستقوم بتحميله لاحقا . في نظام التعليم الالكتروني نوفر هذه الخدمة لكي نبقيك على اطلاع حول محتوى الملف الذي ستقوم بتحميله .
|