Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #2692 > unrolled thread
| Started by | Simon <simonjtyler@gmail.com> |
|---|---|
| First post | 2011-05-25 09:56 +0000 |
| Last post | 2011-05-25 09:56 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.soft-sys.math.mathematica
Re: get a, b from numbers in the form a+b Pi Simon <simonjtyler@gmail.com> - 2011-05-25 09:56 +0000
| From | Simon <simonjtyler@gmail.com> |
|---|---|
| Date | 2011-05-25 09:56 +0000 |
| Subject | Re: get a, b from numbers in the form a+b Pi |
| Message-ID | <irijnq$qde$1@smc.vnet.net> |
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}}
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web