MathGroup Archive 1999

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

Search the Archive

Re: Variables[] in general expressions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg20046] Re: [mg20024] Variables[] in general expressions
  • From: "Carl K.Woll" <carlw at fermi.phys.washington.edu>
  • Date: Sat, 25 Sep 1999 18:46:09 -0400
  • Organization: Department of Physics
  • References: <199909250640.CAA02016@smc.vnet.net.>
  • Sender: owner-wri-mathgroup at wolfram.com

Ken,

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

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

In[6]:=
AllVariables[y + Exp[x]]
AllVariables[y + f[x + 1]]

Out[6]=
{E, x, y}

Out[7]=
{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 cam.ac.uk



  • 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