MathGroup Archive 2003

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

Search the Archive

Re: Format for Do loop in Mathematica

  • To: mathgroup at smc.vnet.net
  • Subject: [mg41937] Re: Format for Do loop in Mathematica
  • From: Mark Westwood <MarkCWestwood at compuserve.com>
  • Date: Wed, 11 Jun 2003 03:49:19 -0400 (EDT)
  • Organization: CompuServe Interactive Services
  • References: <bc465f$krd$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Prasad

It certainly is possible to write do loops in Mathematica - use the Do
function.

If you get stuck with this, post again and I'll try to help.

Regards
Mark Westwood

Prasad wrote:
> 
> 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


  • Prev by Date: Re: Times font error :(
  • Next by Date: Re: InverseFunction[]
  • Previous by thread: Format for Do loop in Mathematica
  • Next by thread: Re: Format for Do loop in Mathematica