Modelowanie matatyczne, laboratoria 3 “Ergodyczność”

F=Sin;

n=100;
Accumulate@(Sin/@NestList[Mod[#+(Sqrt[2]),2π]&,1.3,n])/Range[n+1]

n=1000;
ListPlot[Accumulate@(Sin/@NestList[Mod[#+(Sqrt[2]),2π]&,1.3,n])/Range[n+1],Joined->True,Mesh->Automatic]

Accumulate[{a,b,c,d}]

Range[n+1]

Integrate[Sin[x],{x,0,2π}]

F=((Cos[#])^2)&
n=500;
Show[ListPlot[Accumulate@(F/@NestList[Mod[#+(Sqrt[2]),2π]&,1.3,n])/Range[n+1],Joined->True,Mesh->Automatic],Plot[Integrate[F[x],{x,0,2π}]/(2π),{y,0,n},PlotStyle->Red]]

Procesy Markowa

markov=DiscreteMarkovProcess[{1,0,0,0,0},Table[1/5{1,1,1,1,1},{5}]]

{{0,(1/2),(1/2)},{(1/2),0,(1/2)},{(1/2),(1/2),0}}.{1,0,0}

Graph[markov]

MarkovProcessProperties[markov]

markov=DiscreteMarkovProcess[{1,0,0,0,0},{{0,1,0,0,0},{0,0,1,0,0},{0,0,0,1,0},{0,0,0,0,1},{1,0,0,0,0}}]
Graph[markov]
MarkovProcessProperties[markov]

markov=DiscreteMarkovProcess[{1,0,0,0,0},{{1/3,1/6,1/4,1/8,1/8},{1/3,1/6,1/4,1/8,1/8},{1/3,1/6,1/4,1/8,1/8},{1/3,1/6,1/4,1/8,1/8},{1/3,1/6,1/4,1/8,1/8}}]
Graph[markov]
MarkovProcessProperties[markov]

NestList[#.{{(1/5),(1/5),(1/5),(1/5),(1/5)},{(1/5),(1/5),(1/5),(1/5),(1/5)},{(1/5),(1/5),(1/5),(1/5),(1/5)},{(1/5),(1/5),(1/5),(1/5),(1/5)},{(1/5),(1/5),(1/5),(1/5),(1/5)}}&,{1,0,0,0,0},20]//N

Eigensystem[{{(1/5),(1/5),(1/5),(1/5),(1/5)},{(1/5),(1/5),(1/5),(1/5),(1/5)},{(1/5),(1/5),(1/5),(1/5),(1/5)},{(1/5),(1/5),(1/5),(1/5),(1/5)},{(1/5),(1/5),(1/5),(1/5),(1/5)}}]

{0.

mat={{0,1,0,1,0,0,0,0,0},{1,0,1,0,1,0,0,0,0},{0,0,1,0,0,0,0,0,0},{1,0,0,0,1,0,1,0,0},{0,1,0,1,0,1,0,1,0},{0,0,1,0,1,0,0,0,1},{0,0,0,0,0,0,1,0,0},{0,0,0,0,1,0,1,0,1},{0,0,0,0,0,1,0,1,0}};
mat=#/Total/@#&@mat
markov=DiscreteMarkovProcess[1,mat]
Graph[markov]
MarkovProcessProperties[markov]

NestWhileList[RandomChoice[mat[[#]]->{1,2,3,4,5,6,7,8,9}]&,1,#!=3&&#!=7&]

Integrate[(1/(π(Sqrt[1-x]))),{x,0,1}]
%//N

F=(Sqrt[#])&
n=500;
Show[ListPlot[Accumulate@(F/@NestList[4#(1-#)&,0.3,n])/Range[n+1],Joined->True,Mesh->Automatic],Plot[Integrate[F[x],{x,0,2π}]/(2π),{y,0,n},PlotStyle->Red]]