# How to list variables given equation? [closed]

Given an expression, is there any means to list variables?

Example:

a^3 + b^2 + c -> a,b,c

I need this functionality because I am manipulating large expressions of many variables (20) and would like to know which variables remain once the manipulations have been done.

## closed as off-topic by Artes, m_goldberg, Bob Hanlon, bbgodfrey, ciaoMar 31 '15 at 0:04

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Artes, m_goldberg, Bob Hanlon, bbgodfrey, ciao
If this question can be reworded to fit the rules in the help center, please edit the question.

• Do you have parameters in those expressions ? – Sektor Mar 30 '15 at 18:16
• @Sektor, I am new to Mathematica. Could you give an example? – mod0 Mar 30 '15 at 18:16

## 2 Answers

Use the Variables command:

 Variables[a x^2 + b x + c]


(* {a,b,c,x} *)

You can easily remove the x.

Alternatively:

CoefficientList[a x^2 + b x + c, x]


(* {a, b, c} *)

A quite general approach is to use Cases.

Cases[a^3 + b^2 + c, z_Symbol :> z, {0, Infinity}]
(* {a, b, c} *)


or

Cases[Cos[a] b^c Gamma[d]/e, z_Symbol :> z, {0, Infinity}]
(* {b, c, e, a, d} *)