• No results found

Numerical Methods

N/A
N/A
Protected

Academic year: 2021

Share "Numerical Methods"

Copied!
13
0
0

Loading.... (view fulltext now)

Full text

(1)
(2)

CHAPTER 3

Numerical Methods

Numerical methods are methods for solving problems numerically on computer or calculator (or some times by hand). Numerical methods are often divided into elementary ones such as finding the root of an equation, integrating a function or solving a linear system of equations to intensive ones like the finite element method.

A. Solution of algebraic and transcendental equation / Root Finding

1. Bisection Method

2. Regula falsi method 3. Secant method

4. Newton- Raphson method 5. Horner’s method

6. Descarte’s rule

Consider an equation f(x) = 0 1. Bisection method

This method finds the root between points “a” and “b”.

If f(x) is continuous between a and b and f (a) and f (b) are of opposite sign then there is a root between a & b (Intermediate Value Theorem).

First approx. to the root is x1 =

.

If f(x1) = 0, then x1 is the root of f(x) = 0, otherwise root of f(x)=0 lies between a and

x1 or x1 and b.

Similarly, x2 and x3 . . . are determined.

a b

y = f(x) y

(3)

Note

 Simplest iterative method

 Bisection method always converge but often slowly.  This method can’t be used for finding the complex roots.  Rate of convergence is linear

Example

Find the roots of Solution

f(2) = -ve , f(3) = +ve a root in [2,3] x1 = = 2.5 f(x1) = -ve x2 = = 2.75 f(x2) = +ve x3 = = 2.625 f(x3) = -ve x4 = = 2.6875

2. Newton Raphson method (or successive substitution method or tangent method)

 xn+1 = xn –

 This method is commonly used for its simplicity and greater speed.

 Here f x is assumed to have continuous derivative f’ x . f(x)

Y=f(x)

X2 X1 X0

(4)

 This method fails if f’ x .

 It has second order of convergence or quadratic convergence, i.e. the subsequent error at each step is proportional to the square of the error at previous step.

 Sensitive to starting value, i.e. The Newton’s method converges provided the initial approximation is chosen sufficiently close to the root.

 Rate of convergence is quadratic

Geometric Interpretation y – f(x0 f’ x0) (x-x0)

x1 = x0 -

Draw a tangent at f(x0). Tangent intersects X-axis at x1. Draw a tangent at f(x1 . And so on….

Example

Evaluate √ to four decimal places Solution X2 – 28 = 0 let x0 = 5 f’ x x x1 = x0 - x1= 5 + x1= 5.3 x2 = 5.3 – . . x2= 5.2915094 x3 = 5.2915094– . . x3 = 2.64574 3. Secant Method

Here, the formula is derived from Newton-Raphson by replacing the derivative by the difference co- efficient. =

Note

a) Here derivative is avoided. b) Convergence is not guaranteed.

c) If converges, Convergence super linear (more rapid than linear, almost quadratic

(5)

4. Regula falsi method or (method of false position)

 Regula falsi method always converge.  However, it converges slowly.

 If converges, order of convergence is between 1 & 2 (closer to 1).  It is superior to Bisection method.

Given, f(x) = 0

Select x0 and x1 such that f(x0) f(x1) < 0 (i.e. opposite sign)

Y – f(x0) = – (x- x0) = - – = – Check if f(x0) f(x2) < 0 or f(x1) f(x2) < 0 Compute ………

which is an approximation to the root.

Example

Find the roots of x3 +x-1 =0

Solution

f(x) = x3+ x-1=0

f(1) = 1+1-1= 1 (+ve)

f(0.5) = (0.5)3+(0.5)-1 = -0.375 (-ve)

Hence root lie between 0.5 & 1 x 0 =0.5 , x 1 = 1 x2 = – = 0.64 f(x) X 3 (X0, f(x0)) (X1, f(x1)) X1 X2 X0 X

(6)

f(x2) = -0.0979 (-ve)

Root lies between 0.64 & 1 x3 = . .

. = 0.672

f(x3)= -0.0245 (-ve)

Hence the root in between 0.672 & 1 X4 = 0.6778

B. Solution of linear system of equations

 Gauss elimination method

 Gauss jordan method

 Do little method

 Crout’s triangularization

 Cholesky method

 Jacobi iteration method

 Gauss siedel iteration method

 Relaxation method 1. Gauss Elimination Method

Here equations are converted into “upper triangular matrix” form, then solved by “back substitution” method.

Consider a1x + b1y + c1z = d1

a2x + b2y + c2z = d2

a3x + b3y + c3z = d3

Step 1. To eliminate x from second and third equation (we do this by subtracting suitable multiple of first equation from second and third equation)

a1x + b1y + c1z = d1 pivotal equation, a1 pivot point.

b ’y + c ’ z = d ’

b3’y + c3’ z = d3’

Step 2. Eliminate y from third equation a1x + b1y + c1z = d1

b ’y + 4c z = d ’ pivotal equation, b ’ is pivot point.

c3’’z = d3”

Step 3. The value of x , y and z can be found by back substitution. Note: Number of operations: N = + -

2. Gauss Jordon method

- Used to find inverse of the matrix and solving linear equations.

- Here back substitution is avoided by additional computations that reduce the matrix to “diagonal from”, instead to triangular form in Gauss elimination method.

- Number of operations is more than Gauss elimination as the effort of back substitution is saved at the cost of additional computation.

Step 1: Eliminate x from 2nd and 3rd

(7)

Step 3: Eliminate z from 1st and 2nd

3. L U decomposition

- It is modification of the Gauss eliminiation method. - Also used for finding the inverse of the matrix. [A]n x n = [ L ] n x n [U] n x n

a11 a12 a13 1 0 0 U11 U12 U13

a21 b22 c23 = L21 1 0 0 U22 U23

a31 b32 c33 L31 L32 1 0 0 U31

Ax = LUX = b can be written as a) LY=b, where b) UX=Y

