1
$\begingroup$

Is there a simple and efficient way to compute the vanishing order of a power series, i.e. the degree of its smallest nonzero coefficient?

It seems like this is a basic operation that should be built-in. (Exponent[] computes the largest coefficient.)

Ideally, this would be simple, readable, and work if called on a polynomial instead of a power series.

The best I've come up with so far is

(1+FirstPosition[CoefficientList[#, x], Except[0], 1, 1, Heads -> False])&

Which isn't great. An alternative, which seems ill-advised, is to force conversion to a power series and reach into the SeriesData representation.

(With[{ser = # + O[x]^20}, ser[[4]]/ser[[6]]]) &

Is there a better approach?

$\endgroup$
4
  • $\begingroup$ Try using Asymptotic, e.g., Asymptotic[Cos[x]/Sin[2 x]^3, x -> 0] $\endgroup$
    – Carl Woll
    Nov 16, 2021 at 16:34
  • 1
    $\begingroup$ For a polynomial one can use Exponent[poly,x,Min] $\endgroup$ Nov 16, 2021 at 17:05
  • $\begingroup$ @CarlWoll While this is a nice method there is an issue lurking. To wit, it will most likely use Series and apparently this is what the poster wishes to avoid. $\endgroup$ Nov 16, 2021 at 17:08
  • $\begingroup$ @DanielLichtblau Thanks so much. This is exactly what I was looking for! $\endgroup$ Nov 16, 2021 at 17:51

2 Answers 2

0
$\begingroup$

I'll quote my answer from this question, which solves your problem on the way to a different one:

The leading-order power in your series should be the limit as $x \to 0$ of $x f'(x)/f(x)$. So you could do something like

leadcoeff = Limit[x func'[x]/func[x], x->0]
$\endgroup$
5
  • $\begingroup$ Thanks! Unfortunately, my power series are complicated. I wouldn't want to compute their derivatives, reciprocals, and then multiply them out, just to compute the vanishing order. $\endgroup$ Nov 16, 2021 at 14:49
  • $\begingroup$ @user825383860: Could you try it out and let me know how long it takes? I would expect that Mathematica could take the derivative of a power series fairly quickly, and I would be surprised if it doesn't have L'Hopital-like tricks programmed in to find the limits of the ratios of polynomials and/or power series. $\endgroup$ Nov 16, 2021 at 14:56
  • $\begingroup$ Also, if you want a solution that works well with your particular problem, it would be helpful to include code that generates the particular expressions you're working with. $\endgroup$ Nov 16, 2021 at 14:57
  • $\begingroup$ I am trying to increase the performance of a power series algorithm by taking vanishing orders into account. This answer is unhelpful. $\endgroup$ Nov 16, 2021 at 15:21
  • 1
    $\begingroup$ @user825383860: With all due respect, it's hard to be helpful without more information about the problem you're trying to solve. I would again encourage you to edit your question to provide more information about what you're trying to do; providing sample code would be ideal. Without that, I suspect the responses you get here will be off the mark like mine apparently is. $\endgroup$ Nov 16, 2021 at 15:51
0
$\begingroup$

Here is a solution that works for a simple example

poly = Sum[a[i] x^i, {i, 3, 11}]
(* x^3 a[3] + x^4 a[4] + x^5 a[5] + x^6 a[6] + x^7 a[7] + 
 x^8 a[8] + x^9 a[9] + x^10 a[10] + x^11 a[11] *)

The built in Exponent returns the exponent of the highest order in x

Exponent[poly, x]
(* 11 *)

A simple change of variable, can give the lowest order in x

Block[{x = 1/z}, -Exponent[poly, z]]
(* 3 *)
$\endgroup$

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