MathGroup Archive 1999

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

Search the Archive

Re: Variables[] in general expressions


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