'Program FIG2.BAS finds regions of ab-space with different dynamic behaviors for Elhadj16 map #DEBUG ERROR OFF DEFEXT a-z FUNCTION PBMAIN () AS LONG n&=1e6 'number of iterations for each case dr=1e-8 'perturbation for LE calculation dr2=dr*dr w&=600 'width of plot h&=480 'height of plot GRAPHIC WINDOW "Fig2", 0, 0, w&, h& TO hWin??? GRAPHIC ATTACH hWin???, 0, REDRAW GRAPHIC COLOR %BLACK, %WHITE GRAPHIC BOX (0, 0) - (w&, h&) r=0.4## d=1.6## pi=4##*ATN(1##) FOR j&=1 TO h&-2 FOR i&=1 TO w&-2 a=-2##*pi##+2##*pi##*i&/w& b=1##+4##*j&/h& WHILE p&<1 'try many different initial conditions x=2##*gauss y=2##*gauss xe=x+dr ye=y ltot=0## FOR k&=1 TO n& xnew=x+d*(y-SIN(x)) y=y+d*r*(a-x-b*y) x=xnew xenew=xe+d*(ye-SIN(xe)) ye=ye+d*r*(a-xe-b*ye) xe=xenew dx=x-xe dy=y-ye rs=dx*dx+dy*dy rs=SQR(rs/dr2) IF rs>0 THEN xe=x+dx/rs ye=y+dy/rs IF k&>.01*n& THEN ltot=ltot+LOG(rs) END IF IF ABS(x)>1e5 THEN EXIT FOR 'solution is unbounded NEXT k& IF k& .0001: GRAPHIC COLOR %RED 'chaotic CASE < -.0001: GRAPHIC COLOR %BLUE 'periodic CASE ELSE: GRAPHIC COLOR %GREEN 'quasiperiodic END SELECT IF CSNG(x)=CSNG(y) THEN GRAPHIC COLOR %GRAY 'fixed point IF k&= 1## OR R = 0 GAUSS = V2 * SQR(-2## * LOG(R) / R) END FUNCTION