Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

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

Search the Archive

Re: For loops with mathematica....

  • To: mathgroup at smc.vnet.net
  • Subject: [mg101114] Re: For loops with mathematica....
  • From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
  • Date: Wed, 24 Jun 2009 06:33:58 -0400 (EDT)
  • References: <h1qctk$7u2$1@smc.vnet.net>

Do[ thingstodo, {i,{20,200,300,400}}] will cycle i through the values
20,200,300,400.

You should separate statements in the Do loop with ";" It works just
fine. If you want output, use Print. If you want to deliver more
complex result you might consider lists.

May I offer the advice to start reading some introductory texts that
Mathematica offers in its Documentation centre? Or are you planning to
learn everything by guessing and asking random questions in this
group?

Cheers -- Sjoerd

On Jun 23, 1:05 pm, Julien <jd... at cgr.harvard.edu> wrote:
> Hey guys,
>
> I am totally new to mathematica.
> I want to use a simple loop for but with many arguments in the loop...
> the help says to do
>
> Do[ thingstodo, {i,8}]
>
> i will go from 1 to 8 to do thingstodo.
>
> First question: what if I want i to go from 20 then 200 then 300 then 400=
, (can we give a sequence as argument?)
>
> Second question: I have a lot of line to do in things to do. should I sep=
arate everything with a ; (doesn t seem to work, or use a procedure or some=
thing?)
>
> THanks a lot for your help!!!
>
> Julien



  • Prev by Date: Re: Matrix construction
  • Next by Date: Re: soap films
  • Previous by thread: Re: For loops with mathematica....
  • Next by thread: Using fractions in axis labels