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


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

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

From Simon <simonjtyler@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: get a, b from numbers in the form a+b Pi
Date 2011-05-25 09:56 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <irijnq$qde$1@smc.vnet.net> (permalink)

Show all headers | View raw


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 comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web