In an infinite cubic lattice with points separated in x, y and z axis by one unit, a random walk starts from (0, 0, 0). Any of the 6 possible directions is equally likely at each step.
What is the probability of a return to the origin after 2*N moves?
(In reply to
solution by Charlie)
accum=0;
for i=2:2:22
hits=A002896(i/2);
tot=6^i;
accum = accum+hits /tot ;
fprintf('%3d %15d %18d %15.13f %15.13f\n',i,hits ,tot ,hits /tot ,accum);
end
function a=A002896(x)
n=x;
s=0;
for k=0:n
s=s+nchoosek(n,k)^2 * nchoosek(2*k,k);
end
a=nchoosek(2*n,n)*s ;
end
cumulative
2*n numerator denominator probability probability
2 6 36 0.1666666666667 0.1666666666667
4 90 1296 0.0694444444444 0.2361111111111
6 1860 46656 0.0398662551440 0.2759773662551
8 44730 1679616 0.0266310871056 0.3026084533608
10 1172556 60466176 0.0193919324417 0.3220003858025
12 32496156 2176782336 0.0149285279757 0.3369289137782
14 936369720 78364164096 0.0119489530808 0.3488778668590
16 27770358330 2821109907456 0.0098437704453 0.3587216373043
18 842090474940 101559956668416 0.0082915600062 0.3670131973105
20 25989269017140 3656158440062976 0.0071083541491 0.3741215514596
22 813689707488840 131621703842267136 0.0061820329303 0.3803035843898
|
Posted by Charlie
on 2024-07-04 08:14:52 |