program mandel real :: xmin, xmax real :: ymin, ymax real :: dx, x real :: dy, y integer :: i, j integer :: it, itmax integer, parameter :: nsize = 700 complex :: c, z ! initialize variables itmax = 5000 xmin = -2 xmax = 2 ymin = -2 ymax = 2 ! determine dx, dy for grid based on initial values n = nsize dx = (xmax - xmin)/(n-1) dy = (ymax - ymin)/(n-1) ! loop over the grid do i = 1, n do j = 1, n ! find x,y and set the c to the location in the complex plane x = (i-1) * dx + xmin y = (j-1) * dy + ymin c = cmplx(x,y) z = c ! determine the number of iterations needed it = 0 do while (it < itmax .and. abs(z) < 2) it = it + 1 z = z*z + c enddo ! print the result to a data file write(11,'(2i6, i5)') i,j,it enddo enddo end program mandel