# Computing an average escape distance for a particle

Somewhere in a two dimensional convex bulk of particles (pic related) on a random position a reaction takes place and a particle is sent out in a random direction with a constant velocity $v$.

What is the average distance such a particle travels until it leaves the bulk? Might be codable if one puts a grid over the planes and weightens with a yes/no function if the stating position is within the bulk. Then I'd cut that object with n corners (8 in the pic) into pizza slices and do some geometry to compute the distances in all directions and integrate over all of these and all staring point. I really wonder if there is a good way to do this on a piece of paper, the problem being how to parametrize the points which are inside and not counting these outside.

Monte-Carlo computations for regular polygons would be an interesting semi-solution too.

Edit: Not that it matters much, but the question is motivated by the question Mean free path of UV photon and is part of me wondering about the escape route for particle entering a bunch of mass, and there specifically on the the dependence on the two length characteristica cloud dimensions and mean free path derived by the clouds constitution. Given that the direction of a particle after a collision is random and so it will probably have to make a detour through the cloud, what is the relation between the average cloud radius to the mean free patch such that the particle is able to leave after only one reaction. Because a collision is almost a reset, I have the suspicion that the escape time only falls slowly with the number of collisions a particles had to endure. The simulation of this might be a more standard question, i.e. starting at a random position and choosing a random direction after the mean free path traveled, how manny mean free paths does it take for a particle to escape a random polygon with characteristic measure being some multiple of the mean free path.

• There is no reason MC needs to be limited to regular polygons; determining if points are inside or outside of a arbitrary polygon is a meat and potatoes task, as is projecting a segment to the nearest border in a randomly selected direction. Jul 20 '12 at 4:08
• @NickKidman: THe solution for time of escape with mean free path much shorter than the polygon is also solvable by useful analytic methods, it is found from the Green's function of the heat equation in the domain where you clamp to zero at the boundaries. The intermediate regime where the mean free path is comparable to the size of the region might be best done Monte-Carlo, but it is heavily studied (at least in 3d), it is the problem neutron scattering in moderators. Jul 21 '12 at 3:21

To calculate this using monte-carlo is straightforward--- you pick a random point in the polygon by either by choosing a random point in a surrounding box (to determine if a random point is interior, shoot out a random line and count the parity of the number of intersections with the polygon), or by dividing the polygon into triangles and choosing a random triangle by area and a random point inside each triangle by a shear transformation to make the triangle right. Then you pick a random direction, and compute the length, then average. But this is ridiculously inefficient, unless you are in very high dimension. In 2d, this problem can be simply solved explicitly analytically.

There are two integrals involved in the averaging, the integral over position and the integral over angle. You should average over the interior volume at fixed angle first.

Since you are at one fixed angle, without loss of generality consider the vertical direction. Divide the polygon into triangles/trapezoids separated by the vertical lines running through all the vertices.

For a fixed trapezoid, let the slope relative to horizontal of the top line be m and the slope at the bottom n. the distance to the bottom is unchanged by an (area preserving) shear transformation which makes the bottom line horizontal. This shear makes the slope at the bottom zero and the slope at the top m-n. Then the mean vertical height of a point is the y-location of the center of mass. The center of mass of a trapezoid is just found by averaging the center of mass of the composing rectangle and triangle.

If the i'th rectangle has a base of $a_i$ and a height of $b_i$, and the triangle on top of the rectangle has an additional height of $c_i$, the result is that the center of mass times the area of the trapezoid is

$$a_i ({b_i^2\over 2} + {c_i^2\over 6})$$

You add this up over the trapezoids (the triangles at the end just have $b_i=0$), and divide by the total area of the polygon, and this is the value of the integral over the shape at one fixed $\theta$.

The boundaries of integration, where the subdivision changes are those where the angle $\theta$ that you are considering is equal to the angle of the line joining two vertices. At this angle, one of the triangles/trapezoids degenerates. If you are considering an angle inclined by $\theta$ to this line, $a_i \propto \sin(\theta)$ while $b_i$ and $c_i$ are equal to ${1\over a + b\tan\theta}$ for constants a and b (determined by the angles of the emerging sides).

To average over angles, you just want to make sure that the integral

$$\int {\sin(\theta)\over (a+b\tan\theta)^2} d\theta$$

has an antiderivative, so you can do the average. It does, you integrate by parts once, by introducing a factor of $\cos^2(\theta)$ in the numerator and denominator, to reduce it to an antiderivative minus

$$\int {\cos(\theta)^2(\cos^2(\theta) - 2 \sin^2(\theta))\over a \cos(\theta) + b\sin(\theta)} d\theta$$

and then shift $\theta$ by a constant to make the denominator be proportional to $\sin(\theta)$ (the sign of the constants allows this), which gives a polynomial in sines and cosines, divided by sine. Every monomial of the form

$${\cos^n(\theta)\sin^m(\theta) \over \sin(\theta)}$$

has an elementary antiderivative, from elementary calculus.