ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Montw Carlo Simulation in excel (https://www.excelbanter.com/excel-programming/320501-montw-carlo-simulation-excel.html)

Ricardo Moreno

Montw Carlo Simulation in excel
 
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??

Raul

Montw Carlo Simulation 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


All times are GMT +1. The time now is 08:15 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com