Sie sind auf Seite 1von 42

NM MATERIAL

Solutions of Algebraic and Transcendental equations

1) Bisection Method

2) Regula Falsi/Falsi position method

3) Iteration/Iterative method

4) Newton-Raphson’s Method

5) Secant Method

Bisection Method
The method is also called the interval halving method, the binary search method or the dichotomy method. This
method is used to find root of an equation in a given interval.
Algorithm
1. f(x) is a continuous function in interval [a, b]
2. f(a) * f(b) < 0
3. Find middle point c= (a + b)/2 .
4. If f(c) == 0, then c is the root of the solution
5. Else f(c) != 0
1. If value f(a)*f(c) < 0 then root lies between a and c. So we recur for a and c
2. Else If f(b)*f(c) < 0 then root lies between b and c. So we recur b and c.
3. Else given function doesn’t follow one of assumptions.
1
Examples:

Consider f(x) = x3 + 3x – 5, where [x1 = 1, x2 = 2] and E = 0.001.

Xo=(x1+x2)/2

f(x2) Update x1&x2


i x1 x0 x2 f(x1) f(x0)

1 1 1.5 2 –1 2.875 9 x1=1 x2=1.5

2 1 1.25 1.5 –1 0.703125 2.875 x1=1 x2=1.25

x1=1.125
3 1 1.125 1.25 –1 –0.201171875 0.703125
x2=1.25

x1=1.125
4 1.125 1.1875 1.25 –0.201171875 0.237060546875 0.703125
x2=1.1875

x1=1.125
5 1.125 1.15625 1.1875 –0.201171875 0.014556884765625 0.237060546875
x2=1.15625

x1=1.140625
6 1.125 1.140625 1.15625 –0.201171875 –0.0941429138183594 0.01455688476562 x2=1.15625
5

– x1=1.148437
0.01455688476562
7 1.140625 1.1484375 1.15625 0.094142913818359 –0.0400032997131348 x2=1.15625
5
4

– x1=1.1523437
0.01455688476562
8 1.1484375 1.15234375 1.15625 0.040003299713134 –0.0127759575843811 x2=1.15625
5
8

-
1.1523437 1.15429687 0.0008772537112236 0.01455688476562
9 1.15625 0.012775957584381
5 5 02 5
1

2
F(x0)< E ( E = 0.001) So

Root x0= 1.154296875

Example2:

3
4
Newton-Raphson Method
Newton Raphson method, also called the Newton’s method, is the fastest and simplest approach of all methods
to find the real root of a nonlinear function. It is an open bracket approach, requiring only one initial guess. This
method is quite often used to improve the results obtained from other iterative approaches.

Step 5. Calculate f(xn) and verify how close it is to zero. Stop when the solution is accurate enough.

Example: find the root of following Equation, initial guess x0=1

5
Step 1: x0=1

X4 value is root value

6
Example2:

7
Regula Falsi/Falsi position method

8
Iteration method

9
10
Secant Method

11
12
Numerical Integration

Trapizoidal Rule
Trapizoidal Rule is used to calculate the integral value of any function. It calculates the value of the area under
any curve over a given interval by dividing the area into equal parts. It follows the method similar to integration
by parts.

In order to integrate any function f(x) in the interval (a,b), follow the steps given below:

1. Select a value for n, which is the number of parts the interval is divided into.
2. Calculate the width, h = (b−a)/n.
3. Calculate the values of x0 to xn as x0 = a, x1 = x0 + h,.....xn-1 = xn-2 + h, xn = b.
4. Consider y = f(x). Now find the values of y(y0 to yn) for the corresponding x(x0 to xn) values.
5. Substitute all the above found values in the Trapizoidal Rule Formula to calculate the integral value.

Examples:

n=4

a = 0 b=1 h = (b-a)/n

h = 0.25

X and Y values are

x0 = a, x1=a+1h, x2 = a+2h ……

x0 = 0 y=f(x) f(x) =

y0= 1.00

repeat this process until calculating x5 & y5

13
Simpson Method
Simpson's Rule Formula is used to calculate the integral value of any function. It calculates the value of the area
under any curve over a given interval by dividing the area into equal parts. It follows the method similar to
integration by parts.

In order to integrate any function f(x) in the interval (a,b), follow the steps given below:

