      subroutine fcn(n,fi,f)
!
!     the system of equations
!      
!      implicit real *8 (a-h,o-z)
      dimension fi(n),f(n)

!	f(1)=cos(fi(1))-fi(2)
!	f(2)=fi(1)-sin(fi(2))

!	Sistema para o livro Calc Num
!
	f(1)=fi(1)**3+2*fi(2)**2-fi(3)-20.
	f(2)=2*fi(1)-fi(1)*fi(2)+fi(3)-2.
	f(3)=fi(1)+fi(2)-fi(3)-5.
!

      return
      end
!-----------------------------------------------------------------
      subroutine usrfunex(u,n,np,g,a)
!
!	compute the values of g (through function fcn) 
!	for a given u and the jacobean
!
!      implicit real *8 (a-h,o-z)
      dimension u(n),g(np),a(np,np)
!
!	evaluate the values of g
!
      call fcn(n,u,g)
!
!     build the jacobean exactly
!
	a(1,1)=-sin(u(1))
	a(1,2)=-1.
	a(2,1)=1.
	a(2,2)=-cos(u(2))

      return
      end
 !-----------------------------------------------------------------
       subroutine fcn2(n,fi,f)
!
!     the system of equations
!      
!      implicit real *8 (a-h,o-z)
      dimension fi(n),f(n)

!	Sistema para o livro Calc Num
!
	f(1)=(-2*fi(2)**2+fi(3)+20.)**(1./3.)
	f(2)=(2*fi(1)+fi(3)-2.)/fi(1)
	f(3)=fi(1)+fi(2)-5.
!
!	f(1)=sin(fi(2))    
!	f(2)=cos(fi(1))  

      return
      end
!-----------------------------------------------------------------
