Re: get a, b from numbers in the form a+b Pi
- To: mathgroup at smc.vnet.net
- Subject: [mg119206] Re: get a, b from numbers in the form a+b Pi
- From: Simon <simonjtyler at gmail.com>
- Date: Wed, 25 May 2011 05:55:18 -0400 (EDT)
- Reply-to: comp.soft-sys.math.mathematica at googlegroups.com
The CoefficientList solution can be "fixed" by padding the results: In[1]:= nums = {0, 1, 2, \[Pi], 3 \[Pi], -1 + \[Pi]/2, 3 + 3 \[Pi], 3 I + 3 \[Pi], I + E^(I \[Pi]/2) \[Pi]}; In[2]:= PadRight[#, 2] & /@ CoefficientList[nums, Pi] Out[2]= {{0, 0}, {1, 0}, {2, 0}, {0, 1}, {0, 3}, {-1, 1/2}, {3, 3}, {3 I, 3}, {I, I}}