Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #2692 > unrolled thread

Re: get a, b from numbers in the form a+b Pi

Started bySimon <simonjtyler@gmail.com>
First post2011-05-25 09:56 +0000
Last post2011-05-25 09:56 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Re: get a, b from numbers in the form a+b Pi Simon <simonjtyler@gmail.com> - 2011-05-25 09:56 +0000

#2692 — Re: get a, b from numbers in the form a+b Pi

FromSimon <simonjtyler@gmail.com>
Date2011-05-25 09:56 +0000
SubjectRe: 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}}

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web