1. Select a value for n, which is the number of parts the interval is divided into. Let the value of n be an
even number.
2. Calculate the width, h = (b−a)/n.
3. Calculate the values of x0 to xn as x0 = a, x1 = x0 + h,.....xn-1 = xn-2 + h, xn = b.
4. Consider y = f(x). Now find the values of y(y0 to yn) for the corresponding x(x0 to xn) values.
5. Substitute all the above found values in the Simpson's Rule Formula to calculate the integral value.

14
Example:

15
16
Newton Forward & Backward Interpolation

Interpolation is the technique of estimating the value of a function for any intermediate value of the
independent variable, while the process of computing the value of the function outside the given range is
called extrapolation.

Forward Differences : The differences y1 – y0, y2 – y1, y3 – y2, ……, yn – yn–1 when denoted by dy0, dy1,
dy2, ……, dyn–1 are respectively, called the first forward differences.

Whe
re
s=(x
-x0)/h, f0=y0, P(x0+hs)=f(x)

h means difference between x values.

17
Backward Differences : The differences y1 – y0, y2 – y1, ……, yn – yn–1 when denoted by dy1, dy2, ……,
dyn, respectively, are called first backward difference.

18
f(x)=

Where s=(x-xn)/h, fn=yn, P(xn+hs)=f(x)

h means difference between x values.

19
Lagrange’s Interpolation

Interpolation is a method of finding new data points within the range of a discrete set of known data points. In
other words interpolation is the technique to estimate the value of a mathematical function, for any intermediate
value of the independent variable.

20
x=0.3 x0=0 x1=1 x2=3 x3=4 x4=7

f0=1 f1=3 f2=49 f3=129 f4=813

f(0.3) = 1.831

21
Inverse Lagrange’s Interpolation

Example:

22
Solutions of Linear Equations
1. Gauss elimination
2. Gauss seidel method

5. Gauss Jacobi method

Gauss Elimination Method


DEFINITION: (Forward/Gauss Elimination Method) Gaussian elimination is a method of solving a linear
system (consisting of equations in unknowns) by bringing the augmented matrix

to an upper triangular form

This elimination process is also called the forward elimination method.

Example : Solve the following system using Gaussian elimination:

+The augmented matrix which represents this system is

23
The first goal is to produce zeros below the first entry in the first column, which translates into eliminating the
first variable, x, from the second and third equations. The row operations which accomplish this are as follows:

The second goal is to produce a zero below the second entry in the second column, which translates into
eliminating the second variable, y, from the third equation. One way to accomplish this would be to add −1/5
times the second row to the third row. However, to avoid fractions, there is another option: first interchange
rows two and three. Interchanging two rows merely interchanges the equations, which clearly will not alter the
solution of the system:

Now, add −5 times the second row to the third row:

Since the coefficient matrix has been transformed into echelon form, the “forward” part of Gaussian elimination
is complete. What remains now is to use the third row to evaluate the third unknown, then to back‐substitute
into the second row to evaluate the second unknown, and, finally, to back‐substitute into the first row to
evaluate the first unknwon.

The third row of the final matrix translates into 10 z = 10, which gives z = 1. Back‐substitution of this value into
the second row, which represents the equation y − 3 z = −1, yields y = 2. Back‐substitution of both these values
into the first row, which represents the equation x− 2 y + z = 0, gives x = 3. The solution of this system is
therefore (x, y, z) = (3, 2, 1).

Example2:

24
Gauss seidel method

25
26
27
Gauss Jacobi method

28
29
Solutions of first order differential equations
1. Euler’s method

2. Modified Euler’s method

3. Runge kutta method

1. Euler’s method

Example:

30
31
32
33
Example2: find y(2.2) using euler’s method from the equation dy/dx= -xy2 with y(2)=1.

Solution:

f(x,y)=-xy2 xn = 2.2

y(x0) = y0 so x0 = 2 y0 =1

let n=4 i.e h= (xn – x0)/n

h= (2.2-2)/4

34
h=0.05

35
Modified Euler’s Method

36
37
Runge Kutta Method

The problem with Euler's Method is that you have to use a small interval size to get a reasonably accurate result.
That is, it's not very efficient.

The Runge-Kutta Method produces a better result in fewer steps.

38
39
40
.
0

41
42

Das könnte Ihnen auch gefallen