[Date Index]
[Thread Index]
[Author Index]
Re: double loop do
*To*: mathgroup at smc.vnet.net
*Subject*: [mg112897] Re: double loop do
*From*: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
*Date*: Tue, 5 Oct 2010 05:34:33 -0400 (EDT)
*References*: <i8c8ql$g5q$1@smc.vnet.net>
Hi Maria,
I'm sorry to inform you, but your code contains so many syntax and
other errors that I almost don't know where to start. Additionally,
you use many variables and functions not defined in the part you
provide here so it's next to impossible for us to get it to work.
Some of the errors I spotted:
1. first line: two definitions run together (may be caused by posting
here)
2. same for dL[z_,Om_,h_], or is it L[z_,Om_,h_] ?
3. the call of HubE in the NIntegrate contains two assignments instead
of three arguments.
4. Using two Do loops with the same index j is rather confusing to say
the least
5. Lx=4*dLx=Lx*\[Sqrt]((FxErr/Fx)2+(Log[1+z])2*dbeta2); contains an
illegal way of doing a series of assignments: x = y = 2 is OK but x =
2*y = 2 is not.
6. The NIntegrate has no integration variable nor bounds nor a
bounding bracket as far as I can see
7. DataGRB[[i,2]]; on its own does nothing
8. Om = TabOmegaM[[j]]; assignment to an argument of the function
9. The function dL or L is only defined but not called.
It's probably best to clean up your code and then post again if
problems still occur.
Good luck-- Sjoerd
On Oct 4, 12:04 pm, maria giovanna dainotti
<mariagiovannadaino... at yahoo.it> wrote:
> Dear Mathgroup,
>
> I have a problem with a double loop. Formally it doesn't give any error m=
essage but it doesn't let Om variate in the loop, it takes only the first v=
alue 0.1.
>
> This is the code
> ckms=299792.5HubE[z_,Om_]=(Om*(1+z)^3+(1-Om))^1/2dL[z_,Om_,h_]:=3.0=
856*1018*106*ckms/(100*h)*(1+z)*NIntegrate[1/HubE[xh=0.71TabOmegaM=Tabl=
e[j,{j,0.0,1.0,0.01}]
>
> LxOmegaM={};
> Do[
> Om=TabOmegaM[[j]];
> DataGood={};
> Do[
> logTarest=DataGRB[[i,7]];
> logTaErrrest=DataGRB[[i,8]];
> Fx=DataGRB[[i,3]];
> FxErr=DataGRB[[i,4]];
> idGRB=DataGRB[[i,1]];
> DataGRB[[i,2]];
> class=DataGRB[[i,12]];
> beta=DataGRB[[i,5]];
> dbeta=DataGRB[[i,6]];
> Lx=4*dLx=Lx*\[Sqrt]((FxErr/Fx)2+(Log[1+z])2*dbeta2);
> logLx=Log[10,Lx];
> dlogLx=dLx/(Lx*Log[10]);
> If[\[Sqrt]((dlogLx)2+(logTaErrrest)2)<4 ,
> AppendTo[DataGood,{logTarest,logTaErrrest,logLx,dlogLx,beta,dbeta,z,idGRB=
,class,Om}]],{i,1,Length[DataGRB]},{j,1,Length[TabOmegaM]}];
>
> CLxTa=N[SpearmanRankCorrelation[DataGood[[All,1]],DataGood[[All,3]]]];
> AppendTo[LxOmegaM,{CLxTa,logLx,Om,Length[DataGood]}],{j,1,Length[TabOmega=
M]}]
>
> Then I tried putting in Lx Om[[j]] to let Om variate, but in this case I =
got the following error message:Part::partd: Part specification 0.[[NIntegr=
ate::inumr:
> The integrand 1/[1/HubE[x,Om],{x,0,z},MaxRecursion ->100] has evaluated t=
o
> non-numerical values for all sampling points in the region with boundarie=
s]{{0,1.29}}
>
> I would be really very grateful if you could help me.
>
> Cheers,
>
> Maria
Prev by Date:
**Re: How to apply a list of functions**
Next by Date:
**Re: What assumptions to use to check for orthogonality**
Previous by thread:
**double loop do**
Next by thread:
** Re: double loop do**
| |