Author 
Comment/Response 
Bill Simpson

05/01/13 6:53pm
In Response To 'Re: Re: Manipulate Stochastic Process'  I first tried to use almost exactly your ListPlot of Table code like this.
(*Parameters of Run*)
y = 10;(*Time Span in Years*)
n = 52*y;(*Time Steps*)
Manipulate[
slast = 100;
ListPlot[Table[{k*dt, slast = slast*(1 + dt*\[Mu] + \[Sigma]*Sqrt[dt]*Random[NormalDistribution[0, 1]])}, {k, 1, n}]],
{dt, 1/52, 1/252, Appearance > "Labeled"},
{\[Mu], 0, 1, Appearance > "Labeled"},
{\[Sigma], 0, 1, Appearance > "Labeled"}
]
If you scrape that off the screen, paste it into Mathematica, run it and slide the sigma slider you will see that it is constantly recalculating everything.
In Mathematica there are at least a dozen different ways of doing anything, and many many more ways of doing it wrong. If you search the help pages you can find
http://reference.wolfram.com/mathematica/tutorial/AdvancedManipulateFunctionality.html
and try to understand why it doesn't just update a single time and then wait for you to move the slider again. I read that several times and still could not understand why the code was doing what it was. So I tried half a dozen other ways of writing the code until I think I found one that works.
(*Parameters of Run*)
y = 10;(*Time Span in Years*)
n = 52*y;(*Time Steps*)
Manipulate[
ListPlot[NestList[{#[[1]](*t[n1]*)+ dt, #[[2]](*s[n1]*)*(1 + dt*\[Mu] + 4*\[Sigma]*Sqrt[dt]*Random[NormalDistribution[0, 1]])} &, {0(*t0*), 100(*s0*)}, n]
],
{dt, 1/52, 1/252, Appearance > "Labeled"},
{\[Mu], 0, 1, Appearance > "Labeled"},
{\[Sigma], 0, 1, Appearance > "Labeled"}
]
NestList is similar in a way to Table. You can look it up in the help system. I used a "pure function" (which is a function that isn't given a name and uses # and & in the definition) and that might make this harder for a new user to understand. You can try looking up Function in the help system, but figuring that out the first time can be a real challenge. I tried writing this without using the pure function, because I thought it would be easier to understand, and got the continuous updating like before. So when I finally got the code above to seem to work I stopped trying other ways.
Your last step was wanting multiple series. That is often easy with Listplot[{data1,data2,data3}] when it will do three plots on top of each other. This is only a small change from the previous version.
(*Parameters of Run*)
y = 10;(*Time Span in Years*)
n = 52*y;(*Time Steps*)
Manipulate[
ListPlot[{
NestList[{#[[1]](*t[n1]*)+ dt, #[[2]](*s[n1]*)*(1 + dt*\[Mu] + \[Sigma]*Sqrt[dt]*Random[NormalDistribution[0, 1]])} &, {0(*t0*), 100(*s0*)}, n],
NestList[{#[[1]](*t[n1]*)+ dt, #[[2]](*s[n1]*)*(1 + dt*\[Mu] + 2*\[Sigma]*Sqrt[dt]*Random[NormalDistribution[0, 1]])} &, {0(*t0*), 100(*s0*)}, n],
NestList[{#[[1]](*t[n1]*)+ dt, #[[2]](*s[n1]*)*(1 + dt*\[Mu] + 4*\[Sigma]*Sqrt[dt]*Random[NormalDistribution[0, 1]])} &, {0(*t0*), 100(*s0*)}, n]
}],
{dt, 1/52, 1/252, Appearance > "Labeled"},
{\[Mu], 0, 1, Appearance > "Labeled"},
{\[Sigma], 0, 1, Appearance > "Labeled"}
]
I didn't know what three sequences you might want so I just bumped up the variability in the extra sequences.
You might try taking these apart, look at smaller pieces of this and see if you can figure out how those work. Then gradually assemble the pieces back together and see if you can understand what the thinking was and how the whole thing works.
Then you can try doing the same thing in other ways and see if you can come up with even better or simpler ways of doing this.
Please check all this carefully and see if you find any mistakes.
URL: , 
