Probability distribution confusion

In summary, you generate a list of draws from a uniform pseudo-random variable, and for each draw, calculate the angle θj associated with it. You then use this data to generate a theoretical distribution for θ values.
  • #1
yuiop
3,962
20
Hi, I am trying to write a Monte Carlo type simulation. I have a function for the probability (p) of a photon having an angle (a) between [itex]\theta[/itex] and [itex]\pi/4[/itex] defined by:

[tex]p = \int_{a= \theta}^{a=\pi/2} \cos(2a),\qquad da [/tex]

...where [itex]\theta[/itex] will normally have a value between [itex]-\pi/4[/itex] and [itex]\pi/4[/itex]. One immediate problem with the above equation is that the probability of producing a photon of a given exact angle is exactly zero. Do I need to differentiate the equation? Now what I want to do is use a random number generator to produce photons with angles that will match the distribution above when large numbers of photons are produced, but I am having difficulties achieving this. Can anyone offer any suggestions to help me out here?

P.S. If I have posted this question in the wrong forum please advise. I was wondering if it should be in the calculus forum?
 
Physics news on Phys.org
  • #2
You need two things:

A. a uniform pseudo-random generator (I'll call this uniform random variable u)

B. a closed-form solution for your integral, F[θ], that you can invert at least locally (i.e. for -π/4 < θ < π/4).

I will assume that you have both A and B, and that F is a well-behaved CDF (i.e. monotone increasing, F[-π/4] = 0, F[π/4] = 1) -- you should verify these. Then:

1. generate a list of draws from u, {u1, ..., un}

2. for each u value, calculate θj = F-1[uj] to obtain a list of θ values. Those values will be distributed F.

If you don't have a closed-form integral then you may have to numerically calculate each θj.
 
Last edited:
  • #3
EnumaElish said:
You need two things:

A. a uniform pseudo-random generator (I'll call this uniform random variable u)
Got one of those :smile:

EnumaElish said:
B. a closed-form solution for your integral, F[θ], that you can invert at least locally (i.e. for -π/4 < θ < π/4).

Not quite sure what you mean here. The indefinite integral of cos(2*a) is sin(a)*cos(a). Not quite sure where to go from there either. If I call it u = sin(a)*cos(a) and try to solve for a, I get a fairly complicated result http://www.wolframalpha.com/input/?i=solve+u=+sin(a)+cos(a)+1/2+for+a. Is that what you are referring to?

EnumaElish said:
I will assume that you have both A and B, and that F is a well-behaved CDF (i.e. monotone increasing, F[-π/4] = 0, F[π/4] = 1) -- you should verify these.
I have plot for u = sin(a)*cos(a)+1/2 that smoothly increases from 0 to 1 over that range. It can be seen here
http://www.wolframalpha.com/input/?i=plot+cos(2*a),+sin(a)+cos(a)+1/2+from+a=-pi/4+to+pi/4 alongside a plot for cos(2*a) which does not match your criteria.

EnumaElish said:
Then:

1. generate a list of draws from u, {u1, ..., un}

2. for each u value, calculate θj = F-1[uj] to obtain a list of θ values. Those values will be distributed F.

If you don't have a closed-form integral then you may have to numerically calculate each θj.
Is the complicated solution for a in the Wolfram Alpha link, the F-1[uj] you speak of?
 
Last edited:
  • #4
EnumaElish said:
You need two things:

A. a uniform pseudo-random generator (I'll call this uniform random variable u)

B. a closed-form solution for your integral, F[θ], that you can invert at least locally (i.e. for -π/4 < θ < π/4).

I will assume that you have both A and B, and that F is a well-behaved CDF (i.e. monotone increasing, F[-π/4] = 0, F[π/4] = 1) -- you should verify these. Then:

1. generate a list of draws from u, {u1, ..., un}

2. for each u value, calculate θj = F-1[uj] to obtain a list of θ values. Those values will be distributed F.

If you don't have a closed-form integral then you may have to numerically calculate each θj.

O.K. I managed to get a slightly simpler solution http://www.wolframalpha.com/input/?i=solve+v=+sin(a)+cos(a)+for+a by using v=cos(a)*sin(a) and solving for a, using v as a substitution for u-1/2. This produced a good match to the theoretical distribution using pseudo-random data. Thanks for the help. You obviously know what you are doing. :wink: Cheers! :smile:
 
  • #5


I understand your confusion with the probability distribution in your Monte Carlo simulation. First of all, it is important to note that the function you have provided is not a valid probability distribution as it does not integrate to 1 over the entire range of \theta. This means that the total probability of producing a photon within the specified angle range is not equal to 1, which is a necessary condition for a probability distribution.

To address this issue, you may need to adjust your function to ensure that it integrates to 1 over the entire range of \theta. One way to do this is by normalizing your function, which involves dividing it by the total area under the curve. This will ensure that the total probability of producing a photon within the specified angle range is equal to 1.

Additionally, it is true that the probability of producing a photon with an exact angle is zero, as the probability density function is continuous and not defined at specific points. This is why we use probability distributions in simulations, as they provide a range of possible outcomes rather than exact values.

As for using a random number generator to produce photons with angles that match the distribution, it is important to use a generator that is capable of generating numbers within the specified range. You may also need to adjust the parameters of your generator to match the range and shape of your desired distribution.

In conclusion, it is important to ensure that your probability distribution is valid and that you are using an appropriate random number generator in your simulation. I hope this helps to clarify your confusion and guide you in the right direction. If you need further assistance, you may want to consult with a statistician or a colleague with expertise in Monte Carlo simulations. Good luck with your project!
 

FAQ: Probability distribution confusion

What is a probability distribution?

A probability distribution is a mathematical function that describes the likelihood of different outcomes occurring in a random event. It shows the possible outcomes and their associated probabilities.

What is the difference between a discrete and continuous probability distribution?

A discrete probability distribution is one in which the possible outcomes are countable, such as rolling a die or flipping a coin. A continuous probability distribution, on the other hand, involves a range of possible outcomes, such as the height of individuals in a population.

How is a probability distribution used in statistics?

Probability distributions are used in statistics to make predictions and draw conclusions about a population based on a sample. They also help to determine the likelihood of certain events occurring and to calculate measures of central tendency and variability.

What is the relationship between probability distributions and the normal curve?

The normal curve, also known as the bell curve, is a specific type of continuous probability distribution. It is characterized by a symmetrical, bell-shaped curve and is commonly used in statistics to represent many real-world phenomena.

How can I determine the probability of a specific outcome using a probability distribution?

To determine the probability of a specific outcome, you can use the formula P(x) = n/N, where P(x) is the probability of the outcome, n is the number of times the outcome occurs, and N is the total number of possible outcomes. You can also use a probability distribution table or graph to find the probability of a specific outcome.

Similar threads

Replies
18
Views
3K
Replies
9
Views
2K
Replies
10
Views
533
Replies
2
Views
1K
Replies
1
Views
1K
Replies
1
Views
584
Replies
1
Views
610
Replies
3
Views
2K
Back
Top