[neutron-mc] Error in component Source_simple.comp ?

Peter Willendrup peter.willendrup at risoe.dk
Wed Feb 15 13:41:26 CET 2006


Hello Frederik,

On Tue, 2006-02-14 at 16:12 +0100, Frederik Zilly wrote:
> Points near the center have greater probility than points with a higher 
> radius.

Actually, this is not the case. The square root actually gives zero
probability for points exactly at the origin; more events must be
distributed over a circular area element at the circle perimeter  than
at the center to achieve a uniform distribution.

I wrote up a few lines of matlab code to show this in graphics (you need
the attached hist2d code to reproduce the attached graphics):

chi=2*pi*rand(1e6,1);
r=sqrt(rand(1e6,1)); % Source radius assumed one metre
x=r.*cos(chi);
y=r.*sin(chi);
mXY=[x y];
vXEdge = linspace(-1,1,128);
vYEdge = linspace(-1,1,128);
img=hist2d(mXY,vXEdge,vYEdge);
imagesc(img);

As you can see in the jpg graphic, the result of the above code (which
is equvalent to the c-code in Source_simple) is completely uniform
across the source area.

Hope this helps?


Cheers,

Peter
-- 
Peter Willendrup <peter.willendrup at risoe.dk>
Risø National Laboratory
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hist2d.m
Type: text/x-objcsrc
Size: 1652 bytes
Desc: not available
URL: <http://mailman2.mcstas.org/pipermail/mcstas-users/attachments/20060215/dd69fcf7/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: uniform.jpg
Type: image/jpeg
Size: 64596 bytes
Desc: not available
URL: <http://mailman2.mcstas.org/pipermail/mcstas-users/attachments/20060215/dd69fcf7/attachment.jpg>


More information about the mcstas-users mailing list