Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*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 2006

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

Search the Archive

Re: Extracting terms from an equation

  • To: mathgroup at smc.vnet.net
  • Subject: [mg69786] Re: Extracting terms from an equation
  • From: dimmechan at yahoo.com
  • Date: Sat, 23 Sep 2006 04:44:13 -0400 (EDT)
  • References: <eevubf$hqu$1@smc.vnet.net>

Can someone explain the difference in the following?

Cases[a + b*x^2 + c*y^2 + d*x*y + e*x^3, _?( !FreeQ[#1, x] & )]
{b*x^2, e*x^3, d*x*y}

Cases[a + b*x^2 + c*y^2 + d*x*y + e*x^3, _?(MemberQ[#1, x] & )]
{d*x*y}

Thanks

Î?/Î? Coleman, Mark έγÏ?αÏ?ε:
> Greetings,
>
> I'd like to find a general way to extract all of the terms from an
> equation that involve a given variable. For instance, consider the
> equation
>
> myEquation == Exp[a + b x^2 + c y^2 + d x y + e x^3]]
>
> I'd like to define a function such that
>
>    myFunction[myEquation,x] returns the result {b x^2, d x y, e x^3}
> 
> Thanks,
> 
> -Mark


  • Prev by Date: notebook interface: how make the cursor to be a 'block' cursor instead of the default?
  • Next by Date: Re: Suggestions for translating a Do[] loop ...
  • Previous by thread: Re: Extracting terms from an equation
  • Next by thread: Re: Re: Extracting terms from an equation