Re: List operations

• To: mathgroup at smc.vnet.net
• Subject: [mg25462] Re: List operations
• From: dkeith at sarif.com
• Date: Sun, 1 Oct 2000 02:44:46 -0400 (EDT)
• References: <8r196t\$hs8@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Hi Matt,

Here's one way:

testPair[op1_, op2_, c_, element_] :=
op1[element[[1]]] + op2[element[[2]]] == c;

data = {{3, 5}, {1, 4}, {5, 3}, {4, 1}, {4, 4}, {2, 0}, {3, 3}, {3, 1}};

Select[data, testPair[3#&, #^2&, 10, #]&]

{{3, 1}}

In article <8r196t\$hs8 at smc.vnet.net>,
"Matt Herman" <Henayni at hotmail.com> wrote:
>
> Hi,
>
> Suppose I have a list of ordered pairs {{a1,b1},{a2,b2},...,{an,bn}}.
> What is an efficient way of pulling out all the pairs such that, if I
do
> an operation on the first element in the list, and another on the
> second, and I sum them, they equal some predetermined constant?
>
> For instance, say 3*listpart[[1]]+listpart[[2]]^2
>
> Thanks
>
>

Sent via Deja.com http://www.deja.com/
Before you buy.

```

• Prev by Date: Re: minimizing f(x,y) ???!!!!
• Next by Date: Re: NDSolve : Stopping condition
• Previous by thread: Re: List operations
• Next by thread: Re: List operations