# Why does my integral not evaluate?

I just started using Mathematica today, so I'm sure there is something I am doing incorrectly. I am trying to evaluate this integral:

Integrate[(2*A*r - ((2*B)/r^3) + (d/r)), {r, p, q}]


Where A, B and d are constants and p and q are my bounds of integration. How can I get it to evaluate this?

Mathematica seems to get lost in the complex plane here. Assumptions help:

Integrate[(2*A*r - ((2*B)/r^3) + (d/r)), {r, p, q},
Assumptions -> A > 0 && B > 0 && p > 0 && p < q]


yielding:

B (-(1/p^2) + 1/q^2) + A (-p^2 + q^2) + d Log[q/p]

• Ah ok, didnt know about adding assumptions! thanks! worked great Commented Oct 24, 2018 at 1:39

One possibility is to calculate the integral and then plug in the limits of integration:

int = Integrate[(2*A*r - ((2*B)/r^3) + (d/r)), r];
FullSimplify[(int /. r -> q) - (int /. r -> p)]

-((B + A p^4)/p^2) + B/q^2 + A q^2 - d Log[p] + d Log[q]


(Thanks to @theorist for noting I'd switched the p's and q's.)

• I think you meant FullSimplify[(int /. r -> q) - (int /. r -> p)] Commented Oct 29, 2018 at 23:37