       Re: What variables are in a function and displaying surds

• To: mathgroup at smc.vnet.net
• Subject: [mg31133] Re: What variables are in a function and displaying surds
• From: Albert Retey <albert.retey at visualanalysis.com>
• Date: Fri, 12 Oct 2001 03:36:52 -0400 (EDT)
• Organization: Visual Analysis AG
• References: <9q2l3v\$p4f\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Hi,

> Is there a way in Mathematica to generate a list of variables in an
> expression like Variable[]. For example if I passed the expression
> Sin[x+y]+ z/p - t the list {x,y,z,p,t} would be generated.
>

This is probably not bullet-proof, but should do the job (if any of the
x,y,z,p,t is set to e.g. a number it won't work anymore...):

Mathematica 4.1 for Linux
-- Motif graphics initialized --

In:= expr = Sin[x + y] + z/p - t;

In:= Union[Cases[expr, _Symbol, Infinity]]

Out= {p, t, x, y, z}

In:= x=8;

In:= Union[Cases[expr, _Symbol, Infinity]]

Out= {p, t, y, z}

In:= Quit[]

expr = Sin[x+y]+ z/p - t

Union[Cases[expr, _Symbol, Infinity]]

Albert

```

• Prev by Date: HELP!!!
• Next by Date: Re: displaying unevaluated arguments
• Previous by thread: Re: What variables are in a function and displaying surds
• Next by thread: Re: What variables are in a function and displaying surds