0% found this document useful (0 votes)
1K views3 pages

Newton - Raphson Method

The document describes the Newton-Raphson method for finding the roots of an equation. It provides the general algorithm which takes a continuous, differentiable function f and calculates successive approximations of the root using the formula xn+1 = xn - f(xn)/f'(xn). The method converges to a root if the interval [x0, x1] contains a root, as shown by f(x0) and f(x1) having opposite signs. An example of using the method to find the root of f(x) = x^3 + 4x^2 - 10 is provided, along with MATLAB code for implementing the method.

Uploaded by

Othman Ahmed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views3 pages

Newton - Raphson Method

The document describes the Newton-Raphson method for finding the roots of an equation. It provides the general algorithm which takes a continuous, differentiable function f and calculates successive approximations of the root using the formula xn+1 = xn - f(xn)/f'(xn). The method converges to a root if the interval [x0, x1] contains a root, as shown by f(x0) and f(x1) having opposite signs. An example of using the method to find the root of f(x) = x^3 + 4x^2 - 10 is provided, along with MATLAB code for implementing the method.

Uploaded by

Othman Ahmed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

[1.

3 ] Newton – Raphson Method ‫ رافسين‬- ‫طريقة نيوتن‬

When be differentiation of f its simple . and from easy its finding .then
roots of equation (1) can its finding by high accuracy with using Newton –
Raphson Method .

Solution Algorithm :

Let f be continuous function and differentiable on point (X0) we calculate .


from The general Newton – Raphson law ( formula
f(X𝐧)
Xn+1 = Xn - , n= 0,1,2,…
f (X𝐧)

Remark : The condition of convergence by Newton – Raphson Method .

1- * if output of The Multiplication f (X0). f (X1) less than Zero


2- i.e f(X0). f (X1) < 0 .therefore the equation has solution .The
condition of stop where . |𝑥i − xi+1 | 𝜖 ⇛ Xi+1 is a root.

Example : Find the root of the function f ( X) = X3 +4X2 -10 , when x0


equal 1.5 ) , 𝜖 =10-3, 𝜖 = 0.001

Solution : First we finding the interval [ X0 , X1]

X 0 1 2 3 4
f ( X) - - + +
f ( X) = X3 +4X2 -10

f ( 0) = 0 +0 -10= -10 = (- )

f ( 1) = 1 +4 -10= -5 = (- )

f ( 2) = 8 +16 -10= 14 = (+ )

f ( 3) = 27 +36 - 10= 53 = (+ )

There exists root on [ 1 , 2 ] .

f(X0). f (X1) < 0 ⟹ f(1). f (2) < 0

-5 . 14 = -70 < 0

Therefor the equation it has solution .


Since the interval [1,2 ] that mean [ 1 1.5 2]

Now let X0 = 1.5



f ( X) = X3 +4X2 -10 , 𝑓(X ) = 3 X2 + 8X
f(𝑥0 )
𝑥1 = 𝑥0 − ∕ then f (X1) = (1.5)3 + 4 (1.5)2 - 10
𝑓(X 0)

= 3.375 + 9 - 10 = 2.375
∕ ∕
𝑓(X 1) = 𝑓(1.5) = 3(1.5)2 +8 (1.5 = 6.75 + 12 = 18. 75
f(𝑥0 ) 2.375 28.125− 2.375 25.375
𝑥1 = 𝑥0 − ∕ = 1.5 - = = = 1 . 37333
18.75 18.75 18.75
𝑓(X 0)

|𝑥i − xi+1 | ∈ = 0.001

|𝑥0 − x1 |= -= |1.5 − 1.37333| = 0.12667 > ∈ = 0.001

Then X1 is not root of f(x) moving to X2


f(𝑥1 )
𝑥2 = 𝑥1 − ∕ then f (X1) = f (1.37333) = (1.37333)3 + 4 (1.37333)2 - 10
𝑓(X 1)

=2.59014 + 7.54412 – 10 = 0.13426


∕ ∕
𝑓(X 2) = 𝑓(1.37333)
=
3 (1.37333)2 +8 (1.37333)

= 5.65809 + 15.08829 = 20.74633


f(𝑥1 ) 0.13426 28.49155− 0.13426 28.35729
𝑥2 = 𝑥1 − ∕ =1.37333 - = =
20.74633 20.74633 20.74633
𝑓(X 1)

= 1. 36685

|𝑥1 − x2 |= |1.37333 − 1.36685| = 0.0064 ≤ ∈ = 0.001

Hence X2 is a root of the equation f(x)

Example (H. W)

̇ = 1 + 1, ∈ = 0 ,when X0 = 0.5 .
Solve the equation by N-R method𝑓 (𝑥)
𝑥
Example : Find the root of the function f ( X) = X3 +9X2 +10X – 20
when X0 = 1.5 , ∈ = 0.001 (H. W)
‫‪Example(1) :‬‬
‫‪Write Sub-programme in M language to solve the Equation‬‬
‫‪f(x)= 1\𝑥 -1. when X0 = 0.5. In the precision required . using‬‬
‫‪Newton Raphson .‬‬
‫‪Solution :‬‬
‫‪syms x‬‬
‫;)'‪d=input('inter f(x)=\n‬‬
‫;)‪f=inline(d‬‬
‫;))‪z=diff(f(x‬‬
‫;)‪f1= inline(z‬‬
‫)'‪x0= input ('inter x0=\n‬‬
‫‪x=x0‬‬
‫‪for u= 0:inf‬‬
‫‪y=x‬‬
‫;))‪x=y- (f(x)/f1(x‬‬
‫‪if x==y‬‬
‫‪break‬‬
‫‪end‬‬
‫‪end‬‬
‫بعد الذهاب الى (‪ )run‬سوف يطلب منك ادخال قيمة الدالة بعد ان اعطيت تسمية لعملك وانتبه‬
‫يجب ان تكون التسمية مع الحرف (‪ ) m‬وكذلك يجب ان تكون التسمية في الخانة او الفراغ‬
‫االسفل باسم ‪ . file m‬وبعدها يطلب ادخال قيمة )‪(a‬او قيمة ‪.)x0 ,x1, , , ),‬‬
‫أما اذا اردنا ان نعرف عدد التكرارات بالنسبة الى ( ‪.)x1 ,x2, , , ,‬فأننا نعود الى البرنامج مرة ثانية‬
‫ونكتب في البداية قبل الرمز( ‪ ) syms‬كلمة ( ‪ ) clear‬لكي ينظف كل شئ في البرنامج ‪ ,‬وفي‬
‫االسفل اي بعد كلمة ( ‪ )end‬حرف ( ‪) u‬او اي حرف انت تستخدمة في الكود (‪ )u=0:inf‬ثم‬
‫نعطي ( ‪ )run‬فيطلب البرنامج مرة ثانية ادخال الدالة والفترة المقارنة) كما في ادناه‪.‬وسوف‬
‫تظهر لك عدد التكرارات ‪.‬‬
‫‪clear‬‬
‫‪syms x‬‬
‫;)'‪d=input('inter f(x)=\n‬‬
‫;)‪f=inline(d‬‬
‫;))‪z=diff(f(x‬‬
‫;)‪f1= inline(z‬‬
‫)'‪x0= input ('inter x0=\n‬‬
‫‪x=x0‬‬
‫‪for u= 0:inf‬‬
‫‪y=x‬‬
‫;))‪x=y- (f(x)/f1(x‬‬
‫‪if x==y‬‬
‫‪break‬‬
‫‪end‬‬
‫‪end‬‬
‫‪u‬‬

You might also like