Re: FoourierTransform of a function defined in sections

• To: mathgroup at smc.vnet.net
• Subject: [mg70233] Re: FoourierTransform of a function defined in sections
• From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
• Date: Sun, 8 Oct 2006 02:04:54 -0400 (EDT)
• Organization: The Open University, Milton Keynes, UK
• References: <eg4soa\$ffu\$1@smc.vnet.net> <eg822f\$n0r\$1@smc.vnet.net>

```Jean-Marc Gulliet wrote:
> Eckhard Schlemm wrote:
>> Hello,
>>
>> I want Mathematica to calculate the FourierTransform of a function which is
>> defined by Sin[x]^2 for Abs[x]<PI and zero else. I tried and defined the
>> function g as follows:
>>
>> g[x_]:=If[Abs[x]>PI,0,Sin[x]^2];
>>
>> That works fine. But if I have mathematica try to determine the
>> FourierTransform by
>>
>> FourierTransform[g[x],x,p]
>>
>> I always get the error that the recursion limit and the iteration limit were
>> exceeded...
>>
>> what am I'm doing wrong?
>>
>> Any help is appreciated
>
> Hi Eckhard,
>
> You must have some other conflicting definitions or its a
> platform/version specific problem. With a fresh Mathematica 5.2 kernel
> on Windows XP SP2, I had not problem running the code, see below. (Note
> that I have added two alternative definitions for g, that might help in
>
> In[1]:=
> g1[x_] := If[Abs[x] < PI, Sin[x]^2, 0];
> fg1 = FourierTransform[g1[x], x, p]
>
> Out[2]=
> -((1/(p*(-4 + p^2)))*(Sqrt[2/Pi]*(p*Cos[p*PI]*Sin[2*PI] +
>       (-2 + p^2*Sin[PI]^2)*Sin[p*PI])*(-1 + UnitStep[-PI])))
>
> In[3]:=
> g2[x_] := Piecewise[{{Sin[x]^2, Abs[x] < PI}}, 0]
> fg2 = FourierTransform[g2[x], x, p]
>
> Out[4]=
> -((1/(p*(-4 + p^2)))*(Sqrt[2/Pi]*(p*Cos[p*PI]*Sin[2*PI] +
>       (-2 + p^2*Sin[PI]^2)*Sin[p*PI])*(-1 + UnitStep[-PI])))
>
> In[5]:=
> g3[x_ /; Abs[x] < PI] := Sin[x]^2
> g3[x_] := 0
> fg3 = FourierTransform[g2[x], x, p]
>
> Out[7]=
> -((1/(p*(-4 + p^2)))*(Sqrt[2/Pi]*(p*Cos[p*PI]*Sin[2*PI] +
>       (-2 + p^2*Sin[PI]^2)*Sin[p*PI])*(-1 + UnitStep[-PI])))
>
> In[8]:=
> fg1 == fg2 == fg3
>
> Out[8]=
> True
>
> In[9]:=
> \$Version
>
> Out[9]=
> "5.2 for Microsoft Windows (June 20, 2005)"

Damn it! Reading Jens-Peer Kuska's post, I realized that I had missed
the misspelled symbol for Pi. Here is the corrected code,

In[1]:=
g1[x_] := If[Abs[x] < Pi, Sin[x]^2, 0];
fg1 = FourierTransform[g1[x], x, p]

Out[2]=
-((2*Sqrt[2/Pi]*Sin[p*Pi])/(-4*p + p^3))

In[3]:=
g2[x_] := Piecewise[{{Sin[x]^2, Abs[x] < Pi}}, 0]
fg2 = FourierTransform[g2[x], x, p]

Out[4]=
-((2*Sqrt[2/Pi]*Sin[p*Pi])/(-4*p + p^3))

In[5]:=
g3[x_ /; Abs[x] < Pi] := Sin[x]^2
g3[x_] := 0
fg3 = FourierTransform[g2[x], x, p]

Out[7]=
-((2*Sqrt[2/Pi]*Sin[p*Pi])/(-4*p + p^3))

In[8]:=
fg1 == fg2 == fg3

Out[8]=
True

In[9]:=
\$Version

Out[9]=
"5.2 for Microsoft Windows (June 20, 2005)"

Regards,
Jean-Marc

```

• Prev by Date: Re: Problem with nested NIntegrate[]
• Next by Date: Re: Re: Re: Google Mathematica code search
• Previous by thread: Re: FoourierTransform of a function defined in sections
• Next by thread: Need algorithm to convert general continued fraction to simple continued fraction