MathGroup Archive 1997

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Question about Normal[] and O[]

  • To: mathgroup at smc.vnet.net
  • Subject: [mg8578] Re: [mg8537] Question about Normal[] and O[]
  • From: "w.meeussen" <meeussen.vdmcc at vandemoortele.be>
  • Date: Sun, 7 Sep 1997 22:13:00 -0400
  • Sender: owner-wri-mathgroup at wolfram.com

hi Stefan,

look at the "raw" series object with FullForm:
In[3]:= ser=Series[1+3x^2+x^5,{x,-1,5}]

In[19]:=ser//FullForm
Out[19]//FullForm=
SeriesData[x, -1, List[3, -1, -7, 10, -5, 1], 0, 6, 1]

this allows a representation of the truncated series as:

In[37]:=
(#3 (HoldForm[(#1-#2)//Evaluate] ^Range[#4,#5-1]))&@@ser
Out[37]=
                        2            3            4
{3, -(1 + x), -7 (1 + x) , 10 (1 + x) , -5 (1 + x) , 
 
         5
  (1 + x) }

this is a list that allows picking what you need, and keeps "-(1+x)" in held
form;
if you want the sum then,of course,

In[38]:=Plus@@(#3 (HoldForm[(#1-#2)//Evaluate] ^Range[#4,#5-1]))&@@ser
Out[38]=
                     2             3            4          5
3 - 1 + x - 7 (1 + x)  + 10 (1 + x)  - 5 (1 + x)  + (1 + x)

but the brackets are gone !

using Hold shows this self-effacing function en lieu of brackets:

In[40]:=Plus@@(#3 (Hold[(#1-#2)//Evaluate] ^Range[#4,#5-1]))&@@ser
Out[40]=
                               2                 3
3 - Hold[1 + x] - 7 Hold[1 + x]  + 10 Hold[1 + x]  - 
 
               4              5
  5 Hold[1 + x]  + Hold[1 + x]


not pretty, I know.
Real gurus might have better advice ...


wouter.



At 23:16 6-09-97 -0400, Stefan.Becuwe wrote:
>The purpose of Normal[] is to "truncate a power series to give an
>ordinary expression".  I hoped it would just remove the O[] term,
>but, for one reason or another, it does a bit more (as you can see in
>Out[24]).
>
>Question: is there a function that only removes the O[] term
>(in Mathematica 2.2? 3.0?)
>(I need that "3 - (1 + x)"  and not "2 - x" ...)
>
>If it would have been possible to do a substitution ( /. ) before the
>Normal[] function, then the problem would have been solved, but
>/. doesn't seem to work when there's an O[] term...
>
>
>
>   In[23]:= Series[1+3x^2+x^5,{x,-1,5}]
>
>                                2             3            4          5
>   Out[23]= 3 - (1 + x) - 7 (1 + x)  + 10 (1 + x)  - 5 (1 + x)  + (1 + x)  + 
> 
>             6
>   >    O[1 + x]
>
>   In[24]:= Normal[Series[1+3x^2+x^5,{x,-1,5}]] 
>
>                          2             3            4          5
>   Out[24]= 2 - x - 7 (1 + x)  + 10 (1 + x)  - 5 (1 + x)  + (1 + x)
>
>
>
>
>Stefan Becuwe
>
>
>
>

Dr. Wouter L. J. MEEUSSEN
eu000949 at pophost.eunet.be
w.meeussen.vdmcc at vandemoortele.be



  • Prev by Date: Re: Something like Flatten
  • Next by Date: Re: Combining Lists?
  • Previous by thread: Question about Normal[] and O[]
  • Next by thread: File under <Alt>F: "doesn't exist", but <Ctrl>O: no problem !