2
$\begingroup$

I have a mathematical function where both input parameters x and y are real numbers within the interval [−π,π]:

F[x_, y_] := (16 Sin[2*x]^2 Sin[y/2]^2)/(3 + Cos[4*x] - 2 Cos[y] Sin[2*x]^2)

I performed the integration of F with respect to y, aiming to obtain an expression dependent on x:

$Assumptions = {x \[Element] Reals, y \[Element] Reals};
InterF = FullSimplify[Integrate[F[x, y], {y, -Pi, Pi}]]

This integration yields the following conditional expression:

If Abs[Tan[x]]!=1&&Abs[Cot[x]]!=1
       16*Pi*Cos[x]^2   Abs[Tan[x]]>=1&&Abs[Cot[x]]<1
       16*Pi*Sin[x]^2   True

However, evaluating InterF at x=Pi/4 (ie., InterF/. {x -> Pi/4}) results in Undefined because the conditions in the resultant expression do not include this specific case where x=Pi/4.

I attempted setting GenerateConditions -> False, which did not resolve the issue.

Question: What should be done when a specific condition - in this case, If Abs[Tan[x]]!=1&&Abs[Cot[x]]!=1 — isn’t met? How can I achieve a defined integral result for x = Pi/4, especially if the conditions don't cover this case?

Is it okay to just pick one of the conditional expressions? Since the function F[x_, y_] and its integral could be quite complex (instead of the straightforward example here), I'm unsure if choosing arbitrarily is appropriate. Any guidance or advice would be greatly appreciated. Thank you in advance.

Notably: F[x, y] /. {x -> Pi/4} // Simplify gives 4, which means the integral result will be 8*Pi. However, I don't want to set the value of x before integrating, as this is just a simple example here and I need an expression in terms of x for later evaluations with different x values.

$\endgroup$
4
  • $\begingroup$ Try: Limit[InterF, x -> Pi/4] ? $\endgroup$ Commented Jul 14 at 12:17
  • $\begingroup$ You can evaluate e.g. Assuming[ Reduce[ -Pi <= x <= Pi && (Abs[Tan[x]] == 1 || Abs[Cot[x]] == 1), x], FullSimplify[Integrate[ F[x, y], {y, -Pi, Pi}]]] but I'm not sure I undersand your problem. $\endgroup$
    – Artes
    Commented Jul 14 at 12:17
  • 1
    $\begingroup$ Maple 2024.1 give me solution : -8*Pi*Abs[Cos[2*x]] + 8*Pi. $\endgroup$ Commented Jul 14 at 12:32
  • $\begingroup$ Thanks. That's an interesting point. What if the function is a complicated one, and I don’t know the specific values? Should I first solve the condition using Reduce to get the specific values and then use Integrate? I’m not sure how time-consuming this process will be. $\endgroup$
    – Xuemei
    Commented Jul 14 at 13:29

1 Answer 1

4
$\begingroup$

To get rid of condition like If I use a trick:

G = LaplaceTransform[Integrate[InverseLaplaceTransform[
(a Sin[y/2]^2)/(b - c*Cos[y]), b, s], {y, -Pi, Pi}], s, b] /. {a -> 16 Sin[2 x]^2, 
b -> 3 + Cos[4 x], c -> 2* Sin[2 x]^2}
G1 = FullSimplify[G, Assumptions -> {-Pi <= x <= Pi}] // Expand

(*8 π - 8 π Abs[Cos[2 x]]*)

another way:

F[x_, y_] := (16 Sin[2*x]^2 Sin[y/2]^2)/(3 + Cos[4*x] - 2 Cos[y] Sin[2*x]^2); 
G2 = 2 Integrate[F[x, y], {y, 0, Pi}, Assumptions -> -Pi <= x <= Pi] // Expand
(*Simpler solution than OP answer*)

(*8 π - 4 π Abs[Sec[2 x]] - 4 π Abs[Sec[2 x]] Cos[4 x]*)

Limit[G2, x -> Pi/4] // Quiet(*Need a Limit to get a value!*)
(*8 π*)
$\endgroup$
4
  • $\begingroup$ thank you very much! those are very useful tricks. out of curious, does LaplaceTransform and InverseLaplaceTransform works for arbitrary functions? $\endgroup$
    – Xuemei
    Commented Jul 14 at 13:33
  • $\begingroup$ @Xuemei It depends on the function and whether it is integrable by Integrate. $\endgroup$ Commented Jul 14 at 13:35
  • $\begingroup$ oh, interesting. can you show an example which cannot be integrable by Integrate? thanks a lot! $\endgroup$
    – Xuemei
    Commented Jul 14 at 13:48
  • $\begingroup$ @Xuemei Example: Integrate[ InverseLaplaceTransform[(a Sin[y/2]^2)/(b - c*Cos[y]), c, s], {y, -Pi, Pi}]. $\endgroup$ Commented Jul 14 at 13:59

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.