By:Yanliu
In[]:=
pm=Compile[{{grid,_Real,2}},Module[{plate=grid},Do[plate[[a,b]]=Piecewise[{{plate[[a,b]],(a<11∧b11)∨(a11∧b≥11)},{0.,b≥11∧a≤10}},Mean[{plate[[If[a1,a,a-1],b]],plate[[If[a20,a-1,a+1],b]],plate[[a,If[b1,b,b-1]]],plate[[a,If[b20,b-1,b+1]]]}]],{a,2,19},{b,2,19}];plate]];
In[]:=
ListPlot3D[Last[NestList[pm,{{0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.},{0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,0,0,0,0,0},{0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,10.,9.,8.,7.,6.,5.,4.,3.,2.,0.},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}},190]]]
Out[]=
In[]:=
MatrixPlot[Last[NestList[pm,{{0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.},{0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,0,0,0,0,0},{0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,10.,9.,8.,7.,6.,5.,4.,3.,2.,0.},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}},190]]]
Out[]=
The above graphes are the results of 190 times of recurrsion, now we' ll see if this result converges. We compare the result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0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,0,0,0,0,0},{0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,10.,9.,8.,7.,6.,5.,4.,3.,2.,0.},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}},189]]
Out[]=
{{0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.},{0.,4.54313×,8.42125×,1.13028×,1.29638×,1.33036×,1.23499×,1.02524×,7.26611×,3.72363×,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.},{0.,8.79785×,1.63101×,2.18958×,2.5121×,2.57888×,2.39496×,1.98899×,1.41012×,7.22812×,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.},{0.,1.27301×,2.36058×,3.17027×,3.63922×,3.73845×,3.4744×,2.88763×,2.04859×,1.05058×,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.},{0.,1.63067×,3.02492×,4.06504×,4.67038×,4.80287×,4.46911×,3.71909×,2.64154×,1.35581×,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.},{0.,1.94926×,3.6179×,4.8664×,5.59832×,5.76661×,5.3763×,4.48343×,3.19084×,1.64025×,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.},{0.,2.22484×,4.13257×,5.56596×,6.41511×,6.62423×,6.19453×,5.18361×,3.70216×,1.90864×,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.},{0.,2.45275×,4.56064×,6.15353×,7.11103×,7.36924×,6.92327×,5.8264×,4.1878×,2.1718×,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.},{0.,2.62731×,4.89179×,6.61598×,7.67286×,7.99206×,7.56116×,6.423×,4.67164×,2.45475×,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.},{0.,2.74175×,5.11338×,6.93627×,8.08173×,8.47633×,8.10148×,6.98676×,5.19696×,2.81931×,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.},{0.,2.78848×,5.21061×,7.09311×,8.3112×,8.79375×,8.52216×,7.52077×,5.83069×,3.43511×,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.},{0.,2.75986×,5.16802×,7.06235×,8.32735×,8.89976×,8.76974×,7.97807×,6.61294×,4.82306×,2.93×,2.05761×,1.54938×,1.19582×,9.20465×,6.91034×,4.91753×,3.1372×,1.51193×,0.},{0.,2.64969×,4.97226×,6.82134×,8.09419×,8.73779×,8.75161×,8.18833×,7.15586×,5.82857×,4.47699×,3.47253×,2.72653×,2.14348×,1.66433×,1.255×,8.95183×,5.71814×,2.75752×,0.},{0.,2.45498×,4.61604×,6.35564×,7.58548×,8.26245×,8.3915×,8.02609×,7.2675×,6.26287×,5.19612×,4.24248×,3.43148×,2.74278×,2.1495×,1.6294×,1.16575×,7.45914×,3.60023×,0.},{0.,2.1776×,4.10166×,5.66518×,6.79494×,7.4565×,7.65641×,7.44154×,6.89557×,6.13118×,5.27436×,4.43358×,3.65905×,2.96304×,2.34119×,1.78371×,1.28009×,8.20563×,3.96429×,0.},{0.,1.82524×,3.44291×,4.76753×,5.74098×,6.33645×,6.55982×,6.44825×,6.06573×,5.49474×,4.8232×,4.12659×,3.45223×,2.8227×,2.24499×,1.71783×,1.23623×,7.93776×,3.83833×,0.},{0.,1.41136×,2.66516×,3.6978×,4.46612×,4.95035×,5.15483×,5.10646×,4.85068×,4.44487×,3.94921×,3.41639×,2.88402×,2.3743×,1.89765×,1.45698×,1.05086×,6.75695×,3.26982×,0.},{0.,9.54367×,1.80361×,2.50586×,3.03276×,3.3713×,3.52417×,3.50855×,3.35324×,3.09426×,2.7693×,2.41199×,2.04788×,1.69358×,1.35817×,1.04527×,7.55139×,4.86052×,2.35345×,0.},{0.,4.76121×,9.00212×,1.25173×,1.51675×,1.68888×,1.76936×,1.76644×,1.69393×,1.56904×,1.40978×,1.23243×,1.04974×,8.70372×,6.99363×,5.39011×,3.89781×,2.51044×,1.21597×,0.},{0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.}}
-7
10
-7
10
-6
10
-6
10
-6
10
-6
10
-6
10
-7
10
-7
10
-7
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-7
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-7
10
-7
10
-7
10
-7
10
-7
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-7
10
-7
10
-7
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-7
10
-7
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-7
10
-7
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-7
10
-7
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-7
10
-7
10
-7
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-7
10
-7
10
-7
10
-7
10
-7
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-6
10
-7
10
-7
10
-7
10
-7
10
-7
10
-7
10
Transpose[%273]
As we can see from above, all the difference between 189th recurrsion and 190th recurrsion are smaller than 10^(-5), which means the result converges enough.
In[]:=
AbsoluteTiming[Last[NestList[pm,{{0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.},{0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,0,0,0,0,0},{0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,10.,9.,8.,7.,6.,5.,4.,3.,2.,0.},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}},189]]]