Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to integrate the expression G given below:

R = {Rx, Ry, Rz};
b = {bx, by, bz};
r = Sqrt[(s*b - R).(s*b - R)];
K = Exp[-r/L]/r;
G = Simplify[-K*(1/r + 1/L)*1/r*b.(s*b - R)];

If I use:


it takes quite a long time; instead if I use:

int = Integrate[G, s]
Simplify[(int /. s -> 1) - (int /. s -> 0)]

it takes less than a second.

Why is it so?

share|improve this question
Closely related: What exactly does GenerateConditions do? – Jens Apr 29 '14 at 15:46
up vote 4 down vote accepted

When calculating indefinite integrals Mathematica does not care about the convergence in a domain {x_min,x_max}. In case of definite integrals, at times it is necessary to provide information on the constants in order to obtain the proper result. Check the tutorial on definite integrals. The example with 1/(1 + a Sin[x]) is very similar to your problem.

share|improve this answer
very clear thank you – mattiav27 Apr 29 '14 at 14:16
Since this is a fine answer (and I upvoted) I'll post this as a comment. One can often get improvements by giving assumptions and/or requesting that no conditions be generated. In this example that might be something like Integrate[G, {s, 0, 1}, GenerateConditions -> False, Assumptions -> {Thread[Variables[G] > 0]}] – Daniel Lichtblau Apr 29 '14 at 15:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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