Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #15223 > unrolled thread
| Started by | Ulrich Arndt <ulrich.arndt@data2knowledge.de> |
|---|---|
| First post | 2013-07-22 01:32 +0000 |
| Last post | 2013-07-22 01:32 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.soft-sys.math.mathematica
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Extract Integers Ulrich Arndt <ulrich.arndt@data2knowledge.de> - 2013-07-22 01:32 +0000
| From | Ulrich Arndt <ulrich.arndt@data2knowledge.de> |
|---|---|
| Date | 2013-07-22 01:32 +0000 |
| Subject | Re: Extract Integers |
| Message-ID | <ksi235$hur$1@smc.vnet.net> |
not sure if this falls under propper way but maybe working for you
ToExpression[StringCases[ToString[equ], (x : DigitCharacter ..) -> x]]
But would also have expected that Cases should be able to handle this directly
Ulrich
Am 21.07.2013 um 10:23 schrieb Dana DeLouis:
> 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
>
>
--
Ulrich Arndt
Mobile: +49 172 287 6630
ulrich.arndt@data2knowledge.de
www.data2knowledge.de
data2knowledge GmbH
Fahrenheitstr. 1
D-28359 Bremen
Gesch=E4ftsf=FChrung: Ulrich Arndt
Sitz der Gesellschaft: Bremen, Amtsgericht Bremen, HRB 26480 HB
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web