# Apparently contradictory output from Series and D

I defined a function as:

g[b_] := Integrate[f[n]Exp[-b  DA (n.u)^2], n]


Obviously

 D[g[b], b] /. b -> 0


gives

(-DA)*Integrate[(n.u)^2*f[n], n]


But, then, how can

Series[g[b], {b, 0, 2}]


be

Integrate[f[n], n]


I guess there is something basic I don't understand. Something with order of evaluation? It's like b = 0 is evaluated before the differentiation in Series.

-
Please give reason for negative votes so I can learn! –  Sune Nov 3 '13 at 7:34
I guess formatting (please read these guidelines). Also,your code is not self-contained. There are undefined symbols, like f, u and DA. –  Sjoerd C. de Vries Nov 3 '13 at 7:59
What do you think that n.u means? You use n as the integration variable, so it is one-dimensional. N.u is a vector operation. –  Sjoerd C. de Vries Nov 3 '13 at 8:05
a dot product of n and u –  Sune Nov 3 '13 at 8:06
And thanks for feedback about the post formatting etc. f u and Da are supposed to not be defined, because they are undefined to Mathematica. –  Sune Nov 3 '13 at 8:08

Not answer, but an observation of where the problem is (too small to fit in comment).

If you simplify the function to

  g[b_] := Integrate[ f[n] Exp[-b n ], n];


Now, applying Series[g[x],{x,0,1}], and applying the Series manually (from definition) to see the difference:

  (g[b] /. b -> 0) + (D[g[b], b] /. b -> 0) x


Now using the Series command:

  Series[g[x], {x, 0, 1}]


Ok, so where is the problem? Series is not integrating it correctly when there is a b inside Exp[] (b is the input symbol to the function). This works:

   g[b_] := Integrate[ f[n] Exp[-n], n];


But once b is added inside the integrand and has to be inside Exp[], it fails. Need more Tracing to find where exactly it failed.

Note: I think this is a bug. I verified with Maple, and it gives the results, which matches the manual method:

-
Agree so far :-) –  Sune Nov 3 '13 at 9:12
I also feel this is a bug. Note, BTW, that the O[x]^3 is suspiciously missing. –  Sjoerd C. de Vries Nov 3 '13 at 9:52
The missing O[x]^3 is also consistent with x=0 being (inapproriately) evaluated before the differentiation... –  Sune Nov 3 '13 at 9:57
@sune I don't think so. It's even there (unnecessary) in Series[x, {x, 0, 2}]. –  Sjoerd C. de Vries Nov 3 '13 at 10:10
Workaround: Block[{g}, Series[g[b], {b, 0, 2}]]. –  Michael E2 Nov 3 '13 at 14:58