Sample circle area following a distribution

foxi
Messages
5
Reaction score
0
Hello!
Hope someone can help me, I already tried some solutions, but couldn't come to a final conclusion.

I need to create a circular area, from which particles are emitted. For this, I have a frequency distribution of x and y. I have around 100 points, but to simplify matters I list only some points.
e.g.
x(cm) with frequency
& y(cm)
-3 ......0.55
-2 ......0.8
-1 ......0.9
0 ......0.85
1 ......0.9
2 ......0.85
3 ......0.5

From these data, I see that the radius is 3. Now I need to create a circular area. I am doing this in Fortran.
So I calculate the cumulative sum of the frequency distribution and normalize it to 1. Then I let uniformly distributed random numbers "fall in this table" and get my distribution in x and y.

Now comes the tricky part for me. I have to assign to each x the proper y (that the desired distribution is fulfilled) and get the circular area.
I know the formulas x_coordinate=R*cos(2pi*randomNumber) and y_coordinate=sin(2pi*randomNumber), but by using that (taking the x and y as the radius R), the coordinates are concentrated in the circle center.
So I started to "play" with x=sqrt(R^2-y^2) and R=sqrt(x^2+y^2), but I don't get the circle area with the distribution.
How can I sample a circular surface following a given distribution of x and y values? I hope I could describe the problem properly.
Thank you in advance.
 
Physics news on Phys.org
Let me try to clarify what you are asking.

My interpretation is that you have an empirical distribution of a some quantity (particle emission density) as a function of a single distance measurement.

You want to find a two dimensional distribution on a circle of radius 3 in the XY plane. Are you trying to make the distribution of emission density with respect to a radial distance within the circle agree with the empirical distribution?

Or are you trying to make the marginal distributions with respect to both X and Y agree with the empirical distribution?
 
Hello Stephen!

Yes, I am asking for the first point you wrote:

Stephen Tashi said:
Let me try to clarify what you are asking.

My interpretation is that you have an empirical distribution of a some quantity (particle emission density) as a function of a single distance measurement.

You want to find a two dimensional distribution on a circle of radius 3 in the XY plane. Are you trying to make the distribution of emission density with respect to a radial distance within the circle agree with the empirical distribution?

Yes, the measured data present some emission density. In reality particles are emitted from a circular surface. The data in the table (from my first post) have been measured along the x and y-axis (horizontal and vertical axis). I interpolated these data and have around 100 data points (here I showed only, how the table looks like).
This is why I first assumed the "x" & "y" data as the radius. I sampled this distribution (by making the cumulative sum of the frequency distribution) and calculated x= R * cos (2*pi*randomNumber) and y= R * sin (2*pi*randomNumber). I get my circle, but the data are concentrated in the center and decrease to the border. Usually the Radius should decrease by sqrt(R) to receive a uniform distribution within a circle.
But I think in this case, it is not very simple to sample the sqrt(R).

So I switched to another possible solution:
I tried to assign to each "x" with the distribution the proper "y" with the distribution. Therefore I sampled again the distribution, but then I said that I get the "x" and calculated y=sqrt(R^2-x^2) with R=3. This doesn't really work, because I didn't know where to include the random number.

