1
$\begingroup$

I know it is strange, but it seems MA is unable to compute a simple series expansion

a[1]=-1.0714379525829776`+0.020674495099438535` I;
a[2]=1.0714377324307713` -0.020674497100401874` I;
b[1]=-1.0916908367607507`+0.05485853112917313` I;
b[2]=1.0970191920263659` -0.04438231597079857` I;
b[3]=0.9999997798477938` -0.01000000200096334` I;
f= (a[1]+y)(a[2]+y)/(b[1]-b[2] y+b[3] y^2+y^3);
Series[f,{y,0.,5}]

Out[1]= 1/O[y+0.]^31539

SeriesCoefficient doe not work either, but Apart does. Why? What's going on here? So mysterious that I do not even know how to tag the question...


@MarcoB suggested to Rationalize. The result is

(1.05056 +0.0122096 I)
-(1.05504 +0.0225762 I) (y+0.)
+(1.10568 +0.0369162 I) (y+0.)^2
-(1.11448 +0.0479809 I) (y+0.)^3
+(1.16535 +0.0644737 I) (y+0.)^4
-(1.17832 +0.0765497 I) (y+0.)^5+O[y+0.]^6 

I came up with

Series[#,{y,0,5}]&/@Apart[f]

yielding pretty much the same (but notice y instead of y+0. as the expansion parameter)

(1.05056 +0.0122096 I)
-(1.05504 +0.0225762 I) y
+(1.10568 +0.0369162 I) y^2
-(1.11448 +0.0479809 I) y^3
+(1.16535 +0.0644737 I) y^4
-(1.17832 +0.0765497 I) y^5+O[y]^6

So, if it is not a bug in Series why does Series/@Apart works?

$\endgroup$
11
  • $\begingroup$ What does f + O[y]^5 return? $\endgroup$ Commented Jun 4, 2020 at 15:37
  • 1
    $\begingroup$ @yarchik I don't think so. See for instance: Series[SetPrecision[f, 2], {y, 0., 5}]. You can see where some members have an effective value of zero at that precision. This is caught when the evaluation is carried out at arbitrary precision, but at machine precision things simply don't go too well. That's a numerical precision problem, I'd argue, not a bug. $\endgroup$
    – MarcoB
    Commented Jun 4, 2020 at 15:48
  • 1
    $\begingroup$ @yarchik "Why then Apart works?" - I don't know exactly, but perhaps because the calculation internally takes a path that does not lead to catastrophic loss of precision? Notice that, interestingly, Series[Apart@f, {y, 0., 5}] also works. $\endgroup$
    – MarcoB
    Commented Jun 4, 2020 at 16:50
  • 1
    $\begingroup$ I am not seeing the claimed behavior so it is difficult to comment. What happen if you expand at exact 0 instead of .0? $\endgroup$ Commented Jun 4, 2020 at 23:22
  • 1
    $\begingroup$ Maybe it was a bug that got fixed? I'm told such things happen. $\endgroup$ Commented Jun 5, 2020 at 16:20

1 Answer 1

1
$\begingroup$

The problem seems numerical. Note that the following works fine:

ser = Series[Rationalize[f, 0], {y, 0, 5}]

You could then use N[ser, <yourDesiredPrecision>] for a numerical approximation:

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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