module processamento

use variaveis

contains

!--------------------------------------------------------------------

subroutine funcao(f,zeta,Bi)

	real*8,intent(in)  :: zeta, Bi
	real*8,intent(out) :: f

	f = zeta*dtan(zeta) - Bi

end subroutine funcao

!--------------------------------------------------------------------

subroutine derivada(df,zeta)

	real*8,intent(in)  :: zeta
	real*8,intent(out) :: df

	df = dtan(zeta) + zeta/(dcos(zeta))**2

end subroutine derivada

!--------------------------------------------------------------------

subroutine newton

	integer :: it

	zeta = 0.5d0

	do it = 1, 10

		call funcao(f,zeta,Bi)
		call derivada(df,zeta)

		zeta = zeta - f/df

	end do

end subroutine newton

!--------------------------------------------------------------------

subroutine constante

	Cn = 4.0d0*dsin(zeta) / ( 2.0d0*zeta + dsin(2.0*zeta) )

end subroutine constante

!--------------------------------------------------------------------

end module processamento