Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Secant Method
program secant_method implicit none real:: a,b, root a=2.0 b=3.0 call secan(a,b,root) print*,"The root is", root end program real function f(x) implicit none real:: x f= x**3.0-2.0*x-5.0 end function subroutine secan(a,b,root) implicit none real:: a,b, c,tol=.00001, error,f,root integer::i, n=20 do i= 1,n+1 c= b-(b-a)*(f(b)/(f(b)-f(a))) IF (f(c) == 0.0) THEN root=c stop END IF if (f(a)*f(c)<0) then b=c else a=c end if error=abs(f(c)) if (error<=tol) then root=c exit end if end do end subroutine secan
run
|
edit
|
history
|
help
0
Practice 2(I)
DO CONTINUE
A_03 MODIFIED EULER METHOD
A_01 QN:3
Question 01(a)
A_01 NEWTON_R_M(B(I))
GPA GRADING
Exercise 02
evaluation
A_01 QN:1(I) BISECTION METHOD