program growth
  implicit none

  integer            :: i
  integer, parameter :: n = 1000
  real(8), parameter :: dk = 1.0/n
  real(8)            :: f(n)
  real(8)            :: k(n), c_i(n)
  real(8)            :: A
  complex(8)         :: B(n)
  
  k = 0
  A = 0
  
  do i = 1, n
     k(i) = dk * (i-1)
     !B(i) = sqrt( cmplx( (1-2*k(i))**2-exp(-4*k(i)) ) )
     B(i) = sqrt( cmplx( (1-1*k(i))**2-exp(-2*k(i)) ) )
  end do

  do i = 1, n
     f(i) = imag( (1.0d0/1.0d0)*B(i) )
     !print *, f(i)
     
     if ( f(i) >=  A ) then
        A = f(i)
     else 
        print *, k(i-1)
        exit
     end if
     
  end do

end program growth
