Services & Resources / Wolfram Forums
MathGroup Archive
*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
  • Subject: [mg20046] Re: [mg20024] Variables[] in general expressions
  • From: "Carl K.Woll" <carlw at>
  • Date: Sat, 25 Sep 1999 18:46:09 -0400
  • Organization: Department of Physics
  • References: <>
  • Sender: owner-wri-mathgroup at


This may not be what you want, but maybe it's close:

AllVariables[expr_] := Cases[expr, _Symbol, Infinity]

AllVariables[y + Exp[x]]
AllVariables[y + f[x + 1]]

{E, x, y}

{y, x}

Carl Woll
Physics Dept
U of Washington

Ken Rice wrote:

> Hi there,
> 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}
> Apologies if I'm just being dim.
> Ken Rice
> _____________________________________________________
> Kenneth Rice
> Churchill College
> Cambridge
> CB3 0DS, UK
> E-mail: kmr1004 at

  • Prev by Date: Re: fractions as axes-labels?
  • Next by Date: Re: Contourline values
  • Previous by thread: Variables[] in general expressions
  • Next by thread: RE: Variables[] in general expressions