From: Rob on
Is there a straightforward way to count the number of variables in an
expression? If it makes any difference what I'm looking at is the
product of several polynomials in many variables with rational
coefficients.

From: dh on
Hi Rob,
assuming all your constants are numeric, you could e.g. try:
Length(a)Union@Cases[Sin[x1 + x2] x3 + x1^3, _Symbol, Infinity]

Daniel

On 25.03.2010 10:27, Rob wrote:
> Is there a straightforward way to count the number of variables in an
> expression? If it makes any difference what I'm looking at is the
> product of several polynomials in many variables with rational
> coefficients.
>


--

Daniel Huber
Metrohm Ltd.
Oberdorfstr. 68
CH-9100 Herisau
Tel. +41 71 353 8585, Fax +41 71 353 8907
E-Mail:<mailto:dh(a)metrohm.com>
Internet:<http://www.metrohm.com>


From: Bob Hanlon on

Variables[(x + y)^2 + 3 z^2 - y z + 7]

{x,y,z}

% // Length

3


Bob Hanlon

---- Rob <schabertrobbinger(a)gmail.com> wrote:

=============
Is there a straightforward way to count the number of variables in an
expression? If it makes any difference what I'm looking at is the
product of several polynomials in many variables with rational
coefficients.



From: David Park on
?Variables

Then find the length of the list.

David Park
djmpark(a)comcast.net
http://home.comcast.net/~djmpark/



From: Rob [mailto:schabertrobbinger(a)gmail.com]


Is there a straightforward way to count the number of variables in an
expression? If it makes any difference what I'm looking at is the
product of several polynomials in many variables with rational
coefficients.