What is the Cosine Integral Ci(x)?
The cosine integral, written \(\operatorname{Ci}(x)\), is a special function that appears throughout physics, signal processing, and electromagnetics, especially in antenna theory and the analysis of oscillatory integrals. It is defined for a positive real argument \(x\) as the integral of \((\cos t - 1)/t\) from 0 to \(x\), plus the natural logarithm of \(x\) and the Euler-Mascheroni constant gamma (approximately 0.5772156649). This calculator evaluates \(\operatorname{Ci}(x)\) to full double precision for any real input.
How to use this calculator
Enter the value of \(x\) in the input field and submit. The result is the dimensionless value of \(\operatorname{Ci}(x)\). The domain of the real-valued principal definition is \(x\) greater than 0. At \(x = 0\) the function diverges to negative infinity (a logarithmic singularity), so the calculator reports it as undefined. For negative inputs, the calculator returns \(\operatorname{Ci}(|x|)\), since the real part of \(\operatorname{Ci}(-x)\) equals \(\operatorname{Ci}(x)\); the imaginary component of plus or minus \(i\pi\) is omitted.
The formula explained
The defining relation is $$\operatorname{Ci}(x) = \gamma + \ln|x| + \int_{0}^{x} \frac{\cos t - 1}{t}\, dt$$ Expanding the integrand as a Taylor series and integrating term by term yields the convergent series $$\operatorname{Ci}(x) = \gamma + \ln|x| + \sum_{k=1}^{\infty} \frac{(-1)^{k}\,|x|^{2k}}{2k\,(2k)!}$$ For small to moderate \(x\) (here, \(|x|\) up to 6) this series converges quickly and accurately. For larger \(x\), the calculator switches to the asymptotic representation \(\operatorname{Ci}(x) = f(x)\sin(x) - g(x)\cos(x)\), which avoids the catastrophic cancellation that plagues the series at large arguments. As \(x\) grows, \(\operatorname{Ci}(x)\) decays toward zero while oscillating like \(\sin(x)/x\).
Worked example
For \(x = 1\): \(\ln(1) = 0\), and the series gives $$-0.25 + 0.0104166667 - 0.0002314815 + 0.0000031002 - \ldots \approx -0.2398117421$$ Adding \(\gamma = 0.5772156649\) gives \(\operatorname{Ci}(1) = 0.3374039229\), which matches the known reference value of the cosine integral at 1.
FAQ
Why is Ci(0) undefined? Because \(\ln(x)\) tends to negative infinity as \(x\) approaches 0, the function has a logarithmic singularity there.
What about negative x? Ci is complex for negative arguments. This real calculator returns \(\operatorname{Ci}(|x|)\), the real part, and drops the imaginary term.
How accurate are the results? Results are accurate to roughly machine double precision (about 15 significant digits) across the typical input range.