Group Abstract Group Abstract

Message Boards Message Boards

0
|
4.9K Views
|
5 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Unexpected result from trigonometric integral simplification?

In the notebook below, I calculate a general expression and get zero. This is wrong in general because of the following special case: for qt = 2q, I get the sine of some phases. I have confirmed the special case with pen and paper. Can somebody please tell me why Mathematica screws up like this?

P.S. I know that the attached notebook was created in Mathematica 11. I assure you that Mathematica 13 makes the exact same mistake.

POSTED BY: Dimitrios Tsevas
5 Replies
Posted 3 years ago

Hello Henrik, so apparently I misunderstood your post, thank you for pointing this out to me. In particular, I was mislead by ...can only be applied on the integrand....

Since we are dealing with a vanishing denominator, it makes sense to use Limit[exprInt, qt -> -2 q] instead of exprInt /. qt -> 2 q Subsequent simplification with the condition that q should be integer produces the correct result for this condition. But as I mentioned there are two other conditions ( qt == 0, qt == -2 q) which will also lead to non-zero value of the the integral expression.

Best regards, Michael

POSTED BY: Michael Helmle
Posted 3 years ago

Hello Everybody, this is a rather interesting problem that Dimitrios raised here. My first suspicion was that it is related to the rather agressive transformation that FullSimplify attempts but it turns out that Simplify also faisl to generate the condition. So let us dig a little bit deeper. I The first step is to do the integration exactly like Dimitrios has done it already

int = Integrate[
       2/L*Sin[(2*\[Pi]*q*x)/L + \[Phi]1]*Sin[(2*\[Pi]*q*x)/L + \[Phi]2]*
        Sin[(2*\[Pi]*qt*x)/L + \[Phi]3], {x, 0, L}];

Mathematica solves the integral symbolically and correctly. However, if the expression is simplified acknowledging that both q and qt are integers, FullSimplify and Simplify fail to generate conditions for which the integral does not evaluate to zero. So I do not agree to Hendrik's statement that the conditions should be applied to the integrand nor to Gianluca's statement that the integration should generate a condition. To my understanding the conditions that are generated by integration deals with convergence with the integral which is not an issue here. The condition comes into play once the condition that both q and qt should be integers which restricts the general solution of the integral (up to here I just repeated the stuff Dimitrios has already stated).
So what can be done? From my knowledge the tool of choice to deal with this kind of problems in Mathematica is Reduce. Reduce does not work on expressions, but requires equations or inequalities as input. So we assign the expression produced by integration to a variable var.

sol1 = Reduce[int == var, var]

Reduce has now generated a condition for which the integral will evaluate to some lengthy expression . Introducing the conditions that q and qt are Integers shows now that the integral evaluates to zero for the condition qt ( -4 q^2 + qt^2) != 0

Simplify[var /. Flatten[Solve[sol1 , var]], {q, qt} \[Element] 
  Integers]

Now we look at the cases not covered by the condition . The simplest way to do this is to eliminate var form the equation .

Eliminate[sol1, var]

Next we evaluate the integral expression for each of these conditions

Simplify[Limit[int, qt -> 0], q \[Element] Integers]

Simplify[Limit[int, qt -> -2 q], q \[Element] Integers]

Simplify[Limit[int, qt -> 2 q], q \[Element] Integers]

So we have obtained now 4 solutions for the integral depending on the conditions on q and qt . Two were already covered by Dimitrios.

Please let me know if any of you agrees or whether there is some misconcept in my statements. Best regards, Michael

POSTED BY: Michael Helmle

So I do not agree to Hendrik's statement that the conditions should be applied to the integrand ...

I did not make that statement. I was just stating that the respective condition cannot be applied to the calculated general integral:

enter image description here

But FullSimplify does not see anything else then exprInt. So - how could this function ever come up with this special condition?!

POSTED BY: Henrik Schachner

It seems that Integrate in such cases with parameters will give the "generic" answer and it is up to you to work out the special cases. A simpler example:

Integrate[Cos[a x], {x, 0, 1}]
Limit[%, a -> 0]

One may wish the following to give a conditional expression:

Integrate[Cos[a x], {x, 0, 1}, GenerateConditions -> True]

but, sadly, it does not.

POSTED BY: Gianluca Gorni

Dimitrios,

I suspect that the point here is that the special case (qt -> 2*q) can only be applied on the integrand, not on the calculated integral (because (-4 q^2 + qt^2) is part of its denominator). Therefore for any simplification afterwards there is no chance for a conditional outcome like

$$1/2\cdot Sin(\phi1 + \phi2 - \phi3)\quad \mbox{if} \quad qt == 2*q$$

Does that make sense to you?

POSTED BY: Henrik Schachner
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard