2
$\begingroup$

I'm trying to get an analytical expression for the following integral:

f = 16 k Abs[Cos[t] + Sqrt[2] Sin[t] Cos[k z]]^5/Pi;
Integrate[f, {z, 0, 2 Pi/k}, Assumptions -> k > 0 && t > 0]

The answer Mathematica gives is not correct for t>ArcTan[1/Sqrt[2]]:

(* ConditionalExpression[-((-90 Cos[t] + 55 Cos[3 t] + 3 Cos[5 t])/Sign[Cos[t] + Sqrt[2] Sin[t]]^5), Cos[t] + Sqrt[2] Sin[t] != 0] *)

N@% /. t -> 1

(* 102.226 *)

NIntegrate[f /. {t -> 1, k -> 2}, {z, 0, 2 Pi/2}]

(* 103.146 *)

(these two numerical results should be equal.) The answer is independent of k (e.g. on change of variables to k z). If I set k=1 for Integrate, it gives me the correct (rather complicated) expression. Also, I know I can get a simpler expression by splitting the integral into two regions using ArcCos[-Cot[t]/Sqrt[2]]. However, I want to know when I can't trust Integrate.

$\endgroup$
1
  • 3
    $\begingroup$ I guess the common answer "never trust any CAS result, ever" is not really what you're looking for, right? $\endgroup$ Commented Jun 20, 2019 at 1:37

1 Answer 1

4
$\begingroup$

Making use of RealAbs introduced in 2017 instead of Abs, we obtain the same results symbolically and numerically.

f = 16 k RealAbs[Cos[t] + Sqrt[2] Sin[t] Cos[k z]]^5/Pi;
Integrate[f /. t -> 1, {z, 0, 2 Pi/k}, Assumptions -> k > 0 ]

A long exppression

N[%]

103.146 + 4.45408*10^-15 I

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