Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #15232
| From | Helen Read <readhpr@gmail.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Extract Integers |
| Date | 2013-07-22 01:35 +0000 |
| Message-ID | <ksi28s$hvs$1@smc.vnet.net> (permalink) |
| References | <ksg5j9$c1t$1@smc.vnet.net> |
| Organization | Time-Warner Telecom |
I'm not completely sure what you are trying to do, but if I understand
you correctly, why not simply get the numerators and denominators of the
coefficients?
coeffs = CoefficientList[equ, x]
Numerator[coeffs]
Denominator[coeffs]
You can delete duplicates if desired.
DeleteDuplicates[Numerator[coeffs]]
DeleteDuplicates[Denominator[coeffs]]
Helen Read
University of Vermont
On 7/21/2013 4:19 AM, Dana DeLouis wrote:
> Hi. I've run out of ideas. Does anyone know the proper way to
> extract all the integers from the following simplified version of a larger
> problem I'm working on?
>
> equ=Series[Exp[x],{x,0,5}] //Normal
>
> 1+x+x^2/2+x^3/6+x^4/24+x^5/120
>
> When trying to extract all the integers, I understand numbers like 120 are part of Rational[1,120]
>
> equ //FullForm
>
> << Not shown here >>
>
> I thought looking at all LevelSpec was the solution, but apparently not.
>
> Cases[equ, _Integer, Infinity]
> {1,2,3,4,5}
>
> (* Or *)
>
> Position[equ, _Integer, Infinity]
> {{1},{3,2,2},{4,2,2},{5,2,2},{6,2,2}}
>
> Extract[equ, %]
> {1,2,3,4,5}
>
> Both ways extract from the numerator, but I just can't seem to extract the {2,6,24,120} inside the denominator.
> Does anyone know the proper way?
> Thanks in advance. :>~
>
> Dana
> Mac & Math 9
>
>
--
HPR
Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Find similar | Unroll thread
Extract Integers Dana DeLouis <dana01@icloud.com> - 2013-07-21 08:19 +0000 Re: Extract Integers "Nasser M. Abbasi" <nma@12000.org> - 2013-07-22 01:33 +0000 Re: Extract Integers David Bailey <dave@removedbailey.co.uk> - 2013-07-22 01:33 +0000 Re: Extract Integers Helen Read <readhpr@gmail.com> - 2013-07-22 01:35 +0000
csiph-web