Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

consider following expression:

t = Subscript[α, 0]/2 + Subscript[α, 1]/2 + 2 Subscript[α, 2] + (9 Subscript[α, 3])/2 + 
8 Subscript[α, 4] + (25 Subscript[α, 5])/2 + 18 Subscript[α, 6] + (49 Subscript[α, 7])/2 + 
32 Subscript[α, 8] + (81 Subscript[α, 9])/2;

one can access variable list of expression above by using:

Variables[t]

but how can I get the corresponding coefficient list of variables? I've tried:

CoefficientList[t, Variables[t]]

it just doesn't work...

share|improve this question
    
Try CoefficientArrays. –  Szabolcs May 27 at 21:14

1 Answer 1

The problem with:

CoefficientList[t, Variables[t]]

is that it appears to create a matrix with all the cross terms. Since you only want to first order terms, try out:

Coefficient[t, Variables[t], 1]
{1/2, 1/2, 2, 9/2, 8, 25/2, 18, 49/2, 32, 81/2}

instead.

share|improve this answer
1  
1 seems to be redundant. –  Kuba May 27 at 21:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.