Please help me with the following Fortran program. When the line labeled
60 does not run, the result for q2 is correct; but when this line runs,
the results are totally wrong, since the values of z in the do-loop
change. Can someone tell why and how to correct it? Thanks in advance.


        program  reproducingkernel
        parameter  ( nobs = 10, m=4)
        double precision z(m), q1(m,m), q2(m,m), dk4, dk22
        do 10 j=1,m
              z(j) = j*1.d0/nobs
10      continue
        do 40 i=1,m
          do 40 j=1,m
                write(*,*) i, j, z(i), z(j)
                q2(i,j) = - dk4( z(i) - z(j) )*1000.d0
60              q1(i,j) = dk22( z(i), z(j) ) * 1000.d0 + q2(i,j)
50        continue
40      continue

        write(*,*) 'This is the RK for Ht'
        write(*,*) q1
        write(*,*)
        write(*,*) 'This is the RK for Hw'
        write(*,*) q2
        end

        double precision function dk22 (x1, x2) 
        double precision x1, x2
        x1 = ( x1 - .5d0 ) ** 2
        x1 = ( x1 - 1.d0 / 12.d0 ) / 2.d0
        x2 = ( x2 - .5d0 ) ** 2
        x2 = ( x2 - 1.d0 / 12.d0 ) / 2.d0
        dk22 = x1 * x2
        return 
        end 

        double precision function  dk4 (x) 
        double precision x
        x = abs (x)
        x = ( x - .5d0 ) ** 2
        dk4 = ( x ** 2 - x /2.d0 + 7.d0 / 240.d0 ) / 24.d0 
        return 
        end



=================================================================
Instructions for joining and leaving this list and remarks about
the problem of INAPPROPRIATE MESSAGES are available at
                  http://jse.stat.ncsu.edu/
=================================================================

Reply via email to