PROGRAM secant IMPLICIT NONE REAL::f,ea=6,es=1,x0,x1,x2 INTEGER::c=0 PRINT *, "============================================" PRINT *, "PROGRAM TO FIND ROOTS USING - SECANT METHOD [BY - www.BottomScience.com]" PRINT *, "============================================" PRINT *,'Initial approximation?' read(*,*)x0,x1 DO WHILE(ea>es) x2=x1-((x1-x0)/((f(x1))-(f(x0))))*f(x1) ea=abs(((x1-x0)/x1)*100) x0=x1 x1=x2 c=c+1 IF(c>50) EXIT PRINT *,'Current root is',x1 WRITE(1,*) x1 END DO IF(x1 > 3E+38 .OR. x1 < -3E+38) THEN PRINT *,'WRONG INTIAL APPROXIMATION' ELSE PRINT *,'FINAL ROOT IS',x1 END IF END PROGRAM REAL function f(x1) REAL::x1 f=(x1**2)-3 RETURN END FUNCTION

We are one of the best sources to provide deep knowledge of science concepts and we dedicated to empower you with the very best information and news of every field of science.