4
$\begingroup$

Mathematica 9. I want this

Integrate[(
 Cos[t ω]^2 Cos[α + t ω])/(-1 + 
   A Cos[α + t ω])^2, {t, 0, (2 π)/ω}]

Can Mathematica handle with it?

I tied different forms of input. TrigExpand, TrigReduce, FullSimplify. And sometimes it take more than 3000 seconds to give an answer. Some times it's short:

ConditionalExpression[(8 π Cos[2 α])/(A^3 ω), 
 1/ω ∈ Reals]

Sometimes it's not:

ConditionalExpression[(1/(2 A^3 ω))
 Cos[2 α] (Cos[α] - 
    I Sin[α]) (16 π Cos[α] - ((-16 + 24 A^2 - 
       6 A^4 + A^6) Cos[α] Log[2])/((-1 + A^2)^(3/2)
      Sqrt[(Cos[α] - I Sin[α])^4]) - ((-16 + 24 A^2 - 
       6 A^4 + A^6) Cos[α] Log[-(((2 - A^2 + 
          A^2 Cos[2 α]) (Cos[2 α] - 
          I Sin[2 α]))/(
       2 Sqrt[-1 + A^2]
         Sqrt[(Cos[α] - I Sin[α])^4]))])/((-1 + A^2)^(
     3/2) Sqrt[(Cos[α] - I Sin[α])^4]) + ((-16 + 
       24 A^2 - 6 A^4 + 
       A^6) Cos[α] Log[((2 - A^2 + 
         A^2 Cos[2 α]) (Cos[2 α] - I Sin[2 α]))/(
      Sqrt[-1 + A^2]
        Sqrt[(Cos[α] - I Sin[α])^4])])/((-1 + A^2)^(3/2)
      Sqrt[(Cos[α] - I Sin[α])^4]) + 
    16 I π Sin[α] + (
    I (-16 + 24 A^2 - 6 A^4 + A^6) Log[2] Sin[α])/((-1 + A^2)^(
     3/2) Sqrt[(Cos[α] - I Sin[α])^4]) + (
    I (-16 + 24 A^2 - 6 A^4 + 
       A^6) Log[-(((2 - A^2 + A^2 Cos[2 α]) (Cos[2 α] - 
          I Sin[2 α]))/(
       2 Sqrt[-1 + A^2]
         Sqrt[(Cos[α] - 
          I Sin[α])^4]))] Sin[α])/((-1 + A^2)^(3/2)
      Sqrt[(Cos[α] - I Sin[α])^4]) - (
    I (-16 + 24 A^2 - 6 A^4 + 
       A^6) Log[((2 - A^2 + A^2 Cos[2 α]) (Cos[2 α] - 
         I Sin[2 α]))/(
      Sqrt[-1 + A^2]
        Sqrt[(Cos[α] - 
         I Sin[α])^4])] Sin[α])/((-1 + A^2)^(3/2)
      Sqrt[(Cos[α] - I Sin[α])^4])), 
 1/ω ∈ Reals]

But every time it's wrong. When i calculate it numerically i have different result:

NIntegrate[
  Simplify[((2 Cos[t ω]^2 Cos[α + t ω])/(-1 + 
  A Cos[α + t ω])^2) /. rl], {t, 0, (2 π)/ω /. rl}] // Chop

Why? May be it needs to increase the computation time? Is there any option for Integrate such as TimeConstrain? Or maybe this is impossible task for Mathematica...

Sorry if it's newbie question.

Thanks.

$\endgroup$
4
  • $\begingroup$ If you want it to be aborted after a while, try TimeConstraint. $\endgroup$
    – Wjx
    Commented Jun 18, 2016 at 7:58
  • $\begingroup$ Adding conditions for A and alpha might be useful too. $\endgroup$
    – mattiav27
    Commented Jun 18, 2016 at 8:10
  • 1
    $\begingroup$ Complicated trig functions are almost always better to Integrate numerically. You're probably doing this with Mathematica because you see no way of doing it yourself analytically right? But the software has to use the same analytical rules you would use yourself. $\endgroup$
    – Feyre
    Commented Jun 18, 2016 at 8:44
  • 1
    $\begingroup$ @Feyre, that, or in the hope that it knows special functions that you don't know. ;) $\endgroup$ Commented Jun 18, 2016 at 10:46

