|
Q: 5X5方格中放置1~25的數字,數字是隨機放置,移動的路徑長度的平均數與變異數為何?。 |
|
Clear["Global`*"];
DynamicModule[{i,temp,dist,newdata},
dist[data_]:=
N@Total[EuclideanDistance@@@
Partition[Flatten[Position[data,#]&/@Range[25],1],2,1]];
temp={};i=0;
Dynamic[{i=i+1;
newdata:=Partition[RandomSample[Range[25],25],5];
temp=Join[temp,{dist[newdata]}]};
Column[{MatrixForm[newdata],
Grid[{{"Distance=",dist[newdata]}}],
Histogram[temp,{25,100,1},"PDF",Frame->True,Axes->None,
PlotRange->{{40,100},{0,0.2}},ImageSize->400,
Epilog->Inset[
Grid[{
{"Samplesize=",Length@temp},
{"\[Mu]=",NumberForm[N@Mean@temp,{7,4}]},
{"\[Sigma]=",NumberForm[N@StandardDeviation@temp,{5,4}]},
{"Shapiro\[Dash]Wilktest",NumberForm[ShapiroWilkTest[temp],{5,4}]}},
Frame->True,Alignment->{{Right,Left}}],{85,0.15}]]}]]]
讀者回應 ( 0 意見 )
訂閱發佈留言 (Atom)
發佈留言
Please leave your name and tell me what you thought about this site. Comments, suggestions and views are welcomed.
如果這篇文章對你有幫助,那請留個訊息給我~