1
$\begingroup$

I am interested in the properties of the cosine integral function, in this case the anti-derivative of Cos[Pi*x]/x, which Mathematica evaluates to Integrate[Cos[Pi*x]/x, x] = CosIntegral[Pi*x].

All the literature I can find tells me that this is an even function (as does common sense, since Cos[Pi*x]/x is even). However, Mathematica disagrees. It outputs a complex number for negative values of x with imaginary part apparently \[Pi]*I. The real part of the result appears to equate to the result one would get from putting in Abs[x] as the argument.

Am I missing something fundamental about the nature of the function (in which case I should clearly post on Mathematics Stack Exchange)? Or something about the way Mathematica operates. Is it something to do with assumptions about branch-cuts, for example?

Table[{x, CosIntegral[Pi*x]}, {x, -2, 2, 0.25}]

Output:

{{-2., -0.02256066175 + 3.141592654 I}, {-1.75, -0.142337815 + 3.141592654 I},    
 {-1.5, -0.1984075607 + 3.141592654 I}, {-1.25, -0.128441476 + 3.141592654 I},      
 {-1.,  0.07366791205 + 3.141592654 I}, {-0.75, 0.3305974058 + 3.141592654 I},      
 {-0.5, 0.4720006514 + 3.141592654 I}, {-0.25, 0.1853483213 + 3.141592654 I},
 {0., -\[Infinity]}, {0.25, 0.1853483213}, {0.5, 0.4720006514},
 {0.75, 0.3305974058}, {1., 0.07366791205}, {1.25, -0.128441476},
 {1.5, -0.1984075607}, {1.75, -0.142337815}, {2., -0.02256066175}}
$\endgroup$
2
  • 1
    $\begingroup$ Function Cos[Pi x]/x behaves as 1/x near the origin and so you should expect that CosIntegral behaves as logarithm at 0 which is a singular point. It is natural that the both functions have the branch cut from $-\infty$ to $0$. You can find appropriate information in the documentation pages. $\endgroup$
    – Artes
    Commented Jul 4 at 13:38
  • $\begingroup$ See Entity["MathematicalFunction", "CosIntegral"]["Dataset"] $\endgroup$
    – Bob Hanlon
    Commented Jul 4 at 17:34

2 Answers 2

2
$\begingroup$

Two things: $\cos (\pi x)/x$ is an odd function, not even!

Other than that you are (I think) confusing two functions, let's just assume real $x$ the CosIntegral[x] functions represent the usually denoted $Ci(x)$ function $$ Ci(x) = - \int_x^\infty \frac{\cos t}{t} dt. $$

Often the cosine integral is said to be the $Cin(x)$ function, which is defined as $$ Cin(x) = \int_0^x \frac{1-\cos(t)}{t} $$ which is even. And two can be related by $$ Ci(x) = \gamma + \ln (x) - Cin(x). $$ See the wiki article for more details.

In Mathematica you can check this by calculating

Integrate[(Cos[t] - 1)/t, {t, 0, z}] + Log[z] + EulerGamma
(*CosIntegral[z]*)
$\endgroup$
2
  • 1
    $\begingroup$ Hi @Nitaa. You are of course right that the function is odd - d'oh! But that would tend to imply an even integral, no? In Mathematica, the input Integrate[Cos[Pi*x]/x, x] evaluates to CosIntegral[Pi*x]. What baffles me is the math, I think. While the real part of CosIntegral[Pi*x] appears to be even (as expected), the imaginary part is not. I want to understand why an odd function produces this asymmetry. So, I'll mark it as answered here (I appreciate the clarification), and I'll turn to MathStack for more. Many thanks. $\endgroup$ Commented Jul 4 at 13:55
  • $\begingroup$ Yes that's more of a question for math stackexchange. But I agree that what you are saying is not obvious at first sight. But if we look at the relation between $Ci$ and $Cin$ it's obvious that the relation between $Ci(x)$ and $Ci(-x)$ will be nontrivial thanks the logarithm. $\endgroup$
    – Nitaa a
    Commented Jul 4 at 13:58
2
$\begingroup$

CosIntegral[z] is equivalent to the (complex!) integral

-Integrate[Cos[t]/t, {t, z, Infinity}, 
  Assumptions -> Im[z] != 0 || Re[z] > 0]

with a branch cut indicated by the assumptions (negative real axis). Because of the pole at $t=0$, we pick up $\pi i$, if the path goes above $t=0$ and ends on the negative real axis. (If the path goes below $t=0$, we pick up $-\pi i$.)

-NIntegrate[Cos[t]/t, {t, -2, I, Infinity}]
(*  0.422981 + 3.14159 I  *)

-NIntegrate[Cos[t]/t, {t, -2, -I, Infinity}]
(*  0.422981 - 3.14159 I  *)

If you approach the integral as a real integral, then for negative $z$, either the integral diverges or we choose the principal value. The principal value is symmetric:

-NIntegrate[Cos[t]/t, {t, -2, 0, Infinity}, Method -> "PrincipalValue"]
(* Spurious NIntegrate::izero warning from the method *)
(*  0.422981  *)

-NIntegrate[Cos[t]/t, {t, 2, Infinity}]
(*  0.422981  *)

-Integrate[Cos[t]/t, {t, -2, Infinity}, PrincipalValue -> True]
(*  CosIntegral[2]  *)

Of course, the principal value is not how CosIntegral[] is defined.

$\endgroup$

Your Answer

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

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