Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I am trying to find a function that gives me the divergent part of series in any case.

The method "Series[]" does not work because Series[42,{n,0,-1}] gives as result 42 (which is not divergent in n)

The method "SeriesCoefficient[]" does not work because I do not know the lowest order, so that SeriesCoefficient[1/n^2 + 1/n + 2 + n^2,{n,0,-1}]only gives 1 (from the 1/n-term) but I loose information about the 1/n^2 term.

Is there a possibility to combine the advantages (to eliminate the disadvantages) of both approaches? Thanks for your answers.

share|improve this question
    
Can it be that you are looking for Residue? –  Alexei Boulbitch Jun 3 at 9:16
    
Not exactly ... for example: 1/n^2 + 2/n + 1 + n should give back 1/n^2 + 2/n but Residue of that function gives 1. –  user14728 Jun 3 at 11:46
    
This might or might not be reliable: singularPart[f_, x_, p_: 0] := Expand[Normal[Series[(x - p)*f, {x, p, 1}] + O[x - p]]/(x - p)] –  Daniel Lichtblau Jun 3 at 15:42

1 Answer 1

You might do as follows:

    singPart[f_] := 
  Plus @@ ({Coefficient[f, n, #], #} & /@ 
      Range[-Exponent[f, 1/n], -1] /. {x_, y_} -> x*n^y);

Then if

f = a*n^2 + b*n + e/n^2 + c/n + d + g/n^4;

singPart[f]

returns

(*    g/n^4 + e/n^2 + c/n      *)

Edit: the above function works incorrectly in the case of numeric coefficients. The one below should work in the both cases:

    sing[f_] := Module[{g, lst, cond},
  g[{x_, y_}] := x*n^y;
  lst[z_] := {Coefficient[z, n, #], #} & /@ 
    Range[-Exponent[z, 1/n], -1];
  cond = And @@ (Map[NumberQ, lst[f], {2}] // Flatten);
  Plus @@ Map[g, If[cond, Select[lst[f], #[[1]] != 0 &], lst[f]]]
  ]
share|improve this answer
    
Thanks for your answer, but - for exapmle - singPart[1/n^2] returns 1 - 2/n –  user14728 Jun 3 at 13:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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