8
$\begingroup$

I want to solve the integral

$\int_{p_0}^{p_1}\left(T_0+\Gamma_p(p_0-p)\right)\frac{1}{p}dp$

Mathematica can do the indefinite integral immediately:

>>> Integrate[(T + Γ (p0 - p))*(1/p), p]
-p Γ + (T + p0 Γ) Log[p]

But addind bounds suddenly makes it choke, i.e. the following never returns:

>>> Integrate[(T + Γ (p0 - p))*(1/p), {p, p0, p1}]

even though I can do this just fine:

FullSimplify[Limit[-Γ p + (Γ P + T) Log[p], p -> p1] - Limit[-Γ p + (Γ P + T) Log[p], p -> p0]]

What is the issue?

$\endgroup$
1
  • 1
    $\begingroup$ Is the subscript $p$ on $\Gamma$ in the first equation a typo? Is that not the same $p$ as the integration variable? $\endgroup$
    – nanoman
    Sep 23, 2021 at 12:26

2 Answers 2

13
$\begingroup$

Likely this is due to the fact that antiderivative are troublesome in computer algebra systems. Do this:

Integrate[(T + \[CapitalGamma] (p0 - p))*(1/p), {p, p0, p1},   Assumptions -> {p1 > p0 > 0}]

Assuming, of course, that p1 > p0 > 0 is actually true.

$\endgroup$
1
  • $\begingroup$ +1 for linking back to that Wolfram blog post. $\endgroup$ Sep 23, 2021 at 15:02
3
$\begingroup$

Mathematica likely has problems with four parameters which are assumed to be complex numbers and an antiderivative with branches. The GenerateConditions -> False/True option does the job.

Integrate[(T + \[CapitalGamma] (p0 - p))*(1/p), {p, p0, p1}, GenerateConditions -> False]

p0 - p1) \[CapitalGamma] - (T + p0 \[CapitalGamma]) Log[ p0] + (T + p0 \[CapitalGamma]) Log[p1]

Integrate[(T +\[CapitalGamma] (p0 - p))*(1/p), {p, p0, p1}, 
Assumptions -> {p0, p1, \[CapitalGamma],T} \[Element] Reals,GenerateConditions -> True]

ConditionalExpression[(p0 - p1) \[CapitalGamma] + (T + p0 \[CapitalGamma]) Log[p1/p0], p0 > 0 && p0 != p1 && p1 > 0]

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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