Discover one of the most important stochastic process by yourself
12_A assignament
Request
Discover one of the most important stochastic process by yourself !
Consider the general scheme we have used so far to simulate stochastic processes (such as the relative frequency of success in a sequence of trials, the sample mean, the random walk, the Poisson point process, etc.) and now add this new process to our simulator.
Starting from value 0 at time 0, for each of m paths, at each new time compute P(t) = P(t-1) + Random step(t), for t = 1, …, n,
where the Random step(t) is now:
σ * sqrt(1/n) * Z(t),
where Z(t) is a N(0,1) random variable (the “diffusion” σ is a user parameter, to scale the process dispersion).
At time n (last time) and one (or more) other chosen inner time 1<j<n (j is a program parameter) create and represent with histogram the distribution of P(t). Observe the behavior of the process for large n.
We graphicate the paths and the histograms as before but for sure now we use as a random step the new formula so i made a class
WN graphicate ormalpaths and the histograms as before but for sure now we use as a random step the new formula so i made a class “NormalPathfinder” in witch i generate the list of value:
publicNormalPathfinder(intn,intm){this.m=n;this.n=m;this.p=0.5;this.R=newRandom();for(inti=0;i<m;i++){List<Double>list=createNormalList();paths.Add(newStrade(list));values.Add(list);}}privateboolnormal_Result(doublep,outdoubleou){doublerandom_outcome=(R.NextDouble()+R.NextDouble());doublenormal_distrbAtOut;doublev=R.NextDouble();//create a value between 1 and -1
random_outcome=random_outcome-1;//get the standard normal for that point
normal_distrbAtOut=Math.Pow(Math.E,(Math.Pow(-random_outcome,2)/2))/Math.Sqrt(2*Math.PI);//then use the other generated random
if(v<=normal_distrbAtOut*Math.Sqrt(2*Math.PI)){ou=random_outcome;returntrue;}else{ou=0;returnfalse;}}privateList<double>createNormalList(){List<double>normal=newList<double>();for(inti=0;i<n;i++){doublej;if(normal_Result(p,outj))normal.Add(j);elsei--;}returnnormal;}
Here we use create also the path with a Strade object :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//Dalla lista di valori passo ai punti ;
publicStrade(List<double>values){this.values=values;doublesqrt1n=(double)1/values.Count;Math.Sqrt(sqrt1n);doublejump=0;for(inti=0;i<values.Count;i++){jump+=(sqrt1n)*values[i];path.Add(newPointF(i+1,(float)jump));}}