Sie sind auf Seite 1von 6

[1.1 ] Non- linear equations [ by Shaheed J.

Kherbed ]

>

Give a function f : R R such that f (x) = 0. In this Chapter we determined


roots (solution ) of equation f (x)=0 or ( zeros of function ).In this following sections we
discuss (the Numerical methods ) can be used to approximate solution (roots)of non- linear
equations which be on the following formula.f (X) = 0 ……………….. (1)

when be all from X, f real number , and value X which are give the equation (1) . is called
Roots of equation .

Some Non- linear equations


a) xuxx+yuyy = 0
(b) uut +xux = 2
(c)Ut + √𝑢 = x
1 1
(d) urr+ + 𝑢𝜃𝜃 = 0
𝑟 r2

Definition : If f is continuous in interval [ X0 , X1] , such that f (X0). f (X1) < 0 . There
are positive constant ϵ and integer n ≥ 1. i.e n=1,2, , , such that

| X n+1 - X0| ≤ ϵ we say that root converge to ϵ.

[ 1 . 2] Bisection method of intervals ) ‫) طريقة تنصيف الفترات‬

The Bisection method is based on the intermediate value theorem. The idea behind the
method is that f ∈ C[X0 , X1] and f (X0). f (X1) = 0 .There exist a root x ∈ (X0 , X1 ) such
that f(x) = 0 Bisection method dependent on basic formula X = (X0 + X1)/2

Bisection Method Algorithm

1) If f is continuous in interval [ X0 , X1] , such that f (X0). f (X1) < 0 .

[ 𝐗𝟎 + 𝐗𝟏]
put X2= we division the interval .
𝟐

2) we take interval [ X0, X2] or the interval [X0,X1] .If f (X2).f (X0) = 0,then X2 is a root .we
take |X1 − X0| ≤ 𝜖. Stop where |Xn − X0| 𝜖 … as on ., n=0,1,2, ,

Example : Fin the roots of the equation f ( X) = X6 - X -1by using Bisection


method where 𝜖= 0.01

1
Solution : Since f ( X) = X6 - X -1

First we finding the interval [ X0, X1]

X -3 -2 -1 0 1 2 3
f ( X) + + + - - + +

To find the correct interval substituting the value of X in f (x) . when we choose the
value of X are positive and negative value for x-axis from above table . for instance

If X= 0

f ( X) = X6 - X -1

F(o )= 06 - 0 -1 = -1= -

F(1 )= 16 - 1 -1 = - 1 = 1

F(-1 )= -16 + 1 -1 = +1 = +

F(2 )= 26 - 2 -1 = 64-3 = 61= +

F(-2 )= -26 + 2 -1 = +1 = 64 +1=65= +

.
.

Now , we Look to the change of values X and take the interval that change values X
from negative into positive

Therefore there exists root on [1 , 2 ] and there exists a root on [-1 , 0 ] is neglect .

Before start to find the solution ,must make sure the equation it has solution or not by
applying the condition One above that f (X0). f (X1) < 0 .

should be satisfied in the interval or a root [1 , 2 ] .

Here f (X0). f (X1) = f (1). f (2) = -1 . 61= -61 < 0 ,

hence the equation it has solution this allow us to follow the steps of solution.

2
Example: Find the roots of the equation f (x)= 1 - tan x – 0.5 , if X0 ,X1equal[ 45,60]
where = , = 0.0000001

f (45)= 45 - tan 45 – 0.5 = 43.5

f (60)= 60 - tan x – 0.5 , = 57.768

f (x0). f(x1)= (43.5) . (57.768)= 2,512. 908 > 0

hence there is not root of the equation . there for we finish the solution

Froom interval X0 = 1, X1= 2 , take


[ 𝐗𝟎 + 𝐗𝟏] [ 𝟏 + 𝟐] 𝟑
X2= = = 𝟐 = 1.5
𝟐 𝟐

Use the second condition to show X2 the root or not by applying in |Xn − X0| 𝜖

|X2 − X0| = |1.5 − 1| = |0.5| 𝜖

Then X2 is not root of f , therefore take X3


[ 𝐗𝟎 + 𝐗𝟐] [ 𝟏 + 𝟏.𝟓] 𝟐.𝟓
X3= = = = 1.25
𝟐 𝟐 𝟐

|X3 − X0| = |1.25 − 1|= 0.25 𝜖= 0.01

[ 𝐗𝟎 + 𝐗𝟑] [ 𝟏 + 𝟏.𝟐𝟓] 𝟐.𝟐𝟓


X4= = = = 1.125
𝟐 𝟐 𝟐

|X4 − X0|=|1.125 − 1|=0.125 𝜖


[ 𝐗𝟎 + 𝐗𝟒] [ 𝟏 + 𝟏.𝟏𝟐𝟓] 𝟐.𝟏𝟐𝟓
X5= = = = 1.0625
𝟐 𝟐 𝟐

|X5 − X0| = |1.0625 − 1|= 0.0625 𝜖

Therefore X5 is a root of the equation f .

