Re: removing non-numeric elements from the table
- To: mathgroup at smc.vnet.net
- Subject: [mg108056] Re: removing non-numeric elements from the table
- From: Yves Klett <yves.klett at googlemail.com>
- Date: Sun, 7 Mar 2010 04:05:54 -0500 (EST)
- References: <hmqj5p$so5$1@smc.vnet.net>
Hi,
rnd := Random[];
Eq := Solve[1/2 (Erf[z/Sqrt[2]] + 1) == 2 rnd - 1, z];
Flatten[Table[Eq, {20}]][[All, 2]]
seems to work for your example (every non-empty result of solve will be
listed). You can do it many different ways though, just about all of
which will be more elegant and / or general.
Regards,
Yves
Am 05.03.2010 10:33, schrieb michael partensky:
> Hi. I am building a large table filled with the numerical solutions of an equation.
> Here is an example, where a normal standard variable is being generated.
>
>
> rnd:=Random[];
> Eq:=Solve[1/2 (Erf[z/Sqrt[2]]+1)==2 rnd-1,z];
> tvR=Quiet[Table[z/.Eq[[1]],{20}]];
>
> In[187]:=
> tvR
>
> Out[187]=
> {0.761439, z /. {}[[1]], z /. {}[[1]], 1.07111, 0.031784, z /. {}[[1]], z /.
> {}[[1]], 0.808313, -1.04238, z /. {}[[1]], 0.376982, z /. {}[[1]], 1.06622,
> z /. {}[[1]], -0.546643, -0.367224, 0.28111, -0.0606866, z /. {}[[1]], z /.
> {}[[1]]}
>
> What is a nicer way of removing the non-numeric elements? Clearly, it is
> possible to filter them out using say NumericQ, but I am looking for
> something more elegant (it is apart of a lecture), preferably right while
> the Table is being generated.
>
> Thanks
> Michael
>
>