I am trying to compute an integral but am getting two different answers using two near-identical methods. I wish to know why they differ.

f[x_] := x^2 + 1
g[x_] := 1/(2 π) 1/(x^2 + (1/4))

 Assuming[λ ∈ Reals, 
   f[x] g[x])/(λ + I x), {x, -∞, ∞}, 
   PrincipalValue -> True
 λ > 0
(* Answer: (5+2λ)/(2+4λ) if λ < 1/4*) 

Assuming[λ > 0, 
  (f[x] g[x])/(λ + I x), {x, -∞, ∞}, 
  PrincipalValue -> True
(* Answer: (2+λ)/(1+2λ)  if λ <= 1/4*) 

As shown in the code, the two answers are different. I think the latter answer is correct mathematically. However, based on the underlying physics from which this equation arose, the first answer is correct. (I need the integral to yield 2.5 as lambda goes to 0.) I would like to know what causes this mismatch.

  • $\begingroup$ What's your Mathematica version? v12.2 says integral doesn't converge! $\endgroup$ Jan 24 at 12:13
  • $\begingroup$ I have v12.2 Student Edition. Maybe you didn't use the principal value option? $\endgroup$ Jan 24 at 12:25
  • $\begingroup$ If I use the option Mathematica gives a result with the restriction Re[\[Lambda]] == 0 $\endgroup$ Jan 24 at 12:28
  • $\begingroup$ The first integral without simplification contains "Log"'s. As Log is a multivalued function it is no surprise that different results can be obtained. $\endgroup$ Jan 24 at 19:29
  • $\begingroup$ With v13.0, for the first integral I do not get a conditional result, just (5 + 2*λ)/(2 + 4*λ) and the second integral gives this same result if the assumption is changed to 0 < λ <= 1/4 $\endgroup$
    – Bob Hanlon
    Jan 25 at 4:07

1 Answer 1


If you expand the integrand to ReIm

reim=(f[x] g[x])/(\[Lambda] + I x) // ComplexExpand[ReIm[#]] & // Simplify
(*{(2 (1 + x^2) \[Lambda])/(\[Pi] (1 + 4 x^2)(x^2 + \[Lambda]^2)), -((2 (x + x^3))/(\[Pi] (1 + 4 x^2)(x^2 + \[Lambda]^2)))}*)

integration gives (Mathematica v12.2)

Integrate[reim, {x, -Infinity, Infinity}]

$\left\{\fbox{$\frac{\lambda +2}{2 \lambda +1}\text{ if }\Re(\lambda )>0$},\int_{-\infty }^{\infty } -\frac{2 \left(x^3+x\right)}{\pi \left(4 x^2+1\right) \left(\lambda ^2+x^2\right)} \, dx\right\}$

That means only integration over real part converges.

  • $\begingroup$ Yes, I do understand that $(\lambda+2)/(2\lambda+1)$ is the correct answer that matches numerics. However, why does the difference arise in what I ran? The answer to that may be important as highlighted in my question. Thanks for your inputs. $\endgroup$ Jan 24 at 12:28

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.