Beruflich Dokumente
Kultur Dokumente
1) Bisection 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:
Xo=(x1+x2)/2
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
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.
5
Step 1: x0=1
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
x0 = a, x1=a+1h, x2 = a+2h ……
x0 = 0 y=f(x) f(x) =
y0= 1.00
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)
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)=
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
f(0.3) = 1.831
21
Inverse Lagrange’s Interpolation
Example:
22
Solutions of Linear Equations
1. Gauss elimination
2. Gauss seidel method
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:
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
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
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.
38
39
40
.
0
41
42