MathGroup Archive 2011

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

Search the Archive

for cicle inside an If condition

  • To: mathgroup at smc.vnet.net
  • Subject: [mg118463] for cicle inside an If condition
  • From: maria giovanna dainotti <mariagiovannadainotti at yahoo.it>
  • Date: Fri, 29 Apr 2011 07:30:01 -0400 (EDT)

Dear Mathematica Group,
I am trying to figure out the following Problem:
In the loop below I have to choose only 4 values of z the first one should vary from the table DataGRB[[i,2]] while the other ones are fixed, namely  
||z==4.05||z==5.2||z==8.26 .
The problem is that 
Writing in this way as below I will have all the value of DataGRB[[i,2]]<4 
instead I would like to pick only one value per time in order that I should have the computation for the Lx for all the possible different four values of z, 
namely each z[[i]]<4.05 and the three mentioned value of z.


DataGoodclosed={};
Do[
logTarest=DataGRB[[i,7]];
logTaErrrest=DataGRB[[i,8]];
Fx=DataGRB[[i,3]];
FxErr=DataGRB[[i,4]];
idGRB=DataGRB[[i,1]];
z=DataGRB[[i,2]];
class=DataGRB[[i,12]];
beta=DataGRB[[i,5]];
dbeta=DataGRB[[i,6]];
If[class==33 && (z==DataGRB[[i,2]]<4 ||z==4.05||z==5.2||z==8.26),

Lx=4*p*dLclosed[z,Om,Ol,h]2*(1+z)-(1+beta)*Fx; 
logLx=Log[10,Lx];
AppendTo[DataGoodclosed,{logTarest,logLx,z,idGRB,Om,Ol}]],
{i,1,Length[DataGRB]}];

I thought about a for loop or a select, but when I introduce in the loop 
for example this one:
 For[i=1,i<=78,i++,
{Select[z[[i]],#<4&]}]

It gives the following error message:Select::normal: 
 
Nonatomic expression expected at position 1 in Select z= "1.29"

I would be very grateful if you could help me.

Thanks a lot in advance,

Cheers

Maria


  • Prev by Date: Re: How to create such a list
  • Next by Date: Re: Expected value of the Geometric distribution
  • Previous by thread: Re: Solve / Reduce isolating results.
  • Next by thread: Re: for cicle inside an If condition