I'm working with sine and cosine integral functions, and stumbled on this weird issue when performing integration in Mathematica.

I worked out the following integral by hand and found:

\begin{equation} \int_{-A}^{A} \frac{\sin(B(t-t_0)+Ct)}{t-t_0} dt = \\ \sin(Ct_0) \Big(\textrm{Ci}\big((B+C)(A-t_0)\big)-\textrm{Ci}\big(-(B+C)(A+t_0)\big)\Big) + \\cos(Ct_0) \Big( \textrm{Si}\big( (B+C)(A-t_0)\big) + \textrm{Si}\big((B+C)(A+t_0)\big) \Big), \end{equation}

with $\{A, B, C\} \in \Re_0$, and $\textrm{Si}, \textrm{Ci}$ denoting the Sine Integral and Cosine Integral function, respectively.

However, when I try to solve the same integral in Mathematica, I get a different solution:

Integrate[Sin[B (t - t0) + C t] / (t - t0), {t, -A, A}, GenerateConditions -> False] //FullSimplify
>(CosIntegral[-((B + C) (A - t0))] - CosIntegral[(B + C) (A + t0)]) Sin[C t0] + Cos[C t0] (SinIntegral[(B + C) (A - t0)] + SinIntegral[(B + C) (A + t0)])

where the argument of the first two Cosine Integral functions is suddenly negative compared to my solution by hand. I am fairly certain of my solution, so it would suprise me if I solved it incorrectly somehow.

Something I did try, was performing u-substitution by hand first, which results in:

$$\textrm{Let } u = B(t - t_0) + C t, \\\\$$

$$\int_{-A(B+C)-Bt_0}^{A(B+C)-Bt_0} \frac{\sin(u)}{u-t_0C} du$$

and solving this integral using Mathematica. This does give me my original solution again:

Integrate[Sin[u]/(u - t0*C), {u, -A (B + C) - B t0, A (B + C) - B t0}, GenerateConditions -> False] // FullSimplify
>(CosIntegral[(B + C) (A - t0)] - CosIntegral[-((B + C) (A + t0))]) Sin[C t0] + Cos[C t0] (SinIntegral[(B + C) (A - t0)] + SinIntegral[(B + C) (A + t0)])

So I don't really understand why Mathematica gives a different result before and after the u-substitution (assuming that my u-substitution is correct).

Am I missing something?


1 Answer 1


According to Mathematica's definition of the cosine integral function, we have $$ \text{Ci}(-x) = \text{Ci}(x) + \ln(-x) - \ln(x) = \text{Ci}(x) + i \pi $$ for $x > 0$. This then implies that $\text{Ci}(-x) - \text{Ci}(-y) = \text{Ci}(x) - \text{Ci}(y)$. In other words, the two forms of the integral are functionally equivalent so long as $x > 0$ and $y > 0$.

Mathematica can be induced to show this using FunctionExpand — though if I try to prove the above statement using Reduce, it returns False, which is strange. It's entirely possible that I'm missing something.

 {CosIntegral[x] - CosIntegral[y] == FunctionExpand[CosIntegral[-x] - CosIntegral[-y])], 
  x > 0, y > 0}, Reals]

(* False *)
  • $\begingroup$ I think you get False because there are no real values for which Log[-x] and Log[x] are real-valued. The domain spec. Reals in Reduce means "all constants and function values are also restricted to be real." $\endgroup$
    – Michael E2
    Commented Feb 10, 2022 at 21:01
  • $\begingroup$ @MichaelE2: Hmm, that makes sense. Without the Reals option, it returns Log[-x] == Log[x] + Log[-y] - Log[y] instead, which is (I think) true so long as x and y are both negative or both positive. I was hoping to get Mathematica to print (x > 0 && y > 0) || (x < 0 && y < 0) as its final answer, but I couldn't cajole it into doing so. $\endgroup$ Commented Feb 10, 2022 at 21:52
  • $\begingroup$ That makes sense. Thanks a lot for the helpful answer. I'm gonna look into it! $\endgroup$ Commented Feb 10, 2022 at 22:14

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.