* D02BGF Example Program Text * Mark 14 Revised. NAG Copyright 1989. * .. Parameters .. INTEGER NOUT PARAMETER (NOUT=6) INTEGER N, M PARAMETER (N=3,M=1) * .. Local Scalars .. DOUBLE PRECISION HMAX, PI, TOL, VAL, X, XEND INTEGER I, IFAIL * .. Local Arrays .. DOUBLE PRECISION W(N,10), Y(N) * .. External Functions .. DOUBLE PRECISION X01AAF EXTERNAL X01AAF * .. External Subroutines .. EXTERNAL D02BGF, FCN * .. Executable Statements .. WRITE (NOUT,*) 'D02BGF Example Program Results' XEND = 10.0D0 HMAX = 0.0D0 VAL = 0.0D0 PI = X01AAF(X) DO 20 I = 4, 5 TOL = 10.0D0**(-I) WRITE (NOUT,*) X = 0.0D0 Y(1) = 0.5D0 Y(2) = 0.5D0 Y(3) = PI/5.0D0 IFAIL = 1 * CALL D02BGF(X,XEND,N,Y,TOL,HMAX,M,VAL,FCN,W,IFAIL) * IF (IFAIL.EQ.0) THEN WRITE (NOUT,99999) 'Calculation with TOL =', TOL WRITE (NOUT,99998) ' Y(M) changes sign at X = ', X IF (TOL.LT.0.0D0) WRITE (NOUT,*) + ' Over one-third steps controlled by HMAX' ELSE WRITE (NOUT,99997) IFAIL GO TO 40 END IF * 20 CONTINUE 40 CONTINUE * 99999 FORMAT (1X,A,E8.1) 99998 FORMAT (1X,A,F7.4) 99997 FORMAT (1X,/1X,' ** D02BGF returned with IFAIL = ',I5) END * SUBROUTINE FCN(T,Y,F) * .. Parameters .. INTEGER N PARAMETER (N=3) * .. Scalar Arguments .. DOUBLE PRECISION T * .. Array Arguments .. DOUBLE PRECISION F(N), Y(N) * .. Intrinsic Functions .. INTRINSIC COS, TAN * .. Executable Statements .. F(1) = TAN(Y(3)) F(2) = -0.032D0*TAN(Y(3))/Y(2) - 0.02D0*Y(2)/COS(Y(3)) F(3) = -0.032D0/Y(2)**2 RETURN END