!ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
! LOGISTIC MAP
!  map.f90
!  x'= 4*r*x*(1-x) with fixed points and bifurcations
!ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
program map
  implicit none
  real :: r_min=0.25, r_max=1.0, r, step=0.0025, x
  integer :: n
  open(unit=7,file="map.dat",status="replace",action="write")
  ! calculate the sequences for different values of the parameter
  ! starts from r=r_min, then increase by step=0.0025.
  ! Starting point x=0.5
  r = r_min
  Do 
     r = r + step
     if (r > r_max) exit
     x = 0.5
     ! through away the first 200 points...
     Do  n=0, 200
        x = 4 * r * x * (1 - x)
     end do
     ! ...save other 200 points for each value of the parameter.
     Do  n=201, 401
        x = 4 * r * x * (1 - x)
        Write (unit=7,fmt="(f6.4,f10.6)") r,x
     end do
  end do
  Close(unit=7)
End program map
