13
$\begingroup$

Bug introduced in 9.0 or earlier and persisting through 11.3 or later

Bug resolved in 12.0

As of 12.0, we have an unevaluated result - inconsistent with the differentiation result, but not invalid.

SeriesCoefficient[a.b[x], {x, 0, 1}]
(* SeriesCoefficient[a.b[x], {x, 0, 1}] *)

If I differentiate a dot product, I get the result I expect

D[a.b[x], x]
(* a.b'[x] *)

However, a series expansion of the same expression (V9-V11) gives a very different result

SeriesCoefficient[a.b[x], {x, 0, 1}]
(* a.1 b'[0] *)

Is there any logical explanation of this behaviour?

EDIT

This has been confirmed as a bug by Wolfram support.

$\endgroup$
6
  • 1
    $\begingroup$ attempts to work with abstract vectors in mathematica are usually not fruitful. Note that second strange result can never be evaluated since Dot with a integer is not defined $\endgroup$
    – george2079
    Jun 24, 2016 at 15:03
  • $\begingroup$ bug present in 11.1.0 $\endgroup$
    – user58955
    Mar 24, 2017 at 1:11
  • $\begingroup$ I think the "edit" part should be in the answer, not the question. $\endgroup$
    – user202729
    Aug 7, 2018 at 1:52
  • $\begingroup$ I don't think this is a bug. One might regard it as a limitation that Series was not designed (or implemented) to work with Dot. But that in and of itself is not a bug. $\endgroup$ Aug 7, 2018 at 13:27
  • $\begingroup$ @DanielLichtblau - If Mathematica returns an expression unevaluated, that isn't a bug. If it returns a result that I don't expect, but has a reasonable and logical explanation, that isn't a bug. Here, Mathematica has evaluated a reasonable input and returned a result that nobody has argued is logically correct. Therefore (as the email I had from Wolfram support agreed) I classify it as a bug. $\endgroup$
    – mikado
    Aug 7, 2018 at 19:21

2 Answers 2

7
$\begingroup$

This has been confirmed as a bug by Wolfram support.

(Bug still present in 11.0.0)

$\endgroup$
3
$\begingroup$

You can muck about with an internal function to get Series to work a bit better on Dot (and Cross etc) products. For example:

protect = Unprotect[System`Private`InternalSeries];
System`Private`InternalSeries[a_Dot, {x_, x0_, n_Integer?NonNegative}] := Module[
    {d = NestList[D[#, x]&, a, n], res},

    res = Quiet @ Check[d /. x->x0, $Failed];
    SeriesData[x, x0, TensorExpand @ res, 0, n+1, 1] /; res =!= $Failed
]
Protect @@ protect;

Now, your example works correctly:

SeriesCoefficient[a.b[x],{x,0,1}]

a.b'[0]

A more complicated example:

Series[Exp[a[x].b[x]+x^2], {x, 0, 2}] //TeXForm

$e^{a(0).b(0)}+x e^{a(0).b(0)} \left(a'(0).b(0)+a(0).b'(0)\right)+\frac{1}{2} x^2 e^{a(0).b(0)} \left(\left(a'(0).b(0)+a(0).b'(0)\right)^2+2 \left(a''(0).b(0)+2 a'(0).b'(0)+a(0).b''(0)+1\right)\right)+O\left(x^3\right)$

Where this modification won't help is when the series is not a Taylor or MacLaurin series, e.g., a Laurent or Puiseaux series.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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