Montw Carlo Simulation in excel

  • Thread starter Thread starter Ricardo Moreno
  • Start date Start date
R

Ricardo Moreno

Hiya,

Ive been trying to use excel to do a Monte Carlo computation of the
energy distribution of compto scattered electrons from 60Co photon
irradiation. My problem is that I cannot implement the following
algorithm in excel. I just don't know how to do it.
Any tips?
1. Choose scatter angle
2. Compute energy distr_1
3. Generate random number_1
4. Compute energy distr_2
5. Generate random number_2
6. If R_2 less than or equal to step4/step2 accept else go back to
step2

The energy distribution is given by function

bla bla...

My problem is with step 6, how do I perform this in excel??
 
Assuming you're using VBA to do the calculations, you could use a Do Loop to
do what you want.

step 1
R2Flag = 0
Do Until R2Flag =1
step 2
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top