3
$\begingroup$

Bug introduced in 13.0 or earlier and persisting through 13.2.0 or later.

FourierCosTransform[Cos[(k + p) z], z, q]

gives correct result

Sqrt[\[Pi]/2] DiracDelta[k + p - q] + 
 Sqrt[\[Pi]/2] DiracDelta[k + p + q]

The same but with expanded argument

FourierCosTransform[Cos[k z + p z], z, q]

gives 0. Bad surprise. Indeed, the situation is worse, because the difference remains even if we explicitly state that k, p, q are real numbers

In[]:= FourierCosTransform[Cos[(k + p) z], z, q, Assumptions -> {k, p, q} \[Element] Reals]

Out[]:=Sqrt[\[Pi]/2] DiracDelta[k + p - q] + Sqrt[\[Pi]/2] DiracDelta[k + p + q]

In[]:=FourierCosTransform[Cos[z k + p z], z, q, Assumptions -> {k, p, q} \[Element] Reals]

Out[]:=0
$\endgroup$
7
  • 2
    $\begingroup$ I can reproduce on $Version == "13.0.0 for Mac OS X x86 (64-bit) (December 3, 2021)" $\endgroup$
    – evanb
    May 26, 2022 at 12:46
  • $\begingroup$ Strange, but these two commands TrigExpand[Cos[k z + p z]] and TrigExpand[Cos[(k + p) z]] also give different results. $\endgroup$ May 26, 2022 at 13:15
  • 2
    $\begingroup$ @Rodion: As to your comment, Mathematica's TrigExpand will only re-write the expression if the argument of the sinusoidal functions are in already expanded form. This is, I imagine, a design choice, but I don't know the reason for it. $\endgroup$
    – march
    May 26, 2022 at 15:41
  • 1
    $\begingroup$ If you use FourierTransform instead of FourierCosTransform (which should yield the same result in this case, since the function is even), then both results are identical and equal to the result which is the sum of two delta functions. $\endgroup$
    – march
    May 26, 2022 at 15:44
  • 1
    $\begingroup$ I find the result of FourierCosTransform[Cos[(k + p) z], z, q] i.e. Sqrt[\[Pi]/2] DiracDelta[k + p - q] + Sqrt[\[Pi]/2] DiracDelta[k + p + q] to be a bug, since k,p, and q are complex by default. $\endgroup$
    – user64494
    May 26, 2022 at 15:52

1 Answer 1

1
$\begingroup$

Let us go into deep. The function Cos[(k + p) z] depends on k and p and z which are assumed complex by default. Claiming the correct result of FourirCosTansform to be Sqrt[\[Pi]/2] DiracDelta[k + p - q] + Sqrt[\[Pi]/2] DiracDelta[k + p + q], you silently assume that k + p - q \[Element]] Reals and k + p + q \[Element]] Reals. In other case this is meaningless. If we deal with parameters, then the Assumptions and GenerateConditions->True options are useful. In fact, usual assumptions are {k,p,q}\[Element]Reals. Let us try it.

FourierCosTransform[Cos[(k + p) z], z, q, 
Assumptions -> {k, p, q} \[Element] Reals, GenerateConditions -> True]

Sqrt[\[Pi]/2] DiracDelta[k + p - q] + Sqrt[\[Pi]/2] DiracDelta[k + p + q]

FourierCosTransform[Cos[k z + p z], z, q, 
Assumptions -> {k, p, q} \[Element] Reals, 
GenerateConditions -> True]

returns the input. Of course, this is a weakness, but not a bug. Next,

FourierCosTransform[Cos[(k + p) z], z, q, GenerateConditions -> True]

ConditionalExpression[0, Im[k + p] < 0]

If Im[k + p] < 0, then (If I am not mistaken) the usual FourierCosTransform does not exist. Therefore, the above answer is of such kind "If $2+2=5$, then $2+3=6$".

$\endgroup$
4
  • 1
    $\begingroup$ Thank you but I donэt agree. This is a bug and it could be very drastic. First of all expression k z+ k p and (k + p) z are mathematically identical in all sense and assumptions. I understand that the result of the integration depends on the properties of the parameters, but this is totally wrong if result of FourierCosTransform[Cos[z k + p z], z, q, Assumptions -> {k, p, q} \[Element] Reals] is not the same FourierCosTransform[Cos[(k + p) z], z, q, Assumptions -> {k, p, q} \[Element] Reals]. Otherwise it's a mess. $\endgroup$ May 26, 2022 at 14:45
  • $\begingroup$ @RodionStepanov: The statement "but this is totally wrong if result of FourierCosTransform[Cos[z k + p z], z, q, Assumptions -> {k, p, q} \[Element] Reals] is not the same FourierCosTransform[Cos[(k + p) z], z, q, Assumptions -> {k, p, q} \[Element] Reals]" is your personal opinion. The returned input is a weakness, not a bug. $\endgroup$
    – user64494
    May 26, 2022 at 14:56
  • $\begingroup$ I find the result of FourierCosTransform[Cos[(k + p) z], z, q] i.e. Sqrt[\[Pi]/2] DiracDelta[k + p - q] + Sqrt[\[Pi]/2] DiracDelta[k + p + q] to be a bug. $\endgroup$
    – user64494
    May 26, 2022 at 15:51
  • $\begingroup$ What about `FourierCosTransform[Cos[z k + p z], z, q, Assumptions -> {k, p, q} [Element] Reals]`` results in Sqrt[\[Pi]/2] DiracDelta[k + p - q] + Sqrt[\[Pi]/2] DiracDelta[k + p + q] is it a bug for you? $\endgroup$ May 26, 2022 at 17:28

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.