Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2000
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2000

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: List operations

  • To: mathgroup at smc.vnet.net
  • Subject: [mg25447] Re: List operations
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Sun, 1 Oct 2000 02:44:29 -0400 (EDT)
  • References: <8r196t$hs8@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Mat,
Two ideas:

Cases[data, {x_, y_} /; 3x + y^2 == 7]

        {{1, 2}, {2, 1}}


op[{x_, y_}] := 3x + y^2
Select[data, op[#] == 7 &]

        {{1, 2}, {2, 1}}

--
Allan
---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565

"Matt Herman" <Henayni at hotmail.com> wrote in message
news:8r196t$hs8 at smc.vnet.net...
>
> 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
>
>




  • Prev by Date: Re: I do not understand
  • Next by Date: Re: I do not understand
  • Previous by thread: Re: List operations
  • Next by thread: Re: Run[] in background (NT)?