Workarounds for a possible bug in the linearity of FourierTransform - Mathematica Stack Exchange most recent 30 from mathematica.stackexchange.com 2019-09-22T04:48:09Z https://mathematica.stackexchange.com/feeds/question/56237 https://creativecommons.org/licenses/by-sa/4.0/rdf https://mathematica.stackexchange.com/q/56237 14 Workarounds for a possible bug in the linearity of FourierTransform Oliver Lunt https://mathematica.stackexchange.com/users/18858 2014-07-30T19:17:40Z 2016-05-10T03:29:41Z <p>This is somewhat similar to <a href="https://mathematica.stackexchange.com/questions/40432/possible-bug-with-fouriertransform-linearity">this question</a>, except the problem I am encountering is to do with Fourier transforms of scalar multiples of functions and their derivatives. </p> <p>I wish to input <code>FourierTransform[a*f[t],t,x]</code> and have Mathematica simplify it to <code>a*FourierTransform[f[t],t,x]</code>, and, equivalently, to input <code>FourierTransform[f'[t],t,x]</code> and have Mathematica simplify it to <code>ix*FourierTransform[f[t],t,x]</code>. I'm taking the Fourier transform of a system of differential equations for functions <code>f[t]</code>,<code>g[t]</code>, etc., in order to instead only have to solve a system of algebraic equations for their Fourier transforms, but Mathematica seems to be having some problems doing this.</p> <p>Note that <code>LaplaceTransform</code> works exactly as expected, but for some reason <code>FourierTransform</code> doesn't perform the expected simplification. If someone could suggest a solution that also incorporates the distributive property that <code>FourierTransform</code> was shown to have a problem with in the question I linked, that would be ideal.</p> <h1>Example</h1> <p>This is essentially what I'd like <code>FourierTransform</code> to do:</p> <pre><code>LaplaceTransform[{a*f[t]+b*g'[t]==0,c*f'[t]+d*g[t]==0},t,x] </code></pre> <p>which returns:</p> <pre><code>{a*LaplaceTransform[f[t],t,x]+b*(-g+x*LaplaceTransform[g[t],t,x])==0, c*(-f+x*LaplaceTransform[f[t],t,x])+d*LaplaceTransform[g[t],t,x]==0} </code></pre> <p>Instead, however, <code>FourierTransform</code> of the same expression returns:</p> <pre><code>{FourierTransform[a*f[t]+b*g'[t]==0,t,x],FourierTransform[c*f'[t]+d*g[t]==0,t,x]} </code></pre> <h1>Edit</h1> <p>There is a solution to this problem <a href="https://mathematica.stackexchange.com/questions/16283/obtaining-the-fourier-transform-of-an-operator?rq=1">here</a>, although it doesn't actually explain <code>FourierTransform</code>'s strange functionality.</p> https://mathematica.stackexchange.com/questions/56237/-/71393#71393 9 Answer by xzczd for Workarounds for a possible bug in the linearity of FourierTransform xzczd https://mathematica.stackexchange.com/users/1871 2015-01-09T12:25:32Z 2016-05-10T03:29:41Z <p>The easiest work-around I can think of is to write a "shell" for the current <code>FourierTransform</code>:</p> <pre><code>ft[(h : List | Plus | Equal)[a__], t_, w_] := ft[#, t, w] &amp; /@ h[a] ft[a_ b_, t_, w_] /; FreeQ[b, t] := b ft[a, t, w] ft[a_, t_, w_] := FourierTransform[a, t, w] ft[{a f[t] + b g'[t] == 0, c f'[t] + d e g[t] h[t] == 0}, t, w] </code></pre> <blockquote> <pre><code>{a FourierTransform[f[t], t, w] - I b w FourierTransform[g[t], t, w] == 0, -I c w FourierTransform[f[t], t, w] + d e FourierTransform[g[t] h[t], t, w] == 0} </code></pre> </blockquote> <p>Not sure if this will fail in more complicated cases.</p> <hr> <p>In the code above I've only implemented the rules that are useful for solving differential equations, but it's not hard to include other properties of Fourier transform following the same method, for example:</p> <pre><code>(* Displacement property &lt;- is this the right terminology? *) ft[f_[t_] E^(Complex[0, c_] b_ t_), t_, w_] /; FreeQ[b, t] := ft[f[t], t, w + c b] (* Convolution property *) ft[a_[t_] b_[t_], t_, w_] := Module[{x}, Hold[Convolve][ft[a@t, t, x], ft[b@t, t, x], x, w]/Sqrt[2 Pi]] ft[E^(-I t Ω) a[t], t, w] </code></pre> <blockquote> <pre><code>FourierTransform[a[t], t, w - Ω] </code></pre> </blockquote> <pre><code>(* Verify the correctness: *) FourierTransform[E^(-I t Ω) a[t], t, w] == % /. a -&gt; (Exp[-#^2]&amp;) // Simplify </code></pre> <blockquote> <pre><code>True </code></pre> </blockquote> <pre><code>ft[a[t] b[t], t, w] </code></pre> <blockquote> <pre><code>(1/Sqrt[2 π]) Hold[Convolve][FourierTransform[a[t], t, x\$60844], FourierTransform[b[t], t, x\$60844], x\$60844, w] </code></pre> </blockquote> <pre><code>(* Verify the correctness: *) % == FourierTransform[a[t] b[t], t, w] /. {a -&gt; (Exp[-#^2] &amp;), b -&gt; (Exp[-3 #^2] &amp;)} // ReleaseHold // Simplify </code></pre> <blockquote> <pre><code>True </code></pre> </blockquote>