Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1999
*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 1999

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

Search the Archive

Re: Variables[] in general expressions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg20057] Re: [mg20024] Variables[] in general expressions
  • From: BobHanlon at aol.com
  • Date: Wed, 29 Sep 1999 03:33:21 -0400
  • Sender: owner-wri-mathgroup at wolfram.com

Kenneth,

expr = y + Sin[n*Pi*x] * Exp[-x*z];

If you want all Symbols

Union[Cases[expr, _Symbol, Infinity]]

{\[ExponentialE], n, \[Pi], x, y, z}

If only variables,

Union[Cases[expr, _?(MemberQ[Names["`*"], ToString[#]] &), Infinity]]

{n, x, y, z}


Bob Hanlon

In a message dated 9/25/1999 5:54:25 AM, kmr1004 at hermes.cam.ac.uk writes:

>Is there any way of extracting a list of variables from a general
>expression, not just a polynomial? I want something which will do,
>e.g.
>
>In AllVariables[y + Exp[x]]
>Out    {y,x}
>


  • Prev by Date: Table and Block Questions
  • Next by Date: RE: Select cell
  • Previous by thread: Re: Variables[] in general expressions
  • Next by thread: Re: Re: Variables[] in general expressions