      SUBROUTINE Fehler (x, y, N, xm, mx, ym, my, a, ma, b, mb)
      INTEGER*2 i, N
      REAL*8 x(N), y(N)
      REAL*8 sumx, sumy, sumx2, sumy2, sumxy
      REAL*8 d, sx2, sy2, xm, mx, ym, my, a, ma, b, mb

      sumx  = 0d0
      sumy  = 0d0
      sumx2 = 0d0
      sumy2 = 0d0
      sumxy = 0d0
      DO i = 1, N
        sumx  = sumx  + x(i)
        sumy  = sumy  + y(i)
        sumx2 = sumx2 + x(i)*x(i)
        sumy2 = sumy2 + y(i)*y(i)
        sumxy = sumxy + x(i)*y(i)
      END DO
      xm = sumx / N
      ym = sumy / N
      d  = N*sumx2 - sumx*sumx
      a  = (sumx2*sumy - sumx*sumxy) / d
      b  = (N*sumxy - sumx*sumy) / d
      sx2= d/N/(N-1)
      sy2= (sumy2 - a*sumy - b*sumxy) / (N-2)
      mx = SQRT (sx2)
      my = SQRT (sy2)
      ma = SQRT (sy2*sumx2/d)
      mb = SQRT (sy2*N/d)
C     WRITE(*,*) 'sumx =', sumx
C     WRITE(*,*) 'sumy =', sumy
C     WRITE(*,*) 'sumx2 =', sumx2
C     WRITE(*,*) 'sumy2 =', sumy2
C     WRITE(*,*) 'sumxy =', sumxy
C     WRITE(*,*) 'xm =', xm
C     WRITE(*,*) 'mx =', mx
C     WRITE(*,*) 'ym =', ym
C     WRITE(*,*) 'my =', my
C     WRITE(*,*) 'a  =', a
C     WRITE(*,*) 'b  =', b
C     WRITE(*,*) 'ma =', ma
C     WRITE(*,*) 'mb =', mb
C     WRITE(*,*) 'd  =', d
      END
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
      SUBROUTINE Fehler4 (x, y, N, xm, mx, ym, my, a, ma, b, mb)
      INTEGER i, N
      REAL x(N), y(N)
      REAL sumx, sumy, sumx2, sumy2, sumxy
      REAL d, sx2, sy2, xm, mx, ym, my, a, ma, b, mb

      sumx  = 0.0
      sumy  = 0.0
      sumx2 = 0.0
      sumy2 = 0.0
      sumxy = 0.0
      DO i = 1, N
        sumx = sumx + x(i)
        sumy = sumy + y(i)
        sumx2 = sumx2 + x(i)*x(i)
        sumy2 = sumy2 + y(i)*y(i)
        sumxy = sumxy + x(i)*y(i)
      END DO
      xm = sumx / N
      ym = sumy / N
      d  = N*sumx2 - sumx*sumx
      a  = (sumx2*sumy - sumx*sumxy) / d
      b  = (N*sumxy - sumx*sumy) / d
      sx2= d/N/(N-1)
      sy2= (sumy2 - a*sumy - b*sumxy) / (N-2)
      mx = SQRT (sx2)
      my = SQRT (sy2)
      ma = SQRT (sy2*sumx2/d)
      mb = SQRT (sy2*N/d)
      END
