! The mapping w=1/z.
! Plots the points w=1/z with z indicated by mouse dragging.
! Finishes on a mouse right click.
OPTION ARITHMETIC COMPLEX
LET a=4
SET WINDOW -a,a,-a,a
DRAW grid
DO 
   mouse poll x,y,L,R
   IF L=1 THEN
      SET POINT COLOR 3
      PLOT POINTS: x,y
      SET POINT COLOR 2
      WHEN EXCEPTION IN
         LET z=COMPLEX(x,y)
         LET w=1/z
         PLOT POINTS: re(w),im(w)
      USE
      END WHEN
   END IF
LOOP UNTIL R=1 
END

