Está en la página 1de 13

Chapter-3

Mathematics

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. 2. 3. 4. 5. 6. Bisection Method Regula falsi method Secant method Newton- Raphson method Horners method Descartes rule f(x) = 0

Consider an equation 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 = y y = f(x) .

x a b

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.
THE GATE ACADEMY PVT.LTD. H.O.: #74, Keshava Krupa (third Floor), 30th Cross, 10th Main, Jayanagar 4th Block, Bangalore-11 : 080-65700750, info@thegateacademy.com Copyright reserved. Web: www.thegateacademy.com Page 71

Chapter-3

Mathematics

Note
Simplest iterative method Bisection method always converge but often slowly. This method cant be used for finding the complex roots. Rate of convergence is linear

Example Find the roots of Solution f(2) = -ve , f(3) = +ve x1 = = 2.5 a root in [2,3]

f(x1) = -ve x2 = = 2.75

f(x2) = +ve x3 = = 2.625

Y=f(x) f(x)

X2 f(x3) = -ve x4 = 2. = 2.6875

X1

X0

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 .
THE GATE ACADEMY PVT.LTD. H.O.: #74, Keshava Krupa (third Floor), 30th Cross, 10th Main, Jayanagar 4th Block, Bangalore-11 : 080-65700750, info@thegateacademy.com Copyright reserved. Web: www.thegateacademy.com Page 72

Chapter-3

Mathematics

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 Newtons method converges provided the initial approximation is chosen sufficiently close to the root. Rate of convergence is quadratic

Geometric Interpretation y f(x0 x1 = x0 Draw a tangent at f(x0). Tangent intersects X-axis at x1. Draw a tangent at f(x1 . And so on. f x0) (x-x0)

Example Evaluate Solution X2 28 = 0 let x0 = 5 f x x x1 = x0 x1= 5 + x1= 5.3 x2 = 5.3


. . . .

to four decimal places

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 like Newton Raphson, around 1.62)
THE GATE ACADEMY PVT.LTD. H.O.: #74, Keshava Krupa (third Floor), 30th Cross, 10th Main, Jayanagar 4th Block, Bangalore-11 : 080-65700750, info@thegateacademy.com Copyright reserved. Web: www.thegateacademy.com Page 73

Chapter-3

Mathematics

4.

Regula falsi method or (method of false position)


(X0, f(x0)) f(x)

X
3

X2

X1 X

X0 (X1, f(x1))

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 , x2 = x 1= 1

= 0.64

THE GATE ACADEMY PVT.LTD. H.O.: #74, Keshava Krupa (third Floor), 30th Cross, 10th Main, Jayanagar 4th Block, Bangalore-11 : 080-65700750, info@thegateacademy.com Copyright reserved. Web: www.thegateacademy.com Page 74

Chapter-3

Mathematics

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 Crouts triangularization Cholesky method Jacobi iteration method Gauss siedel iteration method Relaxation method 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 b3y + 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. c3z = d3 Step 3. The value of x , y and z can be found by back substitution. Note: Number of operations: 2. N = + -

1.

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 Step 2: Eliminate y from 1st and 3rd
THE GATE ACADEMY PVT.LTD. H.O.: #74, Keshava Krupa (third Floor), 30th Cross, 10th Main, Jayanagar 4th Block, Bangalore-11 : 080-65700750, info@thegateacademy.com Copyright reserved. Web: www.thegateacademy.com Page 75

Chapter-3

Mathematics

3.

Step 3: Eliminate z from 1st and 2nd 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 a21 b22 c23 L21 1 0 = a31 b32 c33 L31 L32 1 Ax = LUX = b can be written as a) LY=b, where b) UX=Y U11 U12 U13 0 U22 U23 0 0 U31

Solve for Y from a then solve for X from b . This method is known as Dolittles method. Similar methods are Crouts 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) = k2 l2 x(k) m2z(k) z(k+1) = k3 l3 x(k) m3y(k)

THE GATE ACADEMY PVT.LTD. H.O.: #74, Keshava Krupa (third Floor), 30th Cross, 10th Main, Jayanagar 4th Block, Bangalore-11 : 080-65700750, info@thegateacademy.com Copyright reserved. Web: www.thegateacademy.com Page 76

