Using list of elements as arguments for a function?

If you have a list of numbers

v = {3, 9/2, 4}

the command GCD will not work on a list and returns

{3, 9/2, 4}

but

GCD[3, 9/2, 4]

returns an answer of 1/2 which is correct. How do you ‘unlist’ a list so that GCD will work with a list?

Check out

Thanks.

You can apply Sequence[] to turn a list into arguments:

GCD[Apply[Sequence, {3, 9/2, 4}]]

or

GCD[Sequence @@ {3, 9/2, 4}]

All the following methods do the trick:

In[504]:= A = {3, 9/2, 4};
GCD @@ A
Apply[GCD, A]
GCD[A /. List -> Sequence]
GCD[Sequence @@ A]

Out[505]= 1/2

Out[506]= 1/2

Out[507]= 1/2

Out[508]= 1/2

For some related discussions, see here.