Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #2668
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!novia!nx02.iad01.newshosting.com!newshosting.com!newspump.sol.net!posts.news.twtelecom.net!nnrp2.twtelecom.net!not-for-mail |
|---|---|
| From | Murray Eisenberg <murray@math.umass.edu> |
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: get a, b from numbers in the form a+b Pi |
| Date | Tue, 24 May 2011 09:57:59 +0000 (UTC) |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Sender | steve@smc.vnet.net |
| Approved | Steven M. Christensen <steve@smc.vnet.net>, Moderator |
| Message-ID | <irfvf7$bs8$1@smc.vnet.net> (permalink) |
| Lines | 44 |
| NNTP-Posting-Date | 24 May 2011 08:59:03 GMT |
| NNTP-Posting-Host | 63c33815.news.twtelecom.net |
| X-Trace | DXC=4@GMgZL:B7`=QP@4D8HBWiC_A=>8kQj6m9BHNOcEA\@iVa>UVHjQ:;gEFiONJ7[Gofl@lF@8lg9lf |
| X-Complaints-To | abuse@twtelecom.net |
| Xref | x330-a1.tempe.blueboxinc.net comp.soft-sys.math.mathematica:2668 |
Show key headers only | View raw
The code fails to give a pair {a,b} in case the list nums includes a
Pi-free number, e.g., 2.
On 5/23/2011 6:28 AM, Peter Breitfeld wrote:
> "1.156" 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
>> --
>> Sent from my plain desktop PC.
>>
>
> Try this:
>
> abRule = a_. + b_. Pi :> {a, b}
> Expand[nums]
> % /. abRule
--
Murray Eisenberg murray@math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower phone 413 549-1020 (H)
University of Massachusetts 413 545-2859 (W)
710 North Pleasant Street fax 413 545-1801
Amherst, MA 01003-9305
Back to comp.soft-sys.math.mathematica | Previous | Next — Next in thread | Find similar | Unroll thread
Re: get a, b from numbers in the form a+b Pi Murray Eisenberg <murray@math.umass.edu> - 2011-05-24 09:57 +0000 Re: get a, b from numbers in the form a+b Pi Peter Breitfeld <phbrf@t-online.de> - 2011-05-25 09:56 +0000
csiph-web