My Profile
Active Members
TodayLast 7 Days
more...
Awards & Gifts
Online Exams
Fresher Jobs
Our fresher job section is exclusively for fresh graduates! Find jobs for freshers in major Indian
cities including Bangalore, Chennai, Hyderabad, Pune or Kochi
Resources
Find educational articles, blogs, discussion threads and other resources.
Colleges
Find details about any college in India or search for courses.
Advertisements
|
Solving Regula Falsi Method using Fortran
Posted Date: 12 Mar 2008 Resource Type: Articles/Knowledge Sharing Category: Computer & Technology
|
Posted By: ashish singh Member Level: Diamond Rating: Points: 5
|
|
|
|
3. REGULA FALSI METHOD
In the Bisection Method since the approximations are some times higher than and sometimes lower than the exact solution, the convergence of the method is very slow. To improve the rate of convergence, in Regula Falsi Method, the next approximation is takenas the point of intersection of the line (x1,y1)-(x2,y2) with X-axis,instead of the midpoint on the interval x1-x2. Let the equation of line (x1,y1)-(x2,y2) Be y=mx+c Clearly, y1=mx1+c Y2=mx2+c m=(y2-y1)/(x2-x1) c=y1-mx1 c=y1-(y2-y1)/(x2-x1)*x1 c=(x2y1-x1y1-y2x1+x1y1)/x2-x1) c=(x2y1-x1y2)/(x2-x1) y=(y2-y1)/(x2-x1)*x+(x2y1-x1y2)/(x2-x1) To find point of intersection of this line with X-axis, we can put y=0 (y2-y1)/(x2-x1)*x+(x2y1-x1y2)/(x2-x1)=0 (y2-y1)/(x2-x1)*x=-(x2y1-x1y2)/(x2-x1) x=(x2y1-x1y2)/(y2-y1) Thus starting with two values x1 and x2 such that F(x1) and F(x2) have opposite sign we get next approximation as X=(x2y1-x1y2)/(y2-y1) If F(x1) and F(x) have opposite sign then x2 is replaced by x otherwise x1 is replaced by x and this process is repeated until we get x such that F(x)~0.
Fortran Program for Regula Falsi Method :
C SOLUTION OF EQUATION BY USING REGULA-FALSI METHOD FUNCTION F(X) F=2*X*X-4*X+1 RETURN END 2 WRITE(*,*)'ENTER TWO NUMBERS' READ(*,*) X1,X2 Y1=F(X1) Y2=F(X2) IF(F(X1)*F(X2)) 3,4,2 4 IF(F(X1).EQ.0) THEN WRITE(*,*)'SOLUTION=',X1 ELSE WRITE(*,*)'SOLUTION=',X2 STOP END IF 3 WRITE(*,*)'ENTER TOL' READ(*,*) TOL 5 X=(X2*Y1-X1*Y2)/(Y1-Y2) Y=F(X) IF(ABS(Y).LE.TOL) THEN WRITE(*,*)'SOLUTION=',X STOP ENDIF IF(Y*Y1.GT.0) THEN X1=X Y1=Y ELSE X2=X Y2=Y END IF GOTO 5 END
Output
REGULA FALSI METHOD
Microsoft (R) FORTRAN Optimizing Compiler Version 5.10 Copyright (c) Microsoft Corp 1982-1991. All rights reserved.
FALSI.FOR
D:\FORTRAN\BINB>FALSI ENTER TWO NUMBERS 1 2 ENTER TOL .005 SOLUTION= 1.705882 Stop - Program terminated.
|
Responses
|
No responses found. Be the first to respond and make money from revenue sharing program.
|
|
|