You have more mistakes in your code:
- in calculation of h, you are using degs and not rads
- upper bound of integral connected to number of items in TanTab array
- not init variables to 0 (sumo, sume, ...)
- calculation of area for each step, could be done outside do loop
- out-of-bounds mistakes
You should start using debugger and learn how to find problems in your code. The working version is here:
PROGRAM simpson
implicit none
REAL :: area, h, sumo, sume
INTEGER (kind=4) :: i!Loop index
integer, parameter :: k = 100
REAL (kind=4) :: rad, TanTab(k+1) !Radian variable to be calculated in Subroutine, Result array
sumo = 0.0
sume = 0.0
area = 0.0
h = 0.0174532925 * 60.0/real(k) ! Defining step size in relation to number of sampling points
DO i=1,k+1
rad = 0.0174532925 * 60.0 * real(i-1) /real(k)
TanTab(i) = tan(rad)
! write(*,*) "Tan(", i-1, ")", TanTab(i)
ENDDO
DO i=2,k
IF(MOD(i,2) == 1) THEN
sumo = sumo + TanTab(i) !sum of odd functions
ELSE
sume = sume + TanTab(i) !sum of even functions
ENDIF
ENDDO
! by simson
area = (h/3)*( TanTab(1) + (2*sume) + (4*sumo) + TanTab(k+1))
WRITE(*,*) area
! by integration
area = log(1.0) - log(cos(0.0174532925 * 60.0))
WRITE(*,*) area
END PROGRAM simpson