I always switched between these two methods (still don't know which one is the proper one...or which one really works...or is it a combination of both), so I kindly ask for some advice.
Thank you!
 
foxi said:
Hello Stephen!

Yes, I am asking for the first point you wrote:

<snip>
Yes, the measured data present some emission density. In reality particles are emitted from a circular surface. The data in the table (from my first post) have been measured along the x and y-axis (horizontal and vertical axis).

From those statements, I still do not understand the table. Is the left hand column of the table a radial distance? If so, why does it have some negative values?

Or is the left hand column of the table an X distance or a Y distance? If so, why is there only one column? Why not (X,Y) in two columns? Is the table a marginal distribution for X and we assume the marginal distribution for Y is the same distribution?
 
Hello!

The values of emission density have been measured along x and y (horizontal and vertical axes). The x-data are measured along y=0 and vice versa. The center of the circle is zero, this explains why there are also minus values.
It is known that particles are emitted from a circle surface, but only the values of the "circle axes" are known.

There is only one column, because the emission density measured along x and y are the same. This is also why I was writing about a radial distance. We can call the horizontal and vertical axes also in a different way, e.g. a and b.

I am sorry for causing confusion.
 
I understand the table better. However, I don't know much about particle emission. Let's say we have a unit circle and there is a particle emitted at the point x = 2/3,y = 1/3 within that circle. Does particle fly away from that point in a straight line at some random direction? Can I visualize the detector as an array of hit-vs-no-hit detectors sitting along the x-axis? Can the particle emitted at (2/3,1/3) hit the x-axis (the detector) at some x value that may be different than x = 2/3? If the particle is detected by a detector along the x-axis, is it "captured" and prevented from also triggering a detector on the y-axis?
 
Yes, the particle is emitted from a point from the circle surface and is flying in a straight line perpendicular to the circle area.
In reality the "circle area" is not a detector; it is a particle source. So if a particle is emitted at (2/3, 1/3) from the (x,y) plane it is leaving the area exactly from that point.
I am doing this for an input for a MC simulation.
I don't know how to do the procedure of sampling x and y. I mean, saying in my fortran program that it should sample x and y from the given distribution.
 
Let f(x,y) be the joint probability density. I think your are saying that your data gives the marginal density f_x(x,y) = \int_{-3}^3 f(x,y) dy [/tex], which we assume is the same function as the marginal density f_y(x,y) = \int_{-3}^3 f(x,y) dx.<br /> <br /> This resembles the situation in a 2-D tomography problem. When we are given only the marginal densities, these usually don&#039;t determine a unique answer for f(x,y) [/tex]. If we add the assumption that f(x,y) is constant on the concentric circles, then it may be possible to solve for a unique f(x,y). However, this would imply that the marginal distributions should be symmetric about 0 and there is a slight asymmetry to the data in your table. &lt;br /&gt; &lt;br /&gt; If you already have a specific f(x,y) in mind, I can explain how to draw a random pair (x,y) from it.
 
I understand the difficulty of drawing a pair (x,y) on the concentric circles with this asymmetric data, because it is not solvable in a unique way as you said.
But let’s assume I could choose the random pair (because in reality the truth is not known). How could I sample then x and y?
 
  • #10
As I said, we must assume that you know the joint probability density f(x,y)

Then we can find marginal density with respect to x:

f_x(x) = \int_{-3}^3 f(x,y) dy

and the cumulative marginal distribution with respect to x

F_x(x) = \int_{-3}^x f_x(x) dx

and the conditional density of y given x:

g(y,x) = \frac{f(x,y)}{C} [/itex] where C = \int_{-3}^{3} f(x,y) dx<br /> <br /> and the cumulative conditional distribution of y given x:<br /> <br /> G(y,x) = \int_{-3}^y g(y,x) dy<br /> <br /> For a fixed value of x = x_0 , G defines a function of y alone, which will be denoted as G(y,x_0).<br /> <br /> ( I am using the limits of integration -3 to 3 with the understanding that f(x,y) must be defined to be zero for y values that are outside the boundaries of the circle. A more complicated way to write integration for G woud be set the lower limit of integration with respect to y to the smallest y that is within the circle by expressing that limit as a function of x.)<br /> <br /> To draw a random sample (x0,y0):<br /> <br /> Draw u_1 from a uniform distribution on [0,1].<br /> <br /> Set x_0 = F^{-1}(u_0)<br /> <br /> Draw u_2 from a uniform distribution on [0,1].<br /> <br /> Set y_0 = G^{-1}(u_1,x_0) (i.e. find the value of y where G(y,x_0) = u_2 )
 
Back
Top