Logistic Map: Why it Doubles?
CODES
Jeane Anne M. Dagoy
program logisticmap
implicit none
call initialize (o, p, x_0, r_0, n, q)
call calculate1(o, p, x_0, r, m)
call calculate2 (l, n, m, r_0, x_0, q)
real*8 :: x_0, r, r_0
integer*4 :: l, m, n, o, p, q
write (*,*) FINISHED!
!x_0 = the initial population size as
a proportion to the maximum population
end program logisticmap
!#######################################
!x_n = the population size at year n
as a proportion to the maximum population
subroutine initialize(o, p, x_0, r_0, n, q)
implicit none
!r = the combined rate of reproduction
and starvation (r_0 is the initial rate
for the 2nd calculation)
!l & m =
!n
real*8 :: x_0, r_0
integer*4 :: o, p, n, q
loop variables
o = 11
p = 50
x_0 = 0.35
number of time steps
r_0 = 1.0
n = 599
q = 1000
!o = numbers stored in the data file
!p = number of iterations for the
calculation of x_n on fixed values of r
end subroutine initialize
!q = number of iterations for the
calculation of x_n on values of r from
1 to 4
open
open
open
open
open
open
open
open
open
open
open
open
open
(10,
(11,
(12,
(13,
(14,
(15,
(16,
(17,
(18,
(19,
(20,
(21,
(22,
file
file
file
file
file
file
file
file
file
file
file
file
file
=
=
=
=
=
=
=
=
=
=
=
=
=
!#######################################
subroutine calculate1(o, p, x_0, r, m)
implicit none
data_r.dat)
[Link])
[Link])
[Link])
[Link])
[Link])
[Link])
[Link])
[Link])
[Link])
[Link])
[Link])
[Link])
real*8 :: ra(50,2), r, x_n, x_0
integer*4 :: o, p, m, l
do l = 1, o
x_n = x_0
read (10,*) r
do m=1, p
x_n = r*x_n*(1-x_n)
ra(m,1)=m
1
ra(m,2)=x_n
31 format (f7.1, f21.10)
end do
call store1 (r, ra, m, p)
end do
else if (r>1 .and. r<2) then
write (12,32) (ra(m,col), col=1,2)
32 format (f7.1, f21.10)
end subroutine calculate1
else if (r>2 .and. r<3) then
write (13,33) (ra(m,col), col=1,2)
33 format (f7.1, f21.10)
!#######################################
subroutine calculate2(l, n, m, r_0, x_0, q)
implicit none
else if (r>3 .and. r<3.45) then
write (14,34) (ra(m,col), col=1,2)
34 format (f7.1, f21.10)
real*8 :: r_0, r, x_0, x_n, rb(599000,2)
integer*4 :: l, n, m, q
else if (r>3.45 .and. r<3.54) then
write (15,35) (ra(m,col), col=1,2)
35 format (f7.1, f21.10)
x_n=x_0
r=r_0
else if (r>3.54 .and. r<3.564) then
write (16,36) (ra(m,col), col=1,2)
36 format (f7.1, f21.10)
do l=1, n
r=r+0.005
else if (r>3.564 .and. r<3.568) then
write (17,37) (ra(m,col), col=1,2)
37 format (f7.1, f21.10)
do m=1,q
x_n=r*x_n*(1-x_n)
else if (r>3.568 .and. r<3.85) then
write (18,38) (ra(m,col), col=1,2)
38 format (f7.1, f21.10)
rb(m,1)=r
rb(m,2)=x_n
else if (r>3.85 .and. r<3.864) then
write (19,39) (ra(m,col), col=1,2)
39 format (f7.1, f21.10)
end do
call store2(rb, m, q)
end do
else if (r>3.864 .and. r<3.866) then
write (20,40) (ra(m,col), col=1,2)
40 format (f7.1, f21.10)end if
end subroutine calculate2
else if (r>3.866 .and. r<4) then
write (21,41) (ra(m,col), col=1,2)
41 format (f7.1, f21.10)
!#######################################
end if
subroutine store1(r, ra, m, p)
implicit none
end do
real*8 :: ra(50,2), r
integer*4 :: m, p, col
end subroutine store1
!#######################################
do m=1, p
subroutine store2(rb, m, q)
implicit none
if (r>0 .and. r<1) then
write (11,31) (ra(m,col), col=1,2)
real*8 :: rb(599000,2)
integer*4 :: m, q, col
do m=1,q
write (22,42) (rb(m,col), col=1,2)
42 format (f7.3, f21.10)
end do
end subroutine store2