Re: Finding a function within an arbitrary expression

• To: mathgroup at smc.vnet.net
• Subject: [mg131463] Re: Finding a function within an arbitrary expression
• From: amannucci <Anthony.J.Mannucci at jpl.nasa.gov>
• Date: Mon, 29 Jul 2013 23:20:48 -0400 (EDT)
• Delivered-to: l-mathgroup@mail-archive0.wolfram.com
• Delivered-to: l-mathgroup@wolfram.com
• Delivered-to: mathgroup-outx@smc.vnet.net
• Delivered-to: mathgroup-newsendx@smc.vnet.net
• References: <20130630072942.2AF536A20@smc.vnet.net> <kqrj00\$4ao\$1@smc.vnet.net>

On Monday, July 1, 2013 2:43:28 AM UTC-7, Bob Hanlon wrote:
> data = {3*u[1, 0], u[0, 0]/10., 1/u[1, 0], f[u[1, 0]]};
>
>
> data2 = Select[data, MemberQ[#, u[1, 0]] &]
>
>
> {3*u[1, 0], 1/u[1, 0], f[u[1, 0]]}
>
>
> Some other methods: [snip]
>
>
> Bob Hanlon
>
>

Your top example is a good way to do it. I am completely mystified, however. I originally tried to do this with Cases, but that did not work because of expression levels. I did not specify an expression level when using Cases.

You do not specify the level in your MemberQ call, but it works. Yet, this does not work:
MemberQ[{3*u[1, 0]}, u[1, 0]] gives False
but
MemberQ[{3*u[1, 0]}, u[1, 0],Infinity] gives True

So why don't you need a level spec in your example (definition of data2)? It's as if creating a lambda function automatically inserts the level spec.

• Prev by Date: Re: Incorrect (unexpected) output from TransformedField
• Next by Date: Re: Variable transformations
• Previous by thread: Re: Finding a function within an arbitrary expression
• Next by thread: Re: Finding a function within an arbitrary expression