1
$\begingroup$

It is easy to truncate Series upto some order, say $n$. My question is how do I remove low orders? Let us say my series is a power series in $x$. I want to remove the terms with negative powers because they diverge at $x = 0$. I can simply write

s1-s2, where

s1=Normal[Series[blah, {x, 0, n}]

s2=Normal[Series[blah, {x, 0, -1}]

but Mathematica does not understand to cancel the removed terms because they are complicated. The solution would be to use Collect[s1-s2, x, Simplify], but this is horribly slow as I increase $n$ above even 2. I suppose I could simply delete the terms by hand, but the outputs are very messy, and there must exist a proper way to do this.

$\endgroup$
2
  • $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 0) Browse the common pitfalls question 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$ – Dr. belisarius Jul 16 '15 at 5:52
  • 2
    $\begingroup$ It's going to be hard to guess without an example that reproduces the problem. Well, obviously, given 4 answers already, it's not really hard to guess, but it's hard to test whether one's guess is at all helpful. Another guess: Don't Normal the series and try s1 - Normal@s2. That might force it to collect like terms but only simplify the low-order ones. $\endgroup$ – Michael E2 Jul 16 '15 at 6:00
3
$\begingroup$

Why not to subtract two expansions like in

t1 = Series[1/Sin[x], {x, 0, 10}]
t2 = Series[1/Sin[x], {x, 0, 0}]

Then

Normal[t1] - Normal[t2]

Out[3]:= x/6 + (7 x^3)/360 + (31 x^5)/15120 + (127 x^7)/604800 + ( 73 x^9)/3421440

$\endgroup$
4
  • $\begingroup$ This one is my favorite. $\endgroup$ – J. M.'s ennui Jul 16 '15 at 6:02
  • 1
    $\begingroup$ @Guesswhoitis. This is the one the OP says does not work. $\endgroup$ – Michael E2 Jul 16 '15 at 6:08
  • $\begingroup$ @MichaelE2 That's a good reason for choosing a favorite :) $\endgroup$ – Dr. belisarius Jul 16 '15 at 6:12
  • $\begingroup$ @Michael, well damn, I would have gone without the Collect[] myself. I really hope OP would actually tell us the actual series he has… $\endgroup$ – J. M.'s ennui Jul 16 '15 at 6:22
2
$\begingroup$

I'm not sure this approach is applicable to all series, but from a quick test it seems to work for rational exponents:

Looking at the FullForm of

ser = Series[Exp[x]/x^(2/3), {x, 0, 5}]
(* x^(-2/3) + x^(1/3) + x^(4/3)/2 + x^(7/3)/6 + x^(10/3)/24 + x^(13/3)/120 + O[x]^(16/3) *)

gives

FullForm[ser]
(* SeriesData[x,0,List[1,0,0,1,0,0,Rational[1,2],0,0,Rational[1,6],0,0,Rational[1,24],0,0,Rational[1,120]],-2,16,3]

As we see, [[3]] contains a list of coefficients, while the lowest and highest powers are given by [[4]]/[[6]] and [[5]]/[[6]] respectively. If we want to eliminate all negative powers we may simply remove the -[[4]] first coefficients from the coefficient list, and set [[4]] to 0 afterwards. That is:

ser2 = ReplacePart[ser, {3 -> Drop[ser[[3]], -ser[[4]]], 4 -> 0}]
(* x^(1/3) + x^(4/3)/2 + x^(7/3)/6 + x^(10/3)/24 + x^(13/3)/120 + O[x]^(16/3) *)
$\endgroup$
2
$\begingroup$

If everything else fails, you can always do

Total[SeriesCoefficient[f@x, {x, 0, #}] x^# & /@ Range[0, 10]]
$\endgroup$
1
$\begingroup$

Is this as simple as

DeleteCases[s1, _*x^c_ /; c<0]

That is going to find all the terms in your series with negative exponents and simply delete them.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.