Re: how to test where a list contains constant(s) or not
- To: mathgroup at smc.vnet.net
- Subject: [mg91982] Re: how to test where a list contains constant(s) or not
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Tue, 16 Sep 2008 19:21:56 -0400 (EDT)
- Organization: Uni Leipzig
- References: <gal3iu$e0a$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
Hi,
IsConstantsIn[lst_List] := Complement[lst, Variables[lst]] === {}
??
Regards
Jens
Aya wrote:
> case1: { a, b, c, Pi } gives true because of Pi
> case2: { a, b, c, 0.0001} gives true because of 0.0001
> case3: { a, b, c, 2 + Pi I } gives ture becase of 2 + Pi I
> case4: { a, b, c} gives false
>
> is this function right ?
>
> ComplexQ[z_] := NumericQ[ z ] || ( NumericQ[ z ] && SameQ[ Head[ z ],
> Complex] )
> IsConstantsIn[ lstList_ ] :=
> Module[ { intLength },
> intLength = Length@Select[ lstList, ComplexQ[ # ]& ];
> If[ intLength > 0, Return[ True ], Return[ False ] ];
> Return[ False ];
> ]
>