numerical analysis (solution of non-linear equations) part 2

29
Lecture 3 Numerical Analysis

Upload: asad-ali

Post on 15-Jul-2015

145 views

Category:

Education


2 download

TRANSCRIPT

Page 1: Numerical Analysis (Solution of Non-Linear Equations) part 2

Lecture 3

Numerical Analysis

Page 2: Numerical Analysis (Solution of Non-Linear Equations) part 2

Solution of Non-Linear Equations

Chapter 2

Page 3: Numerical Analysis (Solution of Non-Linear Equations) part 2

IntroductionBisection MethodRegula-Falsi MethodMethod of iterationNewton - Raphson MethodMuller’s MethodGraeffe’s Root Squaring Method

Page 4: Numerical Analysis (Solution of Non-Linear Equations) part 2

Definition: The equation Definition: The equation f (x) = 0 is called an f (x) = 0 is called an algebraic, if it is purely a algebraic, if it is purely a polynomial in x; polynomial in x;

it is a transcendental if f (x) it is a transcendental if f (x) contains trigonometric, contains trigonometric, exponential or logarithmic exponential or logarithmic functionsfunctions

Page 5: Numerical Analysis (Solution of Non-Linear Equations) part 2

For example,For example,

is an algebraic equation, is an algebraic equation,

WhereasWhereas

and and

are transcendental equations.are transcendental equations.

3 25 6 3 0x x x+ − + =

sinM E e E= −2 log( 3) sin 0xax x e x+ − + =

Page 6: Numerical Analysis (Solution of Non-Linear Equations) part 2

To find the solution of an To find the solution of an equation equation ff ( (xx) = 0, we find ) = 0, we find those values of those values of xx for which for which ff ( (xx) = 0 is satisfied. ) = 0 is satisfied. Such values of Such values of xx are called are called the roots of the roots of ff ( (xx) = 0. ) = 0. Thus a is a root of an Thus a is a root of an equation equation ff ( (xx) = 0, if and only ) = 0, if and only if, if, ff ( (aa) = 0.) = 0.

Page 7: Numerical Analysis (Solution of Non-Linear Equations) part 2

Properties of an Properties of an algebraic equationalgebraic equation

Every algebraic equation Every algebraic equation of of n-thn-th degree, where degree, where nn is a positive integer, has is a positive integer, has nn and only and only nn roots. roots.

Page 8: Numerical Analysis (Solution of Non-Linear Equations) part 2

Complex roots occur in pairs. Complex roots occur in pairs. That is, if (That is, if (a + iba + ib) is a root of ) is a root of ff ( (xx) = 0, then () = 0, then (a – iba – ib) is also a ) is also a root of this equation.root of this equation.

If If x = ax = a is a root of is a root of ff ( (xx) = 0, a ) = 0, a polynomial of degree polynomial of degree nn, then , then

((x – ax – a) is a factor of ) is a factor of ff ( (xx). On ). On dividing dividing ff ( (xx) by () by (x – ax – a) we obtain ) we obtain a polynomial of degree (a polynomial of degree (nn – 1). – 1).

Page 9: Numerical Analysis (Solution of Non-Linear Equations) part 2

Descartes rule of signs: Descartes rule of signs: The number of positive roots of an The number of positive roots of an algebraic equation algebraic equation ff ( (xx) = 0 with real ) = 0 with real coefficients cannot exceed the coefficients cannot exceed the number of changes in sign of the number of changes in sign of the coefficients in the polynomial coefficients in the polynomial f f ((xx) = 0. ) = 0. Similarly, the number of negative roots Similarly, the number of negative roots of of f f ((xx) = 0 cannot exceed the number ) = 0 cannot exceed the number of changes in the sign of the of changes in the sign of the coefficients of coefficients of ff ( (-x-x) = 0. ) = 0.

Page 10: Numerical Analysis (Solution of Non-Linear Equations) part 2

For example, consider an For example, consider an equationequation

As there are three changes in As there are three changes in sign, so, the degree of the sign, so, the degree of the equation is three, and hence the equation is three, and hence the given equation will have all the given equation will have all the three positive roots.three positive roots.

3 23 4 5 0x x x− + − =

