      SUBROUTINE INITAL
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
      PARAMETER (NX=11)
      COMMON/T/       T,  NSTOP,  NORUN
     1      /Y/   U(NX),  V(NX)
     2      /F/  UT(NX), VT(NX)
     3      /S/  UX(NX), VX(NX)
     4      /P/      DX,     PI
C...
C...  GRID SPACING, PI
      DX=1.0D0/DFLOAT(NX-1)
      PI=4.0D0*DATAN(1.0D0)
C...
C...  INITIAL CONDITIONS
      DO 1 I=1,NX
         U(I)=0.0D0
         V(I)=DCOS((PI/2.0D0)*DX*DFLOAT(I-1))
1     CONTINUE
      RETURN
      END
      SUBROUTINE DERV
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
      PARAMETER (NX=11)
      COMMON/T/       T,  NSTOP,  NORUN
     1      /Y/   U(NX),  V(NX)
     2      /F/  UT(NX), VT(NX)
     3      /S/  UX(NX), VX(NX)
     4      /P/      DX,     PI
C...
C...  BOUNDARY CONDITIONS
          U(1)=0.0D0
         V(NX)=0.0D0
C...
C...  UX, VX
C...
C...     SECOND ORDER DIFFERENCES
         IF(NORUN.EQ.1)THEN
         CALL DSS002(0.0D0,1.0D0,NX,U,UX)
         CALL DSS002(0.0D0,1.0D0,NX,V,VX)
C...
C...     FOURTH ORDER DIFFERENCES
         ELSE IF(NORUN.EQ.2)THEN
         CALL DSS004(0.0D0,1.0D0,NX,U,UX)
         CALL DSS004(0.0D0,1.0D0,NX,V,VX)
         END IF
C...
C...  PDES
      DO 1 I=1,NX
         UT(I)=-VX(I)
         VT(I)=-UX(I)
1     CONTINUE
C...
C...  ZERO TEMPORAL DERIVATIVES ACCORDING TO THE BOUNDARY CONDITIONS
          UT(1)=0.0D0
         VT(NX)=0.0D0
      RETURN
      END
      SUBROUTINE PRINT(NI,NO)
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
      PARAMETER (NX=11)
      COMMON/T/       T,  NSTOP,  NORUN
     1      /Y/   U(NX),  V(NX)
     2      /F/  UT(NX), VT(NX)
     3      /S/  UX(NX), VX(NX)
     4      /P/      DX,     PI
      DIMENSION  UE(NX), VE(NX), EU(NX), EV(NX)
C...
C...  MONITOR THE CALCULATION
      WRITE(*,*)NORUN,T
C...
C...  EXACT SOLUTION
      DO 1 I=1,NX,2
         X=DX*DFLOAT(I-1)
         UE(I)=DSIN((PI/2.0D0)*X)*DSIN((PI/2.0D0)*T)
         VE(I)=DCOS((PI/2.0D0)*X)*DCOS((PI/2.0D0)*T)
1     CONTINUE
C...
C...  ERRORS IN THE NUMERICAL SOLUTION
      DO 4 I=1,NX,2
         EU(I)=U(I)-UE(I)
         EV(I)=V(I)-VE(I)
4     CONTINUE
C...
C...  PRINT THE NUMERICAL AND EXACT SOLUTIONS, AND THE ERRORS
      WRITE(NO,2)T
2     FORMAT(///,5H T = ,F7.3,/,
     1 5X,'X',9X,'U',8X,'UE',9X,'ERR U',
     2        9X,'V',8X,'VE',9X,'ERR V')
      DO 5 I=1,NX,2
         X=DX*DFLOAT(I-1)
         WRITE(NO,3)X,U(I),UE(I),EU(I),
     1                V(I),VE(I),EV(I)
3        FORMAT(F6.3,2F10.5,F14.9,
     1               2F10.5,F14.9)
5     CONTINUE
      RETURN
      END

