      PROGRAM EULER
************************************************************************
* Program that uses Euler's method to obtain an approximate solution   *
* to a first order differential equation of the form:                  *
*                           Y' = F(X, Y)                               *
* Variables used are:                                                  *
*     X      : current X-value                                         *
*     XNEXT  : next X-value (X + DELTAX)                               *
*     Y      : approximate Y-value corresponding to X                  *
*     DELTAX : X-increment used                                        *
*     NVALS  : number of iterations                                    *
*     N      : counts iterations                                       *
*                                                                      *
* Input:  Initial values for X and Y, DELTAX, and NVALS                *
* Output: A sequence of points (X, Y) that approximate the solution    *
*         curve                                                        *
************************************************************************

      REAL X, Y, XNEXT, DELTAX, F
      INTEGER N, NVALS

* Get given information; print table headings and initial values

      PRINT *, 'ENTER X0 AND Y0, X-INCREMENT TO USE, AND'
      PRINT *, 'THE NUMBER OF VALUES TO CALCULATE.'
      READ *, X, Y,  DELTAX, NVALS
      PRINT *
      PRINT *, '      X          Y'
      PRINT *, '===================='
      PRINT 10,  X, Y 
 10   FORMAT (1X, 2F10.5)


* Iterate with Euler's method

      DO 20 N = 1, NVALS
         XNEXT = X + DELTAX
         Y = Y + F(X,Y) * DELTAX
         X = XNEXT
         PRINT 10, X, Y 
 20   CONTINUE
      END


** F(X, Y) *********************************************
* The function F in differential equation Y' = F(X, Y) *
********************************************************

      FUNCTION F(X, Y)

      REAL X, Y, F

      F = 2.0 * X * Y
      END
