FORTRAN 90

advertisement
FORTRAN 90
Lecturer : Rafel Hekmat Hameed
University of Babylon
Subject : Fortran 90
College of Engineering
Year : Second B.Sc.
Mechanical Engineering Dep.
Solution of non linear equation
ITERATIVE METHOD
Iterative Method is different from methods such as Bisection, Regula
False etc because in this method we find the value of x such that F(x) =0 by
successive approximations. This method is also very important and useful
but by this method we get solution in a number of steps, so we can say that it
is a slow method for finding root of Transcendental and Algebraic Equation.
Suppose that you can bring an equation g(x) = 0 in the form x = f(x). We'll
show that you can solve this equation, on certain conditions, using iteration.
Start
with
an
approximation
x0
of
the
root.
Calculate x0, x1, ..., xn, ... such that
x1=f(x0)
;
x2=f(x1)
;
x3=f(x2)
;
...
Basic condition required for convergence when finding roots of
nonlinear equation using the method of simple iteration of the equation as
X = F (X) and down to the root X is that the absolute value of the derivative
is less than one:
ȁ܎ ᇱ ሺ‫ܠ‬ሻȁ ൏ ૚
This is diagnosed by finding the relationship x = f (x) of the equation the
original f(x)= 0 and there may be variations of known (x) in terms of the
remaining of the roots of the equation the original relying on the domain that
is achieved by the root of the equation and then apply the condition above.
Example:
Find the root of the following equations:
2x3-7x+2=0, and use (x0=1) as an initial value.
x=2/7(x3+1) ;
f'(x)=6/7x2
PROGRAM ITERATIVE_METHOD
IMPLICIT NONE
REAL::X0,X1,X,F,TOL=1E-5
F(X)=2/7.0*(X**3+1)
WRITE(*,*)'ENTER INITIAL VALUE'
READ(*,*) X0
2 X1=F(X0)
IF(ABS(X1-X0).GT.TOL) THEN
X0 = X1
GOTO 2
ENDIF
WRITE(*,*)'SOLUTION=',X1
END
Download