! Prototype source code for the multinewt subroutine. ! Add this source code to the module in newton.f90. !--------------------------------------------------------------------------- module general_newton use precision implicit none contains !--------------------------------------------------------------------------- subroutine multnewt(f,df,x,tol,ierr) real(D),intent(inout):: x real(D),intent(in):: tol integer,intent(out):: ierr ! ! The interface block below completes the declarations. Although F is ! a vector-valued function in principle, it is implemented as a subroutine ! here. The function value is returned through the N-vector FCN. ! Similarly, DF is an NxN matrix, which is returned as a subroutine argument. ! interface subroutine f(y,n,fcn) use precision integer,intent(in):: n ! the number of equations real(D),intent(in):: y(n) real(D),intent(out):: fcn(n) ! holds F(y) on return end subroutine f !------------------ subroutine df(y,n,dfcn) use precision integer,intent(in):: n ! the number of equations real(D),intent(in):: y(n) real(D),intent(out):: dfcn(n,n) ! holds the Jacobian matrix on return end subroutine df end interface !------------------ ! ! Local variables and the rest of your code go here. ! return end subroutine multinewt !--------------------------------------------------------------------------- end module general_newton