C     [DEM31]
C     DEMONSTRATION FOR THE REPRESENTATION OF A FUNCTION OF A COMPLEX
C     VARIABLE. THE MODULUS OF THE FUNCTION CAN BE SHOWN AS A SURFACE IN
C     THREE DIMENSIONS, BUT THE PHASE IS LOST IN THE PROCESS. BY SHOWING
C     CONTOURS OF CONSTANT PHASE THE LOST INFORMATION IS REGAINED, BUT
C     IT IS HARD TO SHOW CONTOURS ON A SURFACE ALREADY DENSELY POPULATED
C     BY LINEAR ARCS. BY SHOWING REGIONS OF DIFFERENT PHASE IN DIFFERENT
C     COLORS THE INFORMATION IS PRESENTED IN A READILY PERCEIVABLE FORM.
C     [26-MAY-75]

      EXTERNAL    PLTCA
      COMPLEX     P,U,V,Z
      DIMENSION   W(121,121)

      P(Z)=1.0+Z*(1.0+Z*(1.0+Z*(1.0+Z*(1.0+Z))))

      RO=45.0
      TI=22.50
      NX=121
      NY=121
      X1=-1.5
      X2= 1.5
      Y1=-1.5
      Y2= 1.5
      DX=(X2-X1)/FLOAT(NX-1)
      DY=(Y2-Y1)/FLOAT(NY-1)
      Y=Y1
      DO 20 I=1,NY
      X=X1
      DO 10 J=1,NX
      Z=CMPLX(X,Y)
      U=1.0/P(Z)-Z
      AM=CABS(U)
      PH=CARG(U)
      W(J,I)=SIGN(TANH(0.25*AM),SIN(2.0*PH))
   10 X=X+DX
   20 Y=Y+DY

      CALL PLT00
      CALL PLTFR
      CALL PLTLA ('DEM31')
      CALL PLTUR (-0.1,0.0,1.0,1.0,1.1,-0.1,0.0,1.0,1.0,1.1,0.02,PLTCA)
      CALL PVIIV (0.0,W,1.0,NX,NY,RO,TI,1.0,PLTCA)
      CALL PLTEJ
      CALL PLT00
      CALL PLTFR
      CALL PLTUR (-0.1,0.0,1.0,1.0,1.1,-0.1,0.0,1.0,1.0,1.1,0.02,PLTCA)
      CALL PVIIV (0.0,W,1.0,NX,NY,RO,TI,-1.0,PLTCA)
      CALL PLTEJ
      CALL EXIT
      END

