Well don't worry too much. It seems the best way to get a lot of attention around here is to keep repeating a set of incorrect statements while avoiding seeming like you're purposefully breaking the rules. I don't see many people getting a lot of positive attention.
I would like to ask you (or anybody else) for a favour to run the program that reproduces above results to check that i have not made any silly mistakes. I thank you whether you can help or not.
But first let me explain a bit about the program.
the thumbnail shows 1D implementation. 1,2,3,4,.... are the number of loops. in each loop I throw two numbers for each particle denoting their position and length. if the lines cross (star) I ignore I don't register the position( the round marks) or don't do anything with the lines. But if they don't cross then I have a counter that updates the number of times a hit happened in the particular position (the squared marks). then for each particle I have a counter that simply adds the lengths of this line to the previous total for each particle.
I do that(loops) a million, sometimes a 100 trillion times. then I normalize to the number of throws. the totals of the lines(normalized) are the energy. the numbers of hits for each positions is operated on to get the expectation values. normalized position hits are the probabilities that are similar to the ones we get from the "squaring" of the wavefunction. Without interaction the expectation value is the midpoint of the particle. But when interaction happens the expectation value moves. lets say to left in the left particle and right in the right particle. That denotes a repulsion. you can also get attraction with different logic. But more on the logic part later.
then the particles are moved to a different distance and the operation is repeated.
Now I explain the code in more detail. see attached file.
The code that you see is the cleaned up version of the one in the website.
1. define variables/types
2. set the particle widths (d0,d1) , which I interpret as the compton wavelength, I assume lamda= h/mc the model shows (I will show why) that h=c , so lamda =1/m ,then I choose m to be in au hence if m=.0005485 then lamda=1822.8885 units of length on the axis/line . more on scale later.
3. set the interval (intr), that is used as a quantity to increas the distance between the particles after the calculation finished for certain distance.
4. start the mk loop that will increase the distance between the particle after each iteration.
5. based on mk value set the positions of the particles,zero out some of the variables need be. f1 is the number of hits for crossing f for not crossing. Zero out the arrays (S,Sy),that hold the hits for each position on the axis/line.
6. next is the j loop the heart of the program, it iterates on the random throws
7. don't worry about these lines, not important
long r= rand();
8. calculate the start of the lines from inside of the particles and the length of the lines shooting to the other particl all based on random numbers.
9. use if ( st1+p1 + li1 > st0+ p - li) to check if lines crossed or not.
10. if not crossed update the position hit by incrementing the counter S for that position. add the random line to an acummulation counter (en). I do that for one of the particles only. the other will be similar.
While I said I don't do anything when lines crossed but in this program I do the same using Sy, en1 just for information. I will talk more about it later.
11.go to 6
12. when done with j loop normalize the energy en to the numbers of throws accepted frf = (double)f/en; //energy of the particle
13. calculate the expectation value for the position array S -over the width of the particles.
edx = edx + (( n) * S[n]);
calculate how much exectation is offset from center of the particle
ex[mk] = (double)edx / ((double)f)- (0.5 * int(w*d1))+.5 ;
14. update all data in file for that seperation.
15 . go to mk loop for new seperation distance
To get the said graph you have to run it several times with these parameters. d0=d1= 5,50,200,500,1500,1647,1966 what ever you like up 2000 is ok. just plot distance vs frf(energy)[second and third output columns] for the different runs of particle sizes. but make mk start=0 and intr =50 and kj= 500000000 for 150 points run for each particle will take 2 hours. for 5 particles 10 hours and you are done. you can also run it for only 3 runs for d0=d1=5,200,1500 to get a rough idea. Take the data to a spreadsheet(excel) and plot.
you can also change to for (kk = 0; kk <= 10000000; kk++)
just to be on the safe side.also change to following
long long w =1;
Edited by qsa, 12 April 2012 - 06:22 PM.