program logistic_graph implicit none real r,x_ini,x,xi,y,x_plot(3),y_plot(3),fy integer pgopen,i,i_again,isymbol external fy write (*,*) 'This program plot xn as x_n+1 = 4rx_n(1-x_n+1).' write (*,*) write (*,*) 'What is the initial value of x (0 < x < 1) ?' read (*,*) x_ini if ( pgopen('/xwin') .le. 0 ) stop call pgpap(5.0,1.0) 100 write (*,*) 'What is the value of the control parameter r ?' read (*,*) r call pgeras call pgsci(1) call pgenv(0.0, 1.0, 0.0, 1.0, 0, 0) call pgsci(2) c call pgfunx(fy,1000,0.0,1.0,1) do i=1,1000 x = i/1000.0 y = fy(x,r) call pgpt(1,x,y,-1) end do x_plot(1) = 0.0 y_plot(1) = 0.0 x_plot(2) = 1.1 y_plot(2) = 1.1 call pgsci(1) call pgline(2,x_plot,y_plot) call pgsci(3) x = x_ini y = 0.0 do i=1,500 x_plot(1) = x y_plot(1) = y x_plot(2) = x_plot(1) y = 4*r*x*(1-x) y_plot(2) = y y_plot(3) = y x_plot(3) = y call pgline(3,x_plot,y_plot) x = y end do 102 write (*,*) 'Again ? (1=YES;0=NO)' read (*,*) i_again if (i_again.eq.1) goto 100 if (i_again.eq.0) stop goto 102 end function fy (x,r) real fy,x,r fy = 4*r*x*(1-x) end