MathGroup Archive 2008

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

Search the Archive

Re: Symbols in expression

  • To: mathgroup at
  • Subject: [mg89106] Re: [mg89079] Symbols in expression
  • From: Bob Hanlon <hanlonr at>
  • Date: Mon, 26 May 2008 01:28:27 -0400 (EDT)
  • Reply-to: hanlonr at

r = {Cos[u] Sin[v], Sin[u] Sin[v], Cos[v]};

Union[Cases[r, _Symbol, Infinity]]


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]]


Bob Hanlon

---- sigmundv at 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

  • Prev by Date: Re: No Show
  • Next by Date: NDSolve from negative to positive time
  • Previous by thread: Re: Symbols in expression
  • Next by thread: Re: Symbols in expression