Re: [R] Movement within a circle

2008-12-15 Thread andrew
The following has a bug in it, but it does a reasonable job. The bug occurs in the lines that says if(inner(xnew,xnew) > R^2) xnew <- x[n,] - eps ##error - sometimes x[n,] - eps is outside circle If it is changed to something like xnew <- proj(x[n,] + eps) where proj is a projection function

Re: [R] Movement within a circle

2008-12-15 Thread David Winsemius
On Dec 15, 2008, at 5:20 PM, Juliane Struve wrote: Dear list, I am trying to program semi-random movement within a circle, with no particles leaving the circle. I would like them to bounce back when they come to close to the wall, but I don't seem to be able to get this right. Would som

[R] Movement within a circle

2008-12-15 Thread Juliane Struve
Dear list,   I am trying to program semi-random movement within a circle, with no particles leaving the circle. I would like them to bounce back when they come to close to the wall, but I don't seem to be able to get this right.  Would somebody be able to give me a hint ? This is my code so far,