Chapter-3

Mathematics

b. Gauss Siedel iteration method Modification of the Jacobis 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 g(x0 , y0 ) + h
, ,

+k
,

=0
,

+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
Y Y0 Y1

Y2

X X0 X0+h X0+2
h

X0+n
h

The process of evaluation of definite

THE GATE ACADEMY PVT.LTD. H.O.: #74, Keshava Krupa (third Floor), 30th Cross, 10th Main, Jayanagar 4th Block, Bangalore-11 : 080-65700750, info@thegateacademy.com Copyright reserved. Web: www.thegateacademy.com Page 77

Chapter-3

Mathematics

integeral integration.

from a set of tabulated value of the integrand f(x) is called numerical

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 , Simpsons one third rule Simpsons rule { this is known as Simpson s one third rule or Simpson s rule. The error in approximating an integral using Simpsons one third rule is max
,

Simpsons three eighth rule { 3 3 } max

The error in approximating an integral using Simpsons 3/ rule is

Example Evaluate = 1. Trapezoidal rule 2. Simpsons 3. Simpsons 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 x=2 f(x) = 0.2 = y2
THE GATE ACADEMY PVT.LTD. H.O.: #74, Keshava Krupa (third Floor), 30th Cross, 10th Main, Jayanagar 4th Block, Bangalore-11 : 080-65700750, info@thegateacademy.com Copyright reserved. Web: www.thegateacademy.com Page 78

rule rule

Chapter-3

Mathematics

x=3 x=4 x=5 x=6 1. 2. {

f(x) = 0.1 = y3 f(x) = 0.0588= y4 f(x) = 0.0385= y5 f(x) = 0.027 = y6 By Trapezoidal rule } = 1.4108 rule y y y y y y y } By Simpsons = 1.3662 { y

3.

By Simpsons

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= + } = =0 } }

Initial guess Table K 0 1 2 3 4 5 0 2.5 3.0085 3.0032 2.9995 3.000

0 2.0909 2.0062 1.9985 2.0001

0 1.1023 0.9963 0.9996 1.0001

THE GATE ACADEMY PVT.LTD. H.O.: #74, Keshava Krupa (third Floor), 30th Cross, 10th Main, Jayanagar 4th Block, Bangalore-11 : 080-65700750, info@thegateacademy.com Copyright reserved. Web: www.thegateacademy.com Page 79

Chapter-3

Mathematics

Hence, X1 = 3.00 X2 = 2.00 X3 = 1.00

E.

Solving Differential Equation


Eulers method Runge kutta method Picards method Taylors series method Adam bashford method Milnes 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 Eulers method y x 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.

y , y(0) =0,

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 Find the value of y at x = 0.2, 0.4 for the following differential equation:
THE GATE ACADEMY PVT.LTD. H.O.: #74, Keshava Krupa (third Floor), 30th Cross, 10th Main, Jayanagar 4th Block, Bangalore-11 : 080-65700750, info@thegateacademy.com Copyright reserved. Web: www.thegateacademy.com Page 80

Chapter-3

Mathematics

= Solution f(x, y) = ,

with y(0) =1

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.

THE GATE ACADEMY PVT.LTD. H.O.: #74, Keshava Krupa (third Floor), 30th Cross, 10th Main, Jayanagar 4th Block, Bangalore-11 : 080-65700750, info@thegateacademy.com Copyright reserved. Web: www.thegateacademy.com Page 81

Chapter-3

Mathematics

Important Points - In trapezoidal formula error is zero, if the function is constant or linear then exact value is equals to approximate value. - Simpsons one third and three eights rule, is error is zero for. o Constant o Linear - Quadratic - Cubical functions Exact Value = approximate value.

THE GATE ACADEMY PVT.LTD. H.O.: #74, Keshava Krupa (third Floor), 30th Cross, 10th Main, Jayanagar 4th Block, Bangalore-11 : 080-65700750, info@thegateacademy.com Copyright reserved. Web: www.thegateacademy.com Page 82

También podría gustarte