4 I am improved formatting edited Sep 21 '16 at 16:11 corey979 21.1k66 gold badges4343 silver badges8282 bronze badges I have the following code:  Brownian[x0_,μ_, σ_, t_, h_] := Module[{d = Sqrt[h], m = t/h}, g = Table[Random[NormalDistribution[0, d]], {m}]; sums = FoldList[Plus, 0, g]; Table[X[i] = sums[[i + 1]], {i, 0, m}]; geometric = Table[x0*E^((μ - σ^2/2)*i*h + σ*X[i]), {i, 0, m}]] Brownian[78.55, 0.3693, 0.16689, .5, 0.001]; Xt = geometric; m = 500; h = .001; g1 = Table[{i*h, Xt[[i + 1]]}, {i, 0, m}];  This code works well, and it generates a g1 table as desired. However, I wish to loop this and generate many "g" tables (g1,g2,g3, etc.) all with different contents as there are random variables involved in my code. My desire is to be able to hit g1 and enter, and see contents in that table, then g2 and enter and see different contents. The reason why I want to do this is because I need to generate say 50 samples, and I would like to not want to hit enter every time. I have tried a Do[ ...code...,{k,50}] and added a subscript k under "g" where there is a random function for the normal distribution, under sums, geometric, brownian, Xt, and g1 in hopes that I could hit like a g1(sub1) or a g1(sub2) and get different tables, yet I get errors and red bars. Anyone care to help me out? Thanks, all! P.S. I'll be online so I'll be able to update and give you information as needed. I have the following code:  Brownian[x0_,μ_, σ_, t_, h_] := Module[{d = Sqrt[h], m = t/h}, g = Table[Random[NormalDistribution[0, d]], {m}]; sums = FoldList[Plus, 0, g]; Table[X[i] = sums[[i + 1]], {i, 0, m}]; geometric = Table[x0*E^((μ - σ^2/2)*i*h + σ*X[i]), {i, 0, m}]] Brownian[78.55, 0.3693, 0.16689, .5, 0.001]; Xt = geometric; m = 500; h = .001; g1 = Table[{i*h, Xt[[i + 1]]}, {i, 0, m}];  This code works well, and it generates a g1 table as desired. However, I wish to loop this and generate many "g" tables (g1,g2,g3, etc.) all with different contents as there are random variables involved in my code. My desire is to be able to hit g1 and enter, and see contents in that table, then g2 and enter and see different contents. The reason why I want to do this is because I need to generate say 50 samples, and I would like to not want to hit enter every time. I have tried a Do[ ...code...,{k,50}] and added a subscript k under "g" where there is a random function for the normal distribution, under sums, geometric, brownian, Xt, and g1 in hopes that I could hit like a g1(sub1) or a g1(sub2) and get different tables, yet I get errors and red bars. Anyone care to help me out? Thanks, all! P.S. I'll be online so I'll be able to update and give you information as needed. I have the following code:  Brownian[x0_,μ_, σ_, t_, h_] := Module[{d = Sqrt[h], m = t/h}, g = Table[Random[NormalDistribution[0, d]], {m}]; sums = FoldList[Plus, 0, g]; Table[X[i] = sums[[i + 1]], {i, 0, m}]; geometric = Table[x0*E^((μ - σ^2/2)*i*h + σ*X[i]), {i, 0, m}]] Brownian[78.55, 0.3693, 0.16689, .5, 0.001]; Xt = geometric; m = 500; h = .001; g1 = Table[{i*h, Xt[[i + 1]]}, {i, 0, m}];  This code works well, and it generates a g1 table as desired. However, I wish to loop this and generate many "g" tables (g1,g2,g3, etc.) all with different contents as there are random variables involved in my code. My desire is to be able to hit g1 and enter, and see contents in that table, then g2 and enter and see different contents. The reason why I want to do this is because I need to generate say 50 samples, and I would like to not want to hit enter every time. I have tried a Do[ ...code...,{k,50}] and added a subscript k under "g" where there is a random function for the normal distribution, under sums, geometric, brownian, Xt, and g1 in hopes that I could hit like a g1(sub1) or a g1(sub2) and get different tables, yet I get errors and red bars. Anyone care to help me out? 3 I am improved formatting edit approved Sep 21 '16 at 16:11 LCarvalho 5,94344 gold badges2929 silver badges8787 bronze badges I have the following code:  Brownian[x0_,\[Mu]_μ_, \[Sigma]_σ_, t_, h_] := Module[{d = Sqrt[h], m = t/h}, g = Table[Random[NormalDistribution[0, d]], {m}]; sums = FoldList[Plus, 0, g]; Table[X[i] = sums[[i + 1]], {i, 0, m}]; geometric = Table[x0*E^((\[Mu]μ - \[Sigma]^2σ^2/2)*i*h + \[Sigma]*X[i]σ*X[i]), {i, 0, m}]] Brownian[78.55, 0.3693, 0.16689, .5, 0.001]; Xt = geometric; m = 500; h = .001; g1 = Table[{i*h, Xt[[i + 1]]}, {i, 0, m}];  This code works well, and it generates a g1 table as desired. However, I wish to loop this and generate many "g" tables (g1,g2,g3, etc.) all with different contents as there are random variables involved in my code. My desire is to be able to hit g1 and enter, and see contents in that table, then g2 and enter and see different contents. The reason why I want to do this is because I need to generate say 50 samples, and I would like to not want to hit enter every time. I have tried a Do[ ...code...,{k,50}] and added a subscript k under "g" where there is a random function for the normal distribution, under sums, geometric, brownian, Xt, and g1 in hopes that I could hit like a g1(sub1) or a g1(sub2) and get different tables, yet I get errors and red bars. Anyone care to help me out? Thanks, all! P.S. I'll be online so I'll be able to update and give you information as needed. I have the following code:  Brownian[x0_,\[Mu]_, \[Sigma]_, t_, h_] := Module[{d = Sqrt[h], m = t/h}, g = Table[Random[NormalDistribution[0, d]], {m}]; sums = FoldList[Plus, 0, g]; Table[X[i] = sums[[i + 1]], {i, 0, m}]; geometric = Table[x0*E^((\[Mu] - \[Sigma]^2/2)*i*h + \[Sigma]*X[i]), {i, 0, m}]] Brownian[78.55, 0.3693, 0.16689, .5, 0.001]; Xt = geometric; m = 500; h = .001; g1 = Table[{i*h, Xt[[i + 1]]}, {i, 0, m}];  This code works well, and it generates a g1 table as desired. However, I wish to loop this and generate many "g" tables (g1,g2,g3, etc.) all with different contents as there are random variables involved in my code. My desire is to be able to hit g1 and enter, and see contents in that table, then g2 and enter and see different contents. The reason why I want to do this is because I need to generate say 50 samples, and I would like to not want to hit enter every time. I have tried a Do[ ...code...,{k,50}] and added a subscript k under "g" where there is a random function for the normal distribution, under sums, geometric, brownian, Xt, and g1 in hopes that I could hit like a g1(sub1) or a g1(sub2) and get different tables, yet I get errors and red bars. Anyone care to help me out? Thanks, all! P.S. I'll be online so I'll be able to update and give you information as needed. I have the following code:  Brownian[x0_,μ_, σ_, t_, h_] := Module[{d = Sqrt[h], m = t/h}, g = Table[Random[NormalDistribution[0, d]], {m}]; sums = FoldList[Plus, 0, g]; Table[X[i] = sums[[i + 1]], {i, 0, m}]; geometric = Table[x0*E^((μ - σ^2/2)*i*h + σ*X[i]), {i, 0, m}]] Brownian[78.55, 0.3693, 0.16689, .5, 0.001]; Xt = geometric; m = 500; h = .001; g1 = Table[{i*h, Xt[[i + 1]]}, {i, 0, m}];  This code works well, and it generates a g1 table as desired. However, I wish to loop this and generate many "g" tables (g1,g2,g3, etc.) all with different contents as there are random variables involved in my code. My desire is to be able to hit g1 and enter, and see contents in that table, then g2 and enter and see different contents. The reason why I want to do this is because I need to generate say 50 samples, and I would like to not want to hit enter every time. I have tried a Do[ ...code...,{k,50}] and added a subscript k under "g" where there is a random function for the normal distribution, under sums, geometric, brownian, Xt, and g1 in hopes that I could hit like a g1(sub1) or a g1(sub2) and get different tables, yet I get errors and red bars. Anyone care to help me out? Thanks, all! P.S. I'll be online so I'll be able to update and give you information as needed. 2 added 81 characters in body edited May 26 '15 at 5:59 John Yates 3944 bronze badges I have the following code:  Brownian[x0_,\[Mu]_, \[Sigma]_, t_, h_] := Module[{d = Sqrt[h], m = t/h}, g = Table[Random[NormalDistribution[0, d]], {m}]; sums = FoldList[Plus, 0, g]; Table[X[i] = sums[[i + 1]], {i, 0, m}]; geometric = Table[x0*E^((\[Mu] - \[Sigma]^2/2)*i*h + \[Sigma]*X[i]), {i, 0, m}]] Brownian[78.55, 0.3693, 0.16689, .5, 0.001]; Xt = geometric; m = 500; h = .001; g1 = Table[{i*h, Xt[[i + 1]]}, {i, 0, m}];  This code works well, and it generates a g1 table as desired. However, I wish to loop this and generate many "g" tables (g1,g2,g3, etc.) all with different contents as there are random variables involved in my code. My desire is to be able to hit g1 and enter, and see contents in that table, then g2 and enter and see different contents. The reason why I want to do this is because I need to generate say 50 samples, and I would like to not want to hit enter every time. I have tried a Do[ ...code...,{k,50}] and added a subscript k under "g" where there is a random function for the normal distribution, under sums, geometric, brownian, Xt, and g1 in hopes that I could hit like a g1(sub1) or a g1(sub2) and get different tables, yet I get errors and red bars. Anyone care to help me out? Thanks, all! P.S. I'll be online so I'll be able to update and give you information as needed. I have the following code:  Brownian[x0_,\[Mu]_, \[Sigma]_, t_, h_] := Module[{d = Sqrt[h], m = t/h}, g = Table[Random[NormalDistribution[0, d]], {m}]; sums = FoldList[Plus, 0, g]; Table[X[i] = sums[[i + 1]], {i, 0, m}]; geometric = Table[x0*E^((\[Mu] - \[Sigma]^2/2)*i*h + \[Sigma]*X[i]), {i, 0, m}]] Brownian[78.55, 0.3693, 0.16689, .5, 0.001]; Xt = geometric; m = 500; h = .001; g1 = Table[{i*h, Xt[[i + 1]]}, {i, 0, m}];  This code works well, and it generates a g1 table as desired. However, I wish to loop this and generate many "g" tables (g1,g2,g3, etc.) all with different contents as there are random variables involved in my code. My desire is to be able to hit g1 and enter, and see contents in that table, then g2 and enter and see different contents. The reason why I want to do this is because I need to generate say 50 samples, and I would like to not want to hit enter every time. I have tried a Do[ ...code...,{k,50}] and added a subscript k under "g" where there is a random function for the normal distribution, under sums, geometric, brownian, Xt, and g1, yet I get errors and red bars. Anyone care to help me out? Thanks, all! P.S. I'll be online so I'll be able to update and give you information as needed. I have the following code:  Brownian[x0_,\[Mu]_, \[Sigma]_, t_, h_] := Module[{d = Sqrt[h], m = t/h}, g = Table[Random[NormalDistribution[0, d]], {m}]; sums = FoldList[Plus, 0, g]; Table[X[i] = sums[[i + 1]], {i, 0, m}]; geometric = Table[x0*E^((\[Mu] - \[Sigma]^2/2)*i*h + \[Sigma]*X[i]), {i, 0, m}]] Brownian[78.55, 0.3693, 0.16689, .5, 0.001]; Xt = geometric; m = 500; h = .001; g1 = Table[{i*h, Xt[[i + 1]]}, {i, 0, m}];  This code works well, and it generates a g1 table as desired. However, I wish to loop this and generate many "g" tables (g1,g2,g3, etc.) all with different contents as there are random variables involved in my code. My desire is to be able to hit g1 and enter, and see contents in that table, then g2 and enter and see different contents. The reason why I want to do this is because I need to generate say 50 samples, and I would like to not want to hit enter every time. I have tried a Do[ ...code...,{k,50}] and added a subscript k under "g" where there is a random function for the normal distribution, under sums, geometric, brownian, Xt, and g1 in hopes that I could hit like a g1(sub1) or a g1(sub2) and get different tables, yet I get errors and red bars. Anyone care to help me out? Thanks, all! P.S. I'll be online so I'll be able to update and give you information as needed. 1 asked May 26 '15 at 5:48 John Yates 3944 bronze badges