I defined a function as:

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


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


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

But, then, how can

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


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.

  • $\begingroup$ Please give reason for negative votes so I can learn! $\endgroup$
    – Sooner
    Nov 3, 2013 at 7:34
  • 1
    $\begingroup$ I guess formatting (please read these guidelines). Also,your code is not self-contained. There are undefined symbols, like f, u and DA. $\endgroup$ Nov 3, 2013 at 7:59
  • $\begingroup$ 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. $\endgroup$ Nov 3, 2013 at 8:05
  • $\begingroup$ a dot product of n and u $\endgroup$
    – Sooner
    Nov 3, 2013 at 8:06
  • $\begingroup$ 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. $\endgroup$
    – Sooner
    Nov 3, 2013 at 8:08

1 Answer 1


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

Mathematica graphics

Now using the Series command:

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

Mathematica graphics

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:

Mathematica graphics

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

Your Answer

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

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