MathGroup Archive 2009

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

Search the Archive

Re: Do-command

  • To: mathgroup at smc.vnet.net
  • Subject: [mg102615] Re: [mg102588] Do-command
  • From: Tomas Garza <tgarza10 at msn.com>
  • Date: Mon, 17 Aug 2009 04:01:55 -0400 (EDT)
  • References: <200908161038.GAA01118@smc.vnet.net>

Because it's not meant to. If you want to produce output, instruct Mathematica to do so. For example, in this case it depends whether you want to see the last term in the Do process, or each of the successive terms:

In[1]:= Do[a=Select[{1,2,4,7,6,2},#>=i&],{i,7}]; a
Out[1]= {7}

In[2]:= Do[a=Select[{1,2,4,7,6,2},#>=i&];Print[a],{i,7}]

 {1,2,4,7,6,2}
 {2,4,7,6,2}
 {4,7,6}
 {4,7,6}
 {7,6}
 {7,6}
 {7}

Or, perhaps:

In[4]:= a={}; Do[AppendTo[a,Select[{1,2,4,7,6,2},#>=i&]],{i,7}]

In[5]:= a
Out[5]= {{1,2,4,7,6,2},{2,4,7,6,2},{4,7,6},{4,7,6},{7,6},{7,6},{7}}

Tomas

> Date: Sun, 16 Aug 2009 06:38:59 -0400
> From: u.gotzes at googlemail.com
> Subject: [mg102588] Do-command
> To: mathgroup at smc.vnet.net
>
> Hi!
>
> Can anybody tell, why
> Do[Select[{1, 2, 4, 7, 6, 2}, # >= i &], {i, 7}]
> does not produce output in Mathematica?
>


  • References:
    • Do-command
      • From: Uwe Gotzes <u.gotzes@googlemail.com>
  • Prev by Date: Re: Is it possible with Mathematica?big problem.thank you
  • Next by Date: Re: Generating a list numnber in string format
  • Previous by thread: Re: Do-command
  • Next by thread: Re: Do-command