Page 11: Numerical Analysis (Solution of Non-Linear Equations) part 2

Intermediate value property: Intermediate value property:

If If ff ( (xx) is a real valued continuous ) is a real valued continuous function in the closed interval function in the closed interval

If If ff ( (aa) and ) and ff ( (bb) have opposite ) have opposite once; that is once; that is f f ((xx) = 0 has at least ) = 0 has at least one root such that one root such that

a x b≤ ≤

βa bβ< <

Page 12: Numerical Analysis (Solution of Non-Linear Equations) part 2

Numerical methods for solving Numerical methods for solving either a transcendental equation or either a transcendental equation or an algebraic equation are classified an algebraic equation are classified into two groups:into two groups:

Direct methodsDirect methods, which require no , which require no knowledge of the initial knowledge of the initial approximation of a root of the approximation of a root of the equation equation ff ( (xx) = 0. ) = 0.

Iterative methodsIterative methods, require first , require first approximation to initiate iteration. approximation to initiate iteration.

Page 13: Numerical Analysis (Solution of Non-Linear Equations) part 2

How to get the first How to get the first approximation? approximation?

We can find the approximate We can find the approximate value of the root of value of the root of ff ( (xx) = 0 ) = 0 either by either by graphical methodgraphical method or by an or by an analytical methodanalytical method

Page 14: Numerical Analysis (Solution of Non-Linear Equations) part 2

Graphical methodGraphical methodThe equation The equation ff ( (xx) = 0 can be ) = 0 can be rewritten as rewritten as ff11((xx) = ) = ff22((xx) and the first ) and the first

approximation to a root of approximation to a root of ff ( (xx) = 0 ) = 0 can be taken as the abscissa of the can be taken as the abscissa of the point of intersection of the graphs point of intersection of the graphs of of yy = = ff11((xx) and ) and yy = = ff22((xx). ).

For example, consider,For example, consider,( ) sin 1 0f x x x= − − =

Page 15: Numerical Analysis (Solution of Non-Linear Equations) part 2

It can be written as It can be written as xx – 1 = – 1 = sin xsin x. .

Now, we shall draw the graphs Now, we shall draw the graphs of of yy =( =(xx -1) and -1) and y = sin xy = sin x

Page 16: Numerical Analysis (Solution of Non-Linear Equations) part 2

Answer !Answer !The approximate The approximate value of the root value of the root is found to be 1.9is found to be 1.9

Page 17: Numerical Analysis (Solution of Non-Linear Equations) part 2

Analytical methodAnalytical method

This method is based on This method is based on ‘intermediate value property’. ‘intermediate value property’.

( ) 3 1 sin 0f x x x= − + =

(0) 1

180(1) 3 1 sin 1 3 1 0.84147 1.64299

f

= −

= − + × = − + = ÷

Page 18: Numerical Analysis (Solution of Non-Linear Equations) part 2

Here Here ff (0) and (0) and ff (1) are of (1) are of opposite signs. Therefore, using opposite signs. Therefore, using intermediate value property we intermediate value property we infer that there is at least one infer that there is at least one root between root between xx = 0 and = 0 and xx = 1. = 1. This method is often used to This method is often used to find the first approximation to a find the first approximation to a root of either transcendental root of either transcendental equation or algebraic equation. equation or algebraic equation.

Page 19: Numerical Analysis (Solution of Non-Linear Equations) part 2

Hence, in analytical Hence, in analytical method, we must method, we must always start with an always start with an initial interval (initial interval (a, ba, b), ), so that so that ff ( (aa) and ) and ff ( (bb) ) have opposite signs. have opposite signs.

Page 20: Numerical Analysis (Solution of Non-Linear Equations) part 2

Bisection Method

(Bolzano)

Page 21: Numerical Analysis (Solution of Non-Linear Equations) part 2

Suppose, we wish to locate the Suppose, we wish to locate the root of an equation root of an equation ff ( (xx) = 0 in an ) = 0 in an interval, say (interval, say (xx00, , xx11). Let ). Let ff ( (xx00) and ) and ff

((xx11) are of opposite signs, such ) are of opposite signs, such

that that ff ( (xx00) ) ff ( (xx11) < 0.) < 0.

Then the graph of the function Then the graph of the function crosses the crosses the xx-axis between -axis between xx00 and and

xx11, which guarantees the existence , which guarantees the existence

of at least one root in the interval of at least one root in the interval ((xx00, , xx11). ).

Page 22: Numerical Analysis (Solution of Non-Linear Equations) part 2

The desired root is The desired root is approximately defined by the approximately defined by the midpointmidpoint

If If f f ((xx22) = 0, then ) = 0, then xx22 is the is the

desired root of desired root of f f ((xx) = 0. ) = 0.

However, if However, if f (xf (x22) 0 ) 0 then the then the

root may be between root may be between xx00 and and xx22

or or xx22 and and xx11. .

0 12 2

x xx

+=

Page 23: Numerical Analysis (Solution of Non-Linear Equations) part 2

Now, we define the next Now, we define the next approximation byapproximation by

provided provided ff ( (xx00) ) ff ( (xx22) < 0, then the ) < 0, then the root may be found between root may be found between xx00 and and xx22 or by or by

provided provided ff ( (xx11) ) ff ( (xx22) < 0, then the ) < 0, then the root lies between root lies between xx11 and and xx22 etc. etc.

0 23 2

x xx

+=

1 23 2

x xx

+=

Page 24: Numerical Analysis (Solution of Non-Linear Equations) part 2

Thus, at each step, we either find the Thus, at each step, we either find the desired root to the required desired root to the required accuracy or narrow the range to half accuracy or narrow the range to half the previous interval.the previous interval.

This process of halving the intervals This process of halving the intervals is continued to determine a smaller is continued to determine a smaller and smaller interval within which the and smaller interval within which the desired root lies. desired root lies. Continuation of this process Continuation of this process eventually gives us the desired root.eventually gives us the desired root.

Page 25: Numerical Analysis (Solution of Non-Linear Equations) part 2

Example Example

Solve Solve xx33 – 9 – 9xx + 1 = 0 + 1 = 0 for the root between for the root between xx = 2 and = 2 and xx = 4 by the = 4 by the bisection method.bisection method.

Page 26: Numerical Analysis (Solution of Non-Linear Equations) part 2

Solution Given Solution Given f f ((xx) = ) = xx33 – 9 – 9xx + 1. + 1. Here Here ff (2) = -9, (2) = -9, ff (4) = 29. (4) = 29. Therefore, Therefore, ff (2) (2) ff (4) < 0 and hence (4) < 0 and hence the root lies between 2 and 4. the root lies between 2 and 4. Let Let xx00 = 2, = 2, xx11 = 4. Now, we define = 4. Now, we define

as a first approximation to a root of as a first approximation to a root of ff ( (xx) = 0 and note that ) = 0 and note that ff (3) = 1, so (3) = 1, so that that ff (2) (2) ff (3) < 0. (3) < 0. Thus the root lies Thus the root lies between 2 and 3between 2 and 3

0 12

2 43

2 2

x xx

+ += = =

Page 27: Numerical Analysis (Solution of Non-Linear Equations) part 2

We further define,We further define,

and note that and note that ff ( (xx33) = ) = ff (2.5) < 0, so that (2.5) < 0, so that ff (2.5) (2.5) ff (3) < 0. Therefore, we define the (3) < 0. Therefore, we define the mid-point, mid-point,

Similarly, Similarly, xx55 = 2 . 875 and = 2 . 875 and xx66 = 2.9375 = 2.9375 and the process can be continued until and the process can be continued until the root is obtained to the desired the root is obtained to the desired accuracy. accuracy.

0 23

2 32.5

2 2

x xx

+ += = =

3 24

2.5 32.75, etc.

2 2

x xx

+ += = =

Page 28: Numerical Analysis (Solution of Non-Linear Equations) part 2

These results are presented in the table.These results are presented in the table.

nn xxnn f ( xf ( xn n ))

22 33 1.01.0

33 2.52.5 -5.875-5.875

44 2.752.75 -2.9531-2.9531

55 2.8752.875 -1.1113-1.1113

66 2.93752.9375 -0.0901-0.0901

Page 29: Numerical Analysis (Solution of Non-Linear Equations) part 2

Lecture 3

Numerical Analysis