MathGroup Archive 2007

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

Search the Archive

Re: create a List in a Do loop

  • To: mathgroup at smc.vnet.net
  • Subject: [mg79265] Re: create a List in a Do loop
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Sun, 22 Jul 2007 04:27:37 -0400 (EDT)
  • Organization: The Open University, Milton Keynes, UK
  • References: <f7si85$2cn$1@smc.vnet.net>

liloi wrote:
> hello,
> 
> i would like to  make a list included in a do loop
> and mu3,L1,L2,L3 are constants
> 
> 
> 
> Do[If[Sqrt[6.8*10^(-23)] <= masse2[mu1, mu2, mu3, L1, L2, L3] <= 
>         Sqrt[9.3*10^(-23)] &&
>       
>       Sqrt[1.1*10^(-21)] <= masse3[mu1, mu2, mu3, L1, L2, L3] <= 
>         Sqrt[3.7*10^(-21)],HERE THE LOOP MAY BE GENERATED
>     
>     , Continue[]],
>   
>   {mu1, 1*10^(-6), 1*10^(-3), 5*10^(-6)}, {mu2, 1*10^(-6), 1*10^(-3), 
>     5*10^(-6)}]
> 
> 
> 
> 
> 
> 
> 
> i tried table but i failed because table must have a  imax known before  starting the creation of the list

It is hard to tell, from the given "example", what your inner loop is 
supposed to do and how it is related to the main loop, but you could use 
the functions *Sow* and *Reap* with a *While* construct to build up 
dynamically the list. Something along the line

Reap[
   Do[If[Sqrt[6.8*10^(-23)] <= masse2[mu1, mu2, mu3, L1, L2, L3] <=
         Sqrt[9.3*10^(-23)] &&

       Sqrt[1.1*10^(-21)] <= masse3[mu1, mu2, mu3, L1, L2, L3] <=
         Sqrt[3.7*10^(-21)], While[sometest, ... Sow[something] ...];

     , Continue[]],

   {mu1, 1*10^(-6), 1*10^(-3), 5*10^(-6)}, {mu2, 1*10^(-6), 1*10^(-3),
     5*10^(-6)}]
]

HTH,
Jean-Marc


  • Prev by Date: New graphics primitive: "Curve"?
  • Next by Date: Re: graphing traces of complicated evaluations (improved)
  • Previous by thread: Re: create a List in a Do loop
  • Next by thread: How to set a "slope style" of axe label in ParametricPlot3D?