ok. I don't see how to write in another way my code. Here is what I'm triyng to do.
I divided and x-y plane in little cell, each of 0.04*0.04. In each cell I started an initial condition of a dynamical system (Duffing-van Der Pol oscilator), and I solve it with RK4. In each cell I chose a number of random intial conditions; clearlñy each cell is characterized by two numbers, i and j. So, I use n to describe such a number.
Code:
for(i=0;i<DIMENSION;i++){
for(j=0;j<DIMENSION;j++){
n=i*200+j;
l=j*200+i;
prob[n][l]=0;
for(k=0;k<RANDOM;k++){
xout[0]= (drand48()+i-DIMENSION/2)/25.0;
xout[1]= (drand48()+j-DIMENSION/2)/25.0;
for(m = 0; m< NSTEPS; m++){
for(u=0;u<NDIM;u++) xin[u]=xout[u];
runge_kutta (xin, tau, param, xout);
}
salidax[n][k]=xout[0];
saliday[n][k]=xout[1];
}
}
}
Then I verified in wich cell the output is. Finally, if cell "n" leds to cell "l", probability of n->l increses by one.
Code:
for(n=0;n<DIMENSION*DIMENSION;n++){
for(i=0;i<DIMENSION;i++){
for(j=0;j<DIMENSION;j++){
l=i*200+j;
for(k=0;k<RANDOM;k++){
if((i-DIMENSION/2)/25.0<salidax[n][k]<(i+1-DIMENSION/2)/25.0)
if((j-DIMENSION/2)/25.0<saliday[n][k]<(j+1-DIMENSION/2)/25.0) prob[n][l]++;
}
}
}
}
And that's it. But I'm not clever enogh to see another solution. ¿Do you have sugestions?
Thanks for your answers!