2 Answers 2

7
$\begingroup$

First of all you can simplify the integral by the substitution $t\mapsto t/\omega$, which just changes the value by a known factor. After this, the integrand is:

(Cos[t]^2 Cos[α + t])/(-1 + A Cos[α + t])^2

Which is integrated to obtain

int = Integrate[(Cos[t]^2 Cos[α + t])/(-1 + A Cos[α + t])^2, t];

Plotting the int for some values of A, omega, and alpha, you'll see discontinuities. When expanding int one notices that there are two reason for those. One with the form ArcTan[a + b Tan[t/2]] and another with the form ArcTanh[a Tan[(t + α)/2]].

The first is discontinuous at t = π and the other is at t = Mod[π - α, 2 π]. The second is however -period, so one can discard the Mod[].

When subtracting limits of the antiderivative int, you just need to take into account the discontinuities by using the limits from both sites at these. You end up with these to terms for the integral:

part1 = Assuming[{ω > 0, α ∈ Reals, -1 < A < 1}, FullSimplify[
   Select[int // Expand, Not[FreeQ[#, ArcTan]] &] /. {
     ArcTan[((I Cos[α] + Sin[α]) (A Sin[α] +
     (1 + A Cos[α]) Tan[t/2]))/(Sqrt[-1 + A^2] Sqrt[(Cos[α
     ] - I Sin[α])^2])] ->
  Assuming[{ω > 0, α ∈ Reals, -1 < A < 1}, 
   FullSimplify[
      (Limit[ArcTan[a + b Tan[t/2]], t -> π, Direction -> 1] -
       Limit[ArcTan[a + b Tan[t/2]], t -> π, Direction -> -1] +
       Limit[ArcTan[a + b Tan[t/2]], t -> 2 π, Direction -> 1] -
       Limit[ArcTan[a + b Tan[t/2]], t -> 0, Direction -> -1]) /. {
      a -> ((I Cos[α] + Sin[α]) (A Sin[α]))/(
       Sqrt[-1 + A^2] Sqrt[(Cos[α] - I Sin[α])^2]), 
      b -> ((I Cos[α] + Sin[α]) ((1 + A Cos[α])))/(
       Sqrt[-1 + A^2] Sqrt[(Cos[α] - I Sin[α])^2])}]]}]]

part2 = Assuming[{ω > 0, α ∈ Reals, -1 < A < 1}, FullSimplify[
   Select[int // Expand, Not[FreeQ[#, ArcTanh]] &] /. {
     ArcTanh[((1 + A) Tan[(t + α)/2])/Sqrt[-1 + A^2]] ->
      Assuming[{ω > 0, α ∈ Reals, -1 < A < 1}, FullSimplify[
       (Limit[ArcTanh[a Tan[(t + α)/2]], t -> π - α, Direction -> 1] -
        Limit[ArcTanh[a Tan[(t + α)/2]], t -> π - α, Direction -> -1] +
        Limit[ArcTanh[a Tan[(t + α)/2]], t -> 2 π, Direction -> 1] -
        Limit[ArcTanh[a Tan[(t + α)/2]], t -> 0, Direction -> -1]) /. {
    a -> (1 + A)/Sqrt[-1 + A^2]}]]}]]

The remaining part of the antiderivative is contiuous:

