Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1997
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1997

[Date Index] [Thread Index] [Author Index]

Search the Archive

Creating table with multiple lists

  • To: mathgroup at smc.vnet.net
  • Subject: [mg7510] Creating table with multiple lists
  • From: "Ed McCarthy" <ed_mccarthy at ids.net>
  • Date: Sat, 7 Jun 1997 03:49:01 -0400 (EDT)
  • Organization: EDM
  • Sender: owner-wri-mathgroup at wolfram.com

I'm trying to create a table with multiple lists that have the same
starting value. Here's the basic code:

z=NormalDistribution[0,1];
t=100; x=0;
path=Table[x=x+Random[z], {t}]

This code will generate a continuous path starting at x=0, which is what I
want. My goal is to repeat the process multiple times, but starting each
new iteration with x=0 while storing each path. This For loop works, but
I'm looking for a better way to do it.

z=NormalDistribution[0,1];
list1={};
For[i=0, i<10, i++,
t=100; x=0;
path=Table[x=x+Random[z],{t}];
AppendTo[list1,path]]

Does any have suggestions for generating multiple paths (with x reset to 0
for each iteration) with a functional approach? I'd like to avoid AppendTo
if possible.Thanks--any comments appreciated.

Ed McCarthy


  • Prev by Date: Any uses for SequenceHold ?
  • Next by Date: Need a new type of Hold
  • Previous by thread: Re: Any uses for SequenceHold ?
  • Next by thread: Re: Creating table with multiple lists