4
$\begingroup$

I am using DSolve to verify a multitude of definite integrals I have done by hand, and things have gone perfectly until this integral,

$$ \int_0^t \frac{\mathrm{d}t}{c^2 + (t - s)^2}$$

where $c = \cos\phi$ and $s = \sin\phi$. (For simplicity I am using the same symbol $t$ in the dummy as in the upper bound, because there is no potential for ambiguity in my situation.)

If the $\phi$ dependence (of $c$ and $s$) is hidden from Mathematica, all goes well:

int[t] /. First @ DSolve[
  List[
    int'[t] == 1 / (c^2 + (t - s)^2),
    int [0] == 0
  ], int[t], t
]

$\frac{1}{c} \left( \tan^{-1} \frac{s}{c} - \tan^{-1} \frac{s-t}{c} \right)$

But if the $\phi$ dependence is included, then Mathematica complicates the result unnecessarily, with many half-angle terms:

int[t] /. First @ DSolve[
  List[
    int'[t] == 1 / (Cos[ϕ]^2 + (t - Sin[ϕ])^2),
    int [0] == 0
  ], int[t], t
]

$\frac{1}{2} \left( -2 \tan^{-1} \cot\frac{\phi}{2} \cdot \sec\phi - \text{...} \right)$

I have been unable to simplify this to the former, even with FullSimplify[#, 0 < ϕ < Pi/2] & which should rule out the integrand becoming infinite.

Is there a workaround or simplification method which doesn't require hiding the $\phi$ dependence from Mathematica?

$\endgroup$

1 Answer 1

4
$\begingroup$

One workaround would be to instead use the Rubi integration package for Mathematica, which usually gives integrals in simpler forms than Mathematica itself. [Available for download at: https://rulebasedintegration.org ]. Rubi is called using "Int" instead of "Integrate":

<<Rubi`

int[t] /. 
First@DSolve[List[int'[t] == 1/(c^2 + (t - s)^2), int[0] == 0], int[t], t];
r1 = % /. {s -> Sin[\[Phi]], c -> Cos[\[Phi]]} (*the result you wanted*)

r2 = Int[1/(Cos[\[Phi]]^2 + (t - Sin[\[Phi]])^2), {t, 0, t}] // FullSimplify (*Rubi's result*)

FullSimplify[r1 - r2]

$\sec (\phi ) \left(\tan ^{-1}(\tan (\phi ))-\tan ^{-1}(\sec (\phi ) (\sin (\phi )-t))\right)$

$\sec (\phi ) \left(\tan ^{-1}(t \sec (\phi )-\tan (\phi ))+\tan ^{-1}(\tan (\phi ))\right)$

0

Note, however, that Rubi computes definite integrals by first determining the indefinite integral, substituting the upper and lower limits of integration, and subtracting. This is only guaranteed to be valid for integrands that are continuous on the closed interval between and including those limits.

$\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.