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

Re: Creating table with multiple lists

  • To: mathgroup at smc.vnet.net
  • Subject: [mg7517] Re: [mg7510] Creating table with multiple lists
  • From: "C. Woll" <carlw at u.washington.edu>
  • Date: Tue, 10 Jun 1997 10:48:51 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

On Sat, 7 Jun 1997, Ed McCarthy wrote:

> 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
> 
Hi Ed,

How about

x=Table[0,{100}];
z=Table[NormalDistribution[0,1],{100}];
list=Table[x=x+Random/@z,{10}];

Carl



  • Prev by Date: HELP: Error exporting RTF text from MM3.0 to MS Word 97 on NT 4.0
  • Next by Date: Re: Mathematica and Calculus self tutor for MMA 3.0???
  • Previous by thread: Creating table with multiple lists
  • Next by thread: Re: Creating table with multiple lists