*
* Integ.f by Richard J. Davies
* from `Introductory Java for Scientists and Engineers'
* chapter: `Java from Basics'
* section: `Example - Integration'
*
* This is a Fortran program to integrate 1/(1+x) between x=1 and x=2 by the
* trapezium rule with 100 divisions. It is included for comparison with
* with the Java version `Integ.java'.
*
      PROGRAM INTEG

      DOUBLE PRECISION total, x, y
      INTEGER i

      total = 0

* We are using the trapezium rule, so each end
* point has a weighting of one.

      total = total + 1 / (1 + 1.0)
      total = total + 1 / (1 + 2.0)

* whilst each middle point has weight two

      DO 10 i = 1 , 99
        x = 1 + i/100.0
        y = 1 / (x + 1)

        total = total + 2*y
10    CONTINUE

* Finally, we multiply by half the step size

      total = total * 0.005

      PRINT *, total
      END