3
Example (:Find the roots of the equation f ( X) = X2 - 4 by using Bisection
method where 𝜖= 0.01

Solution : Since f ( X) = X2 - 4.First we finding the interval [ X0, X1]

X -3 -2 -1 0 1 2 3
f ( X) + + - - - + +

There exists root on [ 1 , 2 ] ,There exists a root on [ -1 , -2 ] is neglect .


[ 𝐗𝟎 + 𝐗𝟏] [ 𝟏 + 𝟐] 𝟑
X2= = = = 1.5
𝟐 𝟐 𝟐

Now we take X2 and compensation in |Xn − X0| 𝜖

|X2 − X0| = |1.5 − 1| = |0.5| 𝜖

Then X2 is not root of f , therefore take X3

[ 𝐗𝟎 + 𝐗𝟐] [ 𝟏 + 𝟏.𝟓] 𝟐.𝟓


X3= = = = 1.25
𝟐 𝟐 𝟐

|X3 − X0| = |1.25 − 1|= 0.25 𝜖

[ 𝐗𝟎 + 𝐗𝟑] [ 𝟏 + 𝟏.𝟐𝟓] 𝟐.𝟐𝟓


X4= = = = 1.125
𝟐 𝟐 𝟐

|X4 − X0| = |1.125 − 1|= 0.125 𝜖


[ 𝐗𝟎 + 𝐗𝟒] [ 𝟏 + 𝟏.𝟏𝟐𝟓] 𝟐.𝟏𝟐𝟓
X5= = = = 1.0625
𝟐 𝟐 𝟐

|X5 − X0| = |1.0625 − 1|= 0.0625 𝜖

[ 𝐗𝟎 + 𝐗𝟓] [ 𝟏 + 𝟏.𝟎𝟔𝟐𝟓] 𝟐.𝟎𝟔𝟐𝟓


X6= = = = 1.03
𝟐 𝟐 𝟐

|X6 − X0| = |1.03 − 1|= 0.03 𝜖

[ 𝐗𝟎 + 𝐗𝟔] [ 𝟏 + 𝟏.𝟎𝟑]
X7= = = = 1.01
𝟐 𝟐

|X7 − X0| = |1.01 − 1|= 0.01 𝜖 .Therefore X7 is a root of the equation f

4
‫‪Laboratory‬‬

‫‪Example(1) :‬‬
‫‪Write Sub-programme in M language to solve the Equation‬‬
‫‪f(x)= x 6 -x-1.Within the interval [1,2].Where 𝜖 =0.01.In the‬‬
‫‪precision required . using Bisection Method.‬‬

‫‪Solution :‬‬
‫‪syms x‬‬
‫;)'‪d=input('inter f(x)=\n‬‬
‫;)‪f=inline (d‬‬
‫;)'‪a=input('a=\n‬‬
‫;)'‪b=input('b=\n‬‬
‫)'قيمة المقارنة\‪n=input('n‬‬
‫‪for u=0:inf‬‬
‫‪x= (a + b)/2‬‬
‫;)‪c=f(x‬‬
‫;)‪h=abs(c‬‬
‫‪if h<=n‬‬
‫‪break‬‬
‫‪end‬‬

‫‪if f(a)*c<0‬‬
‫;‪b=x‬‬
‫‪continue‬‬
‫‪else‬‬
‫;‪a=x‬‬
‫‪continue‬‬
‫‪end‬‬
‫‪end‬‬

‫بعد الذهاب الى (‪ )run‬سوف يطلب منك ادخال قيمة الدالةبعد ان اعطيت تسمية لعملك وانتبه يجب ان تكون التسمية‬
‫مع الحرف (‪ ) m‬وكذلك يجب ان تكون التسمية في الخانة او الفراغ االسفل باسم ‪ . file m‬وبعدها يطلب ادخال‬
‫قيمة )‪ )a‬ومن ثم ادخال قيمة )‪( b‬واخيرا يطلب قيمة المقارنة وهي قيمة السماح بالخطا اي القيمة التقريبية المعطاة‬
‫في السؤال ‪.‬‬
‫أما اذا اردنا ان نعرف عدد التكرارات بالنسبة الى ( ‪.)x1 ,x2, , , ,‬فأننا نعود الى البرنامج مرة ثانية ونكتب في البداية‬
‫قبل الرمز( ‪ ) syms‬كلمة ( ‪ ) clear‬لكي ينظف كل شئ في البرنامج ‪ ,‬وفي االسفل اي بعد كلمة ( ‪ )end‬حرف‬
‫( ‪) u‬او اي حرف انت تستخدمة في الكود (‪ )u=0:inf‬ثم نعطي ( ‪ )run‬فيطلب البرنامج مرة ثانية ادخال الدالة‬
‫والفترة وكذلك القيمة التقريبية (قيمة المقارنة) كما في ادناه‪.‬وسوف تظهر لك عدد التكرارات ‪.‬‬

‫‪5‬‬
‫‪Clear‬‬
‫‪syms x‬‬
‫;)'‪d=input('inter f(x)=\n‬‬
‫;)‪f=inline (d‬‬
‫;)'‪a=input('a=\n‬‬
‫;)'‪b=input('b=\n‬‬
‫)'قيمة المقارنة\‪n=input('n‬‬
‫‪for u=0:inf‬‬
‫‪x= (a + b)/2‬‬
‫;)‪c=f(x‬‬
‫;)‪h=abs(c‬‬
‫‪if h<=n‬‬
‫‪break‬‬
‫‪end‬‬
‫‪if f(a)*c<0‬‬
‫;‪b=x‬‬
‫‪continue‬‬
‫‪else‬‬
‫;‪a=x‬‬
‫‪continue‬‬
‫‪end‬‬
‫‪end‬‬
‫‪u‬‬

‫عزيزي الطالب سوف تالحظ ان عدد التكرارات اكثر من التكرارات التي حصلنا عليها عندما قمنا بالحل في‬
‫المحاضرة النظري ‪.‬تذكر النه نحن معا اخذنا قيم تقريبية للناتج واضافتا ً ان في الحاسبة البرنامج ‪ M‬يظيف الرقم‬
‫‪ 0.0005‬ليقرب الرقم اذا كان اكثر من النصف ‪(:‬تحياتي)‬

‫*********************************************************************‬

‫‪6‬‬