Re: How build a ?TestFuntion that applied to a list gives only the elements that are function of x
- To: mathgroup at smc.vnet.net
- Subject: [mg33030] Re: [mg32995] How build a ?TestFuntion that applied to a list gives only the elements that are function of x
- From: Omega Consulting <omega_consulting at yahoo.com>
- Date: Tue, 26 Feb 2002 04:35:25 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
At 01:38 AM 2/23/2002, J. Guillermo Sanchez wrote:
>How build a ?TestFuntion that applied to a list give only the elements
>that are function of x
>
>Example:
>
>In[]:= {Sin[a x], b x, t, c r}/.?TestFuntion
>
>gives
>
>Out[] = {Sin[a x], b x}
>
>Thanks
>
>Guillermo Sanchez
TestFuntion[expr_] := !FreeQ[expr, x]
Then
Select[{Sin[a x], b x, t, c r}, TestFuntion]
or
Cases[{Sin[a x], b x, t, c r}, _?TestFuntion]
--------------------------------------------------------------
Omega Consulting
"The final answer to your Mathematica needs"
Spend less time searching and more time finding.
http://www.wz.com/internet/Mathematica.html