Re: double loop do
- To: mathgroup at smc.vnet.net
- Subject: [mg112934] Re: double loop do
- From: Peter Pein <petsie at dordos.net>
- Date: Wed, 6 Oct 2010 03:17:03 -0400 (EDT)
- References: <i8c8ql$g5q$1@smc.vnet.net>
Am Mon, 4 Oct 2010 10:04:05 +0000 (UTC)
schrieb maria giovanna dainotti <mariagiovannadainotti at yahoo.it>:
> Dear Mathgroup,
>
> I have a problem with a double loop. Formally it doesn't give any
> error message but it doesn't let Om variate in the loop, it takes
> only the first value 0.1.
>
> This is the code
> ckms=299792.5HubE[z_,Om_]=(Om*(1+z)^3+(1-Om))^1/2dL[z_,Om_,h_]:=3.0856*1018*106*ckms/(100*h)*(1+z)*NIntegrate[1/HubE[xh=0.71TabOmegaM=Table[j,{j,0.0,1.0,0.01}]
>
> LxOmegaM={};
> Do[
> Om=TabOmegaM[[j]];
> DataGood={};
> ...
> ,{j,1,Length[TabOmegaM]}];
>
...
Hi,
if you want to loop through a whole list using Do, you can use the form
{var, ListOfVar} as iterator:
Do[
DataGood={};
...
,{Om,TabOmegaM}]
hth,
Peter