MathGroup Archive 2010

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

Search the Archive

Re: double loop do

  • To: mathgroup at
  • Subject: [mg112897] Re: double loop do
  • From: "Sjoerd C. de Vries" <sjoerd.c.devries at>
  • Date: Tue, 5 Oct 2010 05:34:33 -0400 (EDT)
  • References: <i8c8ql$g5q$>

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
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> 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=
> 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=
> CLxTa=N[SpearmanRankCorrelation[DataGood[[All,1]],DataGood[[All,3]]]];
> AppendTo[LxOmegaM,{CLxTa,logLx,Om,Length[DataGood]}],{j,1,Length[TabOmega=
> 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=
> The integrand 1/[1/HubE[x,Om],{x,0,z},MaxRecursion ->100] has evaluated t=
> non-numerical values for all sampling points in the region with boundarie=
> 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