Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #2631
| From | DrMajorBob <btreat1@austin.rr.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: get a, b from numbers in the form a+b Pi |
| Date | 2011-05-23 10:25 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <irdcmu$3nk$1@smc.vnet.net> (permalink) |
nums = {1/2 (-2 + \[Pi]), -2 + (3 \[Pi])/4, -(11/3) + (5 \[Pi])/4,
5/48 (-64 + 21 \[Pi]), -(61/5) + (63 \[Pi])/
16, -(338/15) + (231 \[Pi])/32};
aList = nums /. Pi -> 0
{-1, -2, -(11/3), -(20/3), -(61/5), -(338/15)}
bList = (nums - aList)/Pi // Simplify
{1/2, 3/4, 5/4, 35/16, 63/16, 231/32}
aList + bList Pi - nums // Simplify
{0, 0, 0, 0, 0, 0}
abList = Transpose@{aList, bList}
abList.{1, Pi} - nums // Simplify
{{-1, 1/2}, {-2, 3/4}, {-(11/3), 5/4}, {-(20/3), 35/16}, {-(61/5), 63/
16}, {-(338/15), 231/32}}
{0, 0, 0, 0, 0, 0}
Bobby
On Sun, 22 May 2011 05:57:08 -0500, 1.156 <rob@piovere.com> wrote:
> I have lists of numbers (Mathematica output) all numerically in the
> form a + b*Pi and I'm trying to extract the values of a and b for
> further work.
>
> Here's an example of the best I've been able to do so far:
>
> nums={1/2 (-2+\[Pi]),-2+(3 \[Pi])/4,-(11/3)+(5 \[Pi])/4,5/48 (-64+21
> \[Pi]),-(61/5)+(63 \[Pi])/16,-(338/15)+(231 \[Pi])/32};
> {FullForm[#][[1,1]],FullForm[#][[1,2]]/\[Pi]}&/@nums
>
> When I run this line of code 4 of the six input numbers give me the
> {a,b} I'm looking for but the first and fourth entries fail because the
> form isn't right. Possibly I could patch this scheme to look for a small
> finite set of possibilities of input number form but I suspect I may a
> long way from attacking this problem correctly.
>
> Can someone offer some other ideas on how to pull this off? Many thanks
> for looking at this. Rob
--
DrMajorBob@yahoo.com
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
Re: get a, b from numbers in the form a+b Pi DrMajorBob <btreat1@austin.rr.com> - 2011-05-23 10:25 +0000
csiph-web