part3 = (Select[int // Expand, FreeQ[#, ArcTanh | ArcTan] &] /. t -> 2 π) -
        (Select[int // Expand, FreeQ[#, ArcTanh | ArcTan] &] /. t -> 0)

And it works:

ω = SetPrecision[RandomReal[100], ∞];
A = SetPrecision[RandomReal[{-1, 1}], ∞];
α = SetPrecision[100 RandomReal[{-1, 1}], ∞];

N[part1 + part2 + part3, 50]
-3.3071684335997943207036811422575901665860000837460

NIntegrate[(Cos[t]^2 Cos[α + t])/(-1 + A Cos[α + t])^2, {t, 0, 2 π}, WorkingPrecision -> 50]
-3.3071684335997943207036811422575901665860000837460

Though this is without the factor from the substitution.

The sum of the parts is

(A π)/(1 - A^2)^(3/2) + (4 π Cos[α]^2)/A^3 + (I (4 -
   6 A^2 + A^4) π Cos[2 α])/(A^3 (-1 + A^2)^(3/2)) - (4 π Sin[α]^2)/A^3
$\endgroup$
3
$\begingroup$

We can simplify the derivation of coolwater appreciably by getting rid of the mixture of t and alpha.

It turns out that in the present aproach the only jumps of the antiderivative occur at t = Pi which can be easily taken into account.

Here we go:

$Version

(* Out[176]= "10.1.0  for Microsoft Windows (64-bit) (March 24, 2015)" *)

In the first step we "transfer" alpha to the Cos^2 term, i.e. the original definite integral is identical to the definite integral over the function

f = (Cos[t - α ]^2 Cos[t ])/(-1 + A Cos[t ])^2;

Then we TrigExpand Cos[t-α]^2 to get

cx = (1 + Cos[2 t] Cos[2 α] +  Sin[2 t] Sin[2 α]);

This separates functions of alpha and t.

Checking

Simplify[TrigExpand[Cos[t - α ]^2] == 1/2 cx]

(* Out[169]= True *)

We define

h =  Cos[t ]/(-1 + A Cos[t ])^2;

and separate terms temporarily by changing to a list

cxL = List @@ cx

(* Out[139]= {1, Cos[2 t] Cos[2 α], Sin[2 t] Sin[2 α]} *)

Now we calculate the antiderivative by integrating indefinitely which is done in a few seconds

g = 1/2 Integrate[h cxL, t] // Simplify;

By plotting with some values of A (e.g. A = 1/2) we find that g[[1]] and g[[2]] have a jump at t = Pi, and g[[3]] is continous.

The jumps are easily (and quickly) calculated

j1 = Limit[g[[1]], t -> π, Direction -> -1] - 
  Limit[g[[1]], t -> π, Direction -> 1]

(* Out[143]= (A Sqrt[(1 + A)/(1 - A)] π)/((-1 + A) (1 + A)^2) *)

j2 = Limit[g[[2]], t -> π, Direction -> -1] - 
   Limit[g[[2]], t -> π, Direction -> 1] // Simplify

(* Out[170]= -((Sqrt[(1 + A)/(
  1 - A)] (4 - 6 A^2 + A^4) π Cos[2 α])/((-1 + A) A^3 (1 + A)^2)) *)

j3 = Limit[g[[3]], t -> π, Direction -> -1] - 
   Limit[g[[3]], t -> π, Direction -> 1] // Simplify

(* Out[171]= 0 *)

The difference of the antiderivative at the borders is (still in list form)

dg = (g /. t -> 2 π) - (g /. t -> 0) // Simplify

(* Out[150]= {0, (4 π Cos[2 α])/A^3, 0} *)

The complete integral is then given by additionally taking into account the jumps:

wh = Simplify[Plus @@ dg - j1 - j2 - j3, 0 < A < 1]

(* Out[174]= 
(π (A^4/(1 - A^2)^(3/2) + 
       4 Cos[2 α] - ((4 - 6 A^2 + A^4) Cos[2 α])/(1 - A^2)^(
       3/2)))/A^3 
*)

In Latex

$$\frac{\pi \left(4 \cos (2 \alpha )-\frac{\left(A^4-6 A^2+4\right) \cos (2 \alpha )}{\left(1-A^2\right)^{3/2}}+\frac{A^4}{\left(1-A^2\right)^{3/2}}\right)}{A^3}$$

Which is identical to the solution of coolwater.

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