0
$\begingroup$

I've been having trouble to make mathematica evaluate an integral without specifying the values of the limits of integration. I mean, if I write

Integrate[x,{x,x1,x2}]

Mathematica returns the correct answer: $\frac{(x2)^2-(x1)^2}{2}$. But If I write something like

Integrate[x^2/(1-x),{x,x1,x2}]

Mathematica just keeps the evaluation forever...

Is there something that I can do to avoid this behaviour?

$\endgroup$
1
  • $\begingroup$ Consider what happens when x1 <= 1 <= x2 $\endgroup$ Feb 26, 2013 at 1:20

1 Answer 1

3
$\begingroup$

The integral doesn't converge everywhere, see @belisarius comment, so tell Integrate what constraints you have on x1 and x2 via the Assumptions option:

Integrate[x^2/(1 - x), {x, x1, x2}, Assumptions -> 1 < x1 < x2 || x1 < x2 < 1]
(* 1/2 (x1 - x2) (2 + x1 + x2) + Log[1 - x1] - Log[1 - x2] *)
$\endgroup$
1
  • $\begingroup$ Oh, thank you. I din't know that I had to specify that, but obviously it makes perfect sense. Thank you $\endgroup$
    – PML
    Feb 26, 2013 at 2:07

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.