Hi Prof,

what mathematical model equation is this using.

some how the equations used in EJS xml doesnt look like
http://en.wikipedia.org/wiki/Kinetic_theory

i am looking at

initialisation:
int n2=(int)Math.sqrt(n);
double dx=(xr-xl)/n2,dy=range/n2;
for(int i=0;i<n;i++){
x[i]=xl2+ (i%n2)*dx+size*1.5;
y[i]=ymin+dy*((i/n2))+size;
// x[i]=(xr-xl-R)*(Math.random()-0.5);
// y[i]=range*(Math.random()-0.5);
}
setV();
_view.getElement("Trace").reset();

evolution:
dvx[i]/dt = (getF(i,x,y)-b*vx[i])/m
dvy[i]/dt = (getF(i,y,x)-b*vy[i])/m-g

fixed:
double v,cta;
for(int i=0;i<n;i++){
if(x[i]>xr){
x[i]=2*xr-x[i];
vx[i]=-rr*vx[i];
}else if(x[i]  x[i]=2*xl-x[i];
vx[i]=-rr*vx[i];
}
if(y[i]>ymax){
y[i]=2*ymax-y[i];
vy[i]=-vy[i];
}else if(y[i]  y[i]=2*ymin+size-y[i];
vy[i]=-rr*vy[i];
}
v=Math.sqrt(vx[i]*vx[i]+vy[i]*vy[i]);
if(v<vmin){
cta=Math.PI*2*Math.random();
vx[i]=vmin*2*Math.cos(cta);
vy[i]=vmin*2*Math.sin(cta);
}
}
x0=x[n2];
y0=y[n2];
ymin2=ymin;

custom:
public void setVmin(){
b=0.2*(1.-(T-T0)/(Tmax-T0));
vmin=Math.sqrt((T-T0)/Tk);
if(vmin>vmax/2)vmin=vmax/2.;
}

double r,dx,dy,f,f2;
public double getF (int id,double x[],double y[]) {
f=0.;
for(int i=0;i<n;i++){
if(i!=id){
dx=x[id]-x[i]; dy=y[i]-y[id];
r=Math.sqrt(dx*dx+dy*dy);
//    if(r>R3)f2=0.;
//    else if(r>R) f2=F0*(1.5-0.5*r/R)/r;
if(r>R)f2=F0*R/r;
else f2=F0+(R-r)*(Fmax-F0)/R;
//     f2=F0*R/r;
//    if(r     f+=f2*dx/r;
}
}
return f/n;
}