Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #1969
| From | maria giovanna dainotti <mariagiovannadainotti@yahoo.it> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | for cicle inside an If condition |
| Date | 2011-04-29 11:29 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <ipe7fk$qr9$1@smc.vnet.net> (permalink) |
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
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
for cicle inside an If condition maria giovanna dainotti <mariagiovannadainotti@yahoo.it> - 2011-04-29 11:29 +0000
csiph-web