Format for Do loop in Mathematica
- To: mathgroup at smc.vnet.net
- Subject: [mg41923] Format for Do loop in Mathematica
- From: "Prasad" <haritha12 at attbi.com>
- Date: Tue, 10 Jun 2003 04:46:54 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Hi, I am using Mathematica and would like to know if it is possible to generate a Do loop, similar to in Fortran. x=0 (*initializing x*) y-0 (*initializing y*) Do i = 1,10,1 (*i from 1 to 10 in steps of 1*) x=x+5 (*increment x by 5*) Do j=1,5,1 (*j from 1 to 5 in steps of 1*) y=y+2 Array1(i,j)=x+y Array2(i,j)=x^2+y^2 Print(x,y,Array1(i,j),Array2(i,j)) Return Return Could some one help to format the above steps in Mathematica or provide a good reference example. Can the data in Print statement be saved in a Table format, so that it could be exported as a text or data file. Thank You Prasad