Solve for Y from a then solve for X from b . This method is known as Dolittle’s method. Similar methods are Crout’s method and Cholesky methods.

4. Iterative Method

a. Jacobi iteration method a1x + b1y + c1z = d1

a2x + b2y + c2z = d2

a3x + b3y + c3z = d3

If a1, b2 , c3 are large compared to other coefficients, then solving these for x, y, z

respectively

x = k1 – l1y – m1z

y = k2 – l2x – m2z

z = k3 – l3x – m3y

Let us start with initial approximation x0 , y0 , z0

x1= k1 – l1y0 – m1z0

y1= k2 – l2x0 – m2z0

z1= k3 – l3x0 – m3y0

Note: No of component of x(k) is used in computation unless y(k) and z(k) is computed.

The process is repeated till the difference between two consecutive approximation is negligible. In generalized form: x(k+1) = k1 – l1 y(k) – m1z(k) y(k+1) = k 2 – l2 x(k) – m2z(k) z(k+1) = k3 – l3 x(k) – m3y(k)

(8)

b. Gauss Siedel iteration method

Modification of the Jacobi’s iteration method

Start with (x0, y0, z0)= (0, 0, 0) or anything [No specific condition]

In first equation, put y = y0 z = z0 which will give x1

In second equation, put x = x1 z = z0 which will give y1

In third equation, put x = x1 y = y1 which will give z1

Note: To compute any variable, use the latest available value. In generalized form:

x(k+1) = k1 – l1y(k) – m1z(k)

y(k+1) = k2 – l2x(k+1) – m2z(k)

z(k+1) = k3 – l3x(k+1) – m3y(k+1)

C. Solution of the non – linear simultaneous equation f(x,y) = 0 ; g(x, y)=0; Assume, x1 = x0 + h , y1 = y0 + k f( x0 + h , y0 + k)=0; g( x0 + h , y0 + k) = 0 f(x0 , y0 ) + h , , + k , , = 0 g(x0 , y0 ) + h , , + k , , = 0

Solving for h and k , we get a new approximation to the root as x1 = x0 + h , y1 = y0 + k

D. Numerical Integration

The process of evaluation of definite Y X0+h X0 X0+2 h X0+n h X Y0 Y1 Y 2

(9)

integeral ∫ from a set of tabulated value of the integrand f(x) is called numerical integration.

This process when applied to a function of a single variable is known as quadrature. Trapezoidal formula:

{ }

Error = Exact – approx

The error in approximating an integral using Trapezoidal rule is bounded b

max ,

Simpson’s one third rule Simpson’s rule

{ } this is known as Simpsons one third rule or Simpsons rule.

The error in approximating an integral using Simpson’s one third rule is max ,

Simpson’s three eighth rule

∫ { 3 3 }

The error in approximating an integral using Simpson’s 3/ rule is max ,

Example Evaluate = ∫ 1. Trapezoidal rule 2. Simpson’s rule 3. Simpson’s rule Solution f(x) =

We choose number of sub division to be six i.e. n = 6 Each sub division h = 1

x = 0 f(x) = 1 = y0

x = 1 f(x) = 0.5 = y1

(10)

x = 3 f(x) = 0.1 = y3 x = 4 f(x) = 0.0588= y4 x = 5 f(x) = 0.0385= y5 x = 6 f(x) = 0.027 = y6 1. By Trapezoidal rule ∫ { } = 1.4108 2. By Simpson’s rule ∫ { y y y y … … … y y y y } = 1.3662 3. By Simpson’s rule ∫ { 3 … … … … } = 1.3735 Example

Solve by Gauss Seidal iteration method x1 + x2 + 4x3 = 9

8x1 – 3x2 + 2x3 =20

4x1 + 11x2 – x3 =33

Solution

Arrange in proper order |8| > |-3| + |2 | |11| > |4| + |-1| |4| > |1| |+ |1| 8x1 – 3x2 + 2x3 = 20 4x1 + 11x2 –x3 = 33 X1 + X2 +4x3 = 9 = { 20 + 3 - } = { 33 - + } = { 9 - - } Initial guess = = = 0 Table K 0 0 0 0 1 2.5 2.0909 1.1023 2 3.0085 2.0062 0.9963 3 3.0032 1.9985 0.9996 4 2.9995 2.0001 1.0001 5 3.000

(11)

Hence, X1 = 3.00

X2 = 2.00

X3 = 1.00

E. Solving Differential Equation

 Euler’s method

 Runge kutta method

 Picard’s method

 Taylor’s series method

 Adam bashford method

 Milne’s method

1. Euler method (for first order differential equation ) Given equation is y’ f x, y ; y x0) = y0

Solution is given by, Yn+1 = yn + h f(xn,yn)

Example

Solve the following differential equation by Euler’s method y’ x y , y(0) =0,

Solution f(x, y) = x + y yn+1 = yn + 0.2{ xn + yn} n xn Yn 0.2(xn+yn) 0 0.0 0.000 0.000 1 0.2 0.000 0.040 2 0.4 0.040 0.088 3 0.6 0.128 0.146 4 0.8 0.274 0.215 5 1.0 0.485

2. Runge Kutta Method

Used for finding the y at a particular x without solving the 1st order differential equation

, K1 = h f(x0, y0) K2 = h f(x0 + y0 + ) K3 = h f(x0 + y0 + ) K4 = h f(x0 +h, y0 + k3) K = (k1 + 2k2 + 2k3 + k4) Y(x0+h) = y0 + k Example

(12)

= with y(0) =1 Solution f(x, y) = , x0 = 0, y0 = 1 , h = 0.2 K1 = h f(x0, y0) = 0.2 f(0,1) =0.2 K2 = h f(x0 + , y0 + ) = 0.2 f(0.1 ,1.1) = 0.19672 K3 = h f(x0 + , y0 + ) = 0.2 f(0.1 ,1.09836) = 0.1967 K4 = hf(x0 +h, y0 +k3) = 0.2 f(0.2 ,1.1967) = 0.1891 K = (k1 + 2k2 + 2k3 +k4) = [0.2+2(0.19672) +2(0.1967) +0.1891] = 0.19599 Y(0.2) = y0 +k = 1.196 Y(0.4) = ?, x1 =0.2 , y1 =1.196 , h = 0.2 K1 = 0.1891 K2 = 0.1795 K3 = 0.1793 K4 = 0.1688 K = ( 0.1892 +2 * 0.1795 + 2 * 0.1793 + 0.1688 ) =0.1792 Y(0.4) = y1 + K = 1.196 + 0.1792 = 1.3752

In numerical integration methods to find integration we make equal slides, in a given period and then sum of all the slides, its how we find numerical integration.

For trapezoidal formula and Simpsons one third rule Simpsons three eight rule. We find some error but in exact method we find integration by formula =∫ f x dx So it is exact method.

(13)

Important Points

- In trapezoidal formula error is zero, if the function is constant or linear then exact value is equals to approximate value.

- Simpson’s one third and three eights rule, is error is zero for. o Constant

o Linear - Quadratic - Cubical functions

References

Related documents

Overexpression of CD147 in the tumor cells has been reported to be correlated with metastasis of breast cancer 194 , and oral squamous cell carcinoma 195 ; and with poor

We slightly adapt the basic model presented by Schrady ( 1967 ) and Minner and Lindner ( 2004 ) and analyze the changes on the optimum inventory control policy induced by

design, planning and evaluation –Turnkey program management –Worksite and commuter outreach –Marketing and promotional campaigns –Call/resource center operations

The findings suggest that (1) married women face significantly more barriers than men when contemplating childbearing, and these barriers concern adjustments to one’s lifestyle,

Project Title: Mentoring Functions within the American Council on Education (ACE) Fellows Leadership Development Program: A Mixed Methods Study.

Managing the Change Management process and the Configuration model will improve service support, reduce the risk of infrastructure and system outages, and improve communication within

The implementation and case analysis verified that the model could aggregate virtual and physical computing resources on demand, as well as promote and improve the

- Roll defender's armour (or set armour if a pure magic attack). - If defender's shield may be used, compare adjusted attacker ability roll to defender's shield ability roll.