Re: Symbols in expression

*To*: mathgroup at smc.vnet.net*Subject*: [mg89131] Re: Symbols in expression*From*: sigmundv at gmail.com*Date*: Mon, 26 May 2008 06:23:58 -0400 (EDT)*References*: <g1dhtv$9m1$1@smc.vnet.net>

Thank you, Bob, but isn't Union[Cases[r, _?(Head[#] == Symbol && ! NumericQ[#] &), Infinity]] equivalent to Union[Cases[r, _Symbol?(! NumericQ[#] &), Infinity]] ? /Sigmund On May 26, 7:30 am, Bob Hanlon <hanl... at cox.net> wrote: > r = {Cos[u] Sin[v], Sin[u] Sin[v], Cos[v]}; > > Union[Cases[r, _Symbol, Infinity]] > > {u,v} > > However, this will include numbers if there are numeric symbols such as Pi= or E present. Hence, use > > Union[Cases[r, _?(Head[#] == Symbol && ! NumericQ[#] &), Infinity]] > > {u,v} > > Bob Hanlon > > > > ---- sigmu... at gmail.com wrote: > > Dear all, > > > Define, say, > > > r = {Cos[u] Sin[v],Sin[u] Sin[v],Cos[v]}. > > > How can I write a function, which takes r as an argument and returns a > > list {u,v}? If we defined r[u_,v_]:=... it could be achieved fairly > > easily using DownValues. But how can I achieve it in this case? > > > Kind regards, > > Sigmund Vestergaard