0
$\begingroup$

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?

$\endgroup$
1
$\begingroup$

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]
$\endgroup$
  • $\begingroup$ Ah ok, didnt know about adding assumptions! thanks! worked great $\endgroup$ – Stone Preston Oct 24 '18 at 1:39
1
$\begingroup$

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.)

$\endgroup$
  • $\begingroup$ I think you meant FullSimplify[(int /. r -> q) - (int /. r -> p)] $\endgroup$ – theorist Oct 29 '18 at 23:37

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.