This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: Real f,a,b,L,MP Integer step a=1. b=2. L = b-a step = 0 *implement do while condition to keep bisecting subintervals and determining in which *half f changes sign until a very small length subinterval is reached and a solution *is determined DO WHILE (abs(L) .GT. 0.0000000001) MP = (a+b)/2 IF ((f(a)*f(MP)) .LT. 0)THEN B = MP L = b-a ELSE A = MP L = b-a ENDIF step = step + 1 ENDDO print*, 'A solution of (x**3 + x - 5) is:',MP END *define function to find root of FUNCTION f(x) REAL f,x f = x**3 + x -5 RETURN END...
View Full Document
- Spring '09