Message Boards Message Boards

0
|
3895 Views
|
3 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Calculate the following integral with bounds?

Posted 5 years ago

I just started using mathematica today, so im 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, d, are constants and p and q are my bounds of integration. How can I get it to evaluate this?

POSTED BY: Stone Preston
3 Replies

It will evaluate albeit it takes some time. The reason is that Integrate goes through some trouble to discern what conditions might allow for convergence. The expression below should give an indication of the difficulties encountered.

ConditionalExpression[-((B + A*p^4)/p^2) + B/q^2 + A*q^2 - d*Log[p] + d*Log[q], 
 ((Im[p] <= Im[q] && (Im[p] >= 0 || Im[q] <= 0 || 
     Im[q]*Re[p] >= Im[p]*Re[q])) || (Im[p] >= Im[q] && 
    (Im[p] <= 0 || Im[q] >= 0 || Im[q]*Re[p] <= Im[p]*Re[q]))) && 
  ((p/(p - q) != 0 && Re[p/(-p + q)] >= 0) || NotElement[p/(p - q), Reals] || 
   Re[p/(p - q)] > 1) && (NotElement[p/(p - q), Reals] || Re[p/(p - q)] >= 1 || 
   Re[p/(-p + q)] >= 0) && ((NotElement[q, Reals] && 
    ((Re[p] != 0 && (Element[p, Reals] || (Im[p] == Im[q] && Re[q] == 0))) || 
     (Im[p] == Im[q] && Re[q] != 0 && 2*q*Conjugate[q] != 
       q*Conjugate[p] + p*Conjugate[q]))) || (Element[q, Reals] && 
    ((NotElement[p, Reals] && q != 0) || (Re[p] < q && 
      (q < 0 || (Re[p] > 0 && q > 0))) || (Re[p] > q && 
      (q > 0 || (q < 0 && Re[p] < 0))))) || (Re[p] > 0 && Re[q] == 0 && 
    ((Im[p] < 0 && Im[q] > 0) || (Im[p] > 0 && Im[q] < 0))) || 
   (Im[p] < 0 && ((Im[p] > Im[q] && Im[q] < 0) || (Im[q] > 0 && Re[q] != 0 && 
      Im[q]*Re[p] > Im[p]*Re[q]))) || (Im[p] < Im[q] && 
    (Im[q] < 0 || (Im[p] > 0 && Im[q] > 0))) || (Im[p] > 0 && Im[q] < 0 && 
    Re[q] != 0 && Im[q]*Re[p] < Im[p]*Re[q]) || (Im[p] > Im[q] && Im[q] > 0))]

As others have noted, placing plausible assumptions in the integration will simplify matters considerably.

POSTED BY: Daniel Lichtblau

Adding Assumption helps to solve and give a quick answer:

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

 Integrate[(2*A*r - ((2*B)/r^3) + (d/r)), {r, p, q}, Assumptions -> {q > p, p < 0}]
 (* Integral of -((2 B)/r^3)+d/r+2 A r does not converge on {p,q} *)
POSTED BY: Mariusz Iwaniuk

Stone,

I would report this as a bug. It evaluates without the limits:

in = Integrate[(2*A*r - ((2*B)/r^3) + (d/r)), r]

and then you can manually evaluate it at the limits:

(in /. r -> q) - (in /. r -> p)

My guess is that MMA is trying to figure out what values of p and q are legitimate.

I also tried Rubi for Mathematica and it returned your original integral instantly (of course Rubi did not figure out when p and q are valid.)

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

but it gave the same answer:

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

Regards,

Neil

POSTED BY: Neil Singer
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract