program rtsafe_main real rtsafe, x1, x2, xacc external rtsafe, funcd write (*,*) 'Please type in interval x1 and x2 :' read (*,*) x1, x2 write(*,*) 'Please typle in theaccuracy for root finding :' read (*,*) xacc write(*,*) 'The root is ', rtsafe(funcd,x1,x2,xacc) write(*,*) 'within the accuracy of +/- ', xacc end c subroutine funcd(x,f,df) c real x, f, df c f = x**3 c df = 3*(x**2) c end subroutine funcd(x,f,df) real x, f, df f = x**2 - 1.0 df = 2*x end c subroutine funcd(x,f,df) c real x, f, df c f = 7*sin(x) + x c df = 7*cos(x